Author: cazfi
Date: Thu Aug 18 10:44:35 2016
New Revision: 33641

URL: http://svn.gna.org/viewcvs/freeciv?rev=33641&view=rev
Log:
Added government requirement type value editing.

See patch #7615

Modified:
    trunk/common/government.c
    trunk/common/government.h
    trunk/tools/ruledit/tab_misc.cpp
    trunk/tools/ruledit/univ_value.c

Modified: trunk/common/government.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/government.c?rev=33641&r1=33640&r2=33641&view=diff
==============================================================================
--- trunk/common/government.c   (original)
+++ trunk/common/government.c   Thu Aug 18 10:44:35 2016
@@ -493,6 +493,7 @@
                                 NULL, NULL, NULL, ruler_title_destroy);
   requirement_vector_init(&pgovern->reqs);
   pgovern->changed_to_times = 0;
+  pgovern->disabled = FALSE;
 }
 
 /****************************************************************************

Modified: trunk/common/government.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/government.h?rev=33641&r1=33640&r2=33641&view=diff
==============================================================================
--- trunk/common/government.h   (original)
+++ trunk/common/government.h   Thu Aug 18 10:44:35 2016
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/***********************************************************************
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -52,6 +52,7 @@
 struct government {
   Government_type_id item_number;
   struct name_translation name;
+  bool disabled;
   char graphic_str[MAX_LEN_NAME];
   char graphic_alt[MAX_LEN_NAME];
   struct requirement_vector reqs;
@@ -119,6 +120,14 @@
                   NAME_pgov, government_iter_sizeof, government_iter_init)
 #define governments_iterate_end generic_iterate_end
 
+#define governments_active_iterate(_p)                                  \
+  governments_iterate(_p) {                                             \
+    if (!_p->disabled) {
+
+#define governments_active_iterate_end                                  \
+    }                                                                   \
+  } governments_iterate_end;
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */

Modified: trunk/tools/ruledit/tab_misc.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_misc.cpp?rev=33641&r1=33640&r2=33641&view=diff
==============================================================================
--- trunk/tools/ruledit/tab_misc.cpp    (original)
+++ trunk/tools/ruledit/tab_misc.cpp    Thu Aug 18 10:44:35 2016
@@ -31,6 +31,7 @@
 
 // common
 #include "game.h"
+#include "government.h"
 
 // server
 #include "rssanity.h"
@@ -270,7 +271,13 @@
   stats->item(row++, 4)->setText(QString::number(game.control.nation_count));
   stats->item(row++, 4)->setText(QString::number(game.control.styles_count));
   stats->item(row++, 
4)->setText(QString::number(game.control.num_specialist_types));
-  stats->item(row++, 
4)->setText(QString::number(game.control.government_count));
+
+  count = 0;
+  governments_active_iterate(pgov) {
+    count++;
+  } governments_active_iterate_end;
+  stats->item(row++, 4)->setText(QString::number(count));
+
   stats->item(row++, 
4)->setText(QString::number(game.control.num_disaster_types));
 
   // Third column

Modified: trunk/tools/ruledit/univ_value.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/univ_value.c?rev=33641&r1=33640&r2=33641&view=diff
==============================================================================
--- trunk/tools/ruledit/univ_value.c    (original)
+++ trunk/tools/ruledit/univ_value.c    Thu Aug 18 10:44:35 2016
@@ -18,6 +18,7 @@
 /* common */
 #include "achievements.h"
 #include "game.h"
+#include "government.h"
 #include "requirements.h"
 #include "specialist.h"
 #include "tech.h"
@@ -33,7 +34,6 @@
 ************************************************************************/
 bool universal_value_initial(struct universal *src)
 {
-  /* TODO: Implement really */
   switch (src->kind) {
   case VUT_NONE:
     /* Value of None should never be used */
@@ -215,6 +215,11 @@
     advance_active_iterate(padv) {
       cb(advance_rule_name(padv), univ->value.advance == padv, data);
     } advance_active_iterate_end;
+    break;
+  case VUT_GOVERNMENT:
+    governments_active_iterate(pgov) {
+      cb(government_rule_name(pgov), univ->value.govern == pgov, data);
+    } governments_active_iterate_end;
     break;
   case VUT_MINSIZE:
   case VUT_MINYEAR:


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

Reply via email to