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

tp.c File Reference

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

Include dependency graph for tp.c:

Include dependency graph

Classes

struct  q_entry

Defines

#define for_all_remotes(rid)
#define STARTPKT   '$'
#define ENDPKT   '^'
#define ESCAPEPKT   '!'
#define STARTPKTESC   '%'
#define ENDPKTESC   '&'
#define ESCAPEPKTESC   '@'
#define DOWNLOADPACKETSIZE   200
#define PACKETBUFSIZE   1000
#define add_int_to_checksum(cs, x)   ((cs) += (x));

Functions

int host_the_game (char *hostport)
int try_join_game (char *hostport)
void init_remote_ui (Side *side)
void add_remote_players (void)
int send_join (char *str)
void net_send_chat (int rid, char *str)
void send_version (int rid)
void net_set_variant_value (int which, int v1, int v2, int v3)
void net_set_player_advantage (int n, int newadv)
int net_add_side_and_player (void)
int net_remove_side_and_player (int s)
void net_rename_side_for_player (int n, int which)
void net_set_ai_for_player (int n, char *aitype)
int net_exchange_players (int n, int n2)
void net_update_player (Player *player)
void add_to_packet (char *str)
void flush_write (void)
void broadcast_game_module (void)
void broadcast_start_game_load (void)
void broadcast_start_variant_setup (void)
void broadcast_variants_chosen (void)
void broadcast_start_player_setup (void)
void broadcast_players_assigned (void)
void broadcast_randstate (void)
int net_run_game (int maxactions)
void net_request_additional_side (char *playerspec)
void net_send_message (Side *side, SideMask sidemask, char *str)
void net_resign_game (Side *side, Side *side2)
void net_save_game (char *fname)
void net_set_side_name (Side *side, Side *side2, char *newname)
void net_set_side_longname (Side *side, Side *side2, char *newname)
void net_set_side_shortname (Side *side, Side *side2, char *newname)
void net_set_side_noun (Side *side, Side *side2, char *newname)
void net_set_side_pluralnoun (Side *side, Side *side2, char *newname)
void net_set_side_adjective (Side *side, Side *side2, char *newname)
void net_set_side_emblemname (Side *side, Side *side2, char *newname)
void net_set_side_colorscheme (Side *side, Side *side2, char *newname)
void net_finish_turn (Side *side)
void net_set_trust (Side *side, Side *side2, int val)
void net_set_controlled_by (Side *side, Side *side2, int val)
void net_set_autofinish (Side *side, int value)
void net_set_autoresearch (Side *side, int value)
void net_set_willing_to_save (Side *side, int flag)
void net_set_willing_to_draw (Side *side, int flag)
void net_set_side_self_unit (Side *side, Unit *unit)
void net_set_side_ai (Side *side, char *aitype)
void net_set_doctrine (Side *side, char *spec)
void net_set_side_research_topic (Side *side, int a)
void net_set_side_research_goal (Side *side, int a)
void net_set_side_startx (Side *side, int x)
void net_set_side_starty (Side *side, int y)
void net_become_designer (Side *side)
void net_become_nondesigner (Side *side)
void net_paint_view (Side *side, int x, int y, int r, int tview, int uview)
void net_set_unit_name (Side *side, Unit *unit, char *newname)
void net_set_unit_plan_type (Side *side, Unit *unit, int type)
void net_set_unit_asleep (Side *side, Unit *unit, int flag, int recurse)
void net_set_unit_reserve (Side *side, Unit *unit, int flag, int recurse)
void net_set_unit_main_goal (Side *side, Unit *unit, Goal *goal)
void net_set_unit_curadvance (Side *side, Unit *unit, int a)
void net_set_unit_researchdone (Side *side, Unit *unit, int flag)
void net_set_unit_waiting_for_transport (Side *side, Unit *unit, int flag)
void net_wake_unit (Side *side, Unit *unit, int wakeocc)
void net_wake_area (Side *side, int x, int y, int n, int occs)
void net_set_unit_ai_control (Side *side, Unit *unit, int flag, int recurse)
int net_clear_task_agenda (Side *side, Unit *unit)
int net_clear_task_outcome (Side *side, Unit *unit)
void net_force_replan (Unit *unit)
int net_disband_unit (Side *side, Unit *unit)
void net_set_formation (Unit *unit, Unit *leader, int x, int y, int dist, int flex)
void net_delay_unit (Unit *unit, int flag)
Unit * net_designer_create_unit (Side *side, int u, int s, int x, int y)
int net_designer_teleport (Unit *unit, int x, int y, Unit *other)
int net_designer_change_side (Unit *unit, Side *side)
int net_designer_disband (Unit *unit)
Feature * net_create_feature (char *feattype, char *name)
void net_set_feature_type_name (Feature *feature, char *feattype)
void net_set_feature_name (Feature *feature, char *name)
void net_destroy_feature (Feature *feature)
void net_renumber_features (void)
void net_toggle_user_at (int u, int x, int y)
int net_prep_none_action (Unit *unit, Unit *unit2)
int net_prep_produce_action (Unit *unit, Unit *unit2, int m, int n)
int net_prep_extract_action (Unit *unit, Unit *unit2, int x, int y, int m, int n)
int net_prep_develop_action (Unit *unit, Unit *unit2, int u3)
int net_prep_toolup_action (Unit *unit, Unit *unit2, int u3)
int net_prep_create_in_action (Unit *unit, Unit *unit2, int u3, Unit *dest)
int net_prep_create_at_action (Unit *unit, Unit *unit2, int u3, int x, int y, int z)
int net_prep_build_action (Unit *unit, Unit *unit2, Unit *newunit)
int net_prep_repair_action (Unit *unit, Unit *unit2, Unit *unit3)
int net_prep_disband_action (Unit *unit, Unit *unit2)
int net_prep_change_type_action (Unit *unit, Unit *unit2, int u3)
int net_prep_change_side_action (Unit *unit, Unit *unit2, Side *side)
int net_prep_alter_cell_action (Unit *unit, Unit *unit2, int x, int y, int t)
int net_prep_add_terrain_action (Unit *unit, Unit *unit2, int x, int y, int dir, int t)
int net_prep_remove_terrain_action (Unit *unit, Unit *unit2, int x, int y, int dir, int t)
int net_prep_attack_action (Unit *unit, Unit *unit2, Unit *defender, int n)
int net_prep_overrun_action (Unit *unit, Unit *unit2, int x, int y, int z, int n)
int net_prep_fire_at_action (Unit *unit, Unit *unit2, Unit *unit3, int m)
int net_prep_fire_into_action (Unit *unit, Unit *unit2, int x, int y, int z, int m)
int net_prep_capture_action (Unit *unit, Unit *unit2, Unit *unit3)
int net_prep_detonate_action (Unit *unit, Unit *unit2, int x, int y, int z)
int net_prep_move_action (Unit *unit, Unit *unit2, int x, int y, int z)
int net_prep_enter_action (Unit *unit, Unit *unit2, Unit *unit3)
void net_add_task (Unit *unit, int pos, Task *task)
void net_set_capture_task (Unit *unit, int id, int capmethod, int n)
void net_set_occupy_task (Unit *unit, Unit *transport)
void net_set_collect_task (Unit *unit, int m, int x, int y)
void net_set_move_to_task (Unit *unit, int x, int y, int dist)
void net_push_move_to_task (Unit *unit, int x, int y, int dist)
void net_set_move_dir_task (Unit *unit, int dir, int n)
void net_push_move_dir_task (Unit *unit, int dir, int n)
void net_set_construct_task (Unit *unit, int u, int run, int transid, int x, int y)
void net_push_construct_task (Unit *unit, int u, int run, int transid, int x, int y)
void net_set_build_task (Unit *unit, int id, int cp)
void net_push_build_task (Unit *unit, int id, int cp)
void net_set_repair_task (Unit *unit, int id, int hp)
void net_push_repair_task (Unit *unit, int id, int hp)
void net_set_develop_task (Unit *unit, int u2, int techgoal)
void net_push_develop_task (Unit *unit, int u2, int n)
void net_push_hit_unit_task (Unit *unit, int id, int hitmethod, int n)
void net_set_hit_unit_task (Unit *unit, int id, int hitmethod, int n)
void net_set_disband_task (Unit *unit)
void net_set_resupply_task (Unit *unit, int m)
void net_push_occupy_task (Unit *unit, Unit *transport)
void net_push_pickup_task (Unit *unit, Unit *occ)
void net_push_produce_task (Unit *unit, int m, int n)
void net_set_sentry_task (Unit *unit, int n)
void net_push_sentry_task (Unit *unit, int n)
void net_paint_cell (Side *side, int x, int y, int r, int t)
void net_paint_border (Side *side, int x, int y, int dir, int t, int mode)
void net_paint_connection (Side *side, int x, int y, int dir, int t, int mode)
void net_paint_coating (Side *side, int x, int y, int r, int t, int depth)
void net_paint_people (Side *side, int x, int y, int r, int s)
void net_paint_control (Side *side, int x, int y, int r, int s)
void net_paint_feature (Side *side, int x, int y, int r, int f)
void net_paint_elevation (Side *side, int x, int y, int r, int code, int elev, int vary)
void net_paint_temperature (Side *side, int x, int y, int r, int temp)
void net_paint_material (Side *side, int x, int y, int r, int m, int amt)
void net_paint_clouds (Side *side, int x, int y, int r, int cloudtype, int bot, int hgt)
void net_paint_winds (Side *side, int x, int y, int r, int dir, int force)
void send_quit (void)
void flush_outgoing_queue (void)
void receive_data (int timeout, int lim)
int game_checksum (void)
void dump_checksums (char *str)
void download_to_player (Player *player)

