Author: cazfi Date: Sat Apr 18 11:38:06 2015 New Revision: 28805 URL: http://svn.gna.org/viewcvs/freeciv?rev=28805&view=rev Log: Support up to 5 goods types. Random one gets selected when traderoute is established.
See patch #5992 Modified: trunk/common/fc_types.h trunk/common/traderoutes.c trunk/common/traderoutes.h trunk/server/unithand.c Modified: trunk/common/fc_types.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/fc_types.h?rev=28805&r1=28804&r2=28805&view=diff ============================================================================== --- trunk/common/fc_types.h (original) +++ trunk/common/fc_types.h Sat Apr 18 11:38:06 2015 @@ -46,7 +46,7 @@ #define MAX_EXTRA_TYPES 64 /* Used in the network protocol. */ #define MAX_BASE_TYPES MAX_EXTRA_TYPES /* Used in the network protocol. */ #define MAX_ROAD_TYPES MAX_EXTRA_TYPES /* Used in the network protocol. */ -#define MAX_GOODS_TYPES 1 +#define MAX_GOODS_TYPES 5 #define MAX_DISASTER_TYPES 10 #define MAX_ACHIEVEMENT_TYPES 10 #define MAX_NUM_LEADERS MAX_NUM_ITEMS /* Used in the network protocol. */ Modified: trunk/common/traderoutes.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/traderoutes.c?rev=28805&r1=28804&r2=28805&view=diff ============================================================================== --- trunk/common/traderoutes.c (original) +++ trunk/common/traderoutes.c Sat Apr 18 11:38:06 2015 @@ -17,6 +17,7 @@ /* utility */ #include "log.h" +#include "rand.h" /* common */ #include "city.h" @@ -480,3 +481,11 @@ { return rule_name(&pgood->name); } + +/**************************************************************************** + Return goods type for the new traderoute between given cities. +****************************************************************************/ +struct goods_type *goods_for_new_route(struct city *src, struct city *dest) +{ + return goods_by_number(fc_rand(game.control.num_goods_types)); +} Modified: trunk/common/traderoutes.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/traderoutes.h?rev=28805&r1=28804&r2=28805&view=diff ============================================================================== --- trunk/common/traderoutes.h (original) +++ trunk/common/traderoutes.h Sat Apr 18 11:38:06 2015 @@ -118,6 +118,8 @@ const char *goods_name_translation(struct goods_type *pgood); const char *goods_rule_name(struct goods_type *pgood); +struct goods_type *goods_for_new_route(struct city *src, struct city *dest); + #define goods_type_iterate(_p) \ { \ int _i_; \ Modified: trunk/server/unithand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=28805&r1=28804&r2=28805&view=diff ============================================================================== --- trunk/server/unithand.c (original) +++ trunk/server/unithand.c Sat Apr 18 11:38:06 2015 @@ -2595,7 +2595,7 @@ conn_list_do_buffer(pplayer->connections); /* Get name from the first (and currently only) goods type there is */ - goods_str = goods_name_translation(goods_by_number(0)); + goods_str = goods_name_translation(goods_for_new_route(pcity_homecity, pcity_dest)); if (bonus_str != NULL) { notify_player(pplayer, city_tile(pcity_dest), _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits