Changeset - r9447:7deae5a276a3
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2008-06-02 23:01:57
rubidium@openttd.org
(svn r13365) -Fix: don't segfault on trying to set a non-existing patch setting.
1 file changed with 1 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/settings.cpp
Show inline comments
 
@@ -2223,24 +2223,25 @@ const SettingDesc *GetPatchFromName(cons
 
	return NULL;
 
}
 

	
 
/* Those 2 functions need to be here, else we have to make some stuff non-static
 
 * and besides, it is also better to keep stuff like this at the same place */
 
void IConsoleSetPatchSetting(const char *name, const char *value)
 
{
 
	uint index;
 
	const SettingDesc *sd = GetPatchFromName(name, &index);
 

	
 
	if (sd == NULL) {
 
		IConsolePrintF(CC_WARNING, "'%s' is an unknown patch setting.", name);
 
		return;
 
	}
 

	
 
	bool success;
 
	if (sd->desc.cmd == SDT_STRING) {
 
		success = SetPatchValue(index, value);
 
	} else {
 
		uint32 val;
 
		extern bool GetArgumentInteger(uint32 *value, const char *arg);
 
		success = GetArgumentInteger(&val, value);
 
		if (success) success = SetPatchValue(index, val);
 
	}
 

	
0 comments (0 inline, 0 general)