Variables

long randstate
int flushing = FALSE
int process_packets = TRUE
int display_traffic = FALSE
int hosting
 Is hosting?

int numremotes
 Number of remotes.

int numremotewaiting
 Number of remotes waiting.

int tmprid
 Temporary remote id.

char * remote_player_specs [MAXSIDES]
int online [MAXSIDES]
int expecting_ack
int timeout_warnings = TRUE
int sendnow
 Send now flag.

int downloading
 Download flag.

char * downloadbuf
int dlbufend
long new_randstate
void(* update_variant_callback )(int which)=NULL
void(* update_assignment_callback )(int n)=NULL
int quitter
int bounced = FALSE
char * default_player_spec = NULL
 Default player specification.

time_t last_checksum_time
q_entry * outgoing
q_entry * outgoing_last
q_entry * incoming
q_entry * incoming_last

Define Documentation

#define add_int_to_checksum (  cs,
x   )     ((cs) += (x));
 

#define DOWNLOADPACKETSIZE   200
 

#define ENDPKT   '^'
 

#define ENDPKTESC   '&'
 

#define ESCAPEPKT   '!'
 

#define ESCAPEPKTESC   '@'
 

#define for_all_remotes (  rid   ) 
 

Value:

for ((rid) = 1; (rid) <= numremotes; ++(rid)) \
    if (online[rid])

