Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

unit.c File Reference

#include "conq.h"
#include "kernel.h"
#include "aiscore.h"
#include "aiunit.h"
#include "aiunit2.h"
#include "aitact.h"
#include "aioprt.h"

Include dependency graph for unit.c:

Include dependency graph

Defines

#define INITMAXUNITS   200
#define NUMSHORTBUFS   3

Functions

void free_used_cells (Unit *unit)
void set_unit_image (Unit *unit)
int can_be_actor (Unit *unit)
void init_units (void)
Unitcreate_bare_unit (int type)
Unitcreate_unit (int type, int makebrains)
void init_unit_tooling (Unit *unit)
void init_unit_opinions (Unit *unit, int nsides)
void init_unit_actorstate (Unit *unit, int flagacp, int acp)
void init_unit_extras (Unit *unit)
void change_unit_type (Unit *unit, int newtype, int reason, Side *newside)
int side_owns_occupant_of_unit (Side *side, Unit *unit)
int side_owns_viewer_in_unit (Side *side, Unit *unit)
int see_chance (int u, int u2, int dist)
int see_chance (Unit *seer, Unit *tosee)
int enter_cell (Unit *unit, int x, int y)
int type_survives_in_cell (int u, int x, int y)
int type_survives_in_terrain (int u, int t)
int type_can_occupy_cell (int u, int x, int y)
int side_thinks_type_can_occupy_cell (Side *side, int u, int x, int y)
int type_can_occupy_empty_cell (int u, int x, int y)
int type_can_occupy_terrain (int u, int t)
int can_occupy_cell_without (Unit *unit, int x, int y, Unit *unit3)
int type_can_occupy_cell_without (int u, int x, int y, Unit *unit3)
int side_can_put_type_at (Side *side, int u, int x, int y)
int side_thinks_it_can_put_type_at (Side *side, int u, int x, int y)
int side_can_put_type_at_without (Side *side, int u, int x, int y, Unit *unit)
int side_thinks_it_can_put_type_at_without (Side *side, int u, int x, int y, Unit *unit)
int can_occupy (Unit *unit, Unit *transport)
int type_can_occupy (int u, Unit *transport)
int side_thinks_type_can_occupy (Side *side, int u, UnitView *transport)
int type_can_occupy_without (int u, Unit *transport, Unit *unit)
int side_thinks_type_can_occupy_without (int u, UnitView *transport, Unit *unit)
int type_can_occupy_empty_type (int u, int u2)
int type_can_have_occs (int u)
int is_at_correct_ustack_position (Unit *unit, Unit *unit2)
void enter_transport (Unit *unit, Unit *transport)
void leave_cell (Unit *unit)
void leave_transport (Unit *unit)
int change_cell (Unit *unit, int x, int y)
void change_unit_side (Unit *unit, Side *newside, int reason, Unit *agent)
int unit_allowed_on_side (Unit *unit, Side *side)
int new_unit_allowed_on_side (int u, Side *side)
int type_allowed_on_side (int u, Side *side)
int type_ever_available (int u, Side *side)
int num_sides_allowed (int u)
int unit_trusts_unit (Unit *unit1, Unit *unit2)
void set_unit_side (Unit *unit, Side *side)
void set_unit_origside (Unit *unit, Side *side)
void set_unit_name (Side *side, Unit *unit, char *newname)
void add_to_unit_hp (Unit *unit, int hp)
void change_morale (Unit *unit, int sign, int morchange)
int disband_unit (Side *side, Unit *unit)
void wreck_unit (Unit *unit, HistEventType hevttype, WreckType wrecktype, int wreckarg, Unit *agent)
void kill_unit (Unit *unit, int reason)
void flush_dead_units (void)
void sort_units (int byidonly)
char * unit_desig (Unit *unit)
char * unit_desig_no_loc (Unit *unit)
char * utype_name_n (int u, int n)
char * shortest_unique_name (int u)
char * shortest_generic_name (int u)
char * actorstate_desig (ActorState *as)
Unitfind_unit (int n)
Unitfind_unit_dead_or_alive (int n)
Unitfind_unit_by_name (char *nm)
Unitfind_unit_by_number (int nb)
Unitfind_unit_by_symbol (Obj *sym)
void check_all_units (void)
UnitVectormake_unit_vector (int initsize)
void clear_unit_vector (UnitVector *vec)
UnitVectoradd_unit_to_vector (UnitVector *vec, Unit *unit, int flag)
void remove_unit_from_vector (UnitVector *vec, Unit *unit, int pos)
void sort_unit_vector (UnitVector *vec)
Unitdesigner_create_unit (Side *side, int u, int s, int x, int y)
int designer_teleport (Unit *unit, int x, int y, Unit *other)
int designer_change_side (Unit *unit, Side *side)
int designer_disband (Unit *unit)
int could_be_on (int u, int t)
 Could u be on t?

