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

View File

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

View File

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

View File

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

View File

@ -46,7 +46,7 @@ void ProtocolGame::parseMessage(const InputMessagePtr& msg)
if(callLuaField<bool>("onOpcode", opcode, msg))
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");
switch(opcode) {
@ -1212,13 +1212,16 @@ void ProtocolGame::parseExtendedOpcode(const InputMessagePtr& msg)
int opcode = msg->getU8();
std::string buffer = msg->getString();
#ifdef EXTENDED_OPCODE
try {
callLuaField("onExtendedOpcode", opcode, buffer);
} catch(Exception& e) {
logError("Network exception in extended opcode ", opcode, ": ", e.what());
if(opcode == 0) {
m_enableSendExtendedOpcode = true;
}
else {
try {
callLuaField("onExtendedOpcode", opcode, buffer);
} catch(Exception& e) {
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)

View File

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