Skip to content
Permalink
Browse files

Merge pull request #1230 from MeridianOXC/november-fixes

November fixes
  • Loading branch information
Warboy1982 committed Nov 10, 2019
2 parents 0d30635 + f6586e6 commit 1c844055f9f2aad25024ebca81dada2c89840210
Showing with 16 additions and 12 deletions.
  1. +14 −11 src/Battlescape/BattlescapeGame.cpp
  2. +2 −1 src/Geoscape/DogfightState.cpp
@@ -372,21 +372,24 @@ void BattlescapeGame::endTurn()
Position p;

// check for hot grenades on the ground
for (int i = 0; i < _save->getMapSizeXYZ(); ++i)
if (_save->getSide() != FACTION_NEUTRAL)
{
for (std::vector<BattleItem*>::iterator it = _save->getTiles()[i]->getInventory()->begin(); it != _save->getTiles()[i]->getInventory()->end(); )
for (int i = 0; i < _save->getMapSizeXYZ(); ++i)
{
if ((*it)->getRules()->getBattleType() == BT_GRENADE && (*it)->getFuseTimer() == 0) // it's a grenade to explode now
for (std::vector<BattleItem *>::iterator it = _save->getTiles()[i]->getInventory()->begin(); it != _save->getTiles()[i]->getInventory()->end(); )
{
p.x = _save->getTiles()[i]->getPosition().x*16 + 8;
p.y = _save->getTiles()[i]->getPosition().y*16 + 8;
p.z = _save->getTiles()[i]->getPosition().z*24 - _save->getTiles()[i]->getTerrainLevel();
statePushNext(new ExplosionBState(this, p, (*it), (*it)->getPreviousOwner()));
_save->removeItem((*it));
statePushBack(0);
return;
if ((*it)->getRules()->getBattleType() == BT_GRENADE && (*it)->getFuseTimer() == 0) // it's a grenade to explode now
{
p.x = _save->getTiles()[i]->getPosition().x * 16 + 8;
p.y = _save->getTiles()[i]->getPosition().y * 16 + 8;
p.z = _save->getTiles()[i]->getPosition().z * 24 - _save->getTiles()[i]->getTerrainLevel();
statePushNext(new ExplosionBState(this, p, (*it), (*it)->getPreviousOwner()));
_save->removeItem((*it));
statePushBack(0);
return;
}
++it;
}
++it;
}
}
}
@@ -505,7 +505,8 @@ DogfightState::DogfightState(GeoscapeState *state, Craft *craft, Ufo *ufo) : _st
if (!_ufo->getEscapeCountdown())
{
_ufo->setFireCountdown(0);
_ufo->setEscapeCountdown(_ufo->getRules()->getBreakOffTime() + RNG::generate(0, _ufo->getRules()->getBreakOffTime()) - 30 * _game->getSavedGame()->getDifficultyCoefficient());
int escapeCountdown = _ufo->getRules()->getBreakOffTime() + RNG::generate(0, _ufo->getRules()->getBreakOffTime()) - 30 * _game->getSavedGame()->getDifficultyCoefficient();
_ufo->setEscapeCountdown(std::max(1, escapeCountdown));
}

// technically this block is redundant, but i figure better to initialize the variables as SOMETHING

0 comments on commit 1c84405

Please sign in to comment.
You can’t perform that action at this time.