Fix writables in 7.6, fixes #416

This commit is contained in:
Sam 2013-12-25 15:10:59 +01:00
parent 83dd92cfec
commit 27db78567b
4 changed files with 14 additions and 7 deletions

View File

@ -374,8 +374,8 @@ namespace Otc
GamePlayerStateU16 = 48, GamePlayerStateU16 = 48,
GameNewOutfitProtocol = 49, GameNewOutfitProtocol = 49,
GamePVPMode = 50, GamePVPMode = 50,
GameWritableDate = 51,
// 51-100 reserved to be defined in lua
LastGameFeature = 101 LastGameFeature = 101
}; };

View File

@ -490,9 +490,9 @@ void Game::processCloseTrade()
g_lua.callGlobalField("g_game", "onCloseTrade"); g_lua.callGlobalField("g_game", "onCloseTrade");
} }
void Game::processEditText(uint id, int itemId, int maxLength, const std::string& text, const std::string& writter, const std::string& date) void Game::processEditText(uint id, int itemId, int maxLength, const std::string& text, const std::string& writer, const std::string& date)
{ {
g_lua.callGlobalField("g_game", "onEditText", id, itemId, maxLength, text, writter, date); g_lua.callGlobalField("g_game", "onEditText", id, itemId, maxLength, text, writer, date);
} }
void Game::processEditList(uint id, int doorId, const std::string& text) void Game::processEditList(uint id, int doorId, const std::string& text)
@ -1451,6 +1451,10 @@ void Game::setProtocolVersion(int version)
m_features.reset(); m_features.reset();
enableFeature(Otc::GameFormatCreatureName); enableFeature(Otc::GameFormatCreatureName);
if(version >= 770)
{
enableFeature(Otc::GameWritableDate); // might not be since 770
}
if(version >= 780) if(version >= 780)
{ {

View File

@ -124,7 +124,7 @@ protected:
void processCloseTrade(); void processCloseTrade();
// edit text/list // edit text/list
void processEditText(uint id, int itemId, int maxLength, const std::string& text, const std::string& writter, const std::string& date); void processEditText(uint id, int itemId, int maxLength, const std::string& text, const std::string& writer, const std::string& date);
void processEditList(uint id, int doorId, const std::string& text); void processEditList(uint id, int doorId, const std::string& text);
// questlog // questlog

View File

@ -997,10 +997,13 @@ void ProtocolGame::parseEditText(const InputMessagePtr& msg)
int maxLength = msg->getU16(); int maxLength = msg->getU16();
std::string text = msg->getString(); std::string text = msg->getString();
std::string writter = msg->getString();
std::string date = msg->getString();
g_game.processEditText(id, itemId, maxLength, text, writter, date); std::string writer = msg->getString();
std::string date = "";
if(g_game.getFeature(Otc::GameWritableDate))
date = msg->getString();
g_game.processEditText(id, itemId, maxLength, text, writer, date);
} }
void ProtocolGame::parseEditList(const InputMessagePtr& msg) void ProtocolGame::parseEditList(const InputMessagePtr& msg)