porymap/src/core/heallocation.cpp

41 lines
1.1 KiB
C++
Raw Normal View History

2018-09-12 01:37:36 +01:00
#include "heallocation.h"
#include "config.h"
2020-03-20 17:41:40 +00:00
#include "map.h"
2018-09-12 01:37:36 +01:00
HealLocation::HealLocation(QString id, QString map, int i, uint16_t x, uint16_t y, QString respawnMap, uint16_t respawnNPC)
{
this->idName = id;
this->mapName = map;
this->index = i;
this->x = x;
this->y = y;
this->respawnMap = respawnMap;
this->respawnNPC = respawnNPC;
2018-09-12 01:37:36 +01:00
}
HealLocation HealLocation::fromEvent(Event *event)
{
HealLocation hl;
hl.idName = event->get("id_name");
hl.mapName = event->get("loc_name");
try {
hl.index = event->get("index").toInt();
}
catch(...) {
hl.index = 0;
}
hl.x = event->getU16("x");
hl.y = event->getU16("y");
if (projectConfig.getHealLocationRespawnDataEnabled()) {
hl.respawnNPC = event->getU16("respawn_npc");
2020-03-20 17:41:40 +00:00
hl.respawnMap = Map::mapConstantFromName(event->get("respawn_map")).remove(0,4);
}
return hl;
}
2018-09-15 00:37:36 +01:00
QDebug operator<<(QDebug debug, const HealLocation &hl)
{
debug << "HealLocation_" + hl.mapName << "(" << hl.x << ',' << hl.y << ")";
2018-09-12 01:37:36 +01:00
return debug;
}