From 127d2b51ea9deb5d7101147e19eaa4a94ffdd584 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Fri, 3 May 2024 15:24:58 +0300
Subject: [PATCH 35/59] Generate enum impr_flag_id by generate_enums.py

See RM #532

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 common/fc_types.h                    | 30 +---------------------------
 gen_headers/enums/Makefile.am        |  2 ++
 gen_headers/enums/fc_types_enums.def | 28 ++++++++++++++++++++++++++
 meson.build                          |  1 +
 4 files changed, 32 insertions(+), 29 deletions(-)
 create mode 100644 gen_headers/enums/fc_types_enums.def

diff --git a/common/fc_types.h b/common/fc_types.h
index bc57a5d599..9571aa86c3 100644
--- a/common/fc_types.h
+++ b/common/fc_types.h
@@ -653,35 +653,7 @@ const char *ai_level_name_update_cb(const char *old);
 #define SPECENUM_COUNT  IG_COUNT
 #include "specenum_gen.h"
 
-/* Used in the network protocol. */
-#define SPECENUM_NAME impr_flag_id
-/* Improvement should be visible to others without spying */
-#define SPECENUM_VALUE0 IF_VISIBLE_BY_OTHERS
-#define SPECENUM_VALUE0NAME "VisibleByOthers"
-/* This small wonder is moved to another city if game.savepalace is on. */
-#define SPECENUM_VALUE1 IF_SAVE_SMALL_WONDER
-#define SPECENUM_VALUE1NAME "SaveSmallWonder"
-/* When built, gives gold */
-#define SPECENUM_VALUE2 IF_GOLD
-#define SPECENUM_VALUE2NAME "Gold"
-/* Never destroyed by disasters */
-#define SPECENUM_VALUE3 IF_DISASTER_PROOF
-#define SPECENUM_VALUE3NAME "DisasterProof"
-/* Never destroyed by a surgical strike */
-#define SPECENUM_VALUE4 IF_INDESTRUCTIBLE
-#define SPECENUM_VALUE4NAME "Indestructible"
-#define SPECENUM_VALUE5 IF_USER_FLAG_1
-#define SPECENUM_VALUE6 IF_USER_FLAG_2
-#define SPECENUM_VALUE7 IF_USER_FLAG_3
-#define SPECENUM_VALUE8 IF_USER_FLAG_4
-#define SPECENUM_VALUE9 IF_USER_FLAG_5
-#define SPECENUM_VALUE10 IF_USER_FLAG_6
-#define SPECENUM_VALUE11 IF_USER_FLAG_7
-#define SPECENUM_VALUE12 IF_USER_FLAG_8
-#define SPECENUM_COUNT IF_COUNT
-#define SPECENUM_NAMEOVERRIDE
-#define SPECENUM_BITVECTOR bv_impr_flags
-#include "specenum_gen.h"
+#include "fc_types_enums_gen.h"
 
 #define IF_LAST_USER_FLAG IF_USER_FLAG_8
 #define MAX_NUM_USER_BUILDING_FLAGS (IF_LAST_USER_FLAG - IF_USER_FLAG_1 + 1)
diff --git a/gen_headers/enums/Makefile.am b/gen_headers/enums/Makefile.am
index 8de50edff9..27e8b0f9c7 100644
--- a/gen_headers/enums/Makefile.am
+++ b/gen_headers/enums/Makefile.am
@@ -3,12 +3,14 @@
 ENUMS_GEN = \
 		actions_enums_gen.h	\
 		effects_enums_gen.h	\
+		fc_types_enums_gen.h	\
 		manual_enums_gen.h	\
 		terrain_enums_gen.h
 
 EXTRA_DIST = \
 		actions_enums.def	\
 		effects_enums.def	\
+		fc_types_enums.def	\
 		manual_enums.def	\
 		terrain_enums.def	\
 		$(ENUMS_GEN)
diff --git a/gen_headers/enums/fc_types_enums.def b/gen_headers/enums/fc_types_enums.def
new file mode 100644
index 0000000000..48713c2164
--- /dev/null
+++ b/gen_headers/enums/fc_types_enums.def
@@ -0,0 +1,28 @@
+# Specenum definitions for common/fc_types.h
+# See gen_headers/generate_enums.py for syntax
+
+/* Used in the network protocol. */
+enum impr_flag_id
+  prefix IF_
+  name-override
+  bitvector bv_impr_flags
+  count
+values
+  VISIBLE_BY_OTHERS  "VisibleByOthers"
+  SAVE_SMALL_WONDER  "SaveSmallWonder"
+  /* When built, gives gold */
+  GOLD               "Gold"
+  /* Never destroyed by disasters */
+  DISASTER_PROOF     "DisasterProof"
+  /* Never destroyed by a surgical strike */
+  INDESTRUCTIBLE     "Indestructible"
+
+  USER_FLAG_1
+  USER_FLAG_2
+  USER_FLAG_3
+  USER_FLAG_4
+  USER_FLAG_5
+  USER_FLAG_6
+  USER_FLAG_7
+  USER_FLAG_8
+end
diff --git a/meson.build b/meson.build
index 3a865fdcb3..bdfd057d20 100644
--- a/meson.build
+++ b/meson.build
@@ -1104,6 +1104,7 @@ enum_defs = {
   'common': {
     'actions_enums': ['actions_enums.def', 'actions_enums_gen.h'],
     'effects_enums': ['effects_enums.def', 'effects_enums_gen.h'],
+    'fc_types_enums': ['fc_types_enums.def', 'fc_types_enums_gen.h'],
     'terrain_enums': ['terrain_enums.def', 'terrain_enums_gen.h'],
   },
   'manual': {
-- 
2.43.0

