Cleaning some warnings

This commit is contained in:
Teo-CD 2019-06-09 14:59:17 +02:00
parent 9f28383d7e
commit 4ed9180694
4 changed files with 13 additions and 6 deletions

View file

@ -11,3 +11,9 @@ target_link_libraries(engine
sfml-graphics
sfml-system
pugixml)
if (CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(engine PRIVATE -Wall -Wpedantic -Wextra)
elseif(MSVC)
target_compile_options(engine PRIVATE /W4)
endif()

View file

@ -71,7 +71,7 @@ const sf::RectangleShape& Entity::getShape() const
return(shape);
}
const State Entity::getState() const
State Entity::getState() const
{
return currentState;
}

View file

@ -48,7 +48,7 @@ public:
void move(Orientation orientation);
void update();
const State getState() const;
State getState() const;
const sf::RectangleShape& getShape() const;
/// Returns the grid coordinates at the center of the entity

View file

@ -6,8 +6,8 @@
Level::Level(const pugi::xml_document& xmlDoc, const TextureStore& textureStore)
: textures(textureStore),
size(xmlDoc.child("Level").attribute("w").as_int(),xmlDoc.child("Level").attribute("h").as_int())
: size(xmlDoc.child("Level").attribute("w").as_int(),xmlDoc.child("Level").attribute("h").as_int()),
textures(textureStore)
{
pugi::xml_node levelNode = xmlDoc.child("Level");
for(const pugi::xml_node& child : levelNode.children())
@ -45,6 +45,7 @@ void Level::runStep()
case State::Moving:
{
heuristicSign = 1;
[[fallthrough]];
}
case State::Fleeing:
{
@ -181,7 +182,7 @@ Orientation Level::findPath(pro_maat::GridPos start, pro_maat::GridPos goal, int
pathCosts.insert_or_assign(neighbour,newPathCost);
estimatedCosts.insert_or_assign(neighbour,newPathCost + pro_maat::manhattanDistance(neighbour,goal));
auto returnPathIt = paths.insert_or_assign(neighbour,currentNode);
paths.insert_or_assign(neighbour,currentNode);
}
}