Update of /cvsroot/xconq/xconq/src/include/gdl/side
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv23113/side
Modified Files:
cellview.h doctrine.h side.h sorder.h
Log Message:
Add CVS serialization support.
Fix copyrights.
Index: side.h
===================================================================
RCS file: /cvsroot/xconq/xconq/src/include/gdl/side/side.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** side.h 30 May 2006 02:34:14 -0000 1.1
--- side.h 2 Jun 2006 16:58:34 -0000 1.2
***************
*** 60,66 ****
--- 60,75 ----
(s != indepside ? m_treasury(m) : g_indepside_has_treasury() ? m_treasury(m) : FALSE)
+ //! Is side running an AI locally?
+ #define side_has_local_ai(s) ((s)->ai != NULL)
+
//! Is given unit being tracked by given side?
#define side_tracking_unit(side,unit) (side_in_set((side), (unit)->tracking))
+ //! How many attacks for given side with given attacker against given defender?
+ #define side_atkstats(s,a,d) ((s)->atkstats[a] ? ((s)->atkstats[a])[d] : 0)
+
+ //! How many hits for given side with given attacker against given defender?
+ #define side_hitstats(s,a,d) ((s)->hitstats[a] ? ((s)->hitstats[a])[d] : 0)
+
// Function Macros: Game Area Layer Accessors
***************
*** 94,97 ****
--- 103,115 ----
for (v = sidelist; v != NULL; v = v->next)
+ //! Iterate over player sides.
+ /*! This is the old for_all_sides which does not include indepside. */
+ #define for_all_real_sides(v) \
+ for (v = (sidelist ? sidelist->next : NULL); v != NULL; v = v->next)
+
+ //! Iterate over all units on side.
+ #define for_all_side_units(s,v) \
+ for (v = (s)->unithead->next; v != (s)->unithead; v = v->next)
+
NAMESPACE_XCONQ_BEGIN
NAMESPACE_GDL_BEGIN
***************
*** 424,427 ****
--- 442,476 ----
} Side;
+ //! AI operation hooks.
+ typedef struct a_ai_op {
+ //! Name of AI.
+ char *name;
+ //! Help text about AI.
+ char *help;
+ //! ??
+ int (*to_test_compat)(void);
+ //! Hook: Initialize AI for given side.
+ void (*to_init)(Side *side);
+ //! Hook: Perform start-of-turn analysis/planning.
+ void (*to_init_turn)(Side *side);
+ //! Hook: Choose a plan for given unit.
+ void (*to_decide_plan)(Side *side, Unit *unit);
+ //! Hook: React to outcome of executed unit task.
+ void (*to_react_to_task_result)(
+ Side *side, Unit *unit, Task *task, TaskOutcome rslt);
+ //! Hook: React to new side joining the game.
+ void (*to_react_to_new_side)(Side *side, Side *side2);
+ //! Hook: Adjust an unit's plan during turn.
+ int (*to_adjust_plan)(Side *side, Unit *unit);
+ //! Hook: Finalize action for turn.
+ void (*to_finish_movement)(Side *side);
+ //! Hook: Save state.
+ Obj *(*to_save_state)(Side *side);
+ //! Hook: Get ID of AI region at given coordinates.
+ int (*region_at)(Side *side, int x, int y);
+ //! Hook: Get designator of AI at given coordinates.
+ char *(*at_desig)(Side *side, int x, int y);
+ } AI_ops;
+
//! Parameter box containing unit and side.
struct ParamBoxUnitSide : public ParamBoxUnit {
***************
*** 469,472 ****
--- 518,524 ----
extern int numtotsides;
+ //! The array of all possible AI operation hooks.
+ extern AI_ops *all_ai_ops;
+
// Global Variables: Uniques
***************
*** 482,485 ****
--- 534,541 ----
extern int nextsideid;
+ // Global Variables: Behavior Options
+
+ extern int tmpcompress;
+
// Global Variables: Buffers
***************
*** 601,604 ****
--- 657,672 ----
extern void interp_side_value_list(short *arr, Obj *lis);
+ //! Serialize side's AI state to GDL.
+ extern void ai_save_state(Side *side);
+ //! Serialize side's views layers to GDL.
+ extern void write_side_view(Side *side, int compress);
+ //! Serialize side properties to GDL.
+ extern void write_side_properties(Side *side);
+ //! Serialize sides to GDL.
+ extern void write_sides(struct a_module *module);
+ //! Serialize list of side-value pairs to GDL.
+ extern void write_side_value_list(
+ char *name, short *arr, int dflt, int addnewline);
+
NAMESPACE_GDL_END
NAMESPACE_XCONQ_END
Index: cellview.h
===================================================================
RCS file: /cvsroot/xconq/xconq/src/include/gdl/side/cellview.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** cellview.h 30 May 2006 02:34:14 -0000 1.1
--- cellview.h 2 Jun 2006 16:58:34 -0000 1.2
***************
*** 258,274 ****
// Game Area View Layer Accessors
extern void fn_set_terrain_view(int x, int y, int val);
! extern void fn_set_aux_terrain_view(int x, int y, int val);
extern void fn_set_terrain_view_date(int x, int y, int val);
extern void fn_set_aux_terrain_view_date(int x, int y, int val);
extern void fn_set_material_view(int x, int y, int val);
extern void fn_set_material_view_date(int x, int y, int val);
extern void fn_set_temp_view(int x, int y, int val);
extern void fn_set_temp_view_date(int x, int y, int val);
extern void fn_set_cloud_view(int x, int y, int val);
extern void fn_set_cloud_bottom_view(int x, int y, int val);
extern void fn_set_cloud_height_view(int x, int y, int val);
extern void fn_set_cloud_view_date(int x, int y, int val);
extern void fn_set_wind_view(int x, int y, int val);
extern void fn_set_wind_view_date(int x, int y, int val);
--- 258,317 ----
// Game Area View Layer Accessors
+ //! Get cell value from terrain views layer.
+ extern int fn_terrain_view(int x, int y);
+ //! Get cell value from terrain view dates layer.
+ extern int fn_terrain_view_date(int x, int y);
+ //! Get cell value from aux terrain views layer.
+ extern int fn_aux_terrain_view(int x, int y);
+ //! Get cell value from aux terrain view dates layer.
+ extern int fn_aux_terrain_view_date(int x, int y);
+ //! Get cell value from material views layer.
+ extern int fn_material_view(int x, int y);
+ //! Get cell value from material view dates layer.
+ extern int fn_material_view_date(int x, int y);
+ //! Get cell value from temp views layer.
+ extern int fn_temp_view(int x, int y);
+ //! Get cell value from temp view dates layer.
+ extern int fn_temp_view_date(int x, int y);
+ //! Get cell value from cloud views layer.
+ extern int fn_cloud_view(int x, int y);
+ //! Get cell value from cloud bottom views layer.
+ extern int fn_cloud_bottom_view(int x, int y);
+ //! Get cell value from cloud top/height views layer.
+ extern int fn_cloud_height_view(int x, int y);
+ //! Get cell value from cloud view dates layer.
+ extern int fn_cloud_view_date(int x, int y);
+ //! Get cell value from wind views layer.
+ extern int fn_wind_view(int x, int y);
+ //! Get cell value from wind view dates layer.
+ extern int fn_wind_view_date(int x, int y);
+
+ //! Set cell value in terrain views layer.
extern void fn_set_terrain_view(int x, int y, int val);
! //! Set cell value in terrain view dates layer.
extern void fn_set_terrain_view_date(int x, int y, int val);
+ //! Set cell value in aux terrain views layer.
+ extern void fn_set_aux_terrain_view(int x, int y, int val);
+ //! Set cell value in aux terrain view dates layer.
extern void fn_set_aux_terrain_view_date(int x, int y, int val);
+ //! Set cell value in material views layer.
extern void fn_set_material_view(int x, int y, int val);
+ //! Set cell value in terrain view dates layer.
extern void fn_set_material_view_date(int x, int y, int val);
+ //! Set cell value in temp views layer.
extern void fn_set_temp_view(int x, int y, int val);
+ //! Set cell value in temp view dates layer.
extern void fn_set_temp_view_date(int x, int y, int val);
+ //! Set cell value in cloud views layer.
extern void fn_set_cloud_view(int x, int y, int val);
+ //! Set cell value in cloud bottom views layer.
extern void fn_set_cloud_bottom_view(int x, int y, int val);
+ //! Set cell value in cloud height/top views layer.
extern void fn_set_cloud_height_view(int x, int y, int val);
+ //! Set cell value in cloud view dates layer.
extern void fn_set_cloud_view_date(int x, int y, int val);
+ //! Set cell value in wind views layer.
extern void fn_set_wind_view(int x, int y, int val);
+ //! Set cell value in wind view dates layer.
extern void fn_set_wind_view_date(int x, int y, int val);
***************
*** 287,297 ****
--- 330,346 ----
// GDL I/O
+ //! Read side view layer from GDL.
extern void read_view_layer(
Side *side, Obj *contents, void (*setter)(int, int, int));
+ //! Read side aux terrain view layer from GDL.
extern void read_aux_terrain_view_layer(
Side *side, Obj *contents, void (*setter)(int, int, int));
+ //! Read side material view layer from GDL.
extern void read_material_view_layer(
Side *side, Obj *contents, void (*setter)(int, int, int));
+ //! Serialize side view layer to GDL.
+ extern void write_one_side_view_layer(int propkey, int (*fn)(int x, int y));
+
NAMESPACE_GDL_END
NAMESPACE_XCONQ_END
Index: doctrine.h
===================================================================
RCS file: /cvsroot/xconq/xconq/src/include/gdl/side/doctrine.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** doctrine.h 30 May 2006 02:34:14 -0000 1.2
--- doctrine.h 2 Jun 2006 16:58:34 -0000 1.3
***************
*** 119,122 ****
--- 119,125 ----
extern void interp_doctrine(Obj *form);
+ //! Serialize side doctrines to GDL.
+ extern void write_doctrines(void);
+
NAMESPACE_GDL_END
NAMESPACE_XCONQ_END
Index: sorder.h
===================================================================
RCS file: /cvsroot/xconq/xconq/src/include/gdl/side/sorder.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** sorder.h 30 May 2006 02:34:14 -0000 1.1
--- sorder.h 2 Jun 2006 16:58:34 -0000 1.2
***************
*** 104,107 ****
--- 104,110 ----
extern void interp_standing_order(Side *side, Obj *form);
+ //! Serialize standing orders to GDL.
+ extern void write_standing_orders(Side *side);
+
NAMESPACE_GDL_END
NAMESPACE_XCONQ_END
|