removed extended ifdef, its now activated serverside

This commit is contained in:
Henrique Santiago 2012-05-17 12:24:41 -03:00
parent 4f90783789
commit b0fd5b3ec8
6 changed files with 22 additions and 26 deletions

View File

@ -13,7 +13,7 @@ local localeComboBox
local function sendLocale(localeName) local function sendLocale(localeName)
local protocolGame = g_game.getProtocolGame() local protocolGame = g_game.getProtocolGame()
if protocolGame then if protocolGame then
protocolGame:sendExtendedOpcode(0, localeName) protocolGame:sendExtendedOpcode(1, localeName)
return true return true
end end
return false return false
@ -63,7 +63,7 @@ function Locales.init()
localeComboBox.onOptionChange = onLocaleComboBoxOptionChange localeComboBox.onOptionChange = onLocaleComboBoxOptionChange
end, false) end, false)
Extended.register(0, onServerSetLocale) Extended.register(1, onServerSetLocale)
connect(g_game, { onGameStart = onGameStart }) connect(g_game, { onGameStart = onGameStart })
end end
@ -71,7 +71,7 @@ function Locales.terminate()
installedLocales = nil installedLocales = nil
currentLocale = nil currentLocale = nil
localeComboBox = nil localeComboBox = nil
Extended.unregister(0) Extended.unregister(1)
disconnect(g_game, { onGameStart = onGameStart }) disconnect(g_game, { onGameStart = onGameStart })
end end

View File

@ -5,7 +5,6 @@ ENDIF(${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 6)
# otclient options # otclient options
OPTION(BOT_PROTECTION "Enable bot protection" ON) OPTION(BOT_PROTECTION "Enable bot protection" ON)
OPTION(EXTENDED_OPCODE "Enable extended opcode" OFF)
SET(PROTOCOL 860 CACHE "Protocol version" STRING) SET(PROTOCOL 860 CACHE "Protocol version" STRING)
OPTION(CIPSOFT_RSA "Use cipsoft RSA to login into original tibia" OFF) OPTION(CIPSOFT_RSA "Use cipsoft RSA to login into original tibia" OFF)
ADD_DEFINITIONS(-DPROTOCOL=${PROTOCOL}) ADD_DEFINITIONS(-DPROTOCOL=${PROTOCOL})
@ -25,13 +24,6 @@ ELSE(BOT_PROTECTION)
MESSAGE(STATUS "Bot protection: OFF") MESSAGE(STATUS "Bot protection: OFF")
ENDIF(BOT_PROTECTION) ENDIF(BOT_PROTECTION)
IF(EXTENDED_OPCODE)
ADD_DEFINITIONS(-DEXTENDED_OPCODE)
MESSAGE(STATUS "Extended opcode: ON")
ELSE(EXTENDED_OPCODE)
MESSAGE(STATUS "Extended opcode: OFF")
ENDIF(EXTENDED_OPCODE)
SET(otclient_SOURCES ${otclient_SOURCES} SET(otclient_SOURCES ${otclient_SOURCES}
# otclient # otclient
${CMAKE_CURRENT_LIST_DIR}/otclient.cpp ${CMAKE_CURRENT_LIST_DIR}/otclient.cpp

View File

@ -105,7 +105,7 @@ namespace Proto {
GameServerChallange = 31, GameServerChallange = 31,
GameServerDeath = 40, GameServerDeath = 40,
// all in game opcodes must be equal or greater than 50 // all in game opcodes must be greater than 50
GameServerFirstGameOpcode = 50, GameServerFirstGameOpcode = 50,
// otclient ONLY // otclient ONLY

View File

@ -213,6 +213,7 @@ public:
Position getPosition(const InputMessagePtr& msg); Position getPosition(const InputMessagePtr& msg);
private: private:
Boolean<false> m_enableSendExtendedOpcode;
Boolean<false> m_gameInitialized; Boolean<false> m_gameInitialized;
std::string m_accountName; std::string m_accountName;
std::string m_accountPassword; std::string m_accountPassword;

View File

@ -46,7 +46,7 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
if(callLuaField<bool>("onOpcode", opcode, msg)) if(callLuaField<bool>("onOpcode", opcode, msg))
continue; continue;
if(!m_gameInitialized && opcode >= Proto::GameServerFirstGameOpcode) if(!m_gameInitialized && opcode > Proto::GameServerFirstGameOpcode)
logWarning("received a game opcode from the server, but the game is not initialized yet, this is a server side bug"); logWarning("received a game opcode from the server, but the game is not initialized yet, this is a server side bug");
switch(opcode) { switch(opcode) {
@ -1212,13 +1212,16 @@ void ProtocolGame::parseExtendedOpcode(const InputMessagePtr& msg)
int opcode = msg->getU8(); int opcode = msg->getU8();
std::string buffer = msg->getString(); std::string buffer = msg->getString();
#ifdef EXTENDED_OPCODE if(opcode == 0) {
m_enableSendExtendedOpcode = true;
}
else {
try { try {
callLuaField("onExtendedOpcode", opcode, buffer); callLuaField("onExtendedOpcode", opcode, buffer);
} catch(Exception& e) { } catch(Exception& e) {
logError("Network exception in extended opcode ", opcode, ": ", e.what()); logError("Network exception in extended opcode ", opcode, ": ", e.what());
} }
#endif }
} }
void ProtocolGame::setMapDescription(const InputMessagePtr& msg, int x, int y, int z, int width, int height) void ProtocolGame::setMapDescription(const InputMessagePtr& msg, int x, int y, int z, int width, int height)

View File

@ -33,13 +33,13 @@ void ProtocolGame::safeSend(const OutputMessagePtr& outputMessage)
void ProtocolGame::sendExtendedOpcode(uint8 opcode, const std::string& buffer) void ProtocolGame::sendExtendedOpcode(uint8 opcode, const std::string& buffer)
{ {
#ifdef EXTENDED_OPCODE if(m_enableSendExtendedOpcode) {
OutputMessagePtr msg(new OutputMessage); OutputMessagePtr msg(new OutputMessage);
msg->addU8(Proto::ClientExtendedOpcode); msg->addU8(Proto::ClientExtendedOpcode);
msg->addU8(opcode); msg->addU8(opcode);
msg->addString(buffer); msg->addString(buffer);
safeSend(msg); safeSend(msg);
#endif }
} }
void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRandom) void ProtocolGame::sendLoginPacket(uint challangeTimestamp, uint8 challangeRandom)