From fce804a09a770426c5c0c36ccddaf26846639263 Mon Sep 17 00:00:00 2001 From: Joan Karadimov Date: Fri, 28 Jun 2019 11:58:44 +0300 Subject: [PATCH] Use the dungeon_type enum for leveltype --- Source/gendung.cpp | 2 +- Source/loadsave.cpp | 22 +++++++++++----------- Source/multi.cpp | 2 +- Source/objects.cpp | 4 ++-- Source/portal.cpp | 2 +- Source/themes.cpp | 4 ++-- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Source/gendung.cpp b/Source/gendung.cpp index c56362010..f105ca11d 100644 --- a/Source/gendung.cpp +++ b/Source/gendung.cpp @@ -965,7 +965,7 @@ void InitLevels() { if (!leveldebug) { currlevel = 0; - leveltype = 0; + leveltype = DTYPE_TOWN; setlevel = 0; } } diff --git a/Source/loadsave.cpp b/Source/loadsave.cpp index 48fdf847d..71472eb5b 100644 --- a/Source/loadsave.cpp +++ b/Source/loadsave.cpp @@ -58,7 +58,7 @@ void LoadGame(BOOL firstflag) for (i = 0; i < MAXMONSTERS; i++) monstkills[i] = ILoad(); - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (i = 0; i < MAXMONSTERS; i++) monstactive[i] = WLoad(); for (i = 0; i < nummonsters; i++) @@ -118,7 +118,7 @@ void LoadGame(BOOL firstflag) dItem[i][j] = BLoad(); } - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) dMonster[i][j] = WLoad(); @@ -161,7 +161,7 @@ void LoadGame(BOOL firstflag) AutomapZoomReset(); ResyncQuests(); - if (leveltype) + if (leveltype != DTYPE_TOWN) ProcessLightList(); RedoPlayerVision(); @@ -309,7 +309,7 @@ void SaveGame() for (i = 0; i < MAXMONSTERS; i++) ISave(monstkills[i]); - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (i = 0; i < MAXMONSTERS; i++) WSave(monstactive[i]); for (i = 0; i < nummonsters; i++) @@ -367,7 +367,7 @@ void SaveGame() BSave(dItem[i][j]); } - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) WSave(dMonster[i][j]); @@ -523,7 +523,7 @@ void SaveLevel() SaveBuff = DiabloAllocPtr(dwLen); tbuff = SaveBuff; - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) BSave(dDead[i][j]); @@ -534,7 +534,7 @@ void SaveLevel() WSave(numitems); WSave(nobjects); - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (i = 0; i < MAXMONSTERS; i++) WSave(monstactive[i]); for (i = 0; i < nummonsters; i++) @@ -563,7 +563,7 @@ void SaveLevel() BSave(dItem[i][j]); } - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) WSave(dMonster[i][j]); @@ -612,7 +612,7 @@ void LoadLevel() LoadBuff = pfile_read(szName, &dwLen); tbuff = LoadBuff; - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) dDead[i][j] = BLoad(); @@ -624,7 +624,7 @@ void LoadLevel() numitems = WLoad(); nobjects = WLoad(); - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (i = 0; i < MAXMONSTERS; i++) monstactive[i] = WLoad(); for (i = 0; i < nummonsters; i++) @@ -655,7 +655,7 @@ void LoadLevel() dItem[i][j] = BLoad(); } - if (leveltype) { + if (leveltype != DTYPE_TOWN) { for (j = 0; j < MAXDUNY; j++) { for (i = 0; i < MAXDUNX; i++) dMonster[i][j] = WLoad(); diff --git a/Source/multi.cpp b/Source/multi.cpp index 9366ae861..fe75af292 100644 --- a/Source/multi.cpp +++ b/Source/multi.cpp @@ -778,7 +778,7 @@ void SetupLocalCoords() if (!leveldebug || gbMaxPlayers > 1) { currlevel = 0; - leveltype = 0; + leveltype = DTYPE_TOWN; setlevel = 0; } x = 75; diff --git a/Source/objects.cpp b/Source/objects.cpp index d843ce6b3..1bb94380c 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -134,7 +134,7 @@ BOOL RndLocOk(int xp, int yp) return FALSE; if (nSolidTable[dPiece[xp][yp]]) return FALSE; - if (leveltype != 1 || dPiece[xp][yp] <= 126 || dPiece[xp][yp] >= 144) + if (leveltype != DTYPE_CATHEDRAL || dPiece[xp][yp] <= 126 || dPiece[xp][yp] >= 144) return TRUE; return FALSE; } @@ -829,7 +829,7 @@ void InitObjects() InitRndLocObj(5, 10, 5); InitRndLocObj(3, 6, 6); InitRndLocObj(1, 5, 7); - if (leveltype != 4) + if (leveltype != DTYPE_HELL) AddObjTraps(); if (leveltype > 1u) AddChestTraps(); diff --git a/Source/portal.cpp b/Source/portal.cpp index 620b229f9..dfffa8872 100644 --- a/Source/portal.cpp +++ b/Source/portal.cpp @@ -124,7 +124,7 @@ void GetPortalLevel() setlevel = 0; currlevel = 0; plr[myplr].plrlevel = 0; - leveltype = 0; + leveltype = DTYPE_TOWN; } else { if (portal[portalindex].setlvl) { setlevel = 1; diff --git a/Source/themes.cpp b/Source/themes.cpp index 2cb88b303..db77651f7 100644 --- a/Source/themes.cpp +++ b/Source/themes.cpp @@ -144,7 +144,7 @@ BOOL TFit_SkelRoom(int t) { int i; - if (leveltype != 1 && leveltype != 2) { + if (leveltype != DTYPE_CATHEDRAL && leveltype != DTYPE_CATACOMBS) { return FALSE; } @@ -423,7 +423,7 @@ void InitThemes() } } } - if (leveltype == 2 || leveltype == 3 || leveltype == 4) { + if (leveltype == DTYPE_CATACOMBS || leveltype == DTYPE_CAVES || leveltype == DTYPE_HELL) { for (i = 0; i < themeCount; i++) themes[i].ttype = THEME_NONE; if (QuestStatus(QTYPE_ZHAR)) {