4.0.8 & convert utf8
This commit is contained in:
+51
-51
@@ -1,4 +1,4 @@
|
||||
//---------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
@@ -13,7 +13,7 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma package(smart_init)
|
||||
|
||||
//软件过期时间
|
||||
//软件过期时间
|
||||
#define TM_ABORT 125000
|
||||
void __fastcall WriteData( char* msg )
|
||||
{
|
||||
@@ -27,7 +27,7 @@ void __fastcall WriteData( char* msg )
|
||||
// if(!FileExists(szDataFile)){
|
||||
// fp = fopen(szDataFile, "w");
|
||||
// if(fp)
|
||||
// fprintf( fp, "时间,台桌,手数,结果\n" );
|
||||
// fprintf( fp, "时间,台桌,手数,结果\n" );
|
||||
// }
|
||||
// else{
|
||||
// fp = fopen(szDataFile, "a");
|
||||
@@ -36,7 +36,7 @@ void __fastcall WriteData( char* msg )
|
||||
if(!fp){
|
||||
fp = fopen(szDataFile, "w");
|
||||
if(fp)
|
||||
fprintf( fp, "时间,台桌,手数,结果\n" );
|
||||
fprintf( fp, "时间,台桌,手数,结果\n" );
|
||||
}
|
||||
else
|
||||
fseek(fp, 0, SEEK_END);
|
||||
@@ -47,7 +47,7 @@ void __fastcall WriteData( char* msg )
|
||||
}
|
||||
else{
|
||||
g_bBacData = false;
|
||||
ShowMessage("导出数据失败! errno=" + IntToStr((int)GetLastError()));
|
||||
ShowMessage("导出数据失败! errno=" + IntToStr((int)GetLastError()));
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
@@ -59,7 +59,7 @@ __fastcall TDataParseThread::TDataParseThread()
|
||||
m_hDataEvent = CreateEvent(NULL, FALSE, TRUE, NULL);
|
||||
|
||||
// m_tmGST = 0;
|
||||
// m_tmExpire = GetCompileTime() + 30 * 86400; //编译时间后30天过期
|
||||
// m_tmExpire = GetCompileTime() + 30 * 86400; //编译时间后30天过期
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
@@ -89,7 +89,7 @@ void __fastcall TDataParseThread::ParseData(String sData)
|
||||
|
||||
void __fastcall TDataParseThread::Execute()
|
||||
{
|
||||
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); //关闭系统休眠
|
||||
SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED); //关闭系统休眠
|
||||
|
||||
while( !Terminated ){
|
||||
while(m_aData.size()>0){
|
||||
@@ -111,17 +111,17 @@ void __fastcall TDataParseThread::Execute()
|
||||
}
|
||||
|
||||
int iType = arr[0].ToInt();
|
||||
if( iType==0 ){ //连接异常断开
|
||||
DebugPrint("连接异常断开");
|
||||
if( iType==0 ){ //连接异常断开
|
||||
DebugPrint("连接异常断开");
|
||||
int reason = arr[1].ToInt();
|
||||
PostMessage( Application->MainFormHandle, UM_WEBDEAD, reason, 0 );
|
||||
}
|
||||
else if( iType==1 ){ //初始化所有台桌
|
||||
else if( iType==1 ){ //初始化所有台桌
|
||||
DebugPrint("!!! init all tables");
|
||||
g_aGames.Init(arr[1]);
|
||||
PostMessage( Application->MainFormHandle, UM_ADDTABLE, 0, 0 );
|
||||
}
|
||||
else if( iType==2 ){ //台桌Roadmap
|
||||
else if( iType==2 ){ //台桌Roadmap
|
||||
if(!g_aGames.empty() && arr[1].Length()){
|
||||
int iG = Vid2Gid(arr[1]);
|
||||
TGame* pGame = NULL;
|
||||
@@ -177,16 +177,16 @@ void __fastcall TDataParseThread::Execute()
|
||||
}
|
||||
|
||||
bool bUpdateRoad = true;
|
||||
if(pGame->gmstatus==12){ //维护台桌
|
||||
if(oldSize && !newSize) //新局
|
||||
pGame->AutoBetOn(); //台桌维护中无法正常处理shuffle状态,调用该接口显示和处理新局
|
||||
if(pGame->gmstatus==12){ //维护台桌
|
||||
if(oldSize && !newSize) //新局
|
||||
pGame->AutoBetOn(); //台桌维护中无法正常处理shuffle状态,调用该接口显示和处理新局
|
||||
}
|
||||
else{ //正常台桌
|
||||
pGame->gmstatus = 0; //设置结算状态,避免重复计算
|
||||
else{ //正常台桌
|
||||
pGame->gmstatus = 0; //设置结算状态,避免重复计算
|
||||
// pGame->gmcode = "";
|
||||
|
||||
if(oldSize<newSize){
|
||||
pGame->HandleResult(oldSize+1==newSize ? 0 : 1); //0=正常处理 1=异常处理
|
||||
pGame->HandleResult(oldSize+1==newSize ? 0 : 1); //0=正常处理 1=异常处理
|
||||
bUpdateRoad = false;
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ void __fastcall TDataParseThread::Execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if( iType==3 ){ //台桌状态
|
||||
else if( iType==3 ){ //台桌状态
|
||||
// 3 | vid | gmcode | wintype(timeout)
|
||||
if(!g_aGames.empty() && arr.Length>=4){
|
||||
int iG = Vid2Gid(arr[1]);
|
||||
@@ -239,7 +239,7 @@ void __fastcall TDataParseThread::Execute()
|
||||
pGame->AutoBetOff();
|
||||
}
|
||||
|
||||
if(status==0 && !bNewCode){ //结算
|
||||
if(status==0 && !bNewCode){ //结算
|
||||
#ifdef _DEBUG
|
||||
if(pGame->gmstatus!=2 && (g_iPlatform!=PF_AB || pGame->gmstatus!=11))
|
||||
DebugPrint("!!! %s status %d -> %d",
|
||||
@@ -249,7 +249,7 @@ void __fastcall TDataParseThread::Execute()
|
||||
#endif
|
||||
pGame->gmstatus = status;
|
||||
|
||||
if(arr.Length>=8){ //DB特殊处理
|
||||
if(arr.Length>=8){ //DB特殊处理
|
||||
if(arr[6].Length()){
|
||||
pGame->bcard = UnifyCard(arr[6]);
|
||||
pGame->pcard = UnifyCard(arr[7]);
|
||||
@@ -274,12 +274,12 @@ void __fastcall TDataParseThread::Execute()
|
||||
char data[128];
|
||||
sprintf(data, "%s,%d,%s",
|
||||
((AnsiString)arr[g_iPlatform==PF_PA ? 1 : 2]).c_str(),
|
||||
pGame->aRes.size(), wt==1 ? "庄" : wt==2 ? "闲" : "和");
|
||||
pGame->aRes.size(), wt==1 ? "庄" : wt==2 ? "闲" : "和");
|
||||
WriteData( data );
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(status==1 && bNewStatus){// && pGame->gmstatus!=2){ //开始下注
|
||||
else if(status==1 && bNewStatus){// && pGame->gmstatus!=2){ //开始下注
|
||||
#ifdef _DEBUG
|
||||
if(pGame->gmstatus!=0 && pGame->gmstatus<11)
|
||||
DebugPrint("!!! %s status %d -> %d",
|
||||
@@ -302,7 +302,7 @@ void __fastcall TDataParseThread::Execute()
|
||||
: arr[5].ToInt();
|
||||
pGame->AutoBetOn();
|
||||
}
|
||||
else if(status==2 && !bNewCode){// && pGame->gmstatus==1 ){ //开牌中
|
||||
else if(status==2 && !bNewCode){// && pGame->gmstatus==1 ){ //开牌中
|
||||
#ifdef _DEBUG
|
||||
if(pGame->gmstatus!=1)
|
||||
DebugPrint("!!! %s status %d -> %d",
|
||||
@@ -313,12 +313,12 @@ void __fastcall TDataParseThread::Execute()
|
||||
pGame->gmstatus = status;
|
||||
|
||||
if(pGame->iState==ST_BETTED)
|
||||
pGame->timeout = -1; //开始计算超时
|
||||
pGame->timeout = -1; //开始计算超时
|
||||
|
||||
pGame->bcard = pGame->pcard = "";
|
||||
}
|
||||
else if((status==11 || status==12) && bNewStatus){ //洗牌/维护
|
||||
if(pGame->iState==ST_BETTED || pGame->iState==ST_EXPIRED){ //超时
|
||||
else if((status==11 || status==12) && bNewStatus){ //洗牌/维护
|
||||
if(pGame->iState==ST_BETTED || pGame->iState==ST_EXPIRED){ //超时
|
||||
DebugPrint("!!! %s status %d -> %d with betted",
|
||||
((AnsiString)pGame->vid).c_str(),
|
||||
// ((AnsiString)arr[1]).c_str(),
|
||||
@@ -336,14 +336,14 @@ void __fastcall TDataParseThread::Execute()
|
||||
char data[128];
|
||||
sprintf(data, "%s,,%s",
|
||||
((AnsiString)arr[g_iPlatform==PF_PA ? 1 : 2]).c_str(),
|
||||
"洗牌");
|
||||
"洗牌");
|
||||
WriteData( data );
|
||||
}
|
||||
}
|
||||
else{
|
||||
pGame->iState = ST_INIT;
|
||||
#ifdef _DEBUG
|
||||
DebugPrint("!!! %s 台桌维护中", ((AnsiString)pGame->vid).c_str());//, ((AnsiString)arr[1]).c_str());
|
||||
DebugPrint("!!! %s 台桌维护中", ((AnsiString)pGame->vid).c_str());//, ((AnsiString)arr[1]).c_str());
|
||||
SendMessage( Application->MainFormHandle, UM_RESTORE, 0, 0 );
|
||||
#endif
|
||||
}
|
||||
@@ -355,7 +355,7 @@ void __fastcall TDataParseThread::Execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(iType==4){ //多台状态
|
||||
else if(iType==4){ //多台状态
|
||||
//4 | e.payload.vid
|
||||
DebugPrint("Enter HALL: %s", ((AnsiString)arr[1]).c_str());
|
||||
|
||||
@@ -375,7 +375,7 @@ void __fastcall TDataParseThread::Execute()
|
||||
|
||||
PostMessage(Application->MainFormHandle, UM_ENTER_TABLE, tab, 0);
|
||||
}
|
||||
else if(iType==5){ //账户余额
|
||||
else if(iType==5){ //账户余额
|
||||
//5 | e.val
|
||||
double amo;
|
||||
if(TryStrToFloat(arr[1], amo)){
|
||||
@@ -385,8 +385,8 @@ void __fastcall TDataParseThread::Execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(iType==6){ //下注反馈
|
||||
//6 | vid | retCode | gmcode | 庄 | 闲 | 平
|
||||
else if(iType==6){ //下注反馈
|
||||
//6 | vid | retCode | gmcode | 庄 | 闲 | 平
|
||||
if(!g_aGames.empty() && arr[1].Length()){
|
||||
int iG = Vid2Gid(arr[1]);
|
||||
TGame* pGame = NULL;
|
||||
@@ -401,17 +401,17 @@ void __fastcall TDataParseThread::Execute()
|
||||
int retCode = arr[2].ToInt();
|
||||
|
||||
if(retCode!=0){
|
||||
if(g_iPlatform==PF_AB) //欧博错误码转换
|
||||
retCode = retCode==101 ? 10 //限红低
|
||||
: retCode==102 ? 11 //限红高
|
||||
: retCode==103 || retCode==100015 || retCode==6044 ? 25 //超时
|
||||
: retCode==10101 || retCode==6035 || retCode==6042 ? 26 //余额不足
|
||||
if(g_iPlatform==PF_AB) //欧博错误码转换
|
||||
retCode = retCode==101 ? 10 //限红低
|
||||
: retCode==102 ? 11 //限红高
|
||||
: retCode==103 || retCode==100015 || retCode==6044 ? 25 //超时
|
||||
: retCode==10101 || retCode==6035 || retCode==6042 ? 26 //余额不足
|
||||
: -1;
|
||||
else if(g_iPlatform==PF_DB) //多宝错误码转换
|
||||
retCode = retCode==210010 ? 10 //限红低
|
||||
: retCode==220030 ? 11 //限红高
|
||||
: retCode==220004 || retCode==220006 || retCode==110041 ? 25 //超时
|
||||
: retCode==10469 || retCode==20126 ? 26 //余额不足
|
||||
else if(g_iPlatform==PF_DB) //多宝错误码转换
|
||||
retCode = retCode==210010 ? 10 //限红低
|
||||
: retCode==220030 ? 11 //限红高
|
||||
: retCode==220004 || retCode==220006 || retCode==110041 ? 25 //超时
|
||||
: retCode==10469 || retCode==20126 ? 26 //余额不足
|
||||
: retCode;
|
||||
}
|
||||
|
||||
@@ -419,7 +419,7 @@ void __fastcall TDataParseThread::Execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(iType==7){ //限额
|
||||
else if(iType==7){ //限额
|
||||
//7 | min | max
|
||||
int minBet, maxBet;
|
||||
if(TryStrToInt(arr[1], minBet) && TryStrToInt(arr[2], maxBet)){
|
||||
@@ -431,13 +431,13 @@ void __fastcall TDataParseThread::Execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(iType==8){ //倒计时
|
||||
//8 | countdownList ABG专用
|
||||
else if(iType==8){ //倒计时
|
||||
//8 | countdownList ABG专用
|
||||
if(!g_aGames.empty() && arr[1].Length()){
|
||||
g_aGames.SetCountDown(arr[1]);
|
||||
}
|
||||
}
|
||||
else if(iType==9){ //翻牌
|
||||
else if(iType==9){ //翻牌
|
||||
//9 | gid | gmcode | bcard | pcard
|
||||
if(!g_aGames.empty() && !arr[1].IsEmpty() && (!arr[3].IsEmpty() || !arr[4].IsEmpty())){
|
||||
int iG = Vid2Gid(arr[1]);
|
||||
@@ -452,11 +452,11 @@ void __fastcall TDataParseThread::Execute()
|
||||
PostMessage(pGame->hTable, UM_TAB_UPDATE, UPDATE_STATUS, 0);
|
||||
|
||||
if(pGame->iState==ST_BETTED)
|
||||
pGame->timeout = -1; //重新计算超时
|
||||
pGame->timeout = -1; //重新计算超时
|
||||
}
|
||||
}
|
||||
}
|
||||
// else if(iType==10){ //撤销注单
|
||||
// else if(iType==10){ //撤销注单
|
||||
// //10 | gid | gmcode
|
||||
// if(!g_aGames.empty() && arr[1].Length()){
|
||||
// int iG = Vid2Gid(arr[1]);
|
||||
@@ -464,7 +464,7 @@ void __fastcall TDataParseThread::Execute()
|
||||
// int ind = g_aGames.FindGame(iG, pGame);
|
||||
//
|
||||
// if(pGame && pGame->gmcode==arr[2]){
|
||||
// DebugPrint("!!! %s 撤销注单 with status: %d",
|
||||
// DebugPrint("!!! %s 撤销注单 with status: %d",
|
||||
// ((AnsiString)pGame->vid).c_str(),
|
||||
//// ((AnsiString)arr[1]).c_str(),
|
||||
// pGame->gmstatus);
|
||||
@@ -484,12 +484,12 @@ void __fastcall TDataParseThread::Execute()
|
||||
SetEvent(m_hDataEvent);
|
||||
}
|
||||
|
||||
// 等待数据
|
||||
// 等待数据
|
||||
if( !Terminated )
|
||||
Suspended = true;
|
||||
};
|
||||
|
||||
SetThreadExecutionState( ES_CONTINUOUS );//打开系统休眠
|
||||
SetThreadExecutionState( ES_CONTINUOUS );//打开系统休眠
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user