Merge branch 'master' into jgrpp

# Conflicts:
#	src/articulated_vehicles.cpp
#	src/articulated_vehicles.h
#	src/base_media_base.h
#	src/base_media_func.h
#	src/build_vehicle_gui.cpp
#	src/dock_gui.cpp
#	src/main_gui.cpp
#	src/music_gui.cpp
#	src/network/network_chat_gui.cpp
#	src/network/network_content.cpp
#	src/newgrf.cpp
#	src/newgrf_roadstop.cpp
#	src/os/windows/string_uniscribe.h
#	src/os/windows/win32.cpp
#	src/rail_gui.cpp
#	src/road.cpp
#	src/road_gui.cpp
#	src/settings.cpp
#	src/settings_gui.cpp
#	src/smallmap_gui.cpp
#	src/strings.cpp
#	src/terraform_gui.cpp
#	src/tests/test_script_admin.cpp
#	src/tests/test_window_desc.cpp
#	src/timer/timer_game_calendar.h
#	src/vehicle.cpp
#	src/vehicle_base.h
#	src/viewport.cpp
#	src/widget_type.h
#	src/window.cpp
#	src/window_gui.h
This commit is contained in:
Jonathan G Rennison
2023-11-29 20:32:54 +00:00
154 changed files with 1094 additions and 798 deletions

View File

@@ -197,6 +197,9 @@ bool BaseMedia<Tbase_set>::AddFile(const std::string &filename, size_t basepath_
*prev = set;
set->next = duplicate->next;
/* Keep baseset configuration, if compatible */
set->CopyCompatibleConfig(*duplicate);
/* If the duplicate set is currently used (due to rescanning this can happen)
* update the currently used set to the new one. This will 'lie' about the
* version number until a new game is started which isn't a big problem */
@@ -225,25 +228,58 @@ bool BaseMedia<Tbase_set>::AddFile(const std::string &filename, size_t basepath_
return ret;
}
/**
* Set the set to be used.
* @param set the set to use
* @return true if it could be loaded
*/
template <class Tbase_set>
/* static */ bool BaseMedia<Tbase_set>::SetSet(const Tbase_set *set)
{
if (set == nullptr) {
if (!BaseMedia<Tbase_set>::DetermineBestSet()) return false;
} else {
BaseMedia<Tbase_set>::used_set = set;
}
CheckExternalFiles();
return true;
}
/**
* Set the set to be used.
* @param name of the set to use
* @return true if it could be loaded
*/
template <class Tbase_set>
/* static */ bool BaseMedia<Tbase_set>::SetSet(const std::string &name)
/* static */ bool BaseMedia<Tbase_set>::SetSetByName(const std::string &name)
{
if (name.empty()) {
if (!BaseMedia<Tbase_set>::DetermineBestSet()) return false;
CheckExternalFiles();
return true;
return SetSet(nullptr);
}
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != nullptr; s = s->next) {
if (name == s->name) {
BaseMedia<Tbase_set>::used_set = s;
CheckExternalFiles();
return true;
return SetSet(s);
}
}
return false;
}
/**
* Set the set to be used.
* @param shortname of the set to use
* @return true if it could be loaded
*/
template <class Tbase_set>
/* static */ bool BaseMedia<Tbase_set>::SetSetByShortname(uint32_t shortname)
{
if (shortname == 0) {
return SetSet(nullptr);
}
for (const Tbase_set *s = BaseMedia<Tbase_set>::available_sets; s != nullptr; s = s->next) {
if (shortname == s->shortname) {
return SetSet(s);
}
}
return false;
@@ -376,11 +412,12 @@ template <class Tbase_set>
* @param set_type the type of the BaseSet to instantiate
*/
#define INSTANTIATE_BASE_MEDIA_METHODS(repl_type, set_type) \
template std::string repl_type::ini_set; \
template const char *repl_type::GetExtension(); \
template bool repl_type::AddFile(const std::string &filename, size_t pathlength, const std::string &tar_filename); \
template bool repl_type::HasSet(const struct ContentInfo *ci, bool md5sum); \
template bool repl_type::SetSet(const std::string &name); \
template bool repl_type::SetSet(const set_type *set); \
template bool repl_type::SetSetByName(const std::string &name); \
template bool repl_type::SetSetByShortname(uint32_t shortname); \
template char *repl_type::GetSetsList(char *p, const char *last); \
template int repl_type::GetNumSets(); \
template int repl_type::GetIndexOfUsedSet(); \