1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-03 23:19:22 +02:00

Vlc obstacles [part 1] (#888)

* obstacles content handler, entity service and VLC integration
This commit is contained in:
Nordsoft91
2022-09-15 12:06:54 +04:00
committed by GitHub
parent 7dc05d8e81
commit ad01c7ffce
25 changed files with 807 additions and 489 deletions

View File

@@ -35,6 +35,7 @@
#include "CGeneralTextHandler.h"
#include "CModHandler.h"//todo: remove
#include "BattleFieldHandler.h"
#include "ObstacleHandler.h"
const SlotID SlotID::COMMANDER_SLOT_PLACEHOLDER = SlotID(-2);
const SlotID SlotID::SUMMONED_SLOT_PLACEHOLDER = SlotID(-3);
@@ -292,4 +293,24 @@ BattleField BattleField::fromString(std::string identifier)
return BattleField(rawId.get());
else
return BattleField::NONE;
}
}
const ObstacleInfo * Obstacle::getInfo() const
{
return VLC->obstacles()->getById(*this);
}
Obstacle::operator std::string() const
{
return getInfo()->identifier;
}
Obstacle Obstacle::fromString(std::string identifier)
{
auto rawId = VLC->modh->identifiers.getIdentifier("core", "obstacle", identifier);
if(rawId)
return Obstacle(rawId.get());
else
return Obstacle(-1);
}