Author: cazfi Date: Sat Aug 1 00:45:19 2015 New Revision: 29285 URL: http://svn.gna.org/viewcvs/freeciv?rev=29285&view=rev Log: Made advance_by_number(A_FUTURE) to return valid advance structure. This fixes receiving Future Tech from Darwin's Voyage in multiplayer ruleset.
See bug #23231 Modified: branches/S2_6/common/tech.c branches/S2_6/common/tech.h Modified: branches/S2_6/common/tech.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/tech.c?rev=29285&r1=29284&r2=29285&view=diff ============================================================================== --- branches/S2_6/common/tech.c (original) +++ branches/S2_6/common/tech.c Sat Aug 1 00:45:19 2015 @@ -47,7 +47,7 @@ * server/ruleset.c (for the server) * client/packhand.c (for the client) */ -struct advance advances[A_LAST]; +struct advance advances[A_LAST_EXISTING]; static struct user_flag user_tech_flags[MAX_NUM_USER_TECH_FLAGS]; @@ -96,10 +96,12 @@ **************************************************************************/ struct advance *advance_by_number(const Tech_type_id atype) { - if (atype < 0 || atype >= game.control.num_tech_types) { + if (atype != A_FUTURE + && (atype < 0 || atype >= game.control.num_tech_types)) { /* This isn't an error; some callers depend on it. */ return NULL; } + return &advances[atype]; } @@ -368,6 +370,7 @@ void techs_init(void) { struct advance *a_none = &advances[A_NONE]; + struct advance *a_future = &advances[A_FUTURE]; int i; memset(advances, 0, sizeof(advances)); @@ -382,6 +385,11 @@ a_none->require[AR_ONE] = a_none; a_none->require[AR_TWO] = a_none; a_none->require[AR_ROOT] = A_NEVER; + + name_set(&a_future->name, NULL, "Future"); + a_future->require[AR_ONE] = A_NEVER; + a_future->require[AR_TWO] = A_NEVER; + a_future->require[AR_ROOT] = A_NEVER; } /*************************************************************** Modified: branches/S2_6/common/tech.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/tech.h?rev=29285&r1=29284&r2=29285&view=diff ============================================================================== --- branches/S2_6/common/tech.h (original) +++ branches/S2_6/common/tech.h Sat Aug 1 00:45:19 2015 @@ -42,8 +42,9 @@ #define A_NONE 0 #define A_FIRST 1 #define A_LAST MAX_NUM_ITEMS /* Used in the network protocol. */ -#define A_UNSET (A_LAST + 1) -#define A_FUTURE (A_LAST + 2) +#define A_FUTURE (A_LAST + 1) +#define A_LAST_EXISTING A_FUTURE +#define A_UNSET (A_LAST + 2) #define A_UNKNOWN (A_LAST + 3) #define A_NEVER (NULL) _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits