[Freeciv-Dev] [patch #1659] use specenum_gen for enum terrain_class and enum terrain_alteration

2010-06-30 Thread Matthias Pfafferodt

Update of patch #1659 (project freeciv):

  Status:  Ready For Test = Done   
 Open/Closed:Open = Closed 


___

Reply to this item at:

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

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1659] use specenum_gen for enum terrain_class and enum terrain_alteration

2010-06-09 Thread Matthias Pfafferodt

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

update (08/10)

(file #9287)
___

Additional Item Attachment:

File name:
20100609-08-trunk-use-specenum_gen-for-enum-terrain_class-and-enum-ter.patch
Size:10 KB


___

Reply to this item at:

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

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1659] use specenum_gen for enum terrain_class and enum terrain_alteration

2010-05-04 Thread Matthias Pfafferodt

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

 Static arrays cannot use a function. Maybe there is a simple way to add a
SPECENUM_LAST value?

Would something like the following work? I don't know if this is OK for
bitwise definitions. Or should it only be defined if !bitwise?


#define SPECNUM_LAST (SPECNUM_MAX + 1)


___

Reply to this item at:

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

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1659] use specenum_gen for enum terrain_class and enum terrain_alteration

2010-05-04 Thread pepeto

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

SPECENUM_LAST doesn't make sense for bitwise definitions. There maybe a
SPECENUM_MASK would be required in some case, but it seems a bit more complex
to implement.


___

Reply to this item at:

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

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1659] use specenum_gen for enum terrain_class and enum terrain_alteration

2010-05-03 Thread Matthias Pfafferodt

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

Yes; I did notice this at the time I send the patches. I will add the needed
checks. Most of the time the *_LAST value is needed for the definition of
arrays (see network code). Or could  enum_class_max() be used there?

___

Reply to this item at:

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

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1659] use specenum_gen for enum terrain_class and enum terrain_alteration

2010-05-03 Thread pepeto

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

Static arrays cannot use a function. Maybe there is a simple way to add a
SPECENUM_LAST value?


___

Reply to this item at:

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

___
  Message posté via/par Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1659] use specenum_gen for enum terrain_class and enum terrain_alteration

2010-05-02 Thread Matthias Pfafferodt

URL:
  http://gna.org/patch/?1659

 Summary: use specenum_gen for enum terrain_class and enum
terrain_alteration
 Project: Freeciv
Submitted by: syntron
Submitted on: Sonntag 02.05.2010 um 23:35
Category: general
Priority: 3 - Low
  Status: Ready For Test
 Privacy: Public
 Assigned to: syntron
Originator Email: 
 Open/Closed: Open
 Discussion Lock: Any
 Planned Release: 2.3.0

___

Details:





___

File Attachments:


---
Date: Sonntag 02.05.2010 um 23:35  Name:
20100502-07-trunk-use-specenum_gen-for-enum-terrain_class-and-enum-ter.patch 
Size: 8kB   By: syntron

http://gna.org/patch/download.php?file_id=9115

___

Reply to this item at:

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

___
  Nachricht geschickt von/durch Gna!
  http://gna.org/


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


[Freeciv-Dev] [patch #1659] use specenum_gen for enum terrain_class and enum terrain_alteration

2010-05-02 Thread Ulrik Sverdrup

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