int can_develop (Unit *unit)
int type_can_develop (int u)
int can_extract_at (Unit *unit, int x, int y, int *mp)
int can_load_at (Unit *unit, int x, int y, int *mp)
int can_change_type (Unit *unit)
int could_change_type (int u)
int can_change_type_to (Unit *unit, int u2)
int could_change_type_to (int u, int u2)
int can_disband (Unit *unit)
int type_can_disband (int u)
int side_can_disband (Side *side, Unit *unit)
int can_add_terrain (Unit *unit)
int type_can_add_terrain (int u)
int can_remove_terrain (Unit *unit)
int type_can_remove_terrain (int u)
Unitincomplete_build_target (Unit *unit)
int can_build_attackers (Side *side, int u)
int can_build_defenders (Side *side, int u)
int can_build_explorers (Side *side, int u)
int can_build_colonizers (Side *side, int u)
int can_build_facilities (Side *side, int u)
int can_build (Unit *unit)
int type_can_build (int u, Side *side)
int unit_can_build_type_at (Unit *unit, int u2, int x, int y)
int can_build_type (Unit *unit, int u2)
int unit_can_build_type (Unit *unit, int u2)
int can_develop_or_build_type (Unit *unit, int u2)
int type_can_build_type (int u, Side *side, int u2)
int can_build_or_help (Unit *unit)
int can_research (Unit *unit)
int can_produce (Unit *unit)
int total_production (Unit *unit, int m)
int base_production (Unit *unit, int m)
int total_consumption (Unit *unit, int m)
int base_consumption (Unit *unit, int m)
int survival_time (Unit *unit)
int will_not_move (Unit *unit)
int needs_material_to_move (Unit *unit, int m)
int needs_material_to_survive (Unit *unit, int m)
int can_move (Unit *unit)
int operating_range_worst (int u)
int real_operating_range_worst (Unit *unit)
int operating_range_best (int u)
int real_operating_range_best (Unit *unit)
void fill_utype_array_from_lisp (int *typeary, Obj *typeobj)

Variables

int * numuimages
Unitfreeunits
Unitunitlist
 Unit list.

Unittmpunit
 Unit temporary.

char ** shortestnames = NULL
int longest_shortest
char ** shortestgnames = NULL
char * actorstatebuf = NULL
int numunits
 Number of Units.

int numliveunits
 Number of live Units.

int * numlivebytype
int nextid = 1
short default_size = 1
 Advanced : default size.

short default_usedcells = 0
 Advanced : default used cells.

short default_maxcells = 1
 Advanced : default max cells.

short default_curadvance = -1
long default_population = 1
 Advanced : default population.

enum sortkeys tmpsortkeys [MAXSORTKEYS]
 Temporary sort keys.


Define Documentation

#define INITMAXUNITS   200
 

#define NUMSHORTBUFS   3
 


Function Documentation

char* actorstate_desig ActorState as  ) 
 

void add_to_unit_hp Unit unit,
int  hp
 

UnitVector* add_unit_to_vector UnitVector vec,
Unit unit,
int  flag
 

int base_consumption Unit unit,
int  m
 

int base_production Unit unit,
int  m
 

