static MapObjectType StrMapObjectType(const char *s) { S2T(MAP_OBJECT_TYPE_NORMAL, "Normal"); S2T(MAP_OBJECT_TYPE_PICKUP_SPAWNER, "PickupSpawner"); CASSERT(false, "unknown map object name"); return MAP_OBJECT_TYPE_NORMAL; }
int StrFireMoveStyle(const char *s) { S2T(FIREMOVE_STOP, "Stop"); S2T(FIREMOVE_NORMAL, "Normal"); S2T(FIREMOVE_STRAFE, "Strafe"); return FIREMOVE_STOP; }
int StrSwitchMoveStyle(const char *s) { S2T(SWITCHMOVE_SLIDE, "Slide"); S2T(SWITCHMOVE_STRAFE, "Strafe"); S2T(SWITCHMOVE_NONE, "None"); return SWITCHMOVE_SLIDE; }
int StrSplitscreenStyle(const char *s) { S2T(SPLITSCREEN_NORMAL, "Normal"); S2T(SPLITSCREEN_ALWAYS, "Always"); S2T(SPLITSCREEN_NEVER, "Never"); return SPLITSCREEN_NORMAL; }
int StrLaserSight(const char *s) { S2T(LASER_SIGHT_NONE, "None"); S2T(LASER_SIGHT_PLAYERS, "Players only"); S2T(LASER_SIGHT_ALL, "All"); return LASER_SIGHT_NONE; }
int StrGoreAmount(const char *s) { S2T(GORE_NONE, "None"); S2T(GORE_LOW, "Trickle"); S2T(GORE_MEDIUM, "Buckets"); S2T(GORE_HIGH, "Torrents"); return GORE_NONE; }
int StrQuickPlayQuantity(const char *s) { S2T(QUICKPLAY_QUANTITY_ANY, "Any"); S2T(QUICKPLAY_QUANTITY_SMALL, "Small"); S2T(QUICKPLAY_QUANTITY_MEDIUM, "Medium"); S2T(QUICKPLAY_QUANTITY_LARGE, "Large"); return QUICKPLAY_QUANTITY_ANY; }
int StrAIChatter(const char *s) { S2T(AICHATTER_NONE, "None"); S2T(AICHATTER_SELDOM, "Seldom"); S2T(AICHATTER_OFTEN, "Often"); S2T(AICHATTER_ALWAYS, "Always"); return AICHATTER_NONE; }
LogModule StrLogModule(const char *s) { S2T(LM_MAIN, "MAIN"); S2T(LM_NET, "NET"); S2T(LM_INPUT, "INPUT"); S2T(LM_ACTOR, "ACTOR"); return LM_MAIN; }
int StrDifficulty(const char *s) { S2T(DIFFICULTY_VERYEASY, "Easiest"); S2T(DIFFICULTY_EASY, "Easy"); S2T(DIFFICULTY_NORMAL, "Normal"); S2T(DIFFICULTY_HARD, "Hard"); S2T(DIFFICULTY_VERYHARD, "Very hard"); return DIFFICULTY_NORMAL; }
special_damage_e StrSpecialDamage(const char *s) { S2T(SPECIAL_FLAME, "Flame"); S2T(SPECIAL_POISON, "Poison"); S2T(SPECIAL_PETRIFY, "Petrify"); S2T(SPECIAL_CONFUSE, "Confuse"); CASSERT(false, "unknown special damage type"); return SPECIAL_NONE; }
PicType StrPicType(const char *s) { S2T(PICTYPE_NORMAL, "Normal"); S2T(PICTYPE_DIRECTIONAL, "Directional"); S2T(PICTYPE_ANIMATED, "Animated"); S2T(PICTYPE_ANIMATED_RANDOM, "AnimatedRandom"); CASSERT(false, "unknown pic type"); return PICTYPE_NORMAL; }
LogLevel StrLogLevel(const char *s) { S2T(LL_TRACE, "TRACE"); S2T(LL_DEBUG, "DEBUG"); S2T(LL_INFO, "INFO"); S2T(LL_WARN, "WARN"); S2T(LL_ERROR, "ERROR"); return LL_ERROR; }
// 把TokenID 和Body插入数据库 BOOL ServerDB::InsertPushMsg2DB(string strTokenID, string strBody) { EnterCriticalSection(&m_csInsertData); BOOL bRet = FALSE; TCHAR szSql[1024] = {0}; _stprintf_s(szSql, lpszInsertPushMsg2DB, S2T(strTokenID).c_str(), S2T(strBody).c_str()); bRet = ServerDB::GetInstance()->ExecuteSQL(szSql); LeaveCriticalSection(&m_csInsertData); return bRet; }
ObjectiveType StrObjectiveType(const char *s) { S2T(OBJECTIVE_KILL, "Kill"); S2T(OBJECTIVE_COLLECT, "Collect"); S2T(OBJECTIVE_DESTROY, "Destroy"); S2T(OBJECTIVE_RESCUE, "Rescue"); S2T(OBJECTIVE_INVESTIGATE, "Explore"); assert(0 && "unknown objective name"); return OBJECTIVE_KILL; }
void CServerPointDlg::OnSuccessRecv(string strMsg) { CString strRecvMsg; strRecvMsg.Format(L"%s", S2T(strMsg).c_str()); m_strMsg_Record += strRecvMsg; m_strMsg_Record += strSeparator; //UpdateData(FALSE); //m_Edt_MsgRecord.PostMessage(WM_VSCROLL, SB_BOTTOM, 0); }
void CServerPointDlg::OnErrorSend(string strMsg) { CString strSendMsg; strSendMsg.Format(L"%s", S2T(strMsg).c_str()); m_strMsg_Record += strSendMsg; m_strMsg_Record += strLine; PostMessage(SHOW_MSG2DLG,0,0); //UpdateData(FALSE); //m_Edt_MsgRecord.PostMessage(WM_VSCROLL, SB_BOTTOM, 0); }
static PlacementFlags StrPlacementFlag(const char *s) { S2T(PLACEMENT_OUTSIDE, "Outside"); S2T(PLACEMENT_INSIDE, "Inside"); S2T(PLACEMENT_NO_WALLS, "NoWalls"); S2T(PLACEMENT_ONE_WALL, "OneWall"); S2T(PLACEMENT_ONE_OR_MORE_WALLS, "OneOrMoreWalls"); S2T(PLACEMENT_FREE_IN_FRONT, "FreeInFront"); S2T(PLACEMENT_ON_WALL, "OnWall"); return PLACEMENT_NONE; }
// 类型转换 // int Str2Int(const std::string& data, int defaultvale) { int ret = defaultvale; try { S2T(data, ret); } catch (...) { ; } return ret; }
void CServerPointDlg::OnBnClickedGenerateMd5() { UpdateData(TRUE); if (m_strSource.IsEmpty()) { // 源字符串为空 m_strMD5.Empty(); UpdateData(FALSE); return ; } else { CStringA strSource(m_strSource); string strMD5 = Md5HexString(strSource.GetBuffer()); strSource.ReleaseBuffer(); wstring wstrMD5 = S2T(strMD5); m_strMD5.Empty(); m_strMD5.Format(L"%s", wstrMD5.c_str()); UpdateData(FALSE); } }
int StrScaleMode(const char *s) { S2T(SCALE_MODE_NN, "Nearest neighbor"); S2T(SCALE_MODE_BILINEAR, "Bilinear"); return SCALE_MODE_NN; }