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

side.c File Reference

#include "conq.h"
#include "kernel.h"

Include dependency graph for side.c:

Include dependency graph

Namespaces

namespace  Xconq

Defines

#define checked_elev_at(x, y)   (elevations_defined() ? elev_at(x, y) : 0)
#define INITMAXVIEWS   200
#define VIEW_HASH_SIZE   257

Functions

void set_unit_image (Unit *unit)
void set_unit_view_image (UnitView *uview)
void return_default_colorname (Side *side)
int fn_test_side_in_sideclass (Obj *osclass, ParamBox *pbox)
int n_units_on_side (Side *side)
void init_sides (void)
Sidecreate_side (void)
void init_side_unithead (Side *side)
int side_has_units (Side *side)
void init_doctrine (Side *side)
void init_self_unit (Side *side)
int init_view (Side *side)
void calc_start_xy (Side *side)
int side_number (Side *side)
Sideside_n (int n)
Sidefind_side_by_name (char *str)
Sideparse_side_spec (char *str)
int side_controls_side (Side *side, Side *side2)
int side_controls_unit (Side *side, Unit *unit)
int side_sees_unit (Side *side, Unit *unit)
int side_sees_image (Side *side, Unit *unit)
int occupants_visible (Side *side, Unit *unit)
int num_units_in_play (Side *side, int u)
int num_units_incomplete (Side *side, int u)
Unitfind_next_unit (Side *side, Unit *prevunit)
Unitfind_prev_unit (Side *side, Unit *nextunit)
Unitfind_next_actor (Side *side, Unit *prevunit)
Unitfind_prev_actor (Side *side, Unit *nextunit)
Unitfind_next_mover (Side *side, Unit *prevunit)
Unitfind_prev_mover (Side *side, Unit *nextunit)
Unitfind_next_awake_mover (Side *side, Unit *prevunit)
Unitfind_prev_awake_mover (Side *side, Unit *nextunit)
int side_initacp (Side *side)
int side_acp (Side *side)
int side_acp_reserved (Side *side)
int using_tech_levels (void)
void remove_side_from_game (Side *side)
int num_displayed_sides (void)
void update_side_display_all_sides (Side *side, int rightnow)
void set_side_name (Side *side, Side *side2, char *newname)
void set_side_longname (Side *side, Side *side2, char *newname)
void set_side_shortname (Side *side, Side *side2, char *newname)
void set_side_noun (Side *side, Side *side2, char *newname)
void set_side_pluralnoun (Side *side, Side *side2, char *newname)
void set_side_adjective (Side *side, Side *side2, char *newname)
void set_side_emblemname (Side *side, Side *side2, char *newname)
void set_side_colorscheme (Side *side, Side *side2, char *newname)
void become_designer (Side *side)
void become_nondesigner (Side *side)
int trusted_side (Side *side1, Side *side2)
void set_trust (Side *side, Side *side2, int val)
void set_controlled_by (Side *side, Side *side2, int val)
void set_autofinish (Side *side, int value)
void set_autoresearch (Side *side, int value)
int enemy_side (Side *side1, Side *side2)
int allied_side (Side *side1, Side *side2)
int neutral_side (Side *side1, Side *side2)
void set_willing_to_save (Side *side, int flag)
void set_willing_to_draw (Side *side, int flag)
void set_side_self_unit (Side *side, Unit *unit)
void send_message (Side *side, SideMask sidemask, char *str)
void receive_message (Side *side, Side *sender, char *str)
void reveal_side (Side *sender, Side *recipient, int *types)
void set_doctrine (Side *side, char *spec)
void set_side_research_topic (Side *side, int a)
void set_side_research_goal (Side *side, int a)
void set_side_startx (Side *side, int x)
void set_side_starty (Side *side, int y)
UnitViewunit_view_at (Side *side, int x, int y)
UnitViewunit_view_next (Side *side, int x, int y, UnitView *uview)
UnitViewfind_unit_view (Side *side, Unit *unit)
Unitquery_unit_from_uview (UnitView *uview)
UnitViewquery_uvstack_from_unit (Unit *unit)
UnitViewquery_uvstack_at (int x, int y)
int is_at_correct_uvstack_position (UnitView *uview, UnitView *uview2)
void add_uview_to_uvstack (UnitView *uview, UnitView *tsptview)
void fill_out_uview (Unit *unit, Side *side, UnitView *uview)
UnitViewadd_unit_view (Side *side, Unit *unit)
void add_unit_view_raw (Side *side, UnitView *uview, int x, int y)
void flush_stale_views (void)
int do_fire_at_action (Unit *unit, Unit *unit2, Unit *unit3, int m)
int can_overwatch (Unit *ounit, Unit *unit)
int try_overwatch_from (int x, int y, int *counter, ParamBox *parambox)
void try_overwatch_against (Unit *unit)
void all_see_occupy (Unit *unit, int x, int y, int inopen)
void all_see_leave (Unit *unit, int x, int y, int inopen)
void cover_area (Side *side, Unit *unit, Unit *oldtransport, int x0, int y0, int nx, int ny)
void reset_coverage (void)
void really_reset_coverage (void)
void calc_coverage (Side *side)
void reset_all_views (void)
void reset_view (Side *side)
void react_to_seen_unit (Side *side, Unit *unit, int x, int y)
void maybe_track (Unit *unit)
void maybe_lose_track (Unit *unit, int nx, int ny)
void compute_see_chances (void)
void all_see_cell (int x, int y)
int see_cell (Side *side, int x, int y)
void see_exact (Side *side, int x, int y)
int seen_border (Side *side, int x, int y, int dir)
char * side_desig (Side *side)
Playeradd_player (void)
Playerfind_player (int n)
void canonicalize_player (Player *player)
char * player_desig (Player *player)
int actual_advantage (Side *side)
Doctrinenew_doctrine (int id)
Doctrinefind_doctrine_by_name (char *name)
Doctrinefind_doctrine (int id)
StandingOrdernew_standing_order (void)
int order_conds_match (StandingOrder *sorder, StandingOrder *sorder2)
void add_standing_order (Side *side, StandingOrder *sorder, int pos)
int parse_standing_order (Side *side, char *cmdstr)
char * parse_unit_types (Side *side, char *str, char *utypevec)
char * parse_order_cond (Side *side, char *str, StandingOrder *sorder)
char * standing_order_desc (StandingOrder *sorder, char *buf)
char * get_next_arg (char *str, char *buf, char **rsltp)
void fn_set_terrain_view (int x, int y, int val)
void fn_set_terrain_view_date (int x, int y, int val)
void fn_set_aux_terrain_view (int x, int y, int val)
void fn_set_aux_terrain_view_date (int x, int y, int val)
void fn_set_material_view (int x, int y, int val)
void fn_set_material_view_date (int x, int y, int val)
void fn_set_temp_view (int x, int y, int val)
void fn_set_temp_view_date (int x, int y, int val)
void fn_set_cloud_view (int x, int y, int val)
void fn_set_cloud_bottom_view (int x, int y, int val)
void fn_set_cloud_height_view (int x, int y, int val)
void fn_set_cloud_view_date (int x, int y, int val)
void fn_set_wind_view (int x, int y, int val)
void fn_set_wind_view_date (int x, int y, int val)
void paint_view (Side *side, int x, int y, int r, int tview, int uviewflag)
int side_material_supply (Side *side, int m)
int side_material_production (Side *side, int m)
int side_material_storage (Side *side, int m)
Objchoose_side_research_goal_from_weighted_list (Obj *lis, int *totalweightp, Side *side)