#define PACKETBUFSIZE   1000
 

#define STARTPKT   '$'
 

#define STARTPKTESC   '%'
 


Function Documentation

void add_remote_players (  void   ) 
 

void add_to_packet (  char *  str  ) 
 

void broadcast_game_module (  void   ) 
 

void broadcast_players_assigned (  void   ) 
 

void broadcast_randstate (  void   ) 
 

void broadcast_start_game_load (  void   ) 
 

void broadcast_start_player_setup (  void   ) 
 

void broadcast_start_variant_setup (  void   ) 
 

void broadcast_variants_chosen (  void   ) 
 

void download_to_player (  Player *  player  ) 
 

void dump_checksums (  char *  str  ) 
 

void flush_outgoing_queue (  void   ) 
 

void flush_write (  void   ) 
 

int game_checksum (  void   ) 
 

int host_the_game (  char *  hostport  ) 
 

void init_remote_ui (  Side *  side  ) 
 

int net_add_side_and_player (  void   ) 
 

void net_add_task (  Unit *  unit,
int  pos,
Task *  task
) 
 

void net_become_designer (  Side *  side  ) 
 

void net_become_nondesigner (  Side *  side  ) 
 

int net_clear_task_agenda (  Side *  side,
Unit *  unit
) 
 

int net_clear_task_outcome (  Side *  side,
Unit *  unit
) 
 

Feature* net_create_feature (  char *  feattype,
char *  name
) 
 

