porymap/src/core/heallocation.cpp

38 lines
1.3 KiB
C++
Raw Normal View History

2018-09-12 01:37:36 +01:00
#include "heallocation.h"
#include "config.h"
#include "events.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 *fromEvent) {
HealLocationEvent *event = dynamic_cast<HealLocationEvent *>(fromEvent);
HealLocation healLocation;
healLocation.idName = event->getIdName();
healLocation.mapName = event->getLocationName();
healLocation.index = event->getIndex();
healLocation.x = event->getX();
healLocation.y = event->getY();
if (projectConfig.getHealLocationRespawnDataEnabled()) {
healLocation.respawnNPC = event->getRespawnNPC();
healLocation.respawnMap = Map::mapConstantFromName(event->getRespawnMap()).remove(0,4);
}
return healLocation;
}
QDebug operator<<(QDebug debug, const HealLocation &healLocation) {
debug << "HealLocation_" + healLocation.mapName << "(" << healLocation.x << ',' << healLocation.y << ")";
2018-09-12 01:37:36 +01:00
return debug;
}