Variables

Sidesidelist
 List of .

Sideindepside
 List of independant .

Sidelastside
 Last in list.

Sidetmpside
 Temporary pointer.

int numsides
 Number of .

int numtotsides
 Total number of .

int nextsideid
char * default_colornames [MAXSIDES+1]
short any_los = -1
int any_material_views = -1
char * any_material_views_by_m = NULL
char * sidedesigbuf = NULL
Playerplayerlist
 List of .

Playerlast_player
 Last in list.

int numplayers
 Number of .

int nextplayerid
char * playerdesigbuf = NULL
Doctrinedoctrine_list
 Doctrine list.

Doctrinelast_doctrine
int next_doctrine_id
UnitViewfreeviews
UnitViewviewlist = NULL
short * max_control_ranges
int suppress_see_wakeup
int any_tracking = -1

Define Documentation

#define checked_elev_at x,
 )     (elevations_defined() ? elev_at(x, y) : 0)
 

#define INITMAXVIEWS   200
 

#define VIEW_HASH_SIZE   257
 


Function Documentation

int actual_advantage Side side  ) 
 

Player* add_player void   ) 
 

void add_standing_order Side side,
StandingOrder sorder,
int  pos
 

UnitView* add_unit_view Side side,
Unit unit
 

void add_unit_view_raw Side side,
UnitView uview,
int  x,
int  y
 

void add_uview_to_uvstack UnitView uview,
UnitView tsptview
 

void all_see_cell int  x,
int  y
 

void all_see_leave Unit unit,
int  x,
int  y,
int  inopen
 

void all_see_occupy Unit unit,
int  x,
int  y,
int  inopen
 

int allied_side Side side1,
Side side2
 

void become_designer Side side  ) 
 

void become_nondesigner Side side  ) 
 

void calc_coverage Side side  ) 
 

