minor fixes

* change chase mode while walking and attacking
* avoid lua errors in frame counter when starting
This commit is contained in:
Eduardo Bart
2012-06-07 08:52:17 -03:00
parent 48d243a11d
commit 486837a61d
3 changed files with 45 additions and 24 deletions

View File

@@ -487,6 +487,9 @@ void Game::forceWalk(Otc::Direction direction)
if(!canPerformGameAction())
return;
// always cancel chasing attacks
setChaseMode(Otc::DontChase);
switch(direction) {
case Otc::North:
m_protocolGame->sendWalkNorth();
@@ -879,24 +882,33 @@ void Game::setChaseMode(Otc::ChaseModes chaseMode)
{
if(!canPerformGameAction())
return;
if(m_chaseMode == chaseMode)
return;
m_chaseMode = chaseMode;
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
g_lua.callGlobalField("g_game", "onChaseModeChange", chaseMode);
}
void Game::setFightMode(Otc::FightModes fightMode)
{
if(!canPerformGameAction())
return;
if(m_fightMode == fightMode)
return;
m_fightMode = fightMode;
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
g_lua.callGlobalField("g_game", "onFightModeChange", fightMode);
}
void Game::setSafeFight(bool on)
{
if(!canPerformGameAction())
return;
if(m_safeFight == on)
return;
m_safeFight = on;
m_protocolGame->sendChangeFightModes(m_fightMode, m_chaseMode, m_safeFight);
g_lua.callGlobalField("g_game", "onSafeFightChange", on);
}
void Game::inspectNpcTrade(const ItemPtr& item)