style adjustment and fixes

* style adjustments, now window and button style
* fix bug when logging on a tile with too many creatures
* remove deprecated onLogin and onLogout events
This commit is contained in:
Eduardo Bart
2012-05-10 10:06:06 -03:00
parent c0b6608453
commit 9abac474dd
19 changed files with 30 additions and 63 deletions

View File

@@ -77,10 +77,6 @@ void Game::processConnectionError(const boost::system::error_code& error)
void Game::processDisconnect()
{
if(isOnline()) {
// only process logout event if the player is known
if(m_localPlayer->isKnown())
processLogout();
m_localPlayer = nullptr;
processGameEnd();
@@ -119,7 +115,7 @@ void Game::processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, b
// synchronize fight modes with the server
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
// NOTE: the entire map description and local player informations is not known yet
// NOTE: the entire map description and local player information is not known yet
g_lua.callGlobalField("g_game", "onGameStart");
}
@@ -134,21 +130,6 @@ void Game::processGameEnd()
g_map.cleanDynamicThings();
}
void Game::processLogin()
{
// the game could be offline if the login was canceled
if(!isOnline())
return;
// by now the local player must be known
g_lua.callGlobalField("g_game", "onLogin", m_localPlayer);
}
void Game::processLogout()
{
g_lua.callGlobalField("g_game", "onLogout", m_localPlayer);
}
void Game::processDeath(int penality)
{
m_dead = true;
@@ -1034,12 +1015,11 @@ bool Game::canPerformGameAction()
{
// we can only perform game actions if we meet these conditions:
// - the local player exists
// - the local player is known
// - the local player is not dead
// - we have a game protocol
// - the game protocol is connected
// - its not a bot action
return m_localPlayer && m_localPlayer->isKnown() && !m_dead && m_protocolGame && m_protocolGame->isConnected() && checkBotProtection();
return m_localPlayer && !m_dead && m_protocolGame && m_protocolGame->isConnected() && checkBotProtection();
}
void Game::setAttackingCreature(const CreaturePtr& creature)

View File

@@ -48,9 +48,6 @@ protected:
void processLoginAdvice(const std::string& message);
void processLoginWait(const std::string& message, int time);
void processLogin();
void processLogout();
void processGameStart(const LocalPlayerPtr& localPlayer, int serverBeat, bool canReportBugs);
void processGameEnd();
void processDeath(int penality);

View File

@@ -304,8 +304,8 @@ void Map::setCentralPosition(const Position& centralPosition)
LocalPlayerPtr localPlayer = g_game.getLocalPlayer();
if(!localPlayer || localPlayer->getPosition() == m_centralPosition)
return;
TilePtr tile = getTile(localPlayer->getPosition());
if(!tile || tile->hasThing(localPlayer))
TilePtr tile = localPlayer->getTile();
if(tile && tile->hasThing(localPlayer))
return;
localPlayer->setPosition(m_centralPosition);
});

View File

@@ -25,11 +25,6 @@
#include <otclient/core/player.h>
#include <otclient/core/item.h>
ProtocolGame::ProtocolGame()
{
m_waitingLoginPacket = false;
}
void ProtocolGame::login(const std::string& accountName, const std::string& accountPassword, const std::string& host, uint16 port, const std::string& characterName)
{
if(accountName.empty() || accountPassword.empty()) {

View File

@@ -30,9 +30,6 @@
class ProtocolGame : public Protocol
{
public:
ProtocolGame();
public:
void login(const std::string& accountName, const std::string& accountPassword, const std::string& host, uint16 port, const std::string& characterName);
@@ -198,7 +195,7 @@ private:
Position parsePosition(InputMessage& msg);
private:
bool m_waitingLoginPacket;
Boolean<false> m_waitingLoginPacket;
std::string m_accountName;
std::string m_accountPassword;
std::string m_characterName;

View File

@@ -1270,11 +1270,8 @@ ThingPtr ProtocolGame::internalGetThing(InputMessage& msg)
creature->setEmblem(emblem);
creature->setPassable(passable);
// now that the local player is known, we can schedule login event
if(creature == m_localPlayer && !m_localPlayer->isKnown()) {
if(creature == m_localPlayer && !m_localPlayer->isKnown())
m_localPlayer->setKnown(true);
g_eventDispatcher.addEvent([] { g_game.processLogin(); });
}
}
thing = creature;