Author: sveinung
Date: Wed Apr 29 14:50:51 2015
New Revision: 28944

URL: http://svn.gna.org/viewcvs/freeciv?rev=28944&view=rev
Log:
ruledit: Don't upgrade "Have_Embassies" when editing post 2.6 rulesets.

Freeciv 3.0 splits the "Have_Contacts" effect out from the "Have_Embassies"
effect. A matching "Have_Contacts" effect should therefore be added for each
"Have_Embassies" effect when loading a 2.6 ruleset. Stop doing it when
loading rulesets for versions where the effect already is split.

See bug #23547

Modified:
    trunk/server/rscompat.c

Modified: trunk/server/rscompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rscompat.c?rev=28944&r1=28943&r2=28944&view=diff
==============================================================================
--- trunk/server/rscompat.c     (original)
+++ trunk/server/rscompat.c     Wed Apr 29 14:50:51 2015
@@ -177,11 +177,15 @@
 **************************************************************************/
 static bool effect_list_compat_cb(struct effect *peffect, void *data)
 {
-  if (peffect->type == EFT_HAVE_EMBASSIES) {
-    /* Create "Have_Contacts" effect matching each "Have_Embassies" */
-    struct effect *contacts = effect_copy(peffect);
-
-    contacts->type = EFT_HAVE_CONTACTS;
+  struct rscompat_info *info = (struct rscompat_info *)data;
+
+  if (info->ver_effects < 10) {
+    if (peffect->type == EFT_HAVE_EMBASSIES) {
+      /* Create "Have_Contacts" effect matching each "Have_Embassies" */
+      struct effect *contacts = effect_copy(peffect);
+
+      contacts->type = EFT_HAVE_CONTACTS;
+    }
   }
 
   /* Go to the next effect. */
@@ -280,7 +284,8 @@
                                             "Enter Marketplace"));
   }
 
-  iterate_effect_cache(effect_list_compat_cb, NULL);
+  /* Upgrade existing effects. */
+  iterate_effect_cache(effect_list_compat_cb, info);
 }
 
 /**************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to