[Freeciv-Dev] Received cities do not produce illegal units (PR#2405)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
This patch implements #2405, which is a request to stop the possibility of
production of units for which you do not have the requirements to produce
in cities that you conquer, incite or otherwise obtain.
The implementation idea has been suggested/approved by the design board.
Please test the patch.
- Per
Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.230
diff -u -r1.230 citytools.c
--- server/citytools.c 8 Sep 2003 13:47:29 -0000 1.230
+++ server/citytools.c 8 Sep 2003 14:43:07 -0000
@@ -915,9 +915,13 @@
city_add_improvement(pcity, i);
} built_impr_iterate_end;
- /* If the city was building something we haven't invented we
- must change production. */
- /* advisor_choose_build(pcity); we add the civ bug here :) */
+ /* Set production to something valid for pplayer, if not. */
+ if ((pcity->is_building_unit
+ && !can_build_unit_direct(pcity, pcity->currently_building))
+ || (!pcity->is_building_unit
+ && !can_build_improvement(pcity, pcity->currently_building))) {
+ advisor_choose_build(ptaker, pcity);
+ }
send_city_info(NULL, pcity);
Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.221
diff -u -r1.221 cityturn.c
--- server/cityturn.c 9 Aug 2003 19:21:01 -0000 1.221
+++ server/cityturn.c 8 Sep 2003 14:43:07 -0000
@@ -80,8 +80,6 @@
static void worker_loop(struct city *pcity, int *foodneed,
int *prodneed, int *workers);
-static void advisor_choose_build(struct player *pplayer, struct city *pcity);
-
/**************************************************************************
...
**************************************************************************/
@@ -618,7 +616,7 @@
/**************************************************************************
...
**************************************************************************/
-static void advisor_choose_build(struct player *pplayer, struct city *pcity)
+void advisor_choose_build(struct player *pplayer, struct city *pcity)
{
struct ai_choice choice;
int id=-1;
Index: server/cityturn.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.h,v
retrieving revision 1.29
diff -u -r1.29 cityturn.h
--- server/cityturn.h 7 Aug 2003 21:28:26 -0000 1.29
+++ server/cityturn.h 8 Sep 2003 14:43:07 -0000
@@ -36,5 +36,7 @@
void remove_obsolete_buildings_city(struct city *pcity, bool refresh);
void remove_obsolete_buildings(struct player *pplayer);
+void advisor_choose_build(struct player *pplayer, struct city *pcity);
+
void nullify_prechange_production(struct city *pcity);
#endif /* FC__CITYTURN_H */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Received cities do not produce illegal units (PR#2405),
Per I. Mathisen <=
|
|