void net_delay_unit (  Unit *  unit,
int  flag
) 
 

int net_designer_change_side (  Unit *  unit,
Side *  side
) 
 

Unit* net_designer_create_unit (  Side *  side,
int  u,
int  s,
int  x,
int  y
) 
 

int net_designer_disband (  Unit *  unit  ) 
 

int net_designer_teleport (  Unit *  unit,
int  x,
int  y,
Unit *  other
) 
 

void net_destroy_feature (  Feature *  feature  ) 
 

int net_disband_unit (  Side *  side,
Unit *  unit
) 
 

int net_exchange_players (  int  n,
int  n2
) 
 

void net_finish_turn (  Side *  side  ) 
 

void net_force_replan (  Unit *  unit  ) 
 

void net_paint_border (  Side *  side,
int  x,
int  y,
int  dir,
int  t,
int  mode
) 
 

void net_paint_cell (  Side *  side,
int  x,
int  y,
int  r,
int  t
) 
 

void net_paint_clouds (  Side *  side,
int  x,
int  y,
int  r,
int  cloudtype,
int  bot,
int  hgt
) 
 

void net_paint_coating (  Side *  side,
int  x,
int  y,
int  r,
int  t,
int  depth
) 
 

void net_paint_connection (  Side *  side,
int  x,
int  y,
int  dir,
int  t,
int  mode
) 
 

void net_paint_control (  Side *  side,
int  x,
int  y,
int  r,
int  s
) 
 

void net_paint_elevation (  Side *  side,
int  x,
int  y,
int  r,
int  code,
int  elev,
int  vary
) 
 

void net_paint_feature (  Side *  side,
int  x,
int  y,
int  r,
int  f
) 
 

void net_paint_material (  Side *  side,
int  x,
int  y,
int  r,
int  m,
int  amt
) 
 

void net_paint_people (  Side *  side,
int  x,
int  y,
int  r,
int  s
) 
 

void net_paint_temperature (  Side *  side,
int  x,
int  y,
int  r,
int  temp
) 
 

void net_paint_view (  Side *  side,
int  x,
int  y,
int  r,
int  tview,
int  uview
) 
 

void net_paint_winds (  Side *  side,
int  x,
int  y,
int  r,
int  dir,
int  force
) 
 

int net_prep_add_terrain_action (  Unit *  unit,
Unit *  unit2,
int  x,
int  y,
int  dir,
int  t
) 
 

int net_prep_alter_cell_action (  Unit *  unit,
Unit *  unit2,
int  x,
int  y,
int  t
) 
 

int net_prep_attack_action (  Unit *  unit,
Unit *  unit2,
Unit *  defender,
int  n
) 
 

int net_prep_build_action (  Unit *  unit,
Unit *  unit2,
Unit *  newunit
) 
 

int net_prep_capture_action (  Unit *  unit,
Unit *  unit2,
Unit *  unit3
) 
 

int net_prep_change_side_action (  Unit *  unit,
Unit *  unit2,
Side *  side
) 
 

int net_prep_change_type_action (  Unit *  unit,
Unit *  unit2,
int  u3
) 
 

int net_prep_create_at_action (  Unit *  unit,
Unit *  unit2,
int  u3,
int  x,
int  y,
int  z
) 
 

int net_prep_create_in_action (  Unit *  unit,
Unit *  unit2,
int  u3,
Unit *  dest
) 
 

int net_prep_detonate_action (  Unit *  unit,
Unit *  unit2,
int  x,
int  y,
int  z
) 
 

int net_prep_develop_action (  Unit *  unit,
Unit *  unit2,
int  u3
) 
 

int net_prep_disband_action (  Unit *  unit,
Unit *  unit2
) 
 

int net_prep_enter_action (  Unit *  unit,
Unit *  unit2,
Unit *  unit3
) 
 

int net_prep_extract_action (  Unit *  unit,
Unit *  unit2,
int  x,
int  y,
int  m,
int  n
) 
 

int net_prep_fire_at_action (  Unit *  unit,
Unit *  unit2,
Unit *  unit3,
int  m
) 
 

int net_prep_fire_into_action (  Unit *  unit,
Unit *  unit2,
int  x,
int  y,
int  z,
int  m
) 
 

