summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2009-07-04 13:55:28 +0000
committeralberth <alberth@openttd.org>2009-07-04 13:55:28 +0000
commitc7c422465a4a272e1203d4b69a9836c8b5a2360a (patch)
treeeecd6645e6de9b5380a7d050cc6a5f3465680647
parent7d90c06eb9ef743668ac314d03b3ba1c1ff1d3e1 (diff)
downloadopenttd-c7c422465a4a272e1203d4b69a9836c8b5a2360a.tar.xz
(svn r16738) -Codechange: Remove casting away constness by changing the text before storing.
-rw-r--r--src/ai/ai_info.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp
index 2e6b052de..0ae9582ed 100644
--- a/src/ai/ai_info.cpp
+++ b/src/ai/ai_info.cpp
@@ -142,12 +142,13 @@ SQInteger AIInfo::AddSetting(HSQUIRRELVM vm)
if (strcmp(key, "name") == 0) {
const SQChar *sqvalue;
if (SQ_FAILED(sq_getstring(vm, -1, &sqvalue))) return SQ_ERROR;
- config.name = strdup(FS2OTTD(sqvalue));
+ char *name = strdup(FS2OTTD(sqvalue));
char *s;
/* Don't allow '=' and ',' in configure setting names, as we need those
* 2 chars to nicely store the settings as a string. */
- while ((s = (char *)strchr(config.name, '=')) != NULL) *s = '_';
- while ((s = (char *)strchr(config.name, ',')) != NULL) *s = '_';
+ while ((s = strchr(name, '=')) != NULL) *s = '_';
+ while ((s = strchr(name, ',')) != NULL) *s = '_';
+ config.name = name;
items |= 0x001;
} else if (strcmp(key, "description") == 0) {
const SQChar *sqdescription;