VC++ 2008开发网络百家乐街机游戏(下)
2009-02-27 20:03:11 来源:WEB开发网玩家输赢分值计算函数的核心编码举例如下:
void CTH_ROUND_WINDlg::Calculate_grade_btoc(CString retstring)
{
//读取赔率参数
……
if(retstring=="红色")
{
for(int i=0;i<10;i++)
{
//循环计算十个玩家的输赢分值并回馈显示
CString string_monzsf,string_redmonyfz,string_blackmonyfz,string_greenmonyfz;
m_zsf[i].GetWindowText(string_monzsf);
m_red[i].GetWindowText(string_redmonyfz);
m_black[i].GetWindowText(string_blackmonyfz);
m_green[i].GetWindowText(string_greenmonyfz);
int int_zsf=atoi(string_monzsf.operator LPCTSTR());
int int_red=atoi(string_redmonyfz.operator LPCTSTR());
int int_black=atoi(string_blackmonyfz.operator LPCTSTR());
int int_green=atoi(string_greenmonyfz.operator LPCTSTR());
if(int_red>0)
{
int int_yf,int_addzsf;
if(string_csq=="red")
{
int_yf=(int)(floor(int_red*(int_redcomrate-1)*(1.00-double_csl)));
int_addzsf=int_yf+int_red;
}
else
{
int_yf=int_red*(int_redcomrate-1);
int_addzsf=int_yf+int_red;
}
int_zsf+=int_addzsf;
string_monzsf.Format("%d",int_zsf);
CString string_winfz;
if(int_addzsf-int_black-int_green>0)
string_winfz.Format("+%d",int_addzsf-int_black-int_green);
if(int_addzsf-int_black-int_green<0)
string_winfz.Format("-%d",abs(int_addzsf-int_black-int_green));
m_yf[i].SetText(string_winfz);
}
else
{
CString string_falfz;
string_falfz.Format("-%d",int_black+int_green);
if(string_falfz!="-")
m_yf[i].SetText(string_falfz);
}
//写入后台数据库中
CString strsql;
if(i==0)
strsql="select * from th_round_single01";
……
if(i==8)
strsql="select * from th_round_single09";
if(i==9)
strsql="select * from th_round_single10";
labelred:
try
{
CDATABE_ADO m_datado;
m_datado.Open("TH_ROUND","admin/admin","flyingtjf");
m_datado.OpenTable(strsql);
m_datado.SetField("single_ztf",string_monzsf);
m_datado.SetField("red","0");
m_datado.SetField("black","0");
m_datado.SetField("green","0");
m_zsf[i].SetWindowText(string_monzsf);
m_red[i].SetWindowText("0");
m_black[i].SetWindowText("0");
m_green[i].SetWindowText("0");
m_datado.Close();
}
catch(...)
{
goto labelred;
}
}
}
if(retstring=="黑色")
{
……
}
if(retstring=="绿色")
{
……
}
}
更多精彩
赞助商链接