Merge branch 'master' into jgrpp
# Conflicts: # .github/workflows/ci-build.yml # .github/workflows/release-linux.yml # .github/workflows/release-macos.yml # .github/workflows/release-source.yml # .github/workflows/release.yml # CMakeLists.txt # COMPILING.md # src/ai/ai_core.cpp # src/ai/ai_gui.cpp # src/bridge_gui.cpp # src/company_gui.cpp # src/console_cmds.cpp # src/core/CMakeLists.txt # src/core/smallmap_type.hpp # src/disaster_vehicle.h # src/effectvehicle_base.h # src/fontcache.cpp # src/game/game_core.cpp # src/game/game_gui.cpp # src/gamelog.cpp # src/gamelog_internal.h # src/group_gui.cpp # src/linkgraph/linkgraph.h # src/misc.cpp # src/network/core/config.h # src/network/core/udp.cpp # src/network/network_chat_gui.cpp # src/network/network_content_gui.cpp # src/network/network_gui.cpp # src/newgrf.cpp # src/newgrf_gui.cpp # src/newgrf_profiling.cpp # src/newgrf_profiling.h # src/object_gui.cpp # src/openttd.cpp # src/openttd.h # src/order_gui.cpp # src/os/windows/font_win32.cpp # src/rail_gui.cpp # src/road.cpp # src/road_gui.cpp # src/saveload/afterload.cpp # src/saveload/saveload.h # src/script/api/script_controller.cpp # src/script/api/script_roadtypelist.cpp # src/script/script_config.cpp # src/script/script_config.hpp # src/script/script_instance.cpp # src/script/script_scanner.cpp # src/script/squirrel.cpp # src/script/squirrel_helper.hpp # src/settings_gui.cpp # src/settings_internal.h # src/settings_type.h # src/table/settings/network_private_settings.ini # src/timetable_gui.cpp # src/vehicle.cpp # src/vehicle_base.h # src/window_gui.h
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include "debug.h"
|
||||
#include "date_func.h"
|
||||
#include "rev.h"
|
||||
#include "3rdparty/cpp-btree/btree_map.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -160,7 +161,7 @@ struct GRFPresence{
|
||||
GRFPresence(const GRFConfig *gc) : gc(gc), was_missing(false) {}
|
||||
GRFPresence() = default;
|
||||
};
|
||||
typedef SmallMap<uint32, GRFPresence> GrfIDMapping;
|
||||
typedef btree::btree_map<uint32, GRFPresence> GrfIDMapping;
|
||||
|
||||
/**
|
||||
* Prints active gamelog
|
||||
@@ -249,25 +250,25 @@ void GamelogPrint(GamelogPrintProc *proc)
|
||||
const GRFConfig *gc = FindGRFConfig(lc->grfadd.grfid, FGCM_EXACT, lc->grfadd.md5sum);
|
||||
buf += seprintf(buf, lastof(buffer), "Added NewGRF: ");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfadd.grfid, lc->grfadd.md5sum, gc);
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
if (gm != grf_names.End() && !gm->second.was_missing) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was already added!");
|
||||
auto gm = grf_names.find(lc->grfrem.grfid);
|
||||
if (gm != grf_names.end() && !gm->second.was_missing) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was already added!");
|
||||
grf_names[lc->grfadd.grfid] = gc;
|
||||
break;
|
||||
}
|
||||
|
||||
case GLCT_GRFREM: {
|
||||
/* A NewGRF got removed from the game, either manually or by it missing when loading the game. */
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
auto gm = grf_names.find(lc->grfrem.grfid);
|
||||
buf += seprintf(buf, lastof(buffer), la->at == GLAT_LOAD ? "Missing NewGRF: " : "Removed NewGRF: ");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfrem.grfid, nullptr, gm != grf_names.End() ? gm->second.gc : nullptr);
|
||||
if (gm == grf_names.End()) {
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfrem.grfid, nullptr, gm != grf_names.end() ? gm->second.gc : nullptr);
|
||||
if (gm == grf_names.end()) {
|
||||
buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
} else {
|
||||
if (la->at == GLAT_LOAD) {
|
||||
/* Missing grfs on load are not removed from the configuration */
|
||||
gm->second.was_missing = true;
|
||||
} else {
|
||||
grf_names.Erase(gm);
|
||||
grf_names.erase(gm);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -278,38 +279,38 @@ void GamelogPrint(GamelogPrintProc *proc)
|
||||
const GRFConfig *gc = FindGRFConfig(lc->grfadd.grfid, FGCM_EXACT, lc->grfadd.md5sum);
|
||||
buf += seprintf(buf, lastof(buffer), "Compatible NewGRF loaded: ");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfcompat.grfid, lc->grfcompat.md5sum, gc);
|
||||
if (!grf_names.Contains(lc->grfcompat.grfid)) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
if (grf_names.find(lc->grfcompat.grfid) == grf_names.end()) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
grf_names[lc->grfcompat.grfid] = gc;
|
||||
break;
|
||||
}
|
||||
|
||||
case GLCT_GRFPARAM: {
|
||||
/* A parameter of a NewGRF got changed after the game was started. */
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
auto gm = grf_names.find(lc->grfrem.grfid);
|
||||
buf += seprintf(buf, lastof(buffer), "GRF parameter changed: ");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfparam.grfid, nullptr, gm != grf_names.End() ? gm->second.gc : nullptr);
|
||||
if (gm == grf_names.End()) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfparam.grfid, nullptr, gm != grf_names.end() ? gm->second.gc : nullptr);
|
||||
if (gm == grf_names.end()) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
break;
|
||||
}
|
||||
|
||||
case GLCT_GRFMOVE: {
|
||||
/* The order of NewGRFs got changed, which might cause some other NewGRFs to behave differently. */
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
auto gm = grf_names.find(lc->grfrem.grfid);
|
||||
buf += seprintf(buf, lastof(buffer), "GRF order changed: %08X moved %d places %s",
|
||||
BSWAP32(lc->grfmove.grfid), abs(lc->grfmove.offset), lc->grfmove.offset >= 0 ? "down" : "up" );
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfmove.grfid, nullptr, gm != grf_names.End() ? gm->second.gc : nullptr);
|
||||
if (gm == grf_names.End()) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfmove.grfid, nullptr, gm != grf_names.end() ? gm->second.gc : nullptr);
|
||||
if (gm == grf_names.end()) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
break;
|
||||
}
|
||||
|
||||
case GLCT_GRFBUG: {
|
||||
/* A specific bug in a NewGRF, that could cause wide spread problems, has been noted during the execution of the game. */
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
auto gm = grf_names.find(lc->grfrem.grfid);
|
||||
assert (lc->grfbug.bug == GBUG_VEH_LENGTH);
|
||||
|
||||
buf += seprintf(buf, lastof(buffer), "Rail vehicle changes length outside a depot: GRF ID %08X, internal ID 0x%X", BSWAP32(lc->grfbug.grfid), (uint)lc->grfbug.data);
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfbug.grfid, nullptr, gm != grf_names.End() ? gm->second.gc : nullptr);
|
||||
if (gm == grf_names.End()) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfbug.grfid, nullptr, gm != grf_names.end() ? gm->second.gc : nullptr);
|
||||
if (gm == grf_names.end()) buf += seprintf(buf, lastof(buffer), ". Gamelog inconsistency: GrfID was never added!");
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user