int can_add_terrain Unit unit  ) 
 

int can_be_actor Unit unit  ) 
 

int can_build Unit unit  ) 
 

int can_build_attackers Side side,
int  u
 

int can_build_colonizers Side side,
int  u
 

int can_build_defenders Side side,
int  u
 

int can_build_explorers Side side,
int  u
 

int can_build_facilities Side side,
int  u
 

int can_build_or_help Unit unit  ) 
 

int can_build_type Unit unit,
int  u2
 

int can_change_type Unit unit  ) 
 

Todo:
Move to 'aiunit.cc' where it probably belongs.

Fix prototype for separate actor/agent.

int can_change_type_to Unit unit,
int  u2
 

int can_develop Unit unit  ) 
 

int can_develop_or_build_type Unit unit,
int  u2
 

int can_disband Unit unit  ) 
 

int can_extract_at Unit unit,
int  x,
int  y,
int *  mp
 

int can_load_at Unit unit,
int  x,
int  y,
int *  mp
 

int can_move Unit unit  ) 
 

int can_occupy Unit unit,
Unit transport
 

int can_occupy_cell_without Unit unit,
int  x,
int  y,
Unit unit3
 

int can_produce Unit unit  ) 
 

int can_remove_terrain Unit unit  ) 
 

int can_research Unit unit  ) 
 

int change_cell Unit unit,
int  x,
int  y
 

void change_morale Unit unit,
int  sign,
int  morchange
 

void change_unit_side Unit unit,
Side newside,
int  reason,
Unit agent
 

void change_unit_type Unit unit,
int  newtype,
int  reason,
Side newside
 

void check_all_units void   ) 
 

void clear_unit_vector UnitVector vec  ) 
 

int could_be_on int  u,
int  t
 

Could u be on t?

int could_change_type int  u  ) 
 

int could_change_type_to int  u,
int  u2
 

Unit* create_bare_unit int  type  ) 
 

Unit* create_unit int  type,
int  makebrains
 

int designer_change_side Unit unit,
Side side
 

Unit* designer_create_unit Side side,
int  u,
int  s,
int  x,
int  y
 

int designer_disband Unit unit  ) 
 

int designer_teleport Unit unit,
int  x,
int  y,
Unit other
 

int disband_unit Side side,
Unit unit
 

int enter_cell Unit unit,
int  x,
int  y
 

void enter_transport Unit unit,
Unit transport
 

void fill_utype_array_from_lisp int *  typeary,
Obj typeobj
 

Unit* find_unit int  n  ) 
 

Unit* find_unit_by_name char *  nm  ) 
 

Unit* find_unit_by_number int  nb  ) 
 

Unit* find_unit_by_symbol Obj sym  ) 
 

Unit* find_unit_dead_or_alive int  n  ) 
 

void flush_dead_units void   ) 
 

void free_used_cells Unit unit  ) 
 

Unit* incomplete_build_target Unit unit  ) 
 

void init_unit_actorstate Unit unit,
int  flagacp,
int  acp
 

void init_unit_extras Unit unit  ) 
 

void init_unit_opinions Unit unit,
int  nsides
 

void init_unit_tooling Unit unit  ) 
 

void init_units void   ) 
 

int is_at_correct_ustack_position Unit unit,
Unit unit2
 

void kill_unit Unit unit,
int  reason
 

void leave_cell Unit unit  ) 
 

void leave_transport Unit unit  ) 
 

UnitVector* make_unit_vector int  initsize  ) 
 

int needs_material_to_move Unit unit,
int  m
 

int needs_material_to_survive Unit unit,
int  m
 

int new_unit_allowed_on_side int  u,
Side side
 

int num_sides_allowed int  u  ) 
 

int operating_range_best int  u  ) 
 

int operating_range_worst int  u  ) 
 

int real_operating_range_best Unit unit  ) 
 

int real_operating_range_worst Unit unit  ) 
 

void remove_unit_from_vector UnitVector vec,
Unit unit,
int  pos
 

int see_chance Unit seer,
Unit tosee
 

