Author: cazfi
Date: Mon Dec 28 21:21:44 2015
New Revision: 31245

URL: http://svn.gna.org/viewcvs/freeciv?rev=31245&view=rev
Log:
Support numbers beginning with '+' sign in section files.

See patch #6729

Modified:
    trunk/utility/inputfile.c
    trunk/utility/section_file.c

Modified: trunk/utility/inputfile.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/inputfile.c?rev=31245&r1=31244&r2=31245&view=diff
==============================================================================
--- trunk/utility/inputfile.c   (original)
+++ trunk/utility/inputfile.c   Mon Dec 28 21:21:44 2015
@@ -791,16 +791,16 @@
     return NULL;
   }
 
-  if (*c == '-' || fc_isdigit(*c)) {
+  if (*c == '-' || *c == '+' || fc_isdigit(*c)) {
     /* a number: */
     start = c++;
-    while(*c != '\0' && fc_isdigit(*c)) {
+    while (*c != '\0' && fc_isdigit(*c)) {
       c++;
     }
     if (*c == '.') {
       /* Float maybe */
       c++;
-      while(*c != '\0' && fc_isdigit(*c)) {
+      while (*c != '\0' && fc_isdigit(*c)) {
         c++;
       }
     }

Modified: trunk/utility/section_file.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/section_file.c?rev=31245&r1=31244&r2=31245&view=diff
==============================================================================
--- trunk/utility/section_file.c        (original)
+++ trunk/utility/section_file.c        Mon Dec 28 21:21:44 2015
@@ -185,7 +185,7 @@
     return TRUE;
   }
 
-  if (fc_isdigit(tok[0]) || ('-' == tok[0] && fc_isdigit(tok[1]))) {
+  if (fc_isdigit(tok[0]) || (('-' == tok[0] || '+' == tok[0]) && 
fc_isdigit(tok[1]))) {
     float fvalue;
 
     if (str_to_float(tok, &fvalue)) {


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

Reply via email to