summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-02-17 23:01:42 +0000
committermaedhros <maedhros@openttd.org>2007-02-17 23:01:42 +0000
commit3c5eb8458a0f56fdc7eb7574e96e30e4431a2c67 (patch)
tree89bd3598f7b054c33ebf944bbd2d3ac92ff2cc54
parentc810aef43bf44e125f528e7ec336372380f6748d (diff)
downloadopenttd-3c5eb8458a0f56fdc7eb7574e96e30e4431a2c67.tar.xz
(svn r8792) -Fix (r6623): Don't check whether a string length is 1 when you already know it isn't.
-rw-r--r--src/newgrf.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index e1ba368b7..afaa760bc 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2074,7 +2074,11 @@ static void FeatureNewName(byte *buf, int len)
for (; id < endid && len > 0; id++) {
size_t ofs = strlen(name) + 1;
- if (ofs < 128) {
+ if (ofs == 1) {
+ grfmsg(7, "FeatureNewName: Can't add empty name");
+ } else if (ofs > 127) {
+ grfmsg(7, "FeatureNewName: Too long a name (%d)", ofs);
+ } else {
grfmsg(8, "FeatureNewName: %d <- %s", id, name);
switch (feature) {
@@ -2143,14 +2147,6 @@ static void FeatureNewName(byte *buf, int len)
break;
#endif
}
- } else {
- /* ofs is the string length + 1, so if the string is empty, ofs
- * is 1 */
- if (ofs == 1) {
- grfmsg(7, "FeatureNewName: Can't add empty name");
- } else {
- grfmsg(7, "FeatureNewName: Too long a name (%d)", ofs);
- }
}
name += ofs;
len -= (int)ofs;