[Freeciv-Dev] (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] (PR#13322) Move a bunch of stuff into rulesets |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Thu, 23 Jun 2005 15:13:44 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13322 >
Well, as the subjects says... Some tidbits here and there that were
hard-coded are now put in the game.ruleset. (Oh, and automagically sent to
the client as well! The struct sharing with the packets code rocks.)
- 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 23 Jun 2005 21:58:25 -0000
@@ -1680,30 +1680,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 +1883,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 +1994,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 23 Jun 2005 21:58:25 -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 23 Jun 2005 21:58:25 -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 bribe_factor;
+ UINT16 incite_factor;
+ UINT16 ransom;
+ UINT8 base_tech_cost;
UINT8 save_nturns;
UINT8 save_compress_level;
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 23 Jun 2005 21:58:27 -0000
@@ -19,6 +19,14 @@
global_init_buildings="Palace"
[civstyle]
+base_pollution = -20 ; added to city pollution
+happy_cost = 2 ; cost of making citizen happier
+food_cost = 2 ; cost of upkeeping citizen
+bribe_factor = 750 ; a base bribe cost
+incite_factor = 1000 ; a base incite cost
+ransom = 100 ; barbarian leader ransom
+base_tech_cost = 20 ; base research cost
+
min_city_center_food = 1
min_city_center_shield = 1
min_city_center_trade = 0
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 23 Jun 2005 21:58:28 -0000
@@ -1342,7 +1342,7 @@
}
/* Gold factor */
- cost = city_owner(pcity)->economic.gold + 1000;
+ cost = city_owner(pcity)->economic.gold + game.info.incite_factor;
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 23 Jun 2005 21:58:28 -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.bribe_factor;
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 23 Jun 2005 21:58:28 -0000
@@ -2446,6 +2446,21 @@
(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.bribe_factor =
+ secfile_lookup_int_default(&file, 750, "civstyle.bribe_factor");
+ game.info.incite_factor =
+ secfile_lookup_int_default(&file, 1000, "civstyle.incite_factor");
+ game.info.ransom =
+ secfile_lookup_int_default(&file, 100, "civstyle.ransom");
+ game.info.base_tech_cost =
+ secfile_lookup_int_default(&file, 10, "civstyle.base_tech_cost");
+
output_type_iterate(o) {
game.info.min_city_center_output[o]
= secfile_lookup_int_default(&file, 0,
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 23 Jun 2005 21:58:30 -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)
+ ? game.info.ransom : pplayer->economic.gold;
notify_player_ex(destroyer, pkiller->tile, E_UNIT_WIN_ATT,
_("Barbarian leader captured, %d gold ransom paid."),
ransom);
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 23 Jun 2005 22:07:33 -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: 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 23 Jun 2005 22:08:27 -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;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13322) Move a bunch of stuff into rulesets,
Per I. Mathisen <=
|
|