From e8b643ce46f7ef622b53d3c606c658eb257d5f7b Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 4 May 2024 14:14:35 +0300
Subject: [PATCH 68/68] Ruledit: Clear helptext of newly initialized objects

See RM #550

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 tools/ruledit/tab_building.cpp   | 3 +++
 tools/ruledit/tab_counters.cpp   | 3 +++
 tools/ruledit/tab_extras.cpp     | 3 +++
 tools/ruledit/tab_good.cpp       | 3 +++
 tools/ruledit/tab_gov.cpp        | 3 +++
 tools/ruledit/tab_multiplier.cpp | 3 +++
 tools/ruledit/tab_tech.cpp       | 3 +++
 tools/ruledit/tab_terrains.cpp   | 3 +++
 tools/ruledit/tab_unit.cpp       | 3 +++
 9 files changed, 27 insertions(+)

diff --git a/tools/ruledit/tab_building.cpp b/tools/ruledit/tab_building.cpp
index 49290f97f1..2917861f33 100644
--- a/tools/ruledit/tab_building.cpp
+++ b/tools/ruledit/tab_building.cpp
@@ -236,6 +236,9 @@ bool tab_building::initialize_new_bldg(struct impr_type *pimpr)
 
   name_set(&(pimpr->name), 0, "New Building");
   BV_CLR_ALL(pimpr->flags);
+  if (pimpr->helptext != nullptr) {
+    strvec_clear(pimpr->helptext);
+  }
 
   return true;
 }
diff --git a/tools/ruledit/tab_counters.cpp b/tools/ruledit/tab_counters.cpp
index 35a44ad2da..bccc70f078 100644
--- a/tools/ruledit/tab_counters.cpp
+++ b/tools/ruledit/tab_counters.cpp
@@ -320,6 +320,9 @@ bool tab_counter::initialize_new_counter(struct counter *counter)
   counter->ruledit_disabled = FALSE;
 
   name_set(&counter->name, 0, "New counter");
+  if (counter->helptext != nullptr) {
+    strvec_clear(counter->helptext);
+  }
 
   return true;
 }
diff --git a/tools/ruledit/tab_extras.cpp b/tools/ruledit/tab_extras.cpp
index f1d9e22687..6d4181a3c3 100644
--- a/tools/ruledit/tab_extras.cpp
+++ b/tools/ruledit/tab_extras.cpp
@@ -239,6 +239,9 @@ bool tab_extras::initialize_new_extra(struct extra_type *pextra)
 
   name_set(&(pextra->name), 0, "New Extra");
   BV_CLR_ALL(pextra->flags);
+  if (pextra->helptext != nullptr) {
+    strvec_clear(pextra->helptext);
+  }
 
   return true;
 }
diff --git a/tools/ruledit/tab_good.cpp b/tools/ruledit/tab_good.cpp
index d1bf2bddc3..46c300e2c3 100644
--- a/tools/ruledit/tab_good.cpp
+++ b/tools/ruledit/tab_good.cpp
@@ -229,6 +229,9 @@ bool tab_good::initialize_new_good(struct goods_type *pgood)
 
   name_set(&(pgood->name), 0, "New Good");
   BV_CLR_ALL(pgood->flags);
+  if (pgood->helptext != nullptr) {
+    strvec_clear(pgood->helptext);
+  }
 
   return true;
 }
diff --git a/tools/ruledit/tab_gov.cpp b/tools/ruledit/tab_gov.cpp
index e2c38ece23..7f5086c6eb 100644
--- a/tools/ruledit/tab_gov.cpp
+++ b/tools/ruledit/tab_gov.cpp
@@ -228,6 +228,9 @@ bool tab_gov::initialize_new_gov(struct government *pgov)
   }
 
   name_set(&(pgov->name), 0, "New Government");
+  if (pgov->helptext != nullptr) {
+    strvec_clear(pgov->helptext);
+  }
 
   return true;
 }
diff --git a/tools/ruledit/tab_multiplier.cpp b/tools/ruledit/tab_multiplier.cpp
index 51fe4158e6..e2e924fa76 100644
--- a/tools/ruledit/tab_multiplier.cpp
+++ b/tools/ruledit/tab_multiplier.cpp
@@ -223,6 +223,9 @@ bool tab_multiplier::initialize_new_multiplier(struct multiplier *pmul)
   }
 
   name_set(&(pmul->name), 0, "New Multiplier");
+  if (pmul->helptext != nullptr) {
+    strvec_clear(pmul->helptext);
+  }
 
   return true;
 }
diff --git a/tools/ruledit/tab_tech.cpp b/tools/ruledit/tab_tech.cpp
index 5e13d80e85..9d31dc0538 100644
--- a/tools/ruledit/tab_tech.cpp
+++ b/tools/ruledit/tab_tech.cpp
@@ -415,6 +415,9 @@ bool tab_tech::initialize_new_tech(struct advance *padv)
   padv->require[AR_ROOT] = none;
   name_set(&(padv->name), 0, "New Tech");
   BV_CLR_ALL(padv->flags);
+  if (padv->helptext != nullptr) {
+    strvec_clear(padv->helptext);
+  }
 
   return true;
 }
diff --git a/tools/ruledit/tab_terrains.cpp b/tools/ruledit/tab_terrains.cpp
index 7c4522f724..ebd269cb3d 100644
--- a/tools/ruledit/tab_terrains.cpp
+++ b/tools/ruledit/tab_terrains.cpp
@@ -235,6 +235,9 @@ bool tab_terrains::initialize_new_terrain(struct terrain *pterr)
 
   name_set(&(pterr->name), 0, "New Terrain");
   BV_CLR_ALL(pterr->flags);
+  if (pterr->helptext != nullptr) {
+    strvec_clear(pterr->helptext);
+  }
 
   return true;
 }
diff --git a/tools/ruledit/tab_unit.cpp b/tools/ruledit/tab_unit.cpp
index 47a3f8dff9..57fc3d8137 100644
--- a/tools/ruledit/tab_unit.cpp
+++ b/tools/ruledit/tab_unit.cpp
@@ -252,6 +252,9 @@ bool tab_unit::initialize_new_utype(struct unit_type *ptype)
 
   name_set(&(ptype->name), 0, "New Unit");
   BV_CLR_ALL(ptype->flags);
+  if (ptype->helptext != nullptr) {
+    strvec_clear(ptype->helptext);
+  }
 
   return true;
 }
-- 
2.43.0

