Skip to content

Commit bbb5460

Browse files
committed
don't show psionic sort options until they actually have data they can use
1 parent d089312 commit bbb5460

3 files changed

Lines changed: 24 additions & 6 deletions

File tree

src/Basescape/CraftSoldiersState.cpp

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ GET_ATTRIB_STAT_FN(throwing)
6565
GET_ATTRIB_STAT_FN(strength)
6666
int psiStrengthStat(Game *game, Soldier *s)
6767
{
68-
// don't reveal psi strength before it would otherwise be known
68+
// don't reveal (relative) psi strength before it would otherwise be known
6969
if (s->getCurrentStats()->psiSkill > 0
7070
|| (Options::psiStrengthEval
7171
&& game->getSavedGame()->isResearched(game->getMod()->getPsiRequirements())))
@@ -162,8 +162,28 @@ CraftSoldiersState::CraftSoldiersState(Base *base, size_t craft)
162162
PUSH_IN("STR_FIRING_ACCURACY", firingStat);
163163
PUSH_IN("STR_THROWING_ACCURACY", throwingStat);
164164
PUSH_IN("STR_STRENGTH", strengthStat);
165-
PUSH_IN("STR_PSIONIC_STRENGTH", psiStrengthStat);
166-
PUSH_IN("STR_PSIONIC_SKILL", psiSkillStat);
165+
166+
// don't show psionic sort options until they actually have data they can use
167+
bool showPsiStrength = Options::psiStrengthEval
168+
&& _game->getSavedGame()->isResearched(_game->getMod()->getPsiRequirements());
169+
bool showPsiSkill = false;
170+
for (std::vector<Soldier*>::iterator i = _base->getSoldiers()->begin(); i != _base->getSoldiers()->end(); ++i)
171+
{
172+
if (showPsiSkill) { break; }
173+
if ((*i)->getCurrentStats()->psiSkill > 0)
174+
{
175+
showPsiSkill = true;
176+
}
177+
}
178+
if (showPsiStrength)
179+
{
180+
PUSH_IN("STR_PSIONIC_STRENGTH", psiStrengthStat);
181+
}
182+
if (showPsiSkill)
183+
{
184+
PUSH_IN("STR_PSIONIC_SKILL", psiSkillStat);
185+
}
186+
167187
PUSH_IN("STR_MELEE_ACCURACY", meleeStat);
168188

169189
#undef PUSH_IN
@@ -287,7 +307,6 @@ void CraftSoldiersState::init()
287307
{
288308
State::init();
289309
initList();
290-
291310
}
292311

293312
/**

src/Savegame/MovingTarget.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ void MovingTarget::calculateMeetPoint()
260260
do
261261
{
262262
_meetPointLat += nx*sin(_meetPointLon) - ny*cos(_meetPointLon);
263-
// using std::abs instead of abs since abs can't handle floating point
264263
if (std::abs(_meetPointLat) < M_PI_2) _meetPointLon += nz - (nx*cos(_meetPointLon) + ny*sin(_meetPointLon))*tan(_meetPointLat); else _meetPointLon += M_PI;
265264
path += _speedRadian;
266265

src/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void signalLogger(int sig)
5858
#include <exception>
5959
void exceptionLogger()
6060
{
61-
static int logged = 0;
61+
static bool logged = false;
6262
std::string error;
6363
try
6464
{

0 commit comments

Comments
 (0)