mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r16738) -Codechange: Remove casting away constness by changing the text before storing.
This commit is contained in:
parent
7d90c06eb9
commit
c7c422465a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user