Skip to content

Commit

Permalink
fix alien base ID numeration
Browse files Browse the repository at this point in the history
  • Loading branch information
redv committed Aug 12, 2014
1 parent d22c807 commit f740643
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Geoscape/GeoscapeState.cpp
Expand Up @@ -1044,11 +1044,13 @@ void GeoscapeState::time10Minutes()
double range = ((*j)->getRules()->getSightRange() * (1 / 60.0) * (M_PI / 180));
for(std::vector<AlienBase*>::iterator b = _game->getSavedGame()->getAlienBases()->begin(); b != _game->getSavedGame()->getAlienBases()->end(); b++)
{
if ((*j)->getDistance(*b) <= range)
if (!(*b)->isDiscovered())
{
if (RNG::percent(50-((*j)->getDistance(*b) / range) * 50) && !(*b)->isDiscovered())
double distance = (*j)->getDistance(*b);
if (distance <= range && RNG::percent(50 - (distance / range) * 50))
{
(*b)->setDiscovered(true);
(*b)->setId(_game->getSavedGame()->getId("STR_ALIEN_BASE"));
}
}
}
Expand Down Expand Up @@ -1740,6 +1742,7 @@ void GeoscapeState::time1Month()
if (!(*b)->isDiscovered())
{
(*b)->setDiscovered(true);
(*b)->setId(_game->getSavedGame()->getId("STR_ALIEN_BASE"));
popup(new AlienBaseState(*b, this));
break;
}
Expand Down
1 change: 0 additions & 1 deletion src/Savegame/AlienMission.cpp
Expand Up @@ -644,7 +644,6 @@ void AlienMission::spawnAlienBase(const Globe &globe, Game &engine)
std::pair<double, double> pos = getLandPoint(globe, regionRules, RuleRegion::ALIEN_BASE_ZONE);
AlienBase *ab = new AlienBase();
ab->setAlienRace(_race);
ab->setId(game.getId("STR_ALIEN_BASE"));
ab->setLongitude(pos.first);
ab->setLatitude(pos.second);
game.getAlienBases()->push_back(ab);
Expand Down

0 comments on commit f740643

Please sign in to comment.