[Freeciv-Dev] (PR#9817) default building specified in ruleset
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] (PR#9817) default building specified in ruleset |
From: |
"Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx> |
Date: |
Wed, 25 Aug 2004 20:52:25 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9817 >
If the server/ai can't figure out anything to build it starts on
B_CAPITAL. This patch changes that to be a ruleset value that's put
into game.default_building.
This is the same as in the effects patch but with some bugs fixed:
- Support for all rulesets.
- An invalid default building is a fatal error.
jason
? diff
Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.160
diff -u -r1.160 aicity.c
--- ai/aicity.c 13 Aug 2004 15:59:11 -0000 1.160
+++ ai/aicity.c 26 Aug 2004 03:40:37 -0000
@@ -296,8 +296,8 @@
if (best_role_unit(pcity, F_TRADE_ROUTE) != U_LAST) {
pcity->ai.choice.choice = best_role_unit(pcity, F_TRADE_ROUTE);
pcity->ai.choice.type = CT_NONMIL;
- } else if (can_build_improvement(pcity, B_CAPITAL)) {
- pcity->ai.choice.choice = B_CAPITAL;
+ } else if (can_build_improvement(pcity, game.default_building)) {
+ pcity->ai.choice.choice = game.default_building;
pcity->ai.choice.type = CT_BUILDING;
} else if (best_role_unit(pcity, F_SETTLERS) != U_LAST) {
pcity->ai.choice.choice = best_role_unit(pcity, F_SETTLERS);
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.396
diff -u -r1.396 packhand.c
--- client/packhand.c 20 Aug 2004 20:13:17 -0000 1.396
+++ client/packhand.c 26 Aug 2004 03:40:39 -0000
@@ -2192,6 +2192,8 @@
mystrlcpy(team_get_by_id(i)->name, packet->team_name[i],
MAX_LEN_NAME);
}
+
+ game.default_building = packet->default_building;
}
/**************************************************************************
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.237
diff -u -r1.237 city.c
--- common/city.c 25 Aug 2004 18:24:19 -0000 1.237
+++ common/city.c 26 Aug 2004 03:40:39 -0000
@@ -2717,7 +2717,7 @@
pcity->currently_building = u;
} else {
pcity->is_building_unit = FALSE;
- pcity->currently_building = B_CAPITAL;
+ pcity->currently_building = game.default_building;
}
}
pcity->turn_founded = game.turn;
Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.183
diff -u -r1.183 game.c
--- common/game.c 21 Jul 2004 16:34:33 -0000 1.183
+++ common/game.c 26 Aug 2004 03:40:40 -0000
@@ -278,6 +278,8 @@
game.government_when_anarchy = G_MAGIC; /* flag */
game.ai_goal_government = G_MAGIC; /* flag */
+ game.default_building = B_LAST;
+
sz_strlcpy(game.demography, GAME_DEFAULT_DEMOGRAPHY);
sz_strlcpy(game.allow_take, GAME_DEFAULT_ALLOW_TAKE);
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.148
diff -u -r1.148 game.h
--- common/game.h 16 Aug 2004 15:42:59 -0000 1.148
+++ common/game.h 26 Aug 2004 03:40:40 -0000
@@ -169,6 +169,8 @@
char rulesetdir[MAX_LEN_NAME];
int firepower_factor; /* See README.rulesets */
+ Impr_Type_id default_building;
+
struct {
int cathedral_plus; /* eg Theology */
int cathedral_minus; /* eg Communism */
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.41
diff -u -r1.41 packets.def
--- common/packets.def 25 Aug 2004 18:24:19 -0000 1.41
+++ common/packets.def 26 Aug 2004 03:40:40 -0000
@@ -1245,6 +1245,8 @@
BOOL slow_invasions; add-cap(slow_invasions)
STRING team_name[MAX_NUM_TEAMS][MAX_LEN_NAME];
+
+ IMPROVEMENT default_building;
end
Index: data/civ1/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ1/buildings.ruleset,v
retrieving revision 1.34
diff -u -r1.34 buildings.ruleset
--- data/civ1/buildings.ruleset 13 Jul 2004 22:52:17 -0000 1.34
+++ data/civ1/buildings.ruleset 26 Aug 2004 03:40:40 -0000
@@ -2060,6 +2060,7 @@
aqueduct_size=10;
sewer_size=99;
+default="Capitalization"
; Techs which modify building effects:
Index: data/civ2/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/civ2/buildings.ruleset,v
retrieving revision 1.37
diff -u -r1.37 buildings.ruleset
--- data/civ2/buildings.ruleset 13 Jul 2004 22:52:17 -0000 1.37
+++ data/civ2/buildings.ruleset 26 Aug 2004 03:40:41 -0000
@@ -2051,6 +2051,7 @@
aqueduct_size=8;
sewer_size=12;
+default="Capitalization"
; Techs which modify building effects:
Index: data/default/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/buildings.ruleset,v
retrieving revision 1.49
diff -u -r1.49 buildings.ruleset
--- data/default/buildings.ruleset 14 Jul 2004 16:40:57 -0000 1.49
+++ data/default/buildings.ruleset 26 Aug 2004 03:40:41 -0000
@@ -2138,6 +2138,7 @@
aqueduct_size=8;
sewer_size=12;
+default="Coinage"
; Techs which modify building effects:
Index: data/history/buildings.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/history/buildings.ruleset,v
retrieving revision 1.9
diff -u -r1.9 buildings.ruleset
--- data/history/buildings.ruleset 14 Jul 2004 17:12:21 -0000 1.9
+++ data/history/buildings.ruleset 26 Aug 2004 03:40:42 -0000
@@ -2091,6 +2091,7 @@
aqueduct_size=8;
sewer_size=12;
+default="Coinage"
; Techs which modify building effects:
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.190
diff -u -r1.190 ruleset.c
--- server/ruleset.c 25 Aug 2004 18:57:07 -0000 1.190
+++ server/ruleset.c 26 Aug 2004 03:40:42 -0000
@@ -1475,6 +1475,14 @@
}
} impr_type_iterate_end;
+ item = secfile_lookup_str(file, "b_special.default");
+ game.default_building = find_improvement_by_name(item);
+ if (game.default_building == B_LAST) {
+ /* TRANS: message for an obscure ruleset error. */
+ freelog(LOG_FATAL, _("Bad value for b_special.default (%s)"), filename);
+ exit(EXIT_FAILURE);
+ }
+
/* FIXME: remove all of the following when gen-impr implemented... */
game.aqueduct_size = secfile_lookup_int(file, "b_special.aqueduct_size");
@@ -2004,6 +2012,8 @@
sz_strlcpy(packet.team_name[i], team_get_by_id(i)->name);
}
+ packet.default_building = game.default_building;
+
lsend_packet_ruleset_control(dest, &packet);
}
- [Freeciv-Dev] (PR#9817) default building specified in ruleset,
Jason Short <=
|
|