Skip to content

[BFME][ZH] Validate map chunk versions in debug #742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ PolygonTrigger *PolygonTrigger::getPolygonTriggerByID(Int triggerID)
*/
Bool PolygonTrigger::ParsePolygonTriggersDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData)
{
DEBUG_ASSERTCRASH(info->version <= K_TRIGGERS_VERSION_4, ("PolygonTriggers chunk version newer than supported."));
Int count;
Int numPoints;
Int triggerID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ void SidesList::clear(void)
*/
Bool SidesList::ParseSidesDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData)
{
DEBUG_ASSERTCRASH(info->version <= K_SIDES_DATA_VERSION_3, ("Sides chunk version newer than supported."));
DEBUG_ASSERTCRASH(TheSidesList, ("TheSidesList is null"));

if (TheSidesList==NULL)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,7 @@ void WorldHeightMap::setCliffState(Int xIndex, Int yIndex, Bool state)

Bool WorldHeightMap::ParseWorldDictDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData)
{
DEBUG_ASSERTCRASH(info->version <= K_WORLDDICT_VERSION_1, ("WorldDict chunk version newer than supported."));
Dict d = file.readDict();
*MapObject::getWorldDict() = d;
Bool exists;
Expand All @@ -781,6 +782,7 @@ Bool WorldHeightMap::ParseWorldDictDataChunk(DataChunkInput &file, DataChunkInfo
*/
Bool WorldHeightMap::ParseLightingDataChunk(DataChunkInput &file, DataChunkInfo *info, void *userData)
{
DEBUG_ASSERTCRASH(info->version <= K_LIGHTING_VERSION_3, ("Lighting chunk version newer than supported."));
TheWritableGlobalData->m_timeOfDay = (TimeOfDay)file.readInt();
Int i;
GlobalData::TerrainLighting initLightValues = { { 0,0,0},{0,0,0},{0,0,-1.0f}};
Expand Down Expand Up @@ -889,6 +891,7 @@ Bool WorldHeightMap::ParseHeightMapDataChunk(DataChunkInput &file, DataChunkInfo
*/
Bool WorldHeightMap::ParseHeightMapData(DataChunkInput &file, DataChunkInfo *info, void *userData)
{
DEBUG_ASSERTCRASH(info->version <= K_HEIGHT_MAP_VERSION_4, ("HeightMap chunk version newer than supported."));
m_width = file.readInt();
m_height = file.readInt();
if (info->version >= K_HEIGHT_MAP_VERSION_3) {
Expand Down Expand Up @@ -963,6 +966,7 @@ Bool WorldHeightMap::ParseSizeOnlyInChunk(DataChunkInput &file, DataChunkInfo *i
*/
Bool WorldHeightMap::ParseSizeOnly(DataChunkInput &file, DataChunkInfo *info, void *userData)
{
DEBUG_ASSERTCRASH(info->version <= K_HEIGHT_MAP_VERSION_4, ("HeightMap chunk version newer than supported."));
m_width = file.readInt();
m_height = file.readInt();
if (info->version >= K_HEIGHT_MAP_VERSION_3) {
Expand Down Expand Up @@ -1070,6 +1074,7 @@ void WorldHeightMap::readTexClass(TXTextureClass *texClass, TileData **tileData)
*/
Bool WorldHeightMap::ParseBlendTileData(DataChunkInput &file, DataChunkInfo *info, void *userData)
{
DEBUG_ASSERTCRASH(info->version <= K_BLEND_TILE_VERSION_8, ("BlendTile chunk version newer than supported."));
int i, j;
Int len = file.readInt();
if (m_dataSize != len) {
Expand Down Expand Up @@ -1250,6 +1255,7 @@ Bool WorldHeightMap::ParseObjectDataChunk(DataChunkInput &file, DataChunkInfo *i
*/
Bool WorldHeightMap::ParseObjectData(DataChunkInput &file, DataChunkInfo *info, void *userData, Bool readDict)
{
DEBUG_ASSERTCRASH(info->version <= K_OBJECTS_VERSION_3, ("Objects chunk version newer than supported."));
MapObject *pPrevious = (MapObject *)file.m_currentObject;

Coord3D loc;
Expand Down
Loading