Use squad::find instead of indexing the vector

develop
Pierre-David Bélanger 2014-06-10 22:38:32 -04:00
parent 8ba1307944
commit e0808c8c96
1 changed files with 3 additions and 1 deletions

@ -1558,7 +1558,9 @@ std::string DFHack::Units::getSquadName(df::unit *unit)
{
if (unit->military.squad_id == -1)
return "";
df::squad *squad = world->squads.all[unit->military.squad_id];
df::squad *squad = df::squad::find(unit->military.squad_id);
if (!squad)
return "";
if (squad->alias.size() > 0)
return squad->alias;
return Translation::TranslateName(&squad->name, true);