Author: sveinung Date: Tue Sep 15 13:57:09 2015 New Revision: 29894 URL: http://svn.gna.org/viewcvs/freeciv?rev=29894&view=rev Log: section files: allow underscore in table names
Store in the table format even if the entity name contains an underscore character. This makes ruledit store the obsolete_by field of buildings and the actor_reqs and target_reqs fields of action enablers in a much more readable way. Reported by Marko Lindqvist <cazfi> See bug #21444 Modified: branches/S2_6/utility/registry_ini.c Modified: branches/S2_6/utility/registry_ini.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/utility/registry_ini.c?rev=29894&r1=29893&r2=29894&view=diff ============================================================================== --- branches/S2_6/utility/registry_ini.c (original) +++ branches/S2_6/utility/registry_ini.c Tue Sep 15 13:57:09 2015 @@ -595,6 +595,14 @@ } /************************************************************************** + Returns TRUE iff the character is legal in a table entry name. +**************************************************************************/ +static bool is_legal_table_entry_name(char c, bool num) +{ + return (num ? fc_isalnum(c) : fc_isalpha(c)) || c == '_'; +} + +/************************************************************************** Save the previously filled in section_file to disk. There is now limited ability to save in the new tabular format @@ -684,17 +692,17 @@ sz_strlcpy(pentry_name, entry_name(pentry)); c = first = pentry_name; - if (*c == '\0' || !fc_isalpha(*c)) { + if (*c == '\0' || !is_legal_table_entry_name(*c, FALSE)) { break; } - for (; *c != '\0' && fc_isalpha(*c); c++) { + for (; *c != '\0' && is_legal_table_entry_name(*c, FALSE); c++) { /* nothing */ } if (0 != strncmp(c, "0.", 2)) { break; } c += 2; - if (*c == '\0' || !fc_isalnum(*c)) { + if (*c == '\0' || !is_legal_table_entry_name(*c, TRUE)) { break; } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits