Use ObjectAtPosition for debug object type display

The other use of dObject is displaying the contents of that array so makes sense to leave as is. We're also able to remove the map since we can reference the current object type value directly on the returned object.
This commit is contained in:
ephphatha 2021-10-29 17:55:27 +11:00 committed by Anders Jenbo
commit 903b661307
3 changed files with 3 additions and 8 deletions

View file

@ -39,7 +39,6 @@ bool DebugVision = false;
bool DebugGrid = false;
std::unordered_map<int, Point> DebugCoordsMap;
bool DebugScrollViewEnabled = false;
std::unordered_map<int, int> DebugIndexToObjectID;
namespace {
@ -861,9 +860,9 @@ bool GetDebugGridText(Point dungeonCoords, char *debugGridTextBuffer)
return true;
case DebugGridTextItem::objectindex: {
info = 0;
int objectIndex = dObject[dungeonCoords.x][dungeonCoords.y];
if (objectIndex != 0 && DebugIndexToObjectID.find(objectIndex) != DebugIndexToObjectID.end()) {
info = DebugIndexToObjectID[abs(objectIndex) - 1];
Object *object = ObjectAtPosition(dungeonCoords);
if (object != nullptr) {
info = static_cast<int>(object->_otype);
}
break;
}

View file

@ -22,7 +22,6 @@ extern bool DebugVision;
extern bool DebugGrid;
extern std::unordered_map<int, Point> DebugCoordsMap;
extern bool DebugScrollViewEnabled;
extern std::unordered_map<int, int> DebugIndexToObjectID;
void FreeDebugGFX();
void LoadDebugGFX();

View file

@ -810,9 +810,6 @@ void AddCryptObject(int i, int a2)
void SetupObject(int i, Point position, _object_id ot)
{
#ifdef _DEBUG
DebugIndexToObjectID[i] = ot;
#endif
Objects[i]._otype = ot;
object_graphic_id ofi = AllObjects[ot].ofindex;
Objects[i].position = position;