clgetworldlisthandler.cpp
来自「天之炼狱1服务器端源文件游戏服务端不完整」· C++ 代码 · 共 99 行
CPP
99 行
//////////////////////////////////////////////////////////////////////////////// Filename : CLGetWorldListHandler.cpp// Written By : Reiot// Description ://////////////////////////////////////////////////////////////////////////////#include "CLGetWorldList.h"#ifdef __LOGIN_SERVER__ #include "LoginPlayer.h" #include "Assert.h" #include "DB.h" #include "GameWorldInfoManager.h" #include "WorldInfo.h" #include "Lpackets/LCWorldList.h"#endif//////////////////////////////////////////////////////////////////////////////// 努扼捞攫飘啊 辑滚狼 府胶飘甫 崔扼绊 夸没秦坷搁, 肺弊牢 辑滚绰 DB肺何磐// 辑滚甸狼 沥焊甫 肺爹秦辑 LCWorldList 菩哦俊 淬酒辑 傈价茄促.//////////////////////////////////////////////////////////////////////////////void CLGetWorldListHandler::execute (CLGetWorldList* pPacket , Player* pPlayer) throw (ProtocolException , Error){ __BEGIN_TRY __BEGIN_DEBUG_EX#ifdef __LOGIN_SERVER__ Assert(pPacket != NULL); Assert(pPlayer != NULL); //cout << "Start execute" << endl; LoginPlayer* pLoginPlayer = dynamic_cast<LoginPlayer*>(pPlayer); try { int Num = g_pGameWorldInfoManager->getSize(); //cout << "WorldNum : " << Num << endl; WorldInfo* aWorldInfo[Num]; for(int i = 1 ; i < Num + 1; i++) { WorldInfo* pWorldInfo = new WorldInfo(); GameWorldInfo* pGameWorldInfo = g_pGameWorldInfoManager->getGameWorldInfo(i); pWorldInfo->setID(pGameWorldInfo->getID()); pWorldInfo->setName(pGameWorldInfo->getName()); // by bezz. 2002.12.20 pWorldInfo->setStat(pGameWorldInfo->getStatus()); aWorldInfo[i] = pWorldInfo; // 飘罚角(2) 哗扁 //if (i==2) pWorldInfo->setStat(WORLD_CLOSE); //cout << "AddWorld : " << pWorldInfo->getName() << endl; } LCWorldList lcWorldList; Statement * pStmt = NULL; BEGIN_DB { pStmt = g_pDatabaseManager->getConnection("DARKEDEN")->createStatement(); Result * pResult = pStmt->executeQuery("SELECT CurrentWorldID FROM Player where PlayerID='%s'" , pLoginPlayer->getID().c_str() ); if( pResult->next() ) { lcWorldList.setCurrentWorldID( pResult->getInt(1) ); } SAFE_DELETE(pStmt); // by sigi } END_DB(pStmt) // by sigi for(int k = 1; k < Num + 1; k++) { lcWorldList.addListElement(aWorldInfo[k]); } pLoginPlayer->sendPacket(&lcWorldList); // pLoginPlayer->setPlayerStatus(LPS_PC_MANAGEMENT); } catch (Throwable & t) { //cout << t.toString() << endl; } //cout << "End execute" << endl;#endif __END_DEBUG_EX __END_CATCH}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?