Added first UI elements
Rules can be created from the UI Game can be stopped/started from the UI Current level can be reset (Load from file again) Added "Game" target and main file TODO (A lot): - Unit tests - Fully functionnal UI - Win conditions - Level background - Level switching/progression - Interesting and varied rules - Multi-scale pathfinding - etc
This commit is contained in:
parent
8199b7d036
commit
60770b5395
16 changed files with 260 additions and 29 deletions
|
@ -5,8 +5,8 @@
|
|||
#include "Level.h"
|
||||
|
||||
|
||||
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()),
|
||||
Level::Level(const pugi::xml_document& xmlDoc, const pro_maat::TextureStore& textureStore, int id)
|
||||
: levelID(id), size(xmlDoc.child("Level").attribute("w").as_int(),xmlDoc.child("Level").attribute("h").as_int()),
|
||||
textures(textureStore)
|
||||
{
|
||||
pugi::xml_node levelNode = xmlDoc.child("Level");
|
||||
|
@ -23,8 +23,8 @@ Level::Level(const pugi::xml_document& xmlDoc, const pro_maat::TextureStore& tex
|
|||
}
|
||||
|
||||
// FIXME : For testing purposes
|
||||
addRule(EntityType::Significant,State::Fleeing,EntityType::Citizen);
|
||||
addRule(EntityType::Citizen,State::Moving,EntityType::Significant);
|
||||
// addRule(EntityType::Noble,State::Moving,EntityType::House);
|
||||
// addRule(EntityType::Citizen,State::Moving,EntityType::Citizen);
|
||||
}
|
||||
|
||||
void Level::addRule(EntityType affectedEntities, const State targetState, EntityType targetEntities)
|
||||
|
@ -128,6 +128,7 @@ Orientation Level::findPath(pro_maat::GridPos start, pro_maat::GridPos goal, int
|
|||
// Expand from the open node with the smallest estimated cost
|
||||
pro_maat::GridPos currentNode = std::min_element(estimatedCosts.begin(),estimatedCosts.end(),compWithOpen)->first;
|
||||
|
||||
// FIXME : Lots of bad cases when fleeing
|
||||
if(currentNode == goal)
|
||||
{
|
||||
if(currentNode == start)
|
||||
|
@ -198,3 +199,8 @@ Orientation Level::findPath(pro_maat::GridPos start, pro_maat::GridPos goal, int
|
|||
// If we did not find a path, do not move
|
||||
return Orientation::None;
|
||||
}
|
||||
|
||||
int Level::getLevelID()
|
||||
{
|
||||
return levelID;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue