Freeciv-3.2
Loading...
Searching...
No Matches
Functions
unithand.h File Reference
#include "explanation.h"
#include "unit.h"
#include <hand_gen.h>

Go to the source code of this file.

Functions

bool unit_activity_handling (struct unit *punit, enum unit_activity new_activity)
 
bool unit_activity_handling_targeted (struct unit *punit, enum unit_activity new_activity, struct extra_type **new_target)
 
void unit_change_homecity_handling (struct unit *punit, struct city *new_pcity, bool rehome)
 
bool unit_move_handling (struct unit *punit, struct tile *pdesttile, bool move_diplomat_city)
 
void unit_do_action (struct player *pplayer, const int actor_id, const int target_id, const int sub_tgt_id, const char *name, const action_id action_type)
 
bool unit_perform_action (struct player *pplayer, const int actor_id, const int target_id, const int sub_tgt_id, const char *name, const action_id action_type, const enum action_requester requester)
 
void illegal_action_msg (struct player *pplayer, const enum event_type event, struct unit *actor, const action_id stopped_action, const struct tile *target_tile, const struct city *target_city, const struct unit *target_unit)
 
enum ane_kind action_not_enabled_reason (struct unit *punit, action_id act_id, const struct tile *target_tile, const struct city *target_city, const struct unit *target_unit)
 
bool unit_server_side_agent_set (struct player *pplayer, struct unit *punit, enum server_side_agent agent)
 

Function Documentation

◆ action_not_enabled_reason()

enum ane_kind action_not_enabled_reason ( struct unit punit,
action_id  act_id,
const struct tile target_tile,
const struct city target_city,
const struct unit target_unit 
)

Give the reason kind why an action isn't enabled.

Definition at line 1913 of file unithand.c.

Referenced by dai_do_build_city().

◆ illegal_action_msg()

void illegal_action_msg ( struct player pplayer,
const enum event_type  event,
struct unit actor,
const action_id  stopped_action,
const struct tile target_tile,
const struct city target_city,
const struct unit target_unit 
)

Try to explain to the player why an action is illegal.

Event type should be E_BAD_COMMAND if the player should know that the action is illegal or E_UNIT_ILLEGAL_ACTION if new information potentially is being revealed to the player.

Definition at line 2492 of file unithand.c.

Referenced by execute_orders(), handle_city_name_suggestion_req(), and illegal_action().

◆ unit_activity_handling()

bool unit_activity_handling ( struct unit punit,
enum unit_activity  new_activity 
)

◆ unit_activity_handling_targeted()

bool unit_activity_handling_targeted ( struct unit punit,
enum unit_activity  new_activity,
struct extra_type **  new_target 
)

Handle request for targeted activity.

Definition at line 6538 of file unithand.c.

Referenced by adv_follow_path(), auto_settler_setup_work(), handle_unit_change_activity_real(), and unit_activity_handling().

◆ unit_change_homecity_handling()

void unit_change_homecity_handling ( struct unit punit,
struct city new_pcity,
bool  rehome 
)

Transfer a unit from one city (and possibly player) to another. If 'rehome' is not set, only change the player which owns the unit (the new owner is new_pcity's owner). Otherwise the new unit will be given a homecity, even if it was homeless before. This new homecity must be valid for this unit.

Definition at line 4016 of file unithand.c.

Referenced by do_unit_change_homecity(), do_unit_make_homeless(), and transfer_unit().

◆ unit_do_action()

void unit_do_action ( struct player pplayer,
const int  actor_id,
const int  target_id,
const int  sub_tgt_id,
const char name,
const action_id  action_type 
)

◆ unit_move_handling()

bool unit_move_handling ( struct unit punit,
struct tile pdesttile,
bool  move_do_not_act 
)

Will try to move to/attack the tile dest_x,dest_y. Returns TRUE if this was done, FALSE if it wasn't for some reason. Even if this returns TRUE, the unit may have died upon arrival to new tile.

'move_do_not_act' is a special case which should normally be FALSE. If TRUE any enabler controlled actions punit can perform to pdesttile it self or something located at it will be ignored. If FALSE the system will check if punit can perform any enabler controlled action to pdesttile. If it can the player will be asked to choose what to do. If it can't and punit is unable to move (or perform another non enabler controlled action) to pdesttile the game will try to explain why.

Definition at line 5533 of file unithand.c.

Referenced by execute_orders().

◆ unit_perform_action()

bool unit_perform_action ( struct player pplayer,
const int  actor_id,
const int  target_id,
const int  sub_tgt_id_incoming,
const char name,
const action_id  action_type,
const enum action_requester  requester 
)

Execute a request to perform an action and let the caller know if it was performed or not.

The action must be a valid action.

Returns TRUE iff action could be done, FALSE if it couldn't. Even if this returns TRUE, unit may have died during the action.

Definition at line 3313 of file unithand.c.

Referenced by api_edit_perform_action_unit_vs_city(), api_edit_perform_action_unit_vs_city_impr(), api_edit_perform_action_unit_vs_city_tech(), api_edit_perform_action_unit_vs_self(), api_edit_perform_action_unit_vs_tile(), api_edit_perform_action_unit_vs_tile_extra(), api_edit_perform_action_unit_vs_unit(), dai_manage_paratrooper(), execute_orders(), handle_unit_do_action(), handle_unit_type_upgrade(), random_movements(), unit_do_action(), unit_do_disband_trad(), and unit_move_handling().

◆ unit_server_side_agent_set()

bool unit_server_side_agent_set ( struct player pplayer,
struct unit punit,
enum server_side_agent  agent 
)

Change controlling server side agent.

Returns
TRUE iff the server side agent was changed.

Definition at line 6370 of file unithand.c.

Referenced by dai_manage_settler(), and handle_unit_server_side_agent_set().