void calc_start_xy Side side  ) 
 

int can_overwatch Unit ounit,
Unit unit
 

void canonicalize_player Player player  ) 
 

Obj* choose_side_research_goal_from_weighted_list Obj lis,
int *  totalweightp,
Side side
 

void compute_see_chances void   ) 
 

Note:
'any_see_chances' will be only be set if a see chance is not 100%. Thus, if all the see chances are 0, it will be set. The variable name is somewhat misleading.

void cover_area Side side,
Unit unit,
Unit oldtransport,
int  x0,
int  y0,
int  nx,
int  ny
 

Side* create_side void   ) 
 

int do_fire_at_action Unit unit,
Unit unit2,
Unit unit3,
int  m
 

int enemy_side Side side1,
Side side2
 

void fill_out_uview Unit unit,
Side side,
UnitView uview
 

Doctrine* find_doctrine int  id  ) 
 

Doctrine* find_doctrine_by_name char *  name  ) 
 

Unit* find_next_actor Side side,
Unit prevunit
 

Unit* find_next_awake_mover Side side,
Unit prevunit
 

Unit* find_next_mover Side side,
Unit prevunit
 

Unit* find_next_unit Side side,
Unit prevunit
 

Player* find_player int  n  ) 
 

Unit* find_prev_actor Side side,
Unit nextunit
 

Unit* find_prev_awake_mover Side side,
Unit nextunit
 

Unit* find_prev_mover Side side,
Unit nextunit
 

Unit* find_prev_unit Side side,
Unit nextunit
 

Side* find_side_by_name char *  str  ) 
 

UnitView* find_unit_view Side side,
Unit unit
 

void flush_stale_views void   ) 
 

void fn_set_aux_terrain_view int  x,
int  y,
int  val
 

void fn_set_aux_terrain_view_date int  x,
int  y,
int  val
 

void fn_set_cloud_bottom_view int  x,
int  y,
int  val
 

void fn_set_cloud_height_view int  x,
int  y,
int  val
 

void fn_set_cloud_view int  x,
int  y,
int  val
 

void fn_set_cloud_view_date int  x,
int  y,
int  val
 

void fn_set_material_view int  x,
int  y,
int  val
 

void fn_set_material_view_date int  x,
int  y,
int  val
 

void fn_set_temp_view int  x,
int  y,
int  val
 

void fn_set_temp_view_date int  x,
int  y,
int  val
 

void fn_set_terrain_view int  x,
int  y,
int  val
 

void fn_set_terrain_view_date int  x,
int  y,
int  val
 

void fn_set_wind_view int  x,
int  y,
int  val
 

void fn_set_wind_view_date int  x,
int  y,
int  val
 

int fn_test_side_in_sideclass Obj osclass,
ParamBox pbox
 

char* get_next_arg char *  str,
char *  buf,
char **  rsltp
 

void init_doctrine Side side  ) 
 

void init_self_unit Side side  ) 
 

void init_side_unithead Side side  ) 
 

void init_sides void   ) 
 

int init_view Side side  ) 
 

int is_at_correct_uvstack_position UnitView uview,
UnitView uview2
 

void maybe_lose_track Unit unit,
int  nx,
int  ny
 

void maybe_track Unit unit  ) 
 

int n_units_on_side Side side  ) 
 

int neutral_side Side side1,
Side side2
 

Doctrine* new_doctrine int  id  ) 
 

StandingOrder* new_standing_order void   ) 
 

int num_displayed_sides void   ) 
 

int num_units_in_play Side side,
int  u
 

int num_units_incomplete Side side,
int  u
 

int occupants_visible Side side,
Unit unit
 

int order_conds_match StandingOrder sorder,
StandingOrder sorder2
 

void paint_view Side side,
int  x,
int  y,
int  r,
int  tview,
int  uviewflag
 

char* parse_order_cond Side side,
char *  str,
StandingOrder sorder
 

Side* parse_side_spec char *  str  ) 
 

int parse_standing_order Side side,
char *  cmdstr
 

char* parse_unit_types Side side,
char *  str,
char *  utypevec
 

char* player_desig Player player  ) 
 

Unit* query_unit_from_uview UnitView uview  ) 
 

Todo:
This function will need to be modified to behave differently for clients and servers once we are about to do the client-server separation. For clients, it will actually send a network query to the server asking if we can get back a shadow unit for the unit handle stored with the uview. NULL will be returned by the function if the network response is no unit, else a pointer to the shadow unit will be returned. For the server, it will simply return a pointer to the actual unit associated with the uview. For now, we default to the server behavior.

UnitView* query_uvstack_at int  x,
int  y
 

Note:
See note for 'query_uvstack_from_unit'.

