Author: sveinung
Date: Sun Feb 28 01:37:01 2016
New Revision: 32101

URL: http://svn.gna.org/viewcvs/freeciv?rev=32101&view=rev
Log:
Free user unit class flags.

Clean up user unit class flags when unloading a ruleset. This prevents them
from being seen as a part of the next ruleset loaded.

See bug #24453

Modified:
    trunk/common/game.c
    trunk/common/unittype.c
    trunk/common/unittype.h

Modified: trunk/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/game.c?rev=32101&r1=32100&r2=32101&view=diff
==============================================================================
--- trunk/common/game.c (original)
+++ trunk/common/game.c Sun Feb 28 01:37:01 2016
@@ -575,6 +575,7 @@
   nations_free();
   unit_types_free();
   unit_type_flags_free();
+  unit_class_flags_free();
   role_unit_precalcs_free();
   improvements_free();
   goods_free();

Modified: trunk/common/unittype.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unittype.c?rev=32101&r1=32100&r2=32101&view=diff
==============================================================================
--- trunk/common/unittype.c     (original)
+++ trunk/common/unittype.c     Sun Feb 28 01:37:01 2016
@@ -1613,6 +1613,18 @@
 
   for (i = 0; i < MAX_NUM_USER_UNIT_FLAGS; i++) {
     user_flag_free(&user_type_flags[i]);
+  }
+}
+
+/***************************************************************
+  Frees the memory associated with all unit class flags
+***************************************************************/
+void unit_class_flags_free(void)
+{
+  int i;
+
+  for (i = 0; i < MAX_NUM_USER_UCLASS_FLAGS; i++) {
+    user_flag_free(&user_class_flags[i]);
   }
 }
 

Modified: trunk/common/unittype.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unittype.h?rev=32101&r1=32100&r2=32101&view=diff
==============================================================================
--- trunk/common/unittype.h     (original)
+++ trunk/common/unittype.h     Sun Feb 28 01:37:01 2016
@@ -724,6 +724,7 @@
 void unit_types_init(void);
 void unit_types_free(void);
 void unit_type_flags_free(void);
+void unit_class_flags_free(void);
 
 struct unit_type *unit_type_array_first(void);
 const struct unit_type *unit_type_array_last(void);


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

Reply via email to