Author: cazfi Date: Sun Apr 17 06:07:32 2016 New Revision: 32425 URL: http://svn.gna.org/viewcvs/freeciv?rev=32425&view=rev Log: Renamed unit_alive() as unit_is_alive()
See patch #7108 Modified: trunk/ai/default/aicity.c trunk/ai/default/aiferry.c trunk/common/unit.c trunk/common/unit.h trunk/server/actiontools.c trunk/server/cityturn.c trunk/server/diplomats.c trunk/server/unithand.c trunk/server/unittools.c Modified: trunk/ai/default/aicity.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=32425&r1=32424&r2=32425&view=diff ============================================================================== --- trunk/ai/default/aicity.c (original) +++ trunk/ai/default/aicity.c Sun Apr 17 06:07:32 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -468,7 +468,7 @@ } } - if (!unit_alive(punit_id_stored)) { + if (!unit_is_alive(punit_id_stored)) { /* The unit is gone. Maybe it was killed in Lua? */ return; } @@ -492,7 +492,7 @@ } } - if (!unit_alive(punit_id_stored)) { + if (!unit_is_alive(punit_id_stored)) { /* The unit is gone. Maybe it was killed in Lua? */ return; } Modified: trunk/ai/default/aiferry.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aiferry.c?rev=32425&r1=32424&r2=32425&view=diff ============================================================================== --- trunk/ai/default/aiferry.c (original) +++ trunk/ai/default/aiferry.c Sun Apr 17 06:07:32 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 2004 - The Freeciv Project This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -682,7 +682,7 @@ * ferry to die. That has happened at least when passenger * destroyed city cutting the civ1-style channel (cities in * a chain) ferry was in. */ - if (unit_alive(ferry_id) && 0 < ferry->moves_left + if (unit_is_alive(ferry_id) && 0 < ferry->moves_left && (!alive || unit_tile(ferry) != unit_tile(passenger))) { /* The passenger is no longer on the ferry, * and the ferry can still act. Modified: trunk/common/unit.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=32425&r1=32424&r2=32425&view=diff ============================================================================== --- trunk/common/unit.c (original) +++ trunk/common/unit.c Sun Apr 17 06:07:32 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -2069,9 +2069,9 @@ /************************************************************************** Check if unit with given id is still alive. Use this before using - old unit pointers when unit might have dead. -**************************************************************************/ -bool unit_alive(int id) + 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)) { Modified: trunk/common/unit.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.h?rev=32425&r1=32424&r2=32425&view=diff ============================================================================== --- trunk/common/unit.h (original) +++ trunk/common/unit.h Sun Apr 17 06:07:32 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -375,7 +375,7 @@ bool unit_type_is_losing_hp(const struct player *pplayer, const struct unit_type *punittype); -bool unit_alive(int id); +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, Modified: trunk/server/actiontools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/actiontools.c?rev=32425&r1=32424&r2=32425&view=diff ============================================================================== --- trunk/server/actiontools.c (original) +++ trunk/server/actiontools.c Sun Apr 17 06:07:32 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996-2015 - Freeciv Development Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,10 +20,11 @@ /* server */ #include "aiiface.h" -#include "actiontools.h" #include "notify.h" #include "plrhand.h" #include "unithand.h" + +#include "actiontools.h" typedef void (*action_notify)(struct player *, const int, @@ -866,7 +867,7 @@ fc_assert(action_get_target_kind(act) != ATK_COUNT); } - if (!unit_alive(actor_id)) { + if (!unit_is_alive(actor_id)) { /* The unit is gone. Maybe it was killed in Lua? */ return NULL; } Modified: trunk/server/cityturn.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/cityturn.c?rev=32425&r1=32424&r2=32425&view=diff ============================================================================== --- trunk/server/cityturn.c (original) +++ trunk/server/cityturn.c Sun Apr 17 06:07:32 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -667,12 +667,12 @@ /* Try to perform this unit's can't upkeep actions. */ action_auto_perf_unit_do(AAPC_UNIT_UPKEEP, punit, get_output_type(outp)); - if (wipe_in_the_end && unit_alive(punit_id)) { + if (wipe_in_the_end && unit_is_alive(punit_id)) { /* No forced action was able to kill the unit. Finish the job. */ wipe_unit(punit, wipe_reason, NULL); } - return !unit_alive(punit_id); + return !unit_is_alive(punit_id); } /************************************************************************** Modified: trunk/server/diplomats.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/diplomats.c?rev=32425&r1=32424&r2=32425&view=diff ============================================================================== --- trunk/server/diplomats.c (original) +++ trunk/server/diplomats.c Sun Apr 17 06:07:32 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -552,7 +552,7 @@ action_consequence_success(ACTION_SPY_BRIBE_UNIT, pplayer, uplayer, victim_tile, victim_link); - if (!unit_alive(diplomat_id)) { + if (!unit_is_alive(diplomat_id)) { return TRUE; } @@ -561,7 +561,7 @@ if (NULL == pcity && unit_list_size(unit_tile(pvictim)->units) < 2 && !unit_move_handling(pdiplomat, victim_tile, FALSE, FALSE) /* May have died while trying to move. */ - && unit_alive(diplomat_id)) { + && unit_is_alive(diplomat_id)) { pdiplomat->moves_left = 0; } if (NULL != player_unit_by_number(pplayer, diplomat_id)) { Modified: trunk/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=32425&r1=32424&r2=32425&view=diff ============================================================================== --- trunk/server/unithand.c (original) +++ trunk/server/unithand.c Sun Apr 17 06:07:32 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -1694,7 +1694,7 @@ API_TYPE_ACTION, action_by_number(action), \ API_TYPE_UNIT, actor, \ API_TYPE_CITY, target); \ - if (!actor || !unit_alive(actor_id)) { \ + if (!actor || !unit_is_alive(actor_id)) { \ /* Actor unit was destroyed during pre action Lua. */ \ return FALSE; \ } \ @@ -1707,7 +1707,7 @@ script_server_signal_emit("action_started_unit_self", 2, \ API_TYPE_ACTION, action_by_number(action), \ API_TYPE_UNIT, actor); \ - if (!actor || !unit_alive(actor_id)) { \ + if (!actor || !unit_is_alive(actor_id)) { \ /* Actor unit was destroyed during pre action Lua. */ \ return FALSE; \ } @@ -1717,11 +1717,11 @@ API_TYPE_ACTION, action_by_number(action), \ API_TYPE_UNIT, actor, \ API_TYPE_UNIT, target); \ - if (!actor || !unit_alive(actor_id)) { \ + if (!actor || !unit_is_alive(actor_id)) { \ /* Actor unit was destroyed during pre action Lua. */ \ return FALSE; \ } \ - if (!target || !unit_alive(target_id)) { \ + if (!target || !unit_is_alive(target_id)) { \ /* Target unit was destroyed during pre action Lua. */ \ return FALSE; \ } @@ -1731,7 +1731,7 @@ API_TYPE_ACTION, action_by_number(action), \ API_TYPE_UNIT, actor, \ API_TYPE_TILE, target); \ - if (!actor || !unit_alive(actor_id)) { \ + if (!actor || !unit_is_alive(actor_id)) { \ /* Actor unit was destroyed during pre action Lua. */ \ return FALSE; \ } @@ -1741,7 +1741,7 @@ API_TYPE_ACTION, action_by_number(action), \ API_TYPE_UNIT, actor, \ API_TYPE_TILE, target); \ - if (!actor || !unit_alive(actor_id)) { \ + if (!actor || !unit_is_alive(actor_id)) { \ /* Actor unit was destroyed during pre action Lua. */ \ return FALSE; \ } @@ -3015,7 +3015,7 @@ punit->moved = TRUE; /* We moved */ kill_unit(pwinner, ploser, vet && !uclass_has_flag(unit_class_get(punit), UCF_MISSILE)); - if (unit_alive(winner_id)) { + if (unit_is_alive(winner_id)) { if (uclass_has_flag(unit_class_get(pwinner), UCF_MISSILE)) { wipe_unit(pwinner, ULR_MISSILE, NULL); return; @@ -4037,7 +4037,7 @@ unit_move_handling(pcargo, ttile, FALSE, FALSE); - if (!unit_alive(id)) { + if (!unit_is_alive(id)) { return; } } Modified: trunk/server/unittools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=32425&r1=32424&r2=32425&view=diff ============================================================================== --- trunk/server/unittools.c (original) +++ trunk/server/unittools.c Sun Apr 17 06:07:32 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -3202,7 +3202,7 @@ if (tocity) { unit_enter_city(punit, tocity, passenger); - alive = unit_alive(saved_id); + alive = unit_is_alive(saved_id); if (alive) { /* In case script has changed something about unit */ pplayer_end_pos = unit_owner(punit); @@ -3710,7 +3710,7 @@ act_player = unit_owner(act_unit); if (act_unit == NULL - || !unit_alive(act_unit->id)) { + || !unit_is_alive(act_unit->id)) { /* The unit died before reaching this point. */ continue; } @@ -3785,7 +3785,7 @@ API_TYPE_UNIT, punit, API_TYPE_TILE, psrctile, API_TYPE_TILE, pdesttile); - unit_lives = unit_alive(saved_id); + unit_lives = unit_is_alive(saved_id); } if (unit_lives) { @@ -3797,7 +3797,7 @@ /* Is there a hut? */ if (tile_has_cause_extra(pdesttile, EC_HUT)) { unit_enter_hut(punit); - unit_lives = unit_alive(saved_id); + unit_lives = unit_is_alive(saved_id); } } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits