Changeset - r15240:5a6f41c42dfb
[Not reviewed]
master
0 1 0
rubidium - 14 years ago 2010-05-23 12:21:22
rubidium@openttd.org
(svn r19885) -Fix [FS#3761]: allow loading savegames from the console without specifying the ".sav" extension, i.e. make it consistent with saving savegames from the console
1 file changed with 12 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/console_cmds.cpp
Show inline comments
 
@@ -269,7 +269,18 @@ static const FiosItem *GetFiosItem(const
 
	int i = strtol(file, &endptr, 10);
 
	if (file == endptr || *endptr != '\0') i = -1;
 

	
 
	return IsInsideMM(i, 0, _fios_items.Length()) ? _fios_items.Get(i) : NULL;
 
	if (IsInsideMM(i, 0, _fios_items.Length())) return _fios_items.Get(i);
 

	
 
	/* As a last effort assume it is an OpenTTD savegame and
 
	 * that the ".sav" part was not given. */
 
	char long_file[MAX_PATH];
 
	seprintf(long_file, lastof(long_file), "%s.sav", file);
 
	for (const FiosItem *item = _fios_items.Begin(); item != _fios_items.End(); item++) {
 
		if (strcmp(long_file, item->name) == 0) return item;
 
		if (strcmp(long_file, item->title) == 0) return item;
 
	}
 

	
 
	return NULL;
 
}
 

	
 

	
0 comments (0 inline, 0 general)