Merge branch 'master' into jgrpp

# Conflicts:
#	src/fileio.cpp
#	src/group_gui.cpp
#	src/industry.h
#	src/lang/korean.txt
#	src/linkgraph/linkgraphjob.cpp
#	src/linkgraph/linkgraphjob.h
#	src/linkgraph/linkgraphschedule.cpp
#	src/linkgraph/linkgraphschedule.h
#	src/openttd.cpp
#	src/saveload/saveload.cpp
#	src/saveload/saveload.h
#	src/town_cmd.cpp
#	src/vehicle_gui.cpp
#	src/vehicle_gui_base.h
This commit is contained in:
Jonathan G Rennison
2021-01-30 18:27:25 +00:00
102 changed files with 1870 additions and 1765 deletions

View File

@@ -40,20 +40,10 @@ GameInfo *GameScannerInfo::FindInfo(const char *nameParam, int versionParam, boo
strecpy(game_name, nameParam, lastof(game_name));
strtolower(game_name);
GameInfo *info = nullptr;
int version = -1;
if (versionParam == -1) {
/* We want to load the latest version of this Game script; so find it */
if (this->info_single_list.find(game_name) != this->info_single_list.end()) return static_cast<GameInfo *>(this->info_single_list[game_name]);
/* If we didn't find a match Game script, maybe the user included a version */
char *e = strrchr(game_name, '.');
if (e == nullptr) return nullptr;
*e = '\0';
e++;
versionParam = atoi(e);
/* Continue like we were calling this function with a version. */
return nullptr;
}
if (force_exact_match) {
@@ -62,15 +52,18 @@ GameInfo *GameScannerInfo::FindInfo(const char *nameParam, int versionParam, boo
seprintf(game_name_tmp, lastof(game_name_tmp), "%s.%d", game_name, versionParam);
strtolower(game_name_tmp);
if (this->info_list.find(game_name_tmp) != this->info_list.end()) return static_cast<GameInfo *>(this->info_list[game_name_tmp]);
return nullptr;
}
GameInfo *info = nullptr;
int version = -1;
/* See if there is a compatible Game script which goes by that name, with the highest
* version which allows loading the requested version */
ScriptInfoList::iterator it = this->info_list.begin();
for (; it != this->info_list.end(); it++) {
GameInfo *i = static_cast<GameInfo *>((*it).second);
for (const auto &item : this->info_list) {
GameInfo *i = static_cast<GameInfo *>(item.second);
if (strcasecmp(game_name, i->GetName()) == 0 && i->CanLoadFromVersion(versionParam) && (version == -1 || i->GetVersion() > version)) {
version = (*it).second->GetVersion();
version = item.second->GetVersion();
info = i;
}
}
@@ -103,8 +96,8 @@ GameLibrary *GameScannerLibrary::FindLibrary(const char *library, int version)
strtolower(library_name);
/* Check if the library + version exists */
ScriptInfoList::iterator iter = this->info_list.find(library_name);
if (iter == this->info_list.end()) return nullptr;
ScriptInfoList::iterator it = this->info_list.find(library_name);
if (it == this->info_list.end()) return nullptr;
return static_cast<GameLibrary *>((*iter).second);
return static_cast<GameLibrary *>((*it).second);
}