From 975055e40938730cb09d151ba17bf8defd3b4adf Mon Sep 17 00:00:00 2001 From: Steph Enders Date: Sun, 26 Feb 2023 10:43:21 -0500 Subject: Code quality and improvements I genuinely cannot remember what I was doing here, as I never committed it. But basically - it looks like I used my IDE and fixed warnings and improved some code blocks / references --- src/helper.hpp | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) (limited to 'src/helper.hpp') diff --git a/src/helper.hpp b/src/helper.hpp index e13ee5e..6fef4b6 100644 --- a/src/helper.hpp +++ b/src/helper.hpp @@ -66,7 +66,6 @@ struct board_t struct player_t { - int pid; int score; std::shared_ptr> pieces; }; @@ -82,13 +81,10 @@ std::shared_ptr> loadTextures(const char* path); std::shared_ptr> -createBoard(std::shared_ptr> textures); - -sf::Font -loadFont(); +createBoard(const std::shared_ptr>& textures); std::shared_ptr -createPlayer(const int pid, sf::Texture& pieceTexture); +createPlayer(int pid, sf::Texture& pieceTexture); std::shared_ptr createPiece(int id, sf::Texture& texture); @@ -100,32 +96,23 @@ std::shared_ptr> createRollSprites(sf::Texture& t1, sf::Texture& t2); std::shared_ptr> -createPassSprites(std::shared_ptr> textures); +createPassSprites(const std::shared_ptr>& textures); std::shared_ptr> createWinSprites(int player_id, - std::shared_ptr> textures); + const std::shared_ptr>& textures); std::shared_ptr> -createStartSprites(std::shared_ptr> textures); +createStartSprites(const std::shared_ptr>& textures); void makeNum(sf::Sprite* sprite_ptr, int num, - std::shared_ptr> textures); - -bool -clickedPiece(sf::Vector2i mousePosition, std::shared_ptr piece); - -bool -canMovePiece(std::shared_ptr piece, - int roll, - std::shared_ptr> myPieces, - std::shared_ptr> enemyPieces); + const std::shared_ptr>& textures); bool -hasMoves(std::shared_ptr activePlayer, - std::shared_ptr opponent, +hasMoves(const std::shared_ptr& activePlayer, + const std::shared_ptr& opponent, int roll); sf::Vector2f @@ -134,9 +121,9 @@ pos(float c, float r); bool canPlace(struct piece_t* piece, int turn_pid, - struct board_t board_tile, - std::shared_ptr> myPieces, - std::shared_ptr> opponentPieces, + const struct board_t& board_tile, + const std::shared_ptr>& myPieces, + const std::shared_ptr>& opponentPieces, int& takenPieceId); void -- cgit v1.2.3-54-g00ecf