Author: cazfi Date: Thu Feb 11 14:50:23 2016 New Revision: 31875 URL: http://svn.gna.org/viewcvs/freeciv?rev=31875&view=rev Log: Reserved empty AI callback slots so optional callbacks can later be added without need to break module compatibility.
See patch #6937 Modified: branches/S2_6/common/ai.h branches/S2_6/doc/README.AI_modules Modified: branches/S2_6/common/ai.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/ai.h?rev=31875&r1=31874&r2=31875&view=diff ============================================================================== --- branches/S2_6/common/ai.h (original) +++ branches/S2_6/common/ai.h Thu Feb 11 14:50:23 2016 @@ -21,8 +21,10 @@ #include "fc_types.h" /* MAX_LEN_NAME */ /* Update this capability string when ever there is changes to ai_type - structure below */ -#define FC_AI_MOD_CAPSTR "+Freeciv-2.6-ai-module-2015.Oct.30" + * structure below. When changing mandatory capability part, check that + * there's enough reserved_xx pointers in the end of the structure for + * taking to use without need to bump mandatory capability again. */ +#define FC_AI_MOD_CAPSTR "+Freeciv-2.6-ai-module-2016.Feb.09" /* Timers for all AI activities. Define it to get statistics about the AI. */ #ifdef FREECIV_DEBUG @@ -257,6 +259,20 @@ /* Called for player AI type with short internval */ void (*refresh)(struct player *pplayer); + + /* These are here reserving space for future optional callbacks. + * This way we don't need to change the mandatory capability of the AI module + * interface when adding such callbacks, but existing modules just have these + * set to NULL. Optional capability should be set when taking one of these to use, + * so that new modules know if the server is going to call these or is it too old + * version to do so. + * When mandatory capability then changes again, please add new reservations to + * replace those taken to use. */ + void (*reserved_01)(void); + void (*reserved_02)(void); + void (*reserved_03)(void); + void (*reserved_04)(void); + void (*reserved_05)(void); } funcs; }; Modified: branches/S2_6/doc/README.AI_modules URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/doc/README.AI_modules?rev=31875&r1=31874&r2=31875&view=diff ============================================================================== --- branches/S2_6/doc/README.AI_modules (original) +++ branches/S2_6/doc/README.AI_modules Thu Feb 11 14:50:23 2016 @@ -131,3 +131,5 @@ player once per other player in game. Old player_save and player_load are called only once overall - Added want_to_explore, called for AI type of the unit owner, when it is about to autoexplore +- Added currently unused 'reserved' pointers that we can populate with optional callbacks + without need to change the mandatory capability of the modules _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits