Debug: Add chicken bits for water region invalidation/init
This commit is contained in:
@@ -21,6 +21,8 @@ enum ChickenBitFlags {
|
|||||||
DCBF_DESYNC_CHECK_NO_GENERAL = 4,
|
DCBF_DESYNC_CHECK_NO_GENERAL = 4,
|
||||||
DCBF_DESYNC_CHECK_PERIODIC_SIGNALS = 5,
|
DCBF_DESYNC_CHECK_PERIODIC_SIGNALS = 5,
|
||||||
DCBF_CMD_NO_TEST_ALL = 6,
|
DCBF_CMD_NO_TEST_ALL = 6,
|
||||||
|
DCBF_WATER_REGION_CLEAR = 7,
|
||||||
|
DCBF_WATER_REGION_INIT_ALL = 8,
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool HasChickenBit(ChickenBitFlags flag)
|
inline bool HasChickenBit(ChickenBitFlags flag)
|
||||||
|
@@ -484,6 +484,28 @@ uint GetWaterRegionTileDebugColourIndex(TileIndex tile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebugInvalidateAllWaterRegions()
|
||||||
|
{
|
||||||
|
const uint32_t size_x = GetWaterRegionMapSizeX();
|
||||||
|
const uint32_t size_y = GetWaterRegionMapSizeY();
|
||||||
|
for (uint32_t y = 0; y < size_y; y++) {
|
||||||
|
for (uint32_t x = 0; x < size_x; x++) {
|
||||||
|
GetWaterRegionRef(x, y).Invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugInitAllWaterRegions()
|
||||||
|
{
|
||||||
|
const uint32_t size_x = GetWaterRegionMapSizeX();
|
||||||
|
const uint32_t size_y = GetWaterRegionMapSizeY();
|
||||||
|
for (uint32_t y = 0; y < size_y; y++) {
|
||||||
|
for (uint32_t x = 0; x < size_x; x++) {
|
||||||
|
GetWaterRegionRef(x, y).UpdateIfNotInitialized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WaterRegionCheckCaches(std::function<void(const char *)> log)
|
void WaterRegionCheckCaches(std::function<void(const char *)> log)
|
||||||
{
|
{
|
||||||
char cclog_buffer[1024];
|
char cclog_buffer[1024];
|
||||||
|
@@ -65,6 +65,8 @@ WaterRegionDesc GetWaterRegionInfo(TileIndex tile);
|
|||||||
WaterRegionPatchDesc GetWaterRegionPatchInfo(TileIndex tile);
|
WaterRegionPatchDesc GetWaterRegionPatchInfo(TileIndex tile);
|
||||||
|
|
||||||
void InvalidateWaterRegion(TileIndex tile);
|
void InvalidateWaterRegion(TileIndex tile);
|
||||||
|
void DebugInvalidateAllWaterRegions();
|
||||||
|
void DebugInitAllWaterRegions();
|
||||||
|
|
||||||
using TVisitWaterRegionPatchCallBack = std::function<void(const WaterRegionPatchDesc &)>;
|
using TVisitWaterRegionPatchCallBack = std::function<void(const WaterRegionPatchDesc &)>;
|
||||||
void VisitWaterRegionPatchNeighbors(const WaterRegionPatchDesc &water_region_patch, TVisitWaterRegionPatchCallBack &callback);
|
void VisitWaterRegionPatchNeighbors(const WaterRegionPatchDesc &water_region_patch, TVisitWaterRegionPatchCallBack &callback);
|
||||||
|
@@ -61,6 +61,7 @@
|
|||||||
#include "scope_info.h"
|
#include "scope_info.h"
|
||||||
#include "debug_settings.h"
|
#include "debug_settings.h"
|
||||||
#include "network/network_sync.h"
|
#include "network/network_sync.h"
|
||||||
|
#include "pathfinder/water_regions.h"
|
||||||
#include "3rdparty/cpp-btree/btree_set.h"
|
#include "3rdparty/cpp-btree/btree_set.h"
|
||||||
#include "3rdparty/cpp-btree/btree_map.h"
|
#include "3rdparty/cpp-btree/btree_map.h"
|
||||||
#include "3rdparty/robin_hood/robin_hood.h"
|
#include "3rdparty/robin_hood/robin_hood.h"
|
||||||
@@ -1563,6 +1564,13 @@ void CallVehicleTicks()
|
|||||||
|
|
||||||
if (!_tick_caches_valid || HasChickenBit(DCBF_VEH_TICK_CACHE)) RebuildVehicleTickCaches();
|
if (!_tick_caches_valid || HasChickenBit(DCBF_VEH_TICK_CACHE)) RebuildVehicleTickCaches();
|
||||||
|
|
||||||
|
if (HasChickenBit(DCBF_WATER_REGION_CLEAR)) {
|
||||||
|
DebugInvalidateAllWaterRegions();
|
||||||
|
}
|
||||||
|
if (HasChickenBit(DCBF_WATER_REGION_INIT_ALL)) {
|
||||||
|
DebugInitAllWaterRegions();
|
||||||
|
}
|
||||||
|
|
||||||
Vehicle *v = nullptr;
|
Vehicle *v = nullptr;
|
||||||
SCOPE_INFO_FMT([&v], "CallVehicleTicks: %s", scope_dumper().VehicleInfo(v));
|
SCOPE_INFO_FMT([&v], "CallVehicleTicks: %s", scope_dumper().VehicleInfo(v));
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user