Skip to content

Commit

Permalink
- Fix: Terrain destruction after explosion animation finished.
Browse files Browse the repository at this point in the history
- Fix: Stay in "aiming mode" until right-click.
  • Loading branch information
tomvd committed Mar 2, 2011
1 parent 49231f2 commit ec86b55
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
25 changes: 21 additions & 4 deletions src/Battlescape/BattlescapeState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,18 @@ void BattlescapeState::mapClick(Action *action)
// right-click aborts walking state
if (action->getDetails()->button.button == SDL_BUTTON_RIGHT)
{
if (!_states.empty())
if (_states.empty())
{
if (_targeting)
{
_targeting = false;
_map->setCursorType(CT_NORMAL);
_game->getCursor()->setVisible(true);
_selectedAction = BA_NONE;
return;
}
}
else
{
_states.front()->cancel();
return;
Expand All @@ -289,7 +300,6 @@ void BattlescapeState::mapClick(Action *action)
if (_targeting)
{
// -= fire weapon =-
_targeting = false;
_target = pos;
_map->setCursorType(CT_NONE);
_game->getCursor()->setVisible(false);
Expand Down Expand Up @@ -634,8 +644,15 @@ void BattlescapeState::popState()
// if all states are empty - give the mouse back to the player
if (_states.empty())
{
_map->setCursorType(CT_NORMAL);
_game->getCursor()->setVisible(true);
if (_selectedAction == BA_NONE)
{
_map->setCursorType(CT_NORMAL);
_game->getCursor()->setVisible(true);
}
else
{
_map->setCursorType(CT_AIM);
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/Battlescape/ExplosionBState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ void ExplosionBState::init()
_parent->getMap()->getExplosions()->insert(explosion);
// KABOOM
_parent->getGame()->getResourcePack()->getSoundSet("BATTLE.CAT")->getSound(_parent->getSelectedItem()->getRules()->getHitSound())->play();
_parent->getGame()->getSavedGame()->getBattleGame()->getTerrainModifier()->explode(_center, _item->getAmmoItem()->getRules()->getPower(), _item->getAmmoItem()->getRules()->getDamageType(), 100);
}

void ExplosionBState::think()
Expand All @@ -73,6 +72,7 @@ void ExplosionBState::think()
_parent->getMap()->getExplosions()->erase((*i));
if (_parent->getMap()->getExplosions()->empty())
{
_parent->getGame()->getSavedGame()->getBattleGame()->getTerrainModifier()->explode(_center, _item->getAmmoItem()->getRules()->getPower(), _item->getAmmoItem()->getRules()->getDamageType(), 100);
_parent->popState();
return;
}
Expand Down

0 comments on commit ec86b55

Please sign in to comment.