int net_prep_move_action (  Unit *  unit,
Unit *  unit2,
int  x,
int  y,
int  z
) 
 

int net_prep_none_action (  Unit *  unit,
Unit *  unit2
) 
 

int net_prep_overrun_action (  Unit *  unit,
Unit *  unit2,
int  x,
int  y,
int  z,
int  n
) 
 

int net_prep_produce_action (  Unit *  unit,
Unit *  unit2,
int  m,
int  n
) 
 

int net_prep_remove_terrain_action (  Unit *  unit,
Unit *  unit2,
int  x,
int  y,
int  dir,
int  t
) 
 

int net_prep_repair_action (  Unit *  unit,
Unit *  unit2,
Unit *  unit3
) 
 

int net_prep_toolup_action (  Unit *  unit,
Unit *  unit2,
int  u3
) 
 

void net_push_build_task (  Unit *  unit,
int  id,
int  cp
) 
 

void net_push_construct_task (  Unit *  unit,
int  u,
int  run,
int  transid,
int  x,
int  y
) 
 

void net_push_develop_task (  Unit *  unit,
int  u2,
int  n
) 
 

void net_push_hit_unit_task (  Unit *  unit,
int  id,
int  hitmethod,
int  n
) 
 

void net_push_move_dir_task (  Unit *  unit,
int  dir,
int  n
) 
 

void net_push_move_to_task (  Unit *  unit,
int  x,
int  y,
int  dist
) 
 

void net_push_occupy_task (  Unit *  unit,
Unit *  transport
) 
 

void net_push_pickup_task (  Unit *  unit,
Unit *  occ
) 
 

void net_push_produce_task (  Unit *  unit,
int  m,
int  n
) 
 

void net_push_repair_task (  Unit *  unit,
int  id,
int  hp
) 
 

void net_push_sentry_task (  Unit *  unit,
int  n
) 
 

int net_remove_side_and_player (  int  s  ) 
 

void net_rename_side_for_player (  int  n,
int  which
) 
 

void net_renumber_features (  void   ) 
 

void net_request_additional_side (  char *  playerspec  ) 
 

void net_resign_game (  Side *  side,
Side *  side2
) 
 

int net_run_game (  int  maxactions  ) 
 

void net_save_game (  char *  fname  ) 
 

void net_send_chat (  int  rid,
char *  str
) 
 

void net_send_message (  Side *  side,
SideMask  sidemask,
char *  str
) 
 

void net_set_ai_for_player (  int  n,
char *  aitype
) 
 

void net_set_autofinish (  Side *  side,
int  value
) 
 

void net_set_autoresearch (  Side *  side,
int  value
) 
 

void net_set_build_task (  Unit *  unit,
int  id,
int  cp
) 
 

void net_set_capture_task (  Unit *  unit,
int  id,
int  capmethod,
int  n
) 
 

void net_set_collect_task (  Unit *  unit,
int  m,
int  x,
int  y
) 
 

void net_set_construct_task (  Unit *  unit,
int  u,
int  run,
int  transid,
int  x,
int  y
) 
 

void net_set_controlled_by (  Side *  side,
Side *  side2,
int  val
) 
 

void net_set_develop_task (  Unit *  unit,
int  u2,
int  techgoal
) 
 

void net_set_disband_task (  Unit *  unit  ) 
 

void net_set_doctrine (  Side *  side,
char *  spec
) 
 

void net_set_feature_name (  Feature *  feature,
char *  name
) 
 

void net_set_feature_type_name (  Feature *  feature,
char *  feattype
) 
 

void net_set_formation (  Unit *  unit,
Unit *  leader,
int  x,
int  y,
int  dist,
int  flex
) 
 

void net_set_hit_unit_task (  Unit *  unit,
int  id,
int  hitmethod,
int  n
) 
 

void net_set_move_dir_task (  Unit *  unit,
int  dir,
int  n
) 
 

void net_set_move_to_task (  Unit *  unit,
int  x,
int  y,
int  dist
) 
 

void net_set_occupy_task (  Unit *  unit,
Unit *  transport
) 
 

void net_set_player_advantage (  int  n,
int  newadv
) 
 

void net_set_repair_task (  Unit *  unit,
int  id,
int  hp
) 
 

