equal
deleted
inserted
replaced
2072 len -= generic ? 6 : 5; |
2072 len -= generic ? 6 : 5; |
2073 |
2073 |
2074 for (; id < endid && len > 0; id++) { |
2074 for (; id < endid && len > 0; id++) { |
2075 size_t ofs = strlen(name) + 1; |
2075 size_t ofs = strlen(name) + 1; |
2076 |
2076 |
2077 if (ofs < 128) { |
2077 if (ofs == 1) { |
|
2078 grfmsg(7, "FeatureNewName: Can't add empty name"); |
|
2079 } else if (ofs > 127) { |
|
2080 grfmsg(7, "FeatureNewName: Too long a name (%d)", ofs); |
|
2081 } else { |
2078 grfmsg(8, "FeatureNewName: %d <- %s", id, name); |
2082 grfmsg(8, "FeatureNewName: %d <- %s", id, name); |
2079 |
2083 |
2080 switch (feature) { |
2084 switch (feature) { |
2081 case GSF_TRAIN: |
2085 case GSF_TRAIN: |
2082 case GSF_ROAD: |
2086 case GSF_ROAD: |
2140 break; |
2144 break; |
2141 default : |
2145 default : |
2142 grfmsg(7, "FeatureNewName: Unsupported feature (0x%02X)", feature); |
2146 grfmsg(7, "FeatureNewName: Unsupported feature (0x%02X)", feature); |
2143 break; |
2147 break; |
2144 #endif |
2148 #endif |
2145 } |
|
2146 } else { |
|
2147 /* ofs is the string length + 1, so if the string is empty, ofs |
|
2148 * is 1 */ |
|
2149 if (ofs == 1) { |
|
2150 grfmsg(7, "FeatureNewName: Can't add empty name"); |
|
2151 } else { |
|
2152 grfmsg(7, "FeatureNewName: Too long a name (%d)", ofs); |
|
2153 } |
2149 } |
2154 } |
2150 } |
2155 name += ofs; |
2151 name += ofs; |
2156 len -= (int)ofs; |
2152 len -= (int)ofs; |
2157 } |
2153 } |