int see_chance int  u,
int  u2,
int  dist
 

void set_unit_image Unit unit  ) 
 

void set_unit_name Side side,
Unit unit,
char *  newname
 

void set_unit_origside Unit unit,
Side side
 

void set_unit_side Unit unit,
Side side
 

char* shortest_generic_name int  u  ) 
 

char* shortest_unique_name int  u  ) 
 

int side_can_disband Side side,
Unit unit
 

int side_can_put_type_at Side side,
int  u,
int  x,
int  y
 

int side_can_put_type_at_without Side side,
int  u,
int  x,
int  y,
Unit unit
 

int side_owns_occupant_of_unit Side side,
Unit unit
 

int side_owns_viewer_in_unit Side side,
Unit unit
 

int side_thinks_it_can_put_type_at Side side,
int  u,
int  x,
int  y
 

int side_thinks_it_can_put_type_at_without Side side,
int  u,
int  x,
int  y,
Unit unit
 

int side_thinks_type_can_occupy Side side,
int  u,
UnitView transport
 

int side_thinks_type_can_occupy_cell Side side,
int  u,
int  x,
int  y
 

int side_thinks_type_can_occupy_without int  u,
UnitView transport,
Unit unit
 

void sort_unit_vector UnitVector vec  ) 
 

void sort_units int  byidonly  ) 
 

int survival_time Unit unit  ) 
 

int total_consumption Unit unit,
int  m
 

int total_production Unit unit,
int  m
 

int type_allowed_on_side int  u,
Side side
 

int type_can_add_terrain int  u  ) 
 

int type_can_build int  u,
Side side
 

int type_can_build_type int  u,
Side side,
int  u2
 

int type_can_develop int  u  ) 
 

int type_can_disband int  u  ) 
 

int type_can_have_occs int  u  ) 
 

int type_can_occupy int  u,
Unit transport
 

int type_can_occupy_cell int  u,
int  x,
int  y
 

int type_can_occupy_cell_without int  u,
int  x,
int  y,
Unit unit3
 

int type_can_occupy_empty_cell int  u,
int  x,
int  y
 

int type_can_occupy_empty_type int  u,
int  u2
 

int type_can_occupy_terrain int  u,
int  t
 

int type_can_occupy_without int  u,
Unit transport,
Unit unit
 

int type_can_remove_terrain int  u  ) 
 

int type_ever_available int  u,
Side side
 

int type_survives_in_cell int  u,
int  x,
int  y
 

int type_survives_in_terrain int  u,
int  t
 

int unit_allowed_on_side Unit unit,
Side side
 

int unit_can_build_type Unit unit,
int  u2
 

int unit_can_build_type_at Unit unit,
int  u2,
int  x,
int  y
 

char* unit_desig Unit unit  ) 
 

char* unit_desig_no_loc Unit unit  ) 
 

int unit_trusts_unit Unit unit1,
Unit unit2
 

char* utype_name_n int  u,
int  n
 

int will_not_move Unit unit  ) 
 

void wreck_unit Unit unit,
HistEventType  hevttype,
WreckType  wrecktype,
int  wreckarg,
Unit agent
 


Variable Documentation

char* actorstatebuf = NULL
 

short default_curadvance = -1
 

short default_maxcells = 1
 

Advanced : default max cells.

long default_population = 1
 

Advanced : default population.

short default_size = 1
 

Advanced : default size.

short default_usedcells = 0
 

Advanced : default used cells.

Unit* freeunits
 

int longest_shortest
 

int nextid = 1
 

int* numlivebytype
 

int numliveunits
 

Number of live Units.

int* numuimages
 

int numunits
 

Number of Units.

char** shortestgnames = NULL
 

char** shortestnames = NULL
 

enum sortkeys tmpsortkeys[MAXSORTKEYS]
 

Temporary sort keys.

Unit* tmpunit
 

Unit temporary.

Unit* unitlist
 

Unit list.


Generated on Sat Sep 17 10:29:42 2005 for XconqKernel by doxygen 1.3.6