Freeciv-3.3
|
Go to the source code of this file.
Definition at line 21 of file unittools.h.
#define SPECENUM_VALUE0 ULR_KILLED |
Definition at line 22 of file unittools.h.
#define SPECENUM_VALUE0NAME "killed" |
Definition at line 23 of file unittools.h.
#define SPECENUM_VALUE1 ULR_RETIRED |
Definition at line 24 of file unittools.h.
#define SPECENUM_VALUE10 ULR_ELIMINATED |
Definition at line 43 of file unittools.h.
#define SPECENUM_VALUE10NAME "eliminated" |
Definition at line 44 of file unittools.h.
#define SPECENUM_VALUE11 ULR_EDITOR |
Definition at line 45 of file unittools.h.
#define SPECENUM_VALUE11NAME "editor" |
Definition at line 46 of file unittools.h.
#define SPECENUM_VALUE12 ULR_NONNATIVE_TERR |
Definition at line 47 of file unittools.h.
#define SPECENUM_VALUE12NAME "nonnative_terr" |
Definition at line 48 of file unittools.h.
#define SPECENUM_VALUE13 ULR_PLAYER_DIED |
Definition at line 49 of file unittools.h.
#define SPECENUM_VALUE13NAME "player_died" |
Definition at line 50 of file unittools.h.
#define SPECENUM_VALUE14 ULR_ARMISTICE |
Definition at line 51 of file unittools.h.
#define SPECENUM_VALUE14NAME "armistice" |
Definition at line 52 of file unittools.h.
Definition at line 53 of file unittools.h.
#define SPECENUM_VALUE15NAME "sdi" |
Definition at line 54 of file unittools.h.
#define SPECENUM_VALUE16 ULR_DETONATED |
Definition at line 55 of file unittools.h.
#define SPECENUM_VALUE16NAME "detonated" |
Definition at line 56 of file unittools.h.
#define SPECENUM_VALUE17 ULR_MISSILE |
Definition at line 57 of file unittools.h.
#define SPECENUM_VALUE17NAME "missile" |
Definition at line 58 of file unittools.h.
Definition at line 59 of file unittools.h.
#define SPECENUM_VALUE18NAME "nuke" |
Definition at line 60 of file unittools.h.
#define SPECENUM_VALUE19 ULR_HP_LOSS |
Definition at line 61 of file unittools.h.
#define SPECENUM_VALUE19NAME "hp_loss" |
Definition at line 62 of file unittools.h.
#define SPECENUM_VALUE1NAME "retired" |
Definition at line 25 of file unittools.h.
#define SPECENUM_VALUE2 ULR_DISBANDED |
Definition at line 26 of file unittools.h.
Definition at line 63 of file unittools.h.
#define SPECENUM_VALUE20NAME "fuel" |
Definition at line 64 of file unittools.h.
#define SPECENUM_VALUE21 ULR_STACK_CONFLICT |
Definition at line 65 of file unittools.h.
#define SPECENUM_VALUE21NAME "stack_conflict" |
Definition at line 66 of file unittools.h.
#define SPECENUM_VALUE22 ULR_BRIBED |
Definition at line 67 of file unittools.h.
#define SPECENUM_VALUE22NAME "bribed" |
Definition at line 68 of file unittools.h.
#define SPECENUM_VALUE23 ULR_CAPTURED |
Definition at line 69 of file unittools.h.
#define SPECENUM_VALUE23NAME "captured" |
Definition at line 70 of file unittools.h.
#define SPECENUM_VALUE24 ULR_CAUGHT |
Definition at line 71 of file unittools.h.
#define SPECENUM_VALUE24NAME "caught" |
Definition at line 72 of file unittools.h.
#define SPECENUM_VALUE25 ULR_TRANSPORT_LOST |
Definition at line 73 of file unittools.h.
#define SPECENUM_VALUE25NAME "transport_lost" |
Definition at line 74 of file unittools.h.
#define SPECENUM_VALUE2NAME "disbanded" |
Definition at line 27 of file unittools.h.
#define SPECENUM_VALUE3 ULR_BARB_UNLEASH |
Definition at line 28 of file unittools.h.
#define SPECENUM_VALUE3NAME "barb_unleash" |
Definition at line 29 of file unittools.h.
#define SPECENUM_VALUE4 ULR_CITY_LOST |
Definition at line 30 of file unittools.h.
#define SPECENUM_VALUE4NAME "city_lost" |
Definition at line 31 of file unittools.h.
#define SPECENUM_VALUE5 ULR_STARVED |
Definition at line 32 of file unittools.h.
#define SPECENUM_VALUE5NAME "starved" |
Definition at line 33 of file unittools.h.
Definition at line 34 of file unittools.h.
#define SPECENUM_VALUE6NAME "sold" |
Definition at line 35 of file unittools.h.
#define SPECENUM_VALUE7 ULR_UPKEEP |
Definition at line 37 of file unittools.h.
#define SPECENUM_VALUE7NAME "upkeep" |
Definition at line 38 of file unittools.h.
Definition at line 39 of file unittools.h.
#define SPECENUM_VALUE8NAME "used" |
Definition at line 40 of file unittools.h.
#define SPECENUM_VALUE9 ULR_EXECUTED |
Definition at line 41 of file unittools.h.
#define SPECENUM_VALUE9NAME "executed" |
Definition at line 42 of file unittools.h.
Move or remove a unit due to stack conflicts. This function will try to find a random safe tile within a two tile distance of the unit's current tile and move the unit there. If no tiles are found, the unit is disbanded. If 'verbose' is TRUE, a message is sent to the unit owner regarding what happened.
Definition at line 1225 of file unittools.c.
Referenced by bounce_unit(), diplomat_bribe_stack(), diplomat_bribe_unit(), do_capture_units(), resolve_stack_conflicts(), sg_load_sanitycheck(), sg_load_sanitycheck(), throw_units_from_illegal_cities(), transfer_city_units(), and transfer_unit().
Called when one unit collects ransom of another.
Definition at line 2643 of file unittools.c.
Referenced by do_attack().
void combat_veterans | ( | struct unit * | attacker, |
struct unit * | defender, | ||
bool | powerless, | ||
int | att_vet, | ||
int | def_vet | ||
) |
Maybe make either side of combat veteran. Powerless means that either side of the combat was completely powerless.
Definition at line 404 of file unittools.c.
Referenced by do_attack().
struct unit * create_unit | ( | struct player * | pplayer, |
struct tile * | ptile, | ||
const struct unit_type * | type, | ||
int | veteran_level, | ||
int | homecity_id, | ||
int | moves_left | ||
) |
Wrapper of the below
Definition at line 1605 of file unittools.c.
Referenced by give_midgame_initial_units(), handle_edit_unit_create(), place_animal(), place_starting_unit(), try_summon_barbarians(), and unleash_barbarians().
struct unit * create_unit_full | ( | struct player * | pplayer, |
struct tile * | ptile, | ||
const struct unit_type * | type, | ||
int | veteran_level, | ||
int | homecity_id, | ||
int | moves_left, | ||
int | hp_left, | ||
struct unit * | ptrans | ||
) |
Creates a unit, sets its initial values, and puts it into the right lists. The unit must be placed to a valid tile or a loadable transport. See unit_virtual_prepare() for the processing of moves_left and hp_left
Definition at line 1632 of file unittools.c.
Referenced by create_unit(), and try_summon_barbarians().
Go by airline, if both cities have an airport and neither has been used this turn the unit will be transported by it and have its moves set to 0
Definition at line 3066 of file unittools.c.
Referenced by unit_perform_action().
Autoexplore with unit.
Definition at line 3099 of file unittools.c.
Referenced by begin_phase(), and handle_unit_server_side_agent_set().
void do_nuclear_explosion | ( | const struct action * | paction, |
const struct unit_type * | act_utype, | ||
struct player * | pplayer, | ||
struct tile * | ptile | ||
) |
Nuke all the squares in a the specified radius around the center of the explosion.
paction | the action that caused the explosion |
act_utype | the type of the unit that caused to explosionn. |
pplayer | the player that caused the explosion. |
ptile | the tile at the center of the explosion. |
Definition at line 3034 of file unittools.c.
Referenced by spy_nuke_city(), and unit_nuke().
Returns whether the drop was made or not. Note that it also returns 1 in the case where the drop was successful, but the unit was killed by barbarians in a hut.
Definition at line 3135 of file unittools.c.
Referenced by unit_perform_action().
Executes a unit's orders stored in punit->orders. The unit is put on idle if an action fails or if "patrol" is set and an enemy unit is encountered.
The return value will be TRUE if the unit lives, FALSE otherwise. (This function used to return a goto_result enumeration, declared in gotohand.h. But this enumeration was never checked by the caller and just lead to confusion. All the caller really needs to know is if the unit lived or died; everything else is handled internally within execute_orders.)
If the orders are repeating the loop starts over at the beginning once it completes. To avoid infinite loops on railroad we stop for this turn when the unit is back where it started, even if it have moves left.
A unit will attack under orders only on its final action.
The fresh parameter is true if the order execution happens because the orders just were received.
Definition at line 4518 of file unittools.c.
Referenced by execute_unit_orders(), and handle_unit_orders().
Iterate through all units and execute their orders.
Definition at line 680 of file unittools.c.
Referenced by begin_phase().
Iterate through all units and remember their current activities.
Definition at line 702 of file unittools.c.
Referenced by begin_phase().
struct unit_type * find_a_unit_type | ( | enum unit_role_id | role, |
enum unit_role_id | role_tech | ||
) |
Returns a unit type that matches the role_tech or role roles.
If role_tech is given, then we look at all units with this role whose requirements are met by any player, and return a random one. This can be used to give a unit to barbarians taken from the set of most advanced units researched by the 'real' players.
If role_tech is not give (-1) or if there are no matching unit types, then we look at 'role' value and return a random matching unit type.
It is an error if there are no available units. This function will always return a valid unit.
Definition at line 175 of file unittools.c.
Referenced by try_summon_barbarians(), and unleash_barbarians().
int get_unit_vision_at | ( | const struct unit * | punit, |
const struct tile * | ptile, | ||
enum vision_layer | vlayer | ||
) |
Return the vision the unit will have at the given tile. The base vision range may be modified by effects.
Note that vision MUST be independent of transported_by for this to work properly.
Definition at line 4991 of file unittools.c.
Referenced by maybe_cancel_patrol_due_to_enemy(), and wakeup_neighbor_sentries().
struct unit_list * get_units_seen_via_ally | ( | const struct player * | pplayer, |
const struct player * | aplayer | ||
) |
Returns the list of the units seen by 'pplayer' potentially seen only thanks to an alliance with 'aplayer'. The returned pointer is newly allocated and should be freed by the caller, using unit_list_destroy().
Definition at line 1416 of file unittools.c.
Referenced by handle_diplomacy_accept_treaty_req(), and handle_diplomacy_cancel_pact().
Refresh units visibility of 'aplayer' for 'pplayer' after alliance have been contracted.
Definition at line 1475 of file unittools.c.
Referenced by handle_diplomacy_accept_treaty_req().
bool is_refuel_point | ( | const struct tile * | ptile, |
const struct player * | pplayer, | ||
const struct unit * | punit | ||
) |
Can unit refuel on tile. Considers also carrier capacity on tile.
Definition at line 1530 of file unittools.c.
Referenced by dai_find_strategic_airbase(), dai_manage_airunit(), find_nearest_airbase(), and player_restore_units().
Is unit being refueled in its current position?
Definition at line 1521 of file unittools.c.
Referenced by dai_find_strategic_airbase(), dai_manage_airunit(), and player_restore_units().
Called when one unit kills another in combat (this function is only called in one place). It handles all side effects including notifications and killstack.
Definition at line 2266 of file unittools.c.
Referenced by do_attack().
Unit has a chance to become veteran. This should not be used for settlers for the work they do.
Definition at line 219 of file unittools.c.
Referenced by combat_veterans(), diplomat_bribe_stack(), diplomat_bribe_unit(), diplomat_escape_full(), and diplomat_infiltrate_tile().
Common notification for all experience levels.
Definition at line 747 of file unittools.c.
Referenced by collect_ransom(), diplomat_bribe_stack(), diplomat_bribe_unit(), diplomat_escape_full(), diplomat_infiltrate_tile(), do_attack(), kill_unit(), and update_unit_activity().
void package_short_unit | ( | struct unit * | punit, |
struct packet_unit_short_info * | packet, | ||
enum unit_info_use | packet_use, | ||
int | info_city_id | ||
) |
Package a short_unit_info packet. This contains a limited amount of information about the unit, and is sent to players who shouldn't know everything (like the unit's owner's enemies).
Definition at line 2814 of file unittools.c.
Referenced by diplomat_investigate(), see_combat(), send_unit_info(), and unit_move().
void package_unit | ( | struct unit * | punit, |
struct packet_unit_info * | packet | ||
) |
Package a unit_info packet. This packet contains basically all information about a unit.
Definition at line 2733 of file unittools.c.
Referenced by see_combat(), send_unit_info(), and unit_move().
Place partisans for powner around pcenter (normally around a city).
Definition at line 1161 of file unittools.c.
Referenced by api_edit_place_partisans().
bool place_unit | ( | struct unit * | punit, |
struct player * | pplayer, | ||
struct city * | pcity, | ||
struct unit * | ptrans, | ||
bool | force | ||
) |
Places a virtual unit into the game, assigning it an index, putting it on the right lists and dispatching the information around. The unit must have a tile, pcity and pplayer must be valid and accord to the unit's fields (basically, set by unit_virtual_prepare()). ptrans if not NULL must be a transporter on the same tile the unit can freely load into (or just that can transport it if force) Returns if the unit is placed (must be TRUE if input data are valid)
Definition at line 1713 of file unittools.c.
Referenced by api_edit_create_unit_full(), city_create_unit(), create_unit_full(), place_partisans(), and unit_change_owner().
Definition at line 481 of file unittools.c.
Referenced by end_phase().
Make random movements of the units that move that way.
Definition at line 5097 of file unittools.c.
Referenced by begin_phase().
void remove_allied_visibility | ( | struct player * | pplayer, |
struct player * | aplayer, | ||
const struct unit_list * | seen_units | ||
) |
When two players cancel an alliance, a lot of units that were visible may no longer be visible (this includes units in transporters and cities). Call this function to inform the clients that these units are no longer visible. Pass the list of seen units returned by get_units_seen_via_ally() before alliance was broken up.
Definition at line 1451 of file unittools.c.
Referenced by update_players_after_alliance_breakup().
When in civil war or an alliance breaks there will potentially be units from both sides coexisting on the same squares. This routine resolves this by first bouncing off non-allied units from their cities, then by bouncing both players' units in now illegal multiowner stacks. To avoid drowning due to removal of transports, we bounce everyone (including third parties' units) from ocean tiles.
If verbose is true, the unit owner gets messages about where each units goes.
Definition at line 1401 of file unittools.c.
Referenced by civil_war(), kill_player(), sg_load_sanitycheck(), sg_load_sanitycheck(), transfer_city(), and update_players_after_alliance_breakup().
For each specified connections, send information about all the units known to that player/conn.
Definition at line 2921 of file unittools.c.
Referenced by send_all_info().
Send the unit to the players who need the info. dest = NULL means all connections (game.est_connections)
Definition at line 2877 of file unittools.c.
Referenced by action_success_pay_mp(), action_success_target_pay_mp(), adv_follow_path(), api_edit_unit_hitpoints(), api_edit_unit_movepoints(), api_edit_unit_turn(), auto_worker_findwork(), auto_worker_setup_work(), cancel_orders(), dai_auto_settler_run(), dai_unit_goto_constrained(), destroy_extra(), diplomat_bribe_stack(), diplomat_bribe_unit(), diplomat_embassy(), diplomat_escape_full(), diplomat_get_tech(), diplomat_infiltrate_tile(), diplomat_investigate(), diplomat_sabotage(), do_attack(), do_capture_units(), do_expel_unit(), do_explore(), do_heal_unit(), do_wipe_units(), execute_orders(), finalize_unit_phase_beginning(), give_allied_visibility(), handle_edit_unit(), handle_unit_orders(), handle_unit_sscs_set(), illegal_action_pay_price(), map_change_seen(), map_claim_base(), map_show_tile(), place_animal(), place_unit(), player_restore_units(), remove_city(), send_all_known_units(), server_remove_unit_full(), spy_sabotage_unit(), transfer_city(), transform_unit(), try_summon_barbarians(), try_to_save_unit(), unit_activities_cancel(), unit_activity_dependencies(), unit_activity_internal(), unit_activity_targeted_internal(), unit_bombard(), unit_change_homecity_handling(), unit_lost_with_transport(), unit_move(), unit_move_handling(), unit_server_side_agent_set(), unit_survive_autoattack(), unit_transport_load_send(), unit_transport_load_tp_status(), unit_transport_unload_send(), unleash_barbarians(), update_unit_upkeep(), wakeup_neighbor_sentries(), and wipe_unit_full().
bool teleport_unit_to_city | ( | struct unit * | punit, |
struct city * | pcity, | ||
int | move_cost, | ||
bool | verbose | ||
) |
Teleport punit to city at cost specified. Returns success. Note that unit may die if it successfully moves, i.e., even when return value is TRUE. (If specified cost is -1, then teleportation costs all movement.)
Definition at line 1187 of file unittools.c.
Referenced by diplomat_escape_full(), do_expel_unit(), and try_to_save_unit().
Really transforms a single unit to another type.
This function performs no checks. You should perform the appropriate test first to check that the transformation is legal (unit_upgrade_test() or unit_can_convert()).
vet_loss: Number of veteran levels lost in process.
Note that this function is strongly tied to unit.c:unit_upgrade_test().
Definition at line 1553 of file unittools.c.
Referenced by do_unit_upgrade(), do_upgrade_effects(), unit_convert(), and ur_transform_unit().
Cancel activities, and orders that it might be part of.
Definition at line 800 of file unittools.c.
Referenced by climate_change(), create_city(), transform_unit(), unit_activities_cancel_all_illegal_plr(), unit_activities_cancel_all_illegal_tile(), and unit_change_homecity_handling().
Cancel all illegal activities done by units at the specified tile, and surrounding tiles. For most rulesets this is for cancelling irrigation on surrounding tiles when the central tile was the only source of water, but does not provide water any more.
Definition at line 845 of file unittools.c.
Referenced by tile_change_side_effects().
Cancel all illegal activities done by units of the specified owner.
Definition at line 818 of file unittools.c.
Referenced by research_tech_lost().
Cancel all illegal activities done by units at the specified tile.
Definition at line 830 of file unittools.c.
Referenced by unit_activities_cancel_all_illegal_area().
bool unit_activity_needs_target_from_client | ( | enum unit_activity | activity | ) |
Return TRUE iff activity requires some sort of target to be specified by the client.
Definition at line 1062 of file unittools.c.
Referenced by sg_load_player_unit(), and unit_perform_action().
void unit_assign_specific_activity_target | ( | struct unit * | punit, |
enum unit_activity * | activity, | ||
struct extra_type ** | target | ||
) |
For some activities (currently only pillaging), the precise target can be assigned by the server rather than explicitly requested by the client. This function assigns a specific activity+target if the current settings are open-ended (otherwise leaves them unchanged).
Please update unit_activity_needs_target_from_client() if you add server side unit activity target setting to more activities.
Definition at line 1082 of file unittools.c.
Referenced by action_sub_target_id_for_action(), compat_post_load_030100(), and unit_activity_targeted_internal().
void unit_bombs_unit | ( | struct unit * | attacker, |
struct unit * | defender, | ||
int * | att_hp, | ||
int * | def_hp, | ||
const struct action * | paction | ||
) |
This is the basic unit versus unit classic bombardment routine. 1) ALOT of modifiers bonuses etc is added to the 2 units rates. 2) Do rate attacks and don't kill the defender, then return.
Definition at line 359 of file unittools.c.
Referenced by unit_bombard().
Units (usually barbarian units) may disband spontaneously if they are far from any enemy units or cities. It is to remove barbarians that do not engage into any activity for a long time.
Definition at line 5080 of file unittools.c.
Referenced by begin_turn().
Used to implement the game rule controlled by the unitwaittime setting. Notifies the unit owner if the unit is unable to act.
Definition at line 5032 of file unittools.c.
Referenced by unit_perform_action().
struct unit * unit_change_owner | ( | struct unit * | punit, |
struct player * | pplayer, | ||
int | homecity, | ||
enum unit_loss_reason | reason | ||
) |
We don't really change owner of the unit, but create completely new unit as its copy. The new pointer to 'punit' is returned. Always wipes the source unit but sometimes returns NULL or a unit of a player other than pplayer.
Definition at line 2199 of file unittools.c.
Referenced by diplomat_bribe_stack(), diplomat_bribe_unit(), and do_capture_units().
Mark a unit as having done something at the current time. This is used in conjunction with unit_can_do_action_now() and the unitwaittime setting.
Definition at line 5065 of file unittools.c.
Referenced by do_attack(), do_capture_units(), do_wipe_units(), unit_bombard(), and unit_move_by_data().
Forget the unit's last activity so that it can't be resumed. This is used for example when the unit moves or attacks.
Definition at line 1053 of file unittools.c.
Referenced by do_attack(), do_capture_units(), do_wipe_units(), transform_unit(), unit_bombard(), and unit_move_by_data().
Set carried goods for unit.
Definition at line 1616 of file unittools.c.
Referenced by place_unit(), and unit_change_homecity_handling().
Handle situation where unit goes out of player sight.
Definition at line 2864 of file unittools.c.
Referenced by create_city(), create_extra(), map_change_seen(), map_claim_base(), map_hide_tile(), remove_allied_visibility(), send_combat(), transfer_city(), unit_change_homecity_handling(), unit_move(), and unit_transport_load_send().
Refresh the vision of all units in the list - see unit_refresh_vision().
Definition at line 5021 of file unittools.c.
Referenced by create_city(), create_extra(), found_new_tech(), and update_unit_activity().
Make contact between a player and everyone adjacent to a tile via a unit moving to that tile. Tile and player default to the unit's location and owner if nullptr, but they may be different.
Definition at line 5180 of file unittools.c.
Referenced by do_paradrop(), illegal_action_pay_price(), place_unit(), transfer_unit(), and unit_move().
bool unit_move | ( | struct unit * | punit, |
struct tile * | pdesttile, | ||
int | move_cost, | ||
struct unit * | embark_to, | ||
bool | find_embark_target, | ||
bool | conquer_city_allowed, | ||
bool | conquer_extras_allowed, | ||
bool | enter_hut, | ||
bool | frighten_hut | ||
) |
Moves a unit. No checks whatsoever! This is meant as a practical function for other functions, like do_airline(), which do the checking themselves.
If you move a unit you should always use this function, as it also sets the transport status of the unit correctly. Note that the source tile (the current tile of the unit) and pdesttile need not be adjacent.
Returns TRUE iff unit still alive.
Definition at line 4078 of file unittools.c.
Referenced by adv_unit_execute_path(), api_edit_unit_move(), api_edit_unit_teleport(), bounce_unit(), do_airline(), do_conquer_extras(), do_disembark(), do_paradrop(), do_unit_conquer_city(), do_unit_embark(), do_unit_hut(), teleport_unit_to_city(), terrain_change_bounce_single_unit(), unit_do_regular_move(), unit_move_pay(), and unit_perform_action().
Refresh the unit's vision.
This function has very small overhead and can be called any time effects may have changed the vision range of the unit.
Definition at line 5004 of file unittools.c.
Referenced by place_unit(), sg_load_player_units(), sg_load_player_units(), transform_unit(), unit_change_homecity_handling(), unit_list_refresh_vision(), and unit_tc_effect_refresh().
Set the call back to run when the server removes the unit.
Definition at line 1771 of file unittools.c.
Referenced by uk_rem_gold_append().
Recalculate some unit related effects on turn change
Definition at line 692 of file unittools.c.
Referenced by begin_phase().
Put the unit onto the transporter, and tell everyone.
Definition at line 3389 of file unittools.c.
Referenced by dai_unit_new_task(), do_unit_board(), and do_unit_load().
Pull the unit off of the transporter, and tell everyone.
Definition at line 3441 of file unittools.c.
Referenced by do_attack(), do_unit_deboard(), do_unit_unload(), and throw_units_from_illegal_cities().
Remove the call back so nothing runs when the server removes the unit.
Definition at line 1785 of file unittools.c.
Referenced by unit_list_referred_destroy().
bool unit_versus_unit | ( | struct unit * | attacker, |
struct unit * | defender, | ||
int * | att_hp, | ||
int * | def_hp, | ||
int * | att_vet, | ||
int * | def_vet, | ||
const struct action * | paction | ||
) |
This is the basic unit versus unit combat routine. 1) A LOT of modifiers, bonuses etc are added to the 2 units' rates. 2) The combat loop, which continues until one of the units are dead or EFT_COMBAT_ROUNDS rounds have been fought. 3) The aftermath, the loser (and potentially the stack which is below it) might get wiped, and the winner gets a chance of gaining veteran status
Returns whether either side was completely powerless.
Definition at line 292 of file unittools.c.
Referenced by do_attack().
struct unit * unit_virtual_prepare | ( | struct player * | pplayer, |
struct tile * | ptile, | ||
const struct unit_type * | type, | ||
int | veteran_level, | ||
int | homecity_id, | ||
int | moves_left, | ||
int | hp_left | ||
) |
Creates a virtual unit, and sets its initial values, but does not register the unit in any other data structures or set the vision. If moves_left is less than zero, unit will get max moves; otherwise, it will get the specified number of movement fragments and will be considered moved. If hp_left is zero or less, unit will get full hp. homecity_id won't be set to units with "NoHome" flag. ptile must be a valid tile (its livability for the unit is not checked)
Definition at line 1665 of file unittools.c.
Referenced by api_edit_create_unit_full(), city_create_unit(), create_unit_full(), place_partisans(), and unit_change_owner().
Iterate through all units and update them.
Definition at line 670 of file unittools.c.
Referenced by begin_phase().
Remove the unit, and passengers if it is a carrying any. Remove the minimum number, eg there could be another boat on the square.
Definition at line 2139 of file unittools.c.
Referenced by action_success_actor_consume(), api_edit_unit_hitpoints(), api_edit_unit_kill(), api_edit_unit_teleport(), begin_turn(), bounce_unit(), check_units_single_tile(), collect_ransom(), diplomat_escape_full(), diplomat_get_tech(), diplomat_incite(), diplomat_infiltrate_tile(), diplomat_sabotage(), do_attack(), do_capture_units(), do_nuke_tile(), do_wipe_units(), handle_edit_unit_remove(), handle_edit_unit_remove_by_id(), hut_get_limited(), illegal_action_pay_price(), kill_player(), kill_unit(), player_restore_units(), remove_city(), remove_illegal_armistice_units(), spy_nuke_city(), spy_poison(), spy_sabotage_unit(), spy_spread_plague(), spy_steal_gold(), spy_steal_some_maps(), transfer_city_units(), transfer_unit(), unit_bombard(), unit_change_owner(), unit_nuke(), unleash_barbarians(), and upkeep_kill_unit().