fix protocol 860 death, fix progress bar

This commit is contained in:
Eduardo Bart 2012-01-11 10:48:34 -02:00
parent 0e88b03693
commit dba03d69f6
3 changed files with 8 additions and 2 deletions

View File

@ -4,13 +4,16 @@ function UIProgressBar.create()
local progressbar = UIProgressBar.internalCreate() local progressbar = UIProgressBar.internalCreate()
progressbar:setFocusable(false) progressbar:setFocusable(false)
progressbar:setPhantom(true) progressbar:setPhantom(true)
progressbar.percent = 100 progressbar.percent = 0
progressbar:setBackgroundSize({width = 1, height = 1})
return progressbar return progressbar
end end
function UIProgressBar:setPercent(percent) function UIProgressBar:setPercent(percent)
self:setBackgroundHeight(self:getHeight()) self:setBackgroundHeight(self:getHeight())
self:setBackgroundWidth((percent * self:getWidth())/100) local width = (percent * self:getWidth())/100
if width == 0 then width = 1 end
self:setBackgroundWidth(width)
self.percent = percent self.percent = percent
end end

View File

@ -66,6 +66,7 @@ void Game::processLoginError(const std::string& error)
void Game::processConnectionError(const boost::system::error_code& error) void Game::processConnectionError(const boost::system::error_code& error)
{ {
// connection errors only have meaning if we still have a protocol // connection errors only have meaning if we still have a protocol
dump << "disconnected: connection error = " << error.message();
if(m_protocolGame) { if(m_protocolGame) {
if(error != asio::error::eof) if(error != asio::error::eof)
g_lua.callGlobalField("Game", "onConnectionError", error.message()); g_lua.callGlobalField("Game", "onConnectionError", error.message());

View File

@ -307,7 +307,9 @@ void ProtocolGame::parsePing(InputMessage&)
void ProtocolGame::parseDeath(InputMessage& msg) void ProtocolGame::parseDeath(InputMessage& msg)
{ {
#if PROTOCOL==862
msg.getU8(); // 100 is a fair death. < 100 is a unfair death. msg.getU8(); // 100 is a fair death. < 100 is a unfair death.
#endif
g_game.processDeath(); g_game.processDeath();
} }