void net_set_resupply_task (  Unit *  unit,
int  m
) 
 

void net_set_sentry_task (  Unit *  unit,
int  n
) 
 

void net_set_side_adjective (  Side *  side,
Side *  side2,
char *  newname
) 
 

void net_set_side_ai (  Side *  side,
char *  aitype
) 
 

void net_set_side_colorscheme (  Side *  side,
Side *  side2,
char *  newname
) 
 

void net_set_side_emblemname (  Side *  side,
Side *  side2,
char *  newname
) 
 

void net_set_side_longname (  Side *  side,
Side *  side2,
char *  newname
) 
 

void net_set_side_name (  Side *  side,
Side *  side2,
char *  newname
) 
 

void net_set_side_noun (  Side *  side,
Side *  side2,
char *  newname
) 
 

void net_set_side_pluralnoun (  Side *  side,
Side *  side2,
char *  newname
) 
 

void net_set_side_research_goal (  Side *  side,
int  a
) 
 

void net_set_side_research_topic (  Side *  side,
int  a
) 
 

void net_set_side_self_unit (  Side *  side,
Unit *  unit
) 
 

void net_set_side_shortname (  Side *  side,
Side *  side2,
char *  newname
) 
 

void net_set_side_startx (  Side *  side,
int  x
) 
 

void net_set_side_starty (  Side *  side,
int  y
) 
 

void net_set_trust (  Side *  side,
Side *  side2,
int  val
) 
 

void net_set_unit_ai_control (  Side *  side,
Unit *  unit,
int  flag,
int  recurse
) 
 

void net_set_unit_asleep (  Side *  side,
Unit *  unit,
int  flag,
int  recurse
) 
 

void net_set_unit_curadvance (  Side *  side,
Unit *  unit,
int  a
) 
 

void net_set_unit_main_goal (  Side *  side,
Unit *  unit,
Goal *  goal
) 
 

void net_set_unit_name (  Side *  side,
Unit *  unit,
char *  newname
) 
 

void net_set_unit_plan_type (  Side *  side,
Unit *  unit,
int  type
) 
 

void net_set_unit_researchdone (  Side *  side,
Unit *  unit,
int  flag
) 
 

void net_set_unit_reserve (  Side *  side,
Unit *  unit,
int  flag,
int  recurse
) 
 

void net_set_unit_waiting_for_transport (  Side *  side,
Unit *  unit,
int  flag
) 
 

void net_set_variant_value (  int  which,
int  v1,
int  v2,
int  v3
) 
 

void net_set_willing_to_draw (  Side *  side,
int  flag
) 
 

void net_set_willing_to_save (  Side *  side,
int  flag
) 
 

void net_toggle_user_at (  int  u,
int  x,
int  y
) 
 

void net_update_player (  Player *  player  ) 
 

void net_wake_area (  Side *  side,
int  x,
int  y,
int  n,
int  occs
) 
 

void net_wake_unit (  Side *  side,
Unit *  unit,
int  wakeocc
) 
 

void receive_data (  int  timeout,
int  lim
) 
 

int send_join (  char *  str  ) 
 

void send_quit (  void   ) 
 

void send_version (  int  rid  ) 
 

int try_join_game (  char *  hostport  ) 
 


Variable Documentation

int bounced = FALSE
 

char* default_player_spec = NULL
 

Default player specification.

int display_traffic = FALSE
 

int dlbufend
 

char* downloadbuf
 

int downloading
 

Download flag.

int expecting_ack
 

int flushing = FALSE
 

int hosting
 

Is hosting?

struct q_entry * incoming
 

struct q_entry * incoming_last
 

time_t last_checksum_time
 

long new_randstate
 

int numremotes
 

Number of remotes.

int numremotewaiting
 

Number of remotes waiting.

int online[MAXSIDES]
 

struct q_entry * outgoing
 

struct q_entry * outgoing_last
 

int process_packets = TRUE
 

int quitter
 

long randstate
 

char* remote_player_specs[MAXSIDES]
 

int sendnow
 

Send now flag.

int timeout_warnings = TRUE
 

int tmprid
 

Temporary remote id.

void(* update_assignment_callback)(int n) = NULL
 

void(* update_variant_callback)(int which) = NULL
 


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