[Freeciv-Dev] Re: (PR#13322) Move a bunch of stuff into rulesets
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] Re: (PR#13322) Move a bunch of stuff into rulesets |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Sat, 25 Jun 2005 05:59:43 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13322 >
On Thu, 23 Jun 2005, Jason Short wrote:
> 1.The default/game.ruleset needs better documentation of what these
> values mean.
Done.
Renamed the *_factor variables to base_*_cost. Renamed ransom to
random_gold.
> the base tech cost only applies to some of the techstyles (AFAICT)
It applies to 1 & 2. Nothing will apply to 3. Now documented.
Fixed tech bug in previous patch that turned all tech costs to 1 due to
order in which ruleset stuff was loaded and initialized.
- Per
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.349
diff -u -r1.349 city.c
--- common/city.c 10 Jun 2005 02:20:05 -0000 1.349
+++ common/city.c 25 Jun 2005 12:57:07 -0000
@@ -1680,30 +1684,30 @@
int *angry, int *unhappy, int *happy,
int *content)
{
- while (*luxuries >= HAPPY_COST && *angry > 0) {
+ while (*luxuries >= game.info.happy_cost && *angry > 0) {
/* Upgrade angry to unhappy: costs HAPPY_COST each. */
(*angry)--;
(*unhappy)++;
- *luxuries -= HAPPY_COST;
+ *luxuries -= game.info.happy_cost;
}
- while (*luxuries >= HAPPY_COST && *content > 0) {
+ while (*luxuries >= game.info.happy_cost && *content > 0) {
/* Upgrade content to happy: costs HAPPY_COST each. */
(*content)--;
(*happy)++;
- *luxuries -= HAPPY_COST;
+ *luxuries -= game.info.happy_cost;
}
- while (*luxuries >= 2 * HAPPY_COST && *unhappy > 0) {
+ while (*luxuries >= 2 * game.info.happy_cost && *unhappy > 0) {
/* Upgrade unhappy to happy. Note this is a 2-level upgrade with
* double the cost. */
(*unhappy)--;
(*happy)++;
- *luxuries -= 2 * HAPPY_COST;
+ *luxuries -= 2 * game.info.happy_cost;
}
- if (*luxuries >= HAPPY_COST && *unhappy > 0) {
+ if (*luxuries >= game.info.happy_cost && *unhappy > 0) {
/* Upgrade unhappy to content: costs HAPPY_COST each. */
(*unhappy)--;
(*content)++;
- *luxuries -= HAPPY_COST;
+ *luxuries -= game.info.happy_cost;
}
}
@@ -1883,8 +1887,8 @@
* num_known_tech_with_flag(pplayer, TF_POPULATION_POLLUTION_INC)
* MAX(pop, 0)) / (4 * 100);
- /* Then there's a base -20 pollution. */
- mod = -20;
+ /* Then there is base pollution (usually a negative number). */
+ mod = game.info.base_pollution;
if (pollu_prod) {
*pollu_prod = prod;
@@ -1994,7 +1998,7 @@
/* Add base amounts for building upkeep and citizen consumption. */
pcity->usage[O_GOLD] += city_building_upkeep(pcity, O_GOLD);
- pcity->usage[O_FOOD] += FOOD_COST * pcity->size;
+ pcity->usage[O_FOOD] += game.info.food_cost * pcity->size;
/*
* If you modify anything here these places might also need updating:
Index: common/city.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.h,v
retrieving revision 1.214
diff -u -r1.214 city.h
--- common/city.h 11 May 2005 14:11:20 -0000 1.214
+++ common/city.h 25 Jun 2005 12:57:08 -0000
@@ -83,12 +83,6 @@
#define city_map_iterate(x, y) city_map_iterate_outwards(x, y)
#define city_map_iterate_end city_map_iterate_outwards_end
-/* Cost in luxuries to make one citizen happier by one level. */
-#define HAPPY_COST 2
-
-/* Cost in food to feed one citizen. */
-#define FOOD_COST 2
-
/* Iterate a city map, from the center (the city) outwards */
extern struct iter_index {
int dx, dy, dist;
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.136
diff -u -r1.136 packets.def
--- common/packets.def 14 Jun 2005 18:49:08 -0000 1.136
+++ common/packets.def 25 Jun 2005 12:57:08 -0000
@@ -427,6 +427,13 @@
UINT16 incite_total_factor;
GOVERNMENT government_when_anarchy;
UINT8 revolution_length;
+ SINT16 base_pollution;
+ UINT8 happy_cost;
+ UINT8 food_cost;
+ UINT16 base_bribe_cost;
+ UINT16 base_incite_cost;
+ UINT8 base_tech_cost;
+ UINT16 ransom_gold;
UINT8 save_nturns;
UINT8 save_compress_level;
Index: common/tech.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/tech.c,v
retrieving revision 1.94
diff -u -r1.94 tech.c
--- common/tech.c 21 Jun 2005 16:21:01 -0000 1.94
+++ common/tech.c 25 Jun 2005 12:57:08 -0000
@@ -358,7 +358,7 @@
from game.info.tech_cost_style and game.info.tech_leakage.
tech_cost_style:
- 0 - Civ (I|II) style. Every new tech adds 20 to the cost of the next tech.
+ 0 - Civ (I|II) style. Every new tech adds N to the cost of the next tech.
1 - Cost of technology is
(1 + parents) * 10 * sqrt(1 + parents)
where num_parents == number of requirement for tech (recursive).
@@ -400,7 +400,8 @@
switch (tech_cost_style) {
case 0:
- base_cost = get_player_research(pplayer)->techs_researched * 20;
+ base_cost = get_player_research(pplayer)->techs_researched
+ * game.info.base_tech_cost;
break;
case 1:
base_cost = techcoststyle1[tech];
@@ -548,9 +549,10 @@
tech_type_iterate(tech) {
double reqs = advances[tech].num_reqs + 1;
- const double cost = 10.0 * reqs * sqrt(reqs);
+ const double base = game.info.base_tech_cost / 2;
+ const double cost = base * reqs * sqrt(reqs);
- techcoststyle1[tech] = MAX(cost, 20.0);
+ techcoststyle1[tech] = MAX(cost, game.info.base_tech_cost);
} tech_type_iterate_end;
}
Index: data/default/game.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/game.ruleset,v
retrieving revision 1.22
diff -u -r1.22 game.ruleset
--- data/default/game.ruleset 10 Jun 2005 02:20:08 -0000 1.22
+++ data/default/game.ruleset 25 Jun 2005 12:57:08 -0000
@@ -19,6 +19,25 @@
global_init_buildings="Palace"
[civstyle]
+; Value added to city pollution
+base_pollution = -20
+
+; Cost in luxuries of making one citizen happier
+happy_cost = 2
+
+; Cost in food of upkeeping a single citizen
+food_cost = 2
+
+; A base bribe cost, modified heavily by other factors
+base_bribe_cost = 750
+
+; Barbarian leader ransom in gold
+ransom_gold = 100
+
+; Base research cost for tech styles 1 & 2
+base_tech_cost = 20
+
+; City center minimum outputs
min_city_center_food = 1
min_city_center_shield = 1
min_city_center_trade = 0
@@ -80,11 +99,12 @@
; city_incite_cost =
; total_factor * (city_size) *
-; (base + (units_cost) * unit_factor +
+; (base_incite_cost + (units_cost) * unit_factor +
; (improvements_cost) * improvement_factor)
; / (distance * 100)
; See city_incite_cost() for more details
[incite_cost]
+base_incite_cost = 1000
improvement_factor = 1
unit_factor = 2
total_factor = 100
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.319
diff -u -r1.319 cityturn.c
--- server/cityturn.c 21 Jun 2005 16:21:02 -0000 1.319
+++ server/cityturn.c 25 Jun 2005 12:57:09 -0000
@@ -1342,7 +1342,7 @@
}
/* Gold factor */
- cost = city_owner(pcity)->economic.gold + 1000;
+ cost = city_owner(pcity)->economic.gold + game.info.base_incite_cost;
unit_list_iterate(pcity->tile->units, punit) {
cost += (unit_build_shield_cost(punit->type)
Index: server/diplomats.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplomats.c,v
retrieving revision 1.79
diff -u -r1.79 diplomats.c
--- server/diplomats.c 21 Jun 2005 16:21:02 -0000 1.79
+++ server/diplomats.c 25 Jun 2005 12:57:09 -0000
@@ -1376,7 +1376,7 @@
int dist;
int default_hp = unit_type(punit)->hp;
- cost = unit_owner(punit)->economic.gold + 750;
+ cost = unit_owner(punit)->economic.gold * game.info.base_bribe_cost;
capital = find_palace(unit_owner(punit));
if (capital) {
int tmp = map_distance(capital->tile, punit->tile);
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.267
diff -u -r1.267 ruleset.c
--- server/ruleset.c 11 Jun 2005 18:13:00 -0000 1.267
+++ server/ruleset.c 25 Jun 2005 12:57:10 -0000
@@ -850,8 +850,6 @@
}
} tech_type_iterate_end;
- precalc_tech_data();
-
free(sec);
section_file_check_unused(file, filename);
section_file_free(file);
@@ -2446,6 +2444,19 @@
(void) check_ruleset_capabilities(&file, "+1.11.1", filename);
(void) section_file_lookup(&file, "datafile.description"); /* unused */
+ game.info.base_pollution =
+ secfile_lookup_int_default(&file, -20, "civstyle.base_pollution");
+ game.info.happy_cost =
+ secfile_lookup_int_default(&file, 2, "civstyle.happy_cost");
+ game.info.food_cost =
+ secfile_lookup_int_default(&file, 2, "civstyle.food_cost");
+ game.info.base_bribe_cost =
+ secfile_lookup_int_default(&file, 750, "civstyle.base_bribe_cost");
+ game.info.ransom_gold =
+ secfile_lookup_int_default(&file, 100, "civstyle.ransom_gold");
+ game.info.base_tech_cost =
+ secfile_lookup_int_default(&file, 20, "civstyle.base_tech_cost");
+
output_type_iterate(o) {
game.info.min_city_center_output[o]
= secfile_lookup_int_default(&file, 0,
@@ -2557,6 +2568,8 @@
}
/* City incite cost */
+ game.info.base_incite_cost =
+ secfile_lookup_int_default(&file, 1000, "incite_cost.base_incite_cost");
game.info.incite_improvement_factor =
secfile_lookup_int_default(&file, 1, "incite_cost.improvement_factor");
game.info.incite_unit_factor =
@@ -3039,6 +3052,8 @@
load_ruleset_game();
translate_data_names();
+ precalc_tech_data();
+
script_free();
script_init();
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.359
diff -u -r1.359 unittools.c
--- server/unittools.c 21 Jun 2005 16:21:02 -0000 1.359
+++ server/unittools.c 25 Jun 2005 12:57:10 -0000
@@ -1760,7 +1760,8 @@
if( is_barbarian(pplayer) && unit_has_role(punit->type, L_BARBARIAN_LEADER)
&& (unit_list_size(punit->tile->units) == 1)
&& (is_ground_unit(pkiller) || is_heli_unit(pkiller)) ) {
- ransom = (pplayer->economic.gold >= 100)?100:pplayer->economic.gold;
+ ransom = (pplayer->economic.gold >= game.info.ransom_gold)
+ ? game.info.ransom_gold : pplayer->economic.gold;
notify_player_ex(destroyer, pkiller->tile, E_UNIT_WIN_ATT,
_("Barbarian leader captured, %d gold ransom paid."),
ransom);
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.227
diff -u -r1.227 aicity.c
--- ai/aicity.c 21 Jun 2005 16:20:59 -0000 1.227
+++ ai/aicity.c 25 Jun 2005 12:57:11 -0000
@@ -98,7 +98,7 @@
int providers = 0;
specialist_type_iterate(i) {
- if (get_specialist_output(pcity, i, O_LUXURY) >= HAPPY_COST) {
+ if (get_specialist_output(pcity, i, O_LUXURY) >= game.info.happy_cost) {
providers += pcity->specialists[i];
}
} specialist_type_iterate_end;
|
|