Follow-up Comment #1, patch #1659 (project freeciv):

Notice here that the code before and after don't do the same thing; TC_LAST
is a valid value since it is defined in the enumeration like the others. The
new code will consider 'TC_LAST' to be the name of a valid terrain class.

I have not confirmed this, but TC_LAST is a sentinel value that was used to
signal invalid values; now this is handled differently in specenum and
because of this, TC_LAST is no longer needed? Or is it needed to be around
for other reasons (compatibility?).

specenum's terrain_class_max() function should be able to replace the *_LAST
value's use when the value is needed.


diff --git a/common/requirements.c b/common/requirements.c
index dea01d1..e4cc887 100644
--- a/common/requirements.c
+++ b/common/requirements.c
@@ -133,8 +133,8 @@ struct universal universal_by_rule_name(const char
*kind,
     }
     break;
   case VUT_TERRAINCLASS:
-    source.value.terrainclass = find_terrain_class_by_rule_name(value);
-    if (source.value.terrainclass != TC_LAST) {
+    source.value.terrainclass = terrain_class_by_name(value, strcmp);
+    if (terrain_class_is_valid(source.value.terrainclass)) {
       return source;
     }
     break;


    _______________________________________________________

Reply to this item at:

  <http://gna.org/patch/?1659>

_______________________________________________
  Meddelandet skickades via/av Gna!
  http://gna.org/


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

Reply via email to