First implementation of rules
TODO : - Fix target as getter (currently broken because of inheritance by rules) - Smart pointers for entity store ?
This commit is contained in:
parent
febe0827ad
commit
08e922b0d4
12 changed files with 257 additions and 20 deletions
|
@ -5,7 +5,7 @@
|
|||
#include "Level.h"
|
||||
|
||||
|
||||
Level::Level(const pugi::xml_document& xmlDoc, const TextureStore& textureStore)
|
||||
Level::Level(const pugi::xml_document& xmlDoc, const pro_maat::TextureStore& textureStore)
|
||||
: size(xmlDoc.child("Level").attribute("w").as_int(),xmlDoc.child("Level").attribute("h").as_int()),
|
||||
textures(textureStore)
|
||||
{
|
||||
|
@ -18,6 +18,10 @@ Level::Level(const pugi::xml_document& xmlDoc, const TextureStore& textureStore)
|
|||
|
||||
// Initialize the occupied squares vector with the new entity's squares
|
||||
std::vector<pro_maat::GridPos> entitySquares = entities.rbegin()->getOccupiedSquares();
|
||||
|
||||
// FIXME : For testing purposes
|
||||
Rule<State::Moving,EntityType::House> newRule(*entities.rbegin(),entities,occupiedSquares,size);
|
||||
|
||||
std::move(entitySquares.begin(),entitySquares.end(),std::back_inserter(occupiedSquares));
|
||||
}
|
||||
}
|
||||
|
@ -89,6 +93,8 @@ Orientation Level::findPath(pro_maat::GridPos start, pro_maat::GridPos goal, int
|
|||
std::map<pro_maat::GridPos,pro_maat::GridPos> paths{};
|
||||
|
||||
|
||||
// TODO : Should be OK with raycasting to find goal
|
||||
// FIXME : Just get to goal (Might break)
|
||||
const std::vector<pro_maat::GridPos> goalNeighbours = pro_maat::getNeighbours(goal,size);
|
||||
// Save the iterators : vector is const and .begin() and .end() might get called a lot
|
||||
auto goalNeighboursBeginIterator = goalNeighbours.begin();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue