fix some warnings

This commit is contained in:
Joseph Aquino 2026-01-11 01:01:05 -05:00
parent 69175cf189
commit de93325371
4 changed files with 9 additions and 14 deletions

View File

@ -2,17 +2,17 @@
#include <Fruit.h> #include <Fruit.h>
#include <Random.h> #include <Random.h>
Fruit::Fruit(sf::Vector2i gridPos_in, const Color& color_in) Fruit::Fruit(const sf::Vector2i gridPos_in, const Color& color_in)
: gridPos(gridPos_in) : gridPos(gridPos_in)
, color(color_in) , color(color_in)
{ } { }
sf::Vector2f Fruit::windowPos(sf::Vector2f gameBoundsOrigin, float size) const sf::Vector2f Fruit::windowPos(sf::Vector2f gameBoundsOrigin, const float size) const
{ {
return {gameBoundsOrigin.x + (gridPos.x * size), gameBoundsOrigin.y + (gridPos.y * size)}; return {gameBoundsOrigin.x + (static_cast<float>(gridPos.x) * size), gameBoundsOrigin.y + (static_cast<float>(gridPos.y) * size)};
} }
void Fruit::respawn(const std::vector<SnakeNode>& body_in, unsigned int gridCount_in) void Fruit::respawn(const std::vector<SnakeNode>& body_in, const unsigned int gridCount_in)
{ {
unsigned int tempX; unsigned int tempX;
unsigned int tempY; unsigned int tempY;
@ -20,8 +20,8 @@ void Fruit::respawn(const std::vector<SnakeNode>& body_in, unsigned int gridCoun
do do
{ {
valid = true; valid = true;
tempX = Random::get(0, gridCount_in - 1); tempX = Random::get(0u, gridCount_in - 1);
tempY = Random::get(0, gridCount_in - 1); tempY = Random::get(0u, gridCount_in - 1);
for (const auto& node : body_in) for (const auto& node : body_in)
{ {
if (node.gridPos.x == tempX and node.gridPos.y == tempY) if (node.gridPos.x == tempX and node.gridPos.y == tempY)

View File

@ -158,7 +158,7 @@ bool Game::parseConfigFile()
if (inputBuff == "gridCount") if (inputBuff == "gridCount")
{ {
configFile >> config.gridCount; configFile >> config.gridCount;
config.gridCountBuffer = config.gridCount; config.gridCountBuffer = static_cast<int>(config.gridCount);
continue; continue;
} }
@ -599,7 +599,3 @@ void Game::run()
ImGui::SFML::Shutdown(); ImGui::SFML::Shutdown();
} }
/*
*
*/

View File

@ -7,7 +7,7 @@ SnakeNode::SnakeNode(sf::Vector2u gridPos_in, const Color& color_in)
sf::Vector2f SnakeNode::windowPos(const sf::Vector2f gameBoundsOrigin, float size) const sf::Vector2f SnakeNode::windowPos(const sf::Vector2f gameBoundsOrigin, float size) const
{ {
return {gameBoundsOrigin.x + (gridPos.x * size), gameBoundsOrigin.y + (gridPos.y * size)}; return {gameBoundsOrigin.x + (static_cast<float>(gridPos.x) * size), gameBoundsOrigin.y + (static_cast<float>(gridPos.y) * size)};
} }
SnakeNode& Player::head() SnakeNode& Player::head()

View File

@ -14,7 +14,6 @@ int main(int argc, char* argv[])
} }
LOG("\n\n\033[32mTODO: "); LOG("\n\n\033[32mTODO: ");
LOG("-Implement game config via imgui");
LOG("\033[0m"); LOG("\033[0m");
Game game(useImgui); Game game(useImgui);