00001
00002
00003
00004
00005
00006
00007
00008
00009
00015 #undef DEF_ACTION
00016 #define DEF_ACTION(name,code,args,PREPFN,netprepfn,dofn,checkfn,ARGDECL,doc) \
00017 extern int PREPFN ARGDECL;
00018
00019 #include "action.def"
00020
00021 #undef DEF_TASK
00022 #define DEF_TASK(name,dname,code,argtypes,dofn,CREATEFN,SETFN,netsetfn,PUSHFN,netpushfn,ARGDECL) \
00023 extern void SETFN ARGDECL; \
00024 extern void PUSHFN ARGDECL;
00025
00026 #include "task.def"
00027
00028
00029
00030 enum repairmode {
00031 NO_REPAIR,
00032 SELF_REPAIR,
00033 HP_RECOVERY,
00034 AUTO_REPAIR
00035 };
00036
00037 namespace Xconq {
00039 extern short any_hp_recovery;
00041 extern short any_auto_repair;
00043 extern short *cv__could_be_auto_repaired;
00045 extern short *cv__auto_repaired_range_max;
00046 }
00047
00048
00049
00050 extern int *lowm;
00051 extern int numlow;
00052
00053
00054
00055 extern short any_auto_change_types;
00056
00057
00058
00059 typedef enum {
00060 WRECK_TYPE_UNSPECIFIED = 0,
00061 WRECK_TYPE_KILLED,
00062 WRECK_TYPE_STARVED,
00063 WRECK_TYPE_ACCIDENT,
00064 WRECK_TYPE_ATTRITED,
00065 WRECK_TYPE_TERRAIN,
00066 WRECK_TYPE_SIDE_LOST
00067 } WreckType;
00068
00069
00070
00071
00072 namespace Xconq {
00073 extern int suppress_reactions;
00074 }
00075
00076
00077
00078 extern void rescue_occupants(Unit *unit);
00079 extern void reckon_damage_around(int x, int y, int r, Unit *detonator);
00080 extern void damage_unit(Unit *unit, enum damage_reasons reason, Unit *agent);
00081 extern void capture_unit(Unit *unit, Unit *pris, int captype);
00082 extern int detonate_unit(Unit *unit, int x, int y, int z);
00083
00084
00085
00086 extern void run_economy(void);
00087 extern void run_all_consumption(void);
00088
00089
00090
00091 extern void set_player_advantage(int n, int newadv);
00092 extern void rename_side_for_player(int n, int which);
00093 extern void set_ai_for_player(int n, char *aitype);
00094 extern int exchange_players(int n, int n2);
00095
00096
00097
00098 extern void set_edge_terrain(int doterr);
00099
00100
00101
00102 extern void set_variant_value(int which, int v1, int v2, int v3);
00103
00104
00105
00106 extern int move_unit(Unit *unit, int nx, int ny);
00107 extern void change_control_side_around(int x, int y, int u, Side *side);
00108 extern int has_enough_mp(Unit *unit, Unit *unit2, int mp);
00109 extern int can_have_enough_mp(Unit *unit, Unit *unit2, int mp);
00110
00111
00112
00113 extern void set_unit_plan_type(Side *side, Unit *unit, int type);
00114 extern void set_unit_asleep(Side *side, Unit *unit, int flag, int recurse);
00115 extern void set_unit_reserve(Side *side, Unit *unit, int flag, int recurse);
00116 extern void set_unit_ai_control(Side *side, Unit *unit, int flag, int recurse);
00117 extern void set_unit_main_goal(Side *side, Unit *unit, Goal *goal);
00118 extern void set_unit_curadvance(Side *side, Unit *unit, int a);
00119 extern void set_unit_researchdone(Side *side, Unit *unit, int flag);
00120 extern void set_unit_waiting_for_transport(Side *side, Unit *unit, int flag);
00121 extern void wake_unit(Side *side, Unit *unit, int forcewakeoccs);
00122 extern void selectively_wake_unit(Side *side, Unit *unit, int wakeoccs,
00123 int forcewakeoccs);
00124 extern void wake_area(Side *side, int x, int y, int n, int occs);
00125 extern void set_formation(Unit *unit, Unit *leader, int x, int y, int dist, int flex);
00126 extern void delay_unit(Unit *unit, int flag);
00127 extern int clear_task_agenda(Unit *unit);
00128 extern void clear_task_outcome(Unit *unit);
00129 extern void force_replan(Unit *unit);
00130 extern int execute_plan(Unit *unit);
00131 extern int is_in_formation(Unit *unit);
00132 extern int move_into_formation(Unit *unit);
00133 extern void free_plan(Unit *unit);
00134 extern int execute_standing_order(Unit *unit, int addtask);
00135 extern void set_waiting_for_tasks(Unit *unit, int flag);
00136 extern void pop_task(Plan *plan);
00137 extern Task * find_unit_task_by_type(Unit *unit, TaskType tt);
00138
00139
00140
00141 extern void finish_turn(Side *side);
00142 extern void resign_game(Side *side, Side *side2);
00143
00144
00145
00146 extern void change_people_side_around(int x, int y, int u, Side *side);
00147 extern void maybe_starve(Unit *unit, int partial);
00148 extern void request_additional_side(char *playerspec);
00149 extern int total_acp_for_turn(Unit *unit);
00150
00151
00152
00153 extern void run_people(void);
00154 extern void run_advanced_units(void);
00155 extern void run_turn_start(void);
00156 extern void run_restored_turn_start(void);
00157 extern void run_turn_end(void);
00158
00159
00160
00161 extern void maybe_track(Unit *unit);
00162 extern void maybe_lose_track(Unit *unit, int nx, int ny);
00163 extern UnitView *add_unit_view(Side *side, Unit *unit);
00164 extern void add_unit_view_raw(Side *side, UnitView *uview, int x, int y);
00165 extern void flush_stale_views(void);
00166
00167 extern void set_side_name(Side *side, Side *side2, char *newname);
00168 extern void set_side_longname(Side *side, Side *side2, char *newname);
00169 extern void set_side_shortname(Side *side, Side *side2, char *newname);
00170 extern void set_side_noun(Side *side, Side *side2, char *newname);
00171 extern void set_side_pluralnoun(Side *side, Side *side2, char *newname);
00172 extern void set_side_adjective(Side *side, Side *side2, char *newname);
00173 extern void set_side_emblemname(Side *side, Side *side2, char *newname);
00174 extern void set_side_colorscheme(Side *side, Side *side2, char *newname);
00175 extern void become_designer(Side *side);
00176 extern void become_nondesigner(Side *side);
00177 extern void set_trust(Side *side, Side *side2, int val);
00178 extern void set_autofinish(Side *side, int value);
00179 extern void set_autoresearch(Side *side, int value);
00180 extern void set_willing_to_save(Side *side, int flag);
00181 extern void set_willing_to_draw(Side *side, int flag);
00182 extern void send_message(Side *side, SideMask sidemask, char *str);
00183 extern void set_side_self_unit(Side *side, struct a_unit *unit);
00184 extern void set_doctrine(Side *side, char *spec);
00185 extern void set_controlled_by(Side *side, Side *side2, int val);
00186 extern void set_side_research_topic(Side *side, int a);
00187 extern void set_side_research_goal(Side *side, int a);
00188 extern void set_side_startx(Side *side, int x);
00189 extern void set_side_starty(Side *side, int y);
00190 #ifdef DESIGNERS
00191 extern void paint_view(Side *side, int x, int y, int r, int tview, int uview);
00192 #endif
00193
00194
00195
00196 extern void init_tasks(void);
00197 extern TaskOutcome execute_task(Unit *unit);
00198 extern int target_visible(Unit *unit, Task *task);
00199 extern int direct_access_to(int x, int y);
00200
00201 extern void resume_build_task(Unit *unit, Unit *unit2, int run, int x, int y);
00202 extern void add_task(Unit *unit, int pos, Task *task);
00203 extern Task *clone_task(Task *oldtask);
00204
00205 extern void sort_directions(Unit *unit, int *dirs, int numdirs);
00206 extern void free_task(Task *task);
00207 extern char *parse_task(Side *side, char *str, Task **taskp);
00208 extern char *task_desig(Task *task);
00209
00210 extern int can_resupply_from_here(int x, int y);
00211 extern int can_auto_resupply_self(Unit *unit, int *materials, int numtypes);
00212 extern int can_repair_from_here(int x, int y);
00213
00214
00215
00216
00217
00218 extern void init_remote_ui(Side *side);
00219 extern void add_remote_players(void);
00220 extern void broadcast_start_game_load(void);
00221 extern void broadcast_start_variant_setup(void);
00222 extern void broadcast_variants_chosen(void);
00223 extern void broadcast_start_player_setup(void);
00224 extern void broadcast_players_assigned(void);
00225
00226
00227
00228 extern void add_to_packet(char *str);
00229 extern void flush_write(void);
00230
00231
00232
00233 extern int can_be_actor(Unit *unit);
00234 extern int change_cell(Unit *unit, int x, int y);
00235 extern void wreck_unit(Unit *unit, HistEventType hevttype,
00236 WreckType wrecktype, int wreckarg, Unit *agent);
00237 extern void change_unit_side(Unit *unit, Side *newside, int reason, Unit *agent);
00238 extern void set_unit_side(Unit *unit, Side *side);
00239 extern void set_unit_origside(Unit *unit, Side *side);
00240 extern void set_unit_name(Side *side, Unit *unit, char *newname);
00241 extern int disband_unit(Side *side, Unit *unit);
00242 extern void kill_unit(Unit *unit, int reason);
00243 extern void change_morale(Unit *unit, int sign, int morchange);
00244 #ifdef DESIGNERS
00245 extern Unit *designer_create_unit(Side *side, int u, int s, int x, int y);
00246 extern int designer_teleport(Unit *unit, int x, int y, Unit *other);
00247 extern int designer_change_side(Unit *unit, Side *side);
00248 extern int designer_disband(Unit *unit);
00249 #endif
00250 extern void init_units(void);
00251 extern Unit *create_bare_unit(int type);
00252 extern Unit *create_unit(int type, int makebrains);
00253 extern void init_unit_actorstate(Unit *unit, int flagacp, int acp = 0);
00254 extern void init_unit_plan(Unit *unit);
00255 extern void init_unit_tooling(Unit *unit);
00256 extern void init_unit_opinions(Unit *unit, int nsides);
00257 extern void init_unit_extras(Unit *unit);
00258 extern void change_unit_type(Unit *unit, int newtype, int reason,
00259 Side *newside);
00260 extern int enter_cell(Unit *unit, int x, int y);
00261 extern void enter_transport(Unit *unit, Unit *transport);
00262 extern void leave_cell(Unit *unit);
00263 extern void leave_transport(Unit *unit);
00264 extern void flush_dead_units(void);
00265 extern void add_to_unit_hp(Unit *unit, int hp);
00266 extern void fill_utype_array_from_lisp(int *typeary, Obj *typeobj);
00267
00268
00269
00270 extern void divide_into_regions(char *tlayer, TRegion **rlayer, int liquid);
00271 extern Feature *create_feature(char *feattype, char *name);
00272 extern void set_feature_type_name(Feature *feature, char *feattype);
00273 extern void set_feature_name(Feature *feature, char *name);
00274 extern void destroy_feature(Feature *feature);
00275 extern void renumber_features(void);
00276 #ifdef DESIGNERS
00277 extern void paint_cell(Side *side, int x, int y, int r, int t);
00278 extern void paint_border(Side *side, int x, int y, int dir, int t, int mode);
00279 extern void paint_connection(Side *side, int x, int y, int dir, int t, int mode);
00280 extern void paint_coating(Side *side, int x, int y, int r, int t, int depth);
00281 extern void paint_people(Side *side, int x, int y, int r, int s);
00282 extern void paint_control(Side *side, int x, int y, int r, int s);
00283 extern void paint_feature(Side *side, int x, int y, int r, int f);
00284 extern void paint_elevation(Side *side, int x, int y, int r, int code, int elev, int vary);
00285 extern void paint_temperature(Side *side, int x, int y, int r, int temp);
00286 extern void paint_material(Side *side, int x, int y, int r, int m, int amt);
00287 extern void paint_clouds(Side *side, int x, int y, int r, int cloudtype, int bot, int hgt);
00288 extern void paint_winds(Side *side, int x, int y, int r, int dir, int force);
00289 #endif
00290 extern void toggle_user_at(Unit *unit, int x, int y);
00291
00292
00293
00294
00295
00296 #define type_consumes_from_treasury_directly(utype, side, m) \
00297 (side_has_treasury((side), (m)) && um_takes_from_treasury((utype), (m)) \
00298 && (um_storage_x((utype), (m)) <= 0))
00299
00300
00301
00302 #define consumes_from_treasury_directly(unit, m) \
00303 (side_has_treasury((unit)->side, (m)) \
00304 && um_takes_from_treasury((unit)->type, (m)) \
00305 && (um_storage_x((unit)->type, (m)) <= 0))
00306
00307
00308
00309 #define type_produces_for_treasury_directly(utype, side, m) \
00310 (side_has_treasury((side), (m)) && um_gives_to_treasury((utype), (m)) \
00311 && (um_storage_x((utype), (m)) <= 0))
00312
00313
00314
00315 #define produces_for_treasury_directly(unit, m) \
00316 (side_has_treasury((unit)->side, (m)) \
00317 && um_gives_to_treasury((unit)->type, (m)) \
00318 && (um_storage_x((unit)->type, (m)) <= 0))
00319