Skip to content

Commit

Permalink
Don't try to get HealthComponent for specs in TeamInfoMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
DolceTriade committed Dec 28, 2015
1 parent 2a6280a commit d91bb1f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/sgame/sg_team.cpp
Expand Up @@ -380,6 +380,7 @@ void TeamplayInfoMessage( gentity_t *ent )
gclient_t *cl;
upgrade_t upgrade = UP_NONE;
int curWeaponClass = WP_NONE; // sends weapon for humans, class for aliens
int health = 0;

if ( !g_allowTeamOverlay.integer )
{
Expand Down Expand Up @@ -456,26 +457,28 @@ void TeamplayInfoMessage( gentity_t *ent )
{
upgrade = UP_NONE;
}
health = static_cast<int>( std::ceil( player->entity->Get<HealthComponent>()->Health() ) );
}
else if ( cl->pers.team == TEAM_ALIENS )
{
curWeaponClass = cl->ps.stats[ STAT_CLASS ];
upgrade = UP_NONE;
health = static_cast<int>( std::ceil( player->entity->Get<HealthComponent>()->Health() ) );
}

if( team == TEAM_ALIENS ) // aliens don't have upgrades
{
Com_sprintf( entry, sizeof( entry ), " %i %i %i %i %i", i,
cl->pers.location,
std::max((int)std::ceil(player->entity->Get<HealthComponent>()->Health()), 0),
health,
curWeaponClass,
cl->pers.credit );
}
else
{
Com_sprintf( entry, sizeof( entry ), " %i %i %i %i %i %i", i,
cl->pers.location,
std::max((int)std::ceil(player->entity->Get<HealthComponent>()->Health()), 0),
health,
curWeaponClass,
cl->pers.credit,
upgrade );
Expand Down

0 comments on commit d91bb1f

Please sign in to comment.