00001 /* Definitions for game modules in Xconq. 00002 Copyright (C) 1991-1996, 1999, 2000 Stanley T. Shebs. 00003 00004 Xconq is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU General Public License as published by 00006 the Free Software Foundation; either version 2, or (at your option) 00007 any later version. See the file COPYING. */ 00008 00018 typedef struct a_variant { 00019 Obj *id; 00020 char *name; 00021 char *help; 00022 Obj *dflt; 00023 Obj *range; 00024 Obj *cases; 00025 int used; 00026 int hasintvalue; 00027 int intvalue; 00028 int newvalues[3]; 00029 } Variant; 00030 00036 typedef struct a_module { 00037 char *name; 00038 char *title; 00039 Obj *blurb; 00040 char *picturename; 00041 char *basemodulename; 00042 char *defaultbasemodulename; 00043 char *basegame; 00044 Obj *instructions; 00045 Obj *notes; 00046 Obj *designnotes; 00047 char *version; 00048 Variant *variants; 00049 char *origmodulename; 00050 Variant *origvariants; 00051 char *origversion; 00052 char *contents; /* a string with the actual contents */ 00053 char *sp; 00054 char *filename; 00055 FILE *fp; 00056 int startlineno; 00057 int endlineno; 00058 /* Primarily for designer use, to control writing of a module */ 00059 short def_all; 00060 short def_types; 00061 short def_tables; 00062 short compress_tables; 00063 short def_globals; 00064 short def_scoring; 00065 short def_world; 00066 short def_areas; 00067 short def_area_terrain; 00068 short def_area_misc; 00069 short def_area_weather; 00070 short def_area_material; 00071 short compress_layers; 00072 short def_sides; 00073 short def_side_views; 00074 short def_side_doctrines; 00075 short def_players; 00076 #if 0 00077 short def_agreements; 00078 #endif 00079 short def_units; 00080 short def_unit_ids; 00081 short def_unit_props; 00082 short def_unit_acts; 00083 short def_unit_plans; 00084 short def_history; 00085 short maybe_reshape; 00086 int subarea_width; 00087 int subarea_height; 00088 int subarea_x; 00089 int subarea_y; 00090 int final_subarea_width; 00091 int final_subarea_height; 00092 int final_subarea_x; 00093 int final_subarea_y; 00094 int final_width; 00095 int final_height; 00096 int final_circumference; 00097 short open; 00098 short loaded; 00099 struct a_module *next; 00100 struct a_module *include; 00101 struct a_module *nextinclude; 00102 struct a_module *lastinclude; 00103 } Module; 00104 00110 #define for_all_modules(m) \ 00111 for (m = modulelist; m != NULL; m = m->next) 00112 00119 #define for_all_includes(m,sub) \ 00120 for (sub = m->include; sub != NULL; sub = sub->nextinclude) 00121 00123 extern Module *modulelist; 00125 extern Module *mainmodule; 00126 00127 /* Declarations of module functions. */ 00128 00129 extern void clear_game_modules(void); 00130 extern Module *create_game_module(char *name); 00131 extern Module *find_game_module(char *name); 00132 extern Module *get_game_module(char *name); 00133 extern Module *add_game_module(char *name, Module *includer); 00134 extern void load_default_game(void); 00135 extern int load_game_description(Module *module); 00136 extern void load_game_module(Module *module, int dowarn); 00137 extern void load_base_module(Module *module); 00138 extern int open_module(Module *module, int dowarn); 00139 extern void read_forms(Module *module); 00140 extern void copy_module(Module *module, Module *origmodule); 00141 extern void init_module_reshape(Module *module); 00142 extern int reshape_the_output(Module *module); 00143 extern int valid_reshape(Module *module); 00144 extern void close_module(Module *module); 00145 extern char *module_desig(Module *module); 00146 extern void do_module_variants(Module *module, Obj *lis); 00147 extern char *saved_game_filename(void); 00148 extern char *checkpoint_filename(int n); 00149 extern char *statistics_filename(void); 00150 extern char *preferences_filename(void); 00151 extern char *old_preferences_filename(void); 00152 00153