UnitView* query_uvstack_from_unit Unit unit  ) 
 

Note:
This function (as well as a number of others) will have to be changed to take a unit handle of some sort (perhaps unit ID) when true client-server separation is done. There will also be two separate functions: one that does the client query and gets back the mashalled uview, and one that handles the query on the server side, and marshals an appropriate response back to the client.

void react_to_seen_unit Side side,
Unit unit,
int  x,
int  y
 

void really_reset_coverage void   ) 
 

void receive_message Side side,
Side sender,
char *  str
 

void remove_side_from_game Side side  ) 
 

void reset_all_views void   ) 
 

void reset_coverage void   ) 
 

void reset_view Side side  ) 
 

void return_default_colorname Side side  ) 
 

void reveal_side Side sender,
Side recipient,
int *  types
 

int see_cell Side side,
int  x,
int  y
 

void see_exact Side side,
int  x,
int  y
 

int seen_border Side side,
int  x,
int  y,
int  dir
 

void send_message Side side,
SideMask  sidemask,
char *  str
 

void set_autofinish Side side,
int  value
 

void set_autoresearch Side side,
int  value
 

void set_controlled_by Side side,
Side side2,
int  val
 

void set_doctrine Side side,
char *  spec
 

void set_side_adjective Side side,
Side side2,
char *  newname
 

void set_side_colorscheme Side side,
Side side2,
char *  newname
 

void set_side_emblemname Side side,
Side side2,
char *  newname
 

void set_side_longname Side side,
Side side2,
char *  newname
 

void set_side_name Side side,
Side side2,
char *  newname
 

void set_side_noun Side side,
Side side2,
char *  newname
 

void set_side_pluralnoun Side side,
Side side2,
char *  newname
 

void set_side_research_goal Side side,
int  a
 

void set_side_research_topic Side side,
int  a
 

void set_side_self_unit Side side,
Unit unit
 

void set_side_shortname Side side,
Side side2,
char *  newname
 

void set_side_startx Side side,
int  x
 

void set_side_starty Side side,
int  y
 

void set_trust Side side,
Side side2,
int  val
 

void set_unit_image Unit unit  ) 
 

void set_unit_view_image UnitView uview  ) 
 

void set_willing_to_draw Side side,
int  flag
 

void set_willing_to_save Side side,
int  flag
 

int side_acp Side side  ) 
 

int side_acp_reserved Side side  ) 
 

int side_controls_side Side side,
Side side2
 

int side_controls_unit Side side,
Unit unit
 

char* side_desig Side side  ) 
 

int side_has_units Side side  ) 
 

int side_initacp Side side  ) 
 

int side_material_production Side side,
int  m
 

int side_material_storage Side side,
int  m
 

int side_material_supply Side side,
int  m
 

Side* side_n int  n  ) 
 

int side_number Side side  ) 
 

int side_sees_image Side side,
Unit unit
 

int side_sees_unit Side side,
Unit unit
 

char* standing_order_desc StandingOrder sorder,
char *  buf
 

int trusted_side Side side1,
Side side2
 

void try_overwatch_against Unit unit  ) 
 

int try_overwatch_from int  x,
int  y,
int *  counter,
ParamBox parambox
 

UnitView* unit_view_at Side side,
int  x,
int  y
 

UnitView* unit_view_next Side side,
int  x,
int  y,
UnitView uview
 

void update_side_display_all_sides Side side,
int  rightnow
 

int using_tech_levels void   ) 
 


Variable Documentation

short any_los = -1
 

int any_material_views = -1
 

char* any_material_views_by_m = NULL
 

int any_tracking = -1
 

char* default_colornames[MAXSIDES + 1]
 

Initial value:

 {
        "lemon-chiffon",
        "blue",
        "red",
        "yellow",
        "green",
        "dark-orange",
        "deep-pink",
        "cyan",
        "purple",
        "tomato",
        "violet",
        "dodger-blue",
        "light-sea-green",
        "rosy-brown",
        "slate-blue",
        "firebrick"
}

Doctrine* doctrine_list
 

Doctrine list.

UnitView* freeviews
 

Side* indepside
 

List of independant .

Doctrine* last_doctrine
 

Player* last_player
 

Last in list.

Side* lastside
 

Last in list.

short* max_control_ranges
 

int next_doctrine_id
 

int nextplayerid
 

int nextsideid
 

int numplayers
 

Number of .

int numsides
 

Number of .

int numtotsides
 

Total number of .

char* playerdesigbuf = NULL
 

Player* playerlist
 

List of .

char* sidedesigbuf = NULL
 

Side* sidelist
 

List of .

int suppress_see_wakeup
 

Side* tmpside
 

Temporary pointer.

UnitView* viewlist = NULL
 


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