Author: cazfi Date: Tue Mar 24 04:14:07 2015 New Revision: 28606 URL: http://svn.gna.org/viewcvs/freeciv?rev=28606&view=rev Log: Rewritten the code to determine barbarian gang size.
See patch #5909 Modified: branches/S2_6/server/barbarian.c branches/S2_6/server/barbarian.h Modified: branches/S2_6/server/barbarian.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/barbarian.c?rev=28606&r1=28605&r2=28606&view=diff ============================================================================== --- branches/S2_6/server/barbarian.c (original) +++ branches/S2_6/server/barbarian.c Tue Mar 24 04:14:07 2015 @@ -474,12 +474,14 @@ { struct tile *ptile, *utile; int i, dist; - int uprise = 1; + int uprise; struct city *pc; struct player *barbarians, *victim; struct unit_type *leader_type; int barb_count, really_created = 0; bool hut_present = FALSE; + int city_count; + int city_max; /* We attempt the summons on a particular, random position. If this is * an invalid position then the summons simply fails this time. This means @@ -518,9 +520,8 @@ fc_assert(1 < game.server.barbarianrate); /* do not harass small civs - in practice: do not uprise at the beginning */ - if ((int)fc_rand(UPRISE_CIV_MORE) > - (int)city_list_size(victim->cities) - - UPRISE_CIV_SIZE/(game.server.barbarianrate-1) + if ((int)fc_rand(30) + 1 > + (int)city_list_size(victim->cities) * (game.server.barbarianrate - 1) || fc_rand(100) > get_player_bonus(victim, EFT_CIVIL_WAR_CHANCE)) { return; } @@ -538,6 +539,15 @@ update_tile_knowledge(utile); } + city_count = city_list_size(victim->cities); + city_max = UPRISE_CIV_SIZE; + uprise = 1; + + while (city_max <= city_count) { + uprise++; + city_max *= 1.2 + UPRISE_CIV_SIZE; + } + barb_count = fc_rand(3) + uprise * game.server.barbarianrate; leader_type = get_role_unit(L_BARBARIAN_LEADER, 0); @@ -546,9 +556,6 @@ barbarians = create_barbarian_player(LAND_BARBARIAN); if (!barbarians) { return; - } - if (city_list_size(victim->cities) > UPRISE_CIV_MOST) { - uprise = 3; } for (i = 0; i < barb_count; i++) { struct unit_type *punittype Modified: branches/S2_6/server/barbarian.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/barbarian.h?rev=28606&r1=28605&r2=28606&view=diff ============================================================================== --- branches/S2_6/server/barbarian.h (original) +++ branches/S2_6/server/barbarian.h Tue Mar 24 04:14:07 2015 @@ -22,8 +22,6 @@ #define MAX_UNREST_DIST 8 #define UPRISE_CIV_SIZE 10 -#define UPRISE_CIV_MORE 30 -#define UPRISE_CIV_MOST 50 #define MAP_FACTOR 2000 /* adjust this to get a good uprising frequency */ _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits