Feature #2490 » 0078-Inline-unit_is_alive.patch
| common/game.h | ||
|---|---|---|
|
void game_remove_unit(struct world *gworld, struct unit *punit);
|
||
|
void game_remove_city(struct world *gworld, struct city *pcity);
|
||
|
/**********************************************************************//**
|
||
|
Check if unit with given id is still alive. Use this before using
|
||
|
old unit pointers when unit might have died.
|
||
|
**************************************************************************/
|
||
|
inline bool unit_is_alive(int id)
|
||
|
{
|
||
|
return game_unit_by_number(id) != nullptr;
|
||
|
}
|
||
|
void initialize_globals(void);
|
||
|
bool is_player_phase(const struct player *pplayer, int phase);
|
||
| common/unit.c | ||
|---|---|---|
|
utype_class(punittype)->hp_loss_pct / 100);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Check if unit with given id is still alive. Use this before using
|
||
|
old unit pointers when unit might have died.
|
||
|
**************************************************************************/
|
||
|
bool unit_is_alive(int id)
|
||
|
{
|
||
|
/* Check if unit exist in game */
|
||
|
if (game_unit_by_number(id)) {
|
||
|
return TRUE;
|
||
|
}
|
||
|
return FALSE;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Return TRUE if this is a valid unit pointer but does not correspond to
|
||
|
any unit that exists in the game.
|
||
| common/unit.h | ||
|---|---|---|
|
bool unit_type_is_losing_hp(const struct player *pplayer,
|
||
|
const struct unit_type *punittype);
|
||
|
bool unit_is_alive(int id);
|
||
|
void *unit_ai_data(const struct unit *punit, const struct ai_type *ai);
|
||
|
void unit_set_ai_data(struct unit *punit, const struct ai_type *ai,
|
||
|
void *data);
|
||