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;
}