Files
coffee_crisis_arcade_edition/cppcheck-result-warning-style-performance
Sergio Valor b060f21696 Arreglades les herencies de Sprite
Abans de llevar mil coses que sobren i replantejar-se estes 4 classes
2024-10-13 10:01:07 +02:00

771 lines
59 KiB
Plaintext

/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:14:11: warning: The class 'MovingSprite' defines member variable with name 'x_' also defined in its parent class 'Sprite'. [duplInheritedMember]
float x_; // Posición en el eje X
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:11:9: note: Parent variable 'Sprite::x_'
int x_; // Posición en el eje X donde dibujar el sprite
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:14:11: note: Derived variable 'MovingSprite::x_'
float x_; // Posición en el eje X
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:15:11: warning: The class 'MovingSprite' defines member variable with name 'y_' also defined in its parent class 'Sprite'. [duplInheritedMember]
float y_; // Posición en el eje Y
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:12:9: note: Parent variable 'Sprite::y_'
int y_; // Posición en el eje Y donde dibujar el sprite
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:15:11: note: Derived variable 'MovingSprite::y_'
float y_; // Posición en el eje Y
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:51:10: warning: The class 'MovingSprite' defines member function with name 'render' also defined in its parent class 'Sprite'. [duplInheritedMember]
void render();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:30:10: note: Parent function 'Sprite::render'
void render();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:51:10: note: Derived function 'MovingSprite::render'
void render();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:54:11: warning: The class 'MovingSprite' defines member function with name 'getPosX' also defined in its parent class 'Sprite'. [duplInheritedMember]
float getPosX() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:33:9: note: Parent function 'Sprite::getPosX'
int getPosX() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:54:11: note: Derived function 'MovingSprite::getPosX'
float getPosX() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:55:11: warning: The class 'MovingSprite' defines member function with name 'getPosY' also defined in its parent class 'Sprite'. [duplInheritedMember]
float getPosY() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:34:9: note: Parent function 'Sprite::getPosY'
int getPosY() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:55:11: note: Derived function 'MovingSprite::getPosY'
float getPosY() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:122:14: warning: The class 'MovingSprite' defines member function with name 'getRect' also defined in its parent class 'Sprite'. [duplInheritedMember]
SDL_Rect getRect();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:44:14: note: Parent function 'Sprite::getRect'
SDL_Rect getRect() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:122:14: note: Derived function 'MovingSprite::getRect'
SDL_Rect getRect();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:519:22: warning: The class 'AnimatedSprite' defines member function with name 'update' also defined in its parent class 'MovingSprite'. [duplInheritedMember]
void AnimatedSprite::update()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:45:10: note: Parent function 'MovingSprite::update'
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:519:22: note: Derived function 'AnimatedSprite::update'
void AnimatedSprite::update()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.h:52:5: style: Class 'Texture' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Texture(SDL_Renderer *renderer, std::string path = "");
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:23:5: style: Class 'Sprite' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Sprite(int x = 0, int y = 0, int w = 0, int h = 0, std::shared_ptr<Texture> texture = nullptr);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:24:5: style: Class 'Sprite' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Sprite(SDL_Rect rect, std::shared_ptr<Texture> texture = nullptr);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:36:5: style: Class 'MovingSprite' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
MovingSprite(float x = 0, float y = 0, int w = 0, int h = 0, float velx = 0, float vely = 0, float accelx = 0, float accely = 0, std::shared_ptr<Texture> texture = nullptr);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.h:40:5: style: Class 'AnimatedSprite' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
AnimatedSprite(std::shared_ptr<Texture> texture = nullptr, std::string file = "", std::vector<std::string> *buffer = nullptr);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.h:41:5: style: Class 'AnimatedSprite' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
AnimatedSprite(AnimatedFile *animation);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:159:78: performance: Function parameter 'file' should be passed by const reference. [passedByValue]
AnimatedSprite::AnimatedSprite(std::shared_ptr<Texture> texture, std::string file, std::vector<std::string> *buffer)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:208:42: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
int AnimatedSprite::getIndex(std::string name)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:212:12: performance: Range variable 'a' should be declared as const reference. [iterateByValue]
for (auto a : animations_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:287:54: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
void AnimatedSprite::setAnimationCounter(std::string name, int num)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:293:52: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
void AnimatedSprite::setAnimationSpeed(std::string name, int speed)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:305:51: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
void AnimatedSprite::setAnimationLoop(std::string name, int loop)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:317:56: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
void AnimatedSprite::setAnimationCompleted(std::string name, bool value)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:335:55: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
SDL_Rect AnimatedSprite::getAnimationClip(std::string name, Uint8 index)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:493:54: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
void AnimatedSprite::setCurrentAnimation(std::string name)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:186:46: style: Parameter 'animation' can be declared as pointer to const [constParameterPointer]
AnimatedSprite::AnimatedSprite(AnimatedFile *animation)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:172:16: style: Consider using std::copy algorithm instead of a raw loop. [useStlAlgorithm]
animations_.push_back(animation);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:197:15: style: Consider using std::copy algorithm instead of a raw loop. [useStlAlgorithm]
animations_.push_back(a);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.cpp:18:30: style: Variable 'file_name' is assigned a value that is never used. [unreadVariable]
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:31:5: performance: Variable 'executable_path_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
executable_path_ = executable_path.substr(0, executable_path.find_last_of("\\/"));
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.h:48:2: style: Class 'Asset' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Asset(std::string path);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:11:30: performance: Function parameter 'executable_path' should be passed by const reference. [passedByValue]
void Asset::init(std::string executable_path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:29:26: performance: Function parameter 'executable_path' should be passed by const reference. [passedByValue]
Asset::Asset(std::string executable_path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:36:29: performance: Function parameter 'file' should be passed by const reference. [passedByValue]
void Asset::add(std::string file, AssetType type, bool required, bool absolute)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:49:36: performance: Function parameter 'text' should be passed by const reference. [passedByValue]
std::string Asset::get(std::string text) const
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:51:15: performance: Range variable 'f' should be declared as const reference. [iterateByValue]
for (auto f : file_list_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:86:19: performance: Range variable 'f' should be declared as const reference. [iterateByValue]
for (auto f : file_list_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:101:23: performance: Range variable 'f' should be declared as const reference. [iterateByValue]
for (auto f : file_list_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:120:35: performance: Function parameter 'path' should be passed by const reference. [passedByValue]
bool Asset::checkFile(std::string path) const
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:123:24: style: Variable 'result' is assigned a value that is never used. [unreadVariable]
std::string result = "ERROR";
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:126:33: style: Variable 'file_name' is assigned a value that is never used. [unreadVariable]
const std::string file_name = path.substr(path.find_last_of("\\/") + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/asset.cpp:131:16: style: Variable 'result' is assigned a value that is never used. [unreadVariable]
result = "OK";
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/background.cpp:14:5: performance: Variable 'buildings_texture_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
buildings_texture_ = std::make_shared<Texture>(renderer, Asset::get()->get("game_buildings.png"));
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/background.h:110:3: style: Class 'Background' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Background(SDL_Renderer *renderer);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/balloon.cpp:13:2: performance: Variable 'sprite_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
sprite_ = std::make_unique<AnimatedSprite>(texture, "", animation);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.h:88:10: warning: The class 'AnimatedSprite' defines member function with name 'update' also defined in its parent class 'MovingSprite'. [duplInheritedMember]
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:45:10: note: Parent function 'MovingSprite::update'
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.h:88:10: note: Derived function 'AnimatedSprite::update'
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/bullet.cpp:23:5: performance: Variable 'sprite_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
sprite_ = std::make_unique<Sprite>(SDL_Rect{x, y, BULLET_WIDTH, BULLET_HEIGHT}, texture);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/define_buttons.h:49:5: style: Class 'DefineButtons' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
DefineButtons(std::unique_ptr<Text> text);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/smart_sprite.h:35:7: warning: The class 'SmartSprite' defines member function with name 'update' also defined in its parent class 'AnimatedSprite'. [duplInheritedMember]
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.h:88:10: note: Parent function 'AnimatedSprite::update'
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/smart_sprite.h:35:7: note: Derived function 'SmartSprite::update'
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/smart_sprite.h:35:7: warning: The class 'SmartSprite' defines member function with name 'update' also defined in its parent class 'MovingSprite'. [duplInheritedMember]
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:45:10: note: Parent function 'MovingSprite::update'
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/smart_sprite.h:35:7: note: Derived function 'SmartSprite::update'
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/fade.h:57:2: style: Class 'Fade' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Fade(SDL_Renderer *renderer);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/smart_sprite.h:26:2: style: Class 'SmartSprite' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
SmartSprite(std::shared_ptr<Texture> texture);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/hiscore_table.h:73:2: style: Class 'HiScoreTable' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
HiScoreTable(JA_Music_t *music);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/instructions.h:83:2: style: Class 'Instructions' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Instructions(JA_Music_t *music);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/writer.h:30:2: style: Class 'Writer' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Writer(std::shared_ptr<Text> text);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/intro.h:55:2: style: Class 'Intro' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Intro(JA_Music_t *music);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/manage_hiscore_table.h:27:5: style: Class 'ManageHiScoreTable' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
ManageHiScoreTable(std::vector<HiScoreEntry> *table);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/title.h:98:2: style: Class 'Title' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Title(JA_Music_t *music);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/director.cpp:301:19: style: Operator '|' with one operand equal to zero is redundant. [badBitmaskCheck]
flags = flags | SDL_RENDERER_PRESENTVSYNC;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/director.cpp:481:39: performance: Function parameter 'filepath' should be passed by const reference. [passedByValue]
void Director::loadParams(std::string filepath)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/director.cpp:506:47: performance: Function parameter 'folder' should be passed by const reference. [passedByValue]
void Director::createSystemFolder(std::string folder)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/director.cpp:572:12: performance: Range variable 'l' should be declared as const reference. [iterateByValue]
for (auto l : list)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/director.cpp:590:12: performance: Range variable 'l' should be declared as const reference. [iterateByValue]
for (auto l : list)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/director.cpp:487:54: style: Parameter 'argv' can be declared as const array [constParameter]
void Director::checkProgramArguments(int argc, char *argv[])
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/enemy_formations.cpp:455:7: style: Variable 'incX' is assigned a value that is never used. [unreadVariable]
incX = BALLOON_WIDTH_1 + 1;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.h:275:7: style: Unused private function: 'Game::decBalloonSpeed' [unusedPrivateFunction]
void decBalloonSpeed();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.h:287:7: style: Unused private function: 'Game::popAllBalloons' [unusedPrivateFunction]
void popAllBalloons();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.h:299:6: style: Unused private function: 'Game::countBalloons' [unusedPrivateFunction]
int countBalloons();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2421:13: style: Condition 'i<STAGE_COUNTER' is always true [knownConditionTrueFalse]
else if (i< STAGE_COUNTER)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2407:20: note: Assuming that condition 'i<STAGE_COUNTER' is not redundant
for (int i = 0; i < STAGE_COUNTER; ++i)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2421:13: note: Condition 'i<STAGE_COUNTER' is always true
else if (i< STAGE_COUNTER)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:180:13: style: Local variable 'player' shadows outer variable [shadowVariable]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:136:7: note: Shadowed declaration
auto player = getPlayer(player_id);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:180:13: note: Shadow variable
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:247:9: style: Local variable 'player' shadows outer variable [shadowVariable]
auto player = getPlayer(otherPlayer);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:136:7: note: Shadowed declaration
auto player = getPlayer(player_id);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:247:9: note: Shadow variable
auto player = getPlayer(otherPlayer);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:251:14: style: Local variable 'player' shadows outer variable [shadowVariable]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:136:7: note: Shadowed declaration
auto player = getPlayer(player_id);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:251:14: note: Shadow variable
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:600:37: performance: Function parameter 'file_path' should be passed by const reference. [passedByValue]
bool Game::loadDemoFile(std::string file_path, DemoKeys (*data_file)[TOTAL_DEMO_DATA])
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2687:45: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
void Game::addScoreToScoreBoard(std::string name, int score)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:180:13: style: Variable 'player' can be declared as reference to const [constVariableReference]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:764:13: style: Variable 'player' can be declared as reference to const [constVariableReference]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:1171:13: style: Variable 'balloon' can be declared as reference to const [constVariableReference]
for (auto &balloon : balloons_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:1230:13: style: Variable 'balloon' can be declared as reference to const [constVariableReference]
for (auto &balloon : balloons_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:1680:13: style: Variable 'balloon' can be declared as reference to const [constVariableReference]
for (auto &balloon : balloons_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2350:13: style: Variable 'balloon' can be declared as reference to const [constVariableReference]
for (auto &balloon : balloons_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2451:14: style: Variable 'player' can be declared as reference to const [constVariableReference]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2467:13: style: Variable 'player' can be declared as reference to const [constVariableReference]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2479:13: style: Variable 'player' can be declared as reference to const [constVariableReference]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2491:13: style: Variable 'player' can be declared as reference to const [constVariableReference]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2663:13: style: Variable 'player' can be declared as reference to const [constVariableReference]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2732:13: style: Variable 'player' can be declared as reference to const [constVariableReference]
for (auto &player : players_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:1234:4: style: Consider using std::count_if algorithm instead of a raw loop. [useStlAlgorithm]
num++;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:1684:20: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
menace_current_ += balloon->getMenace();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2354:10: style: Consider using std::accumulate algorithm instead of a raw loop. [useStlAlgorithm]
power += balloon->getPower();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:2735:3: style: Consider using std::find_if algorithm instead of a raw loop. [useStlAlgorithm]
{
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:604:30: style: Variable 'file_name' is assigned a value that is never used. [unreadVariable]
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:673:37: performance: Function parameter 'file_path' should be passed by const reference. [passedByValue]
bool Game::saveDemoFile(std::string file_path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game.cpp:676:30: style: Variable 'file_name' is assigned a value that is never used. [unreadVariable]
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/game_logo.cpp:19:5: performance: Variable 'dust_texture_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
dust_texture_ = std::make_shared<Texture>(Screen::get()->getRenderer(), Asset::get()->get("title_dust.png"));
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/input.h:94:2: style: Class 'Input' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Input(std::string game_controller_db_path);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/input.cpp:12:30: performance: Function parameter 'game_controller_db_path' should be passed by const reference. [passedByValue]
void Input::init(std::string game_controller_db_path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/input.cpp:30:26: performance: Function parameter 'game_controller_db_path' should be passed by const reference. [passedByValue]
Input::Input(std::string game_controller_db_path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/input.cpp:531:39: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
int Input::getIndexByName(std::string name) const
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/input.cpp:575:42: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
InputType Input::to_inputs_e(std::string name) const
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/input.cpp:441:32: style: Variable 'separator' is assigned a value that is never used. [unreadVariable]
const std::string separator(" #");
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/intro.cpp:416:13: style: Variable 'text' can be declared as reference to const [constVariableReference]
for (auto &text : texts_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/item.cpp:11:2: performance: Variable 'sprite_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
sprite_ = std::make_unique<AnimatedSprite>(texture, "", animation);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/item.cpp:14:2: performance: Variable 'time_to_live_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
time_to_live_ = 600;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/manage_hiscore_table.cpp:89:26: style: C-style pointer casting [cstyleCast]
char *name = (char *)malloc(nameSize + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/manage_hiscore_table.cpp:53:38: performance: Function parameter 'a' should be passed by const reference. [passedByValue]
bool operator()(HiScoreEntry a, HiScoreEntry b) const { return a.score > b.score; }
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/manage_hiscore_table.cpp:53:54: performance: Function parameter 'b' should be passed by const reference. [passedByValue]
bool operator()(HiScoreEntry a, HiScoreEntry b) const { return a.score > b.score; }
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/manage_hiscore_table.cpp:60:51: performance: Function parameter 'file_path' should be passed by const reference. [passedByValue]
bool ManageHiScoreTable::loadFromFile(std::string file_path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/manage_hiscore_table.cpp:116:49: performance: Function parameter 'file_path' should be passed by const reference. [passedByValue]
bool ManageHiScoreTable::saveToFile(std::string file_path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/manage_hiscore_table.cpp:65:32: style: Variable 'filename' is assigned a value that is never used. [unreadVariable]
const std::string filename = file_path.substr(file_path.find_last_of("\\/") + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/manage_hiscore_table.cpp:119:32: style: Variable 'fileName' is assigned a value that is never used. [unreadVariable]
const std::string fileName = file_path.substr(file_path.find_last_of("\\/") + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.cpp:30:2: performance: Variable 'currentFlip_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
currentFlip_ = SDL_FLIP_NONE;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.cpp:69:20: warning: The class 'MovingSprite' defines member function with name 'render' also defined in its parent class 'Sprite'. [duplInheritedMember]
void MovingSprite::render()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:30:10: note: Parent function 'Sprite::render'
void render();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.cpp:69:20: note: Derived function 'MovingSprite::render'
void MovingSprite::render()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.cpp:78:21: warning: The class 'MovingSprite' defines member function with name 'getPosX' also defined in its parent class 'Sprite'. [duplInheritedMember]
float MovingSprite::getPosX() const
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:33:9: note: Parent function 'Sprite::getPosX'
int getPosX() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.cpp:78:21: note: Derived function 'MovingSprite::getPosX'
float MovingSprite::getPosX() const
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.cpp:84:21: warning: The class 'MovingSprite' defines member function with name 'getPosY' also defined in its parent class 'Sprite'. [duplInheritedMember]
float MovingSprite::getPosY() const
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:34:9: note: Parent function 'Sprite::getPosY'
int getPosY() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.cpp:84:21: note: Derived function 'MovingSprite::getPosY'
float MovingSprite::getPosY() const
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.cpp:298:24: warning: The class 'MovingSprite' defines member function with name 'getRect' also defined in its parent class 'Sprite'. [duplInheritedMember]
SDL_Rect MovingSprite::getRect()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.h:44:14: note: Parent function 'Sprite::getRect'
SDL_Rect getRect() const;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.cpp:298:24: note: Derived function 'MovingSprite::getRect'
SDL_Rect MovingSprite::getRect()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/notify.cpp:17:5: performance: Variable 'bgColor' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
bgColor = param.notification.color;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/notify.cpp:13:120: performance: Function parameter 'soundFile' should be passed by const reference. [passedByValue]
Notify::Notify(SDL_Renderer *renderer, std::string iconFile, std::string bitmapFile, std::string textFile, std::string soundFile)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/options.cpp:243:29: performance: Function parameter 'var' should be passed by const reference. [passedByValue]
bool setOptions(std::string var, std::string value)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/options.cpp:243:46: performance: Function parameter 'value' should be passed by const reference. [passedByValue]
bool setOptions(std::string var, std::string value)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/options.cpp:89:30: style: Variable 'file_name' is assigned a value that is never used. [unreadVariable]
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/options.cpp:153:30: style: Variable 'file_name' is assigned a value that is never used. [unreadVariable]
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:155:28: performance: Function parameter 'var' should be passed by const reference. [passedByValue]
bool setParams(std::string var, std::string value)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:155:45: performance: Function parameter 'value' should be passed by const reference. [passedByValue]
bool setParams(std::string var, std::string value)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:101:48: warning: Either the condition 'pos<=(int)line.size()' is redundant or 'pos' can have the value line.size(). Expression 'line[pos]' cause access out of bounds. [containerOutOfBounds]
while (pos <= (int)line.size() && (int)line[pos] > 32)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:101:16: note: Assuming that condition 'pos<=(int)line.size()' is not redundant
while (pos <= (int)line.size() && (int)line[pos] > 32)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:101:48: note: Access out of bounds
while (pos <= (int)line.size() && (int)line[pos] > 32)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:117:49: warning: Either the condition 'pos<=(int)line.size()' is redundant or 'pos' can have the value line.size(). Expression 'line[pos]' cause access out of bounds. [containerOutOfBounds]
while (pos <= (int)line.size() && (int)line[pos] <= 32)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:117:17: note: Assuming that condition 'pos<=(int)line.size()' is not redundant
while (pos <= (int)line.size() && (int)line[pos] <= 32)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:117:49: note: Access out of bounds
while (pos <= (int)line.size() && (int)line[pos] <= 32)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:130:50: warning: Either the condition 'pos<=(int)line.size()' is redundant or 'pos' can have the value line.size(). Expression 'line[pos]' cause access out of bounds. [containerOutOfBounds]
while (pos <= (int)line.size() && (int)line[pos] > 32)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:130:18: note: Assuming that condition 'pos<=(int)line.size()' is not redundant
while (pos <= (int)line.size() && (int)line[pos] > 32)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:130:50: note: Access out of bounds
while (pos <= (int)line.size() && (int)line[pos] > 32)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/param.cpp:84:11: performance: Ineffective call of function 'substr' because a prefix of the string is assigned to itself. Use resize() or pop_back() instead. [uselessCallsSubstr]
line = line.substr(0, line.find("#"));
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:14:9: warning: Member variable 'Player::controller_index_' is not initialized in the constructor. [uninitMemberVar]
Player::Player(int id, float x, int y, bool demo, SDL_Rect *play_area, std::vector<std::shared_ptr<Texture>> texture, std::vector<std::vector<std::string> *> animations)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:17:2: performance: Variable 'player_sprite_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
player_sprite_ = std::make_unique<AnimatedSprite>(texture[0], "", animations[0]);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:18:2: performance: Variable 'power_sprite_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
power_sprite_ = std::make_unique<AnimatedSprite>(texture[1], "", animations[1]);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:241:22: style: The statement 'if (status_walking_!=status) status_walking_=status' is logically equivalent to 'status_walking_=status'. [duplicateConditionalAssign]
if (status_walking_ != status)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:243:19: note: Assignment 'status_walking_=status'
status_walking_ = status;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:241:22: note: Condition 'status_walking_!=status' is redundant
if (status_walking_ != status)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:251:21: style: The statement 'if (status_firing_!=status) status_firing_=status' is logically equivalent to 'status_firing_=status'. [duplicateConditionalAssign]
if (status_firing_ != status)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:253:18: note: Assignment 'status_firing_=status'
status_firing_ = status;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:251:21: note: Condition 'status_firing_!=status' is redundant
if (status_firing_ != status)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:697:70: performance: Function parameter 'texture' should be passed by const reference. [passedByValue]
void Player::setPlayerTextures(std::vector<std::shared_ptr<Texture>> texture)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:747:34: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
void Player::setName(std::string name)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/player.cpp:753:40: performance: Function parameter 'record_name' should be passed by const reference. [passedByValue]
void Player::setRecordName(std::string record_name)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.cpp:40:2: performance: Variable 'game_power_meter_texture_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
game_power_meter_texture_ = nullptr;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.cpp:41:2: performance: Variable 'power_meter_sprite_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
power_meter_sprite_ = nullptr;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.cpp:42:2: performance: Variable 'text_scoreboard_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
text_scoreboard_ = nullptr;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.h:106:2: style: Class 'Scoreboard' has a constructor with 1 argument that is not explicit. [noExplicitConstructor]
Scoreboard(SDL_Renderer *renderer);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.cpp:326:13: style: Local variable 'rect_' shadows outer variable [shadowVariable]
SDL_Rect rect_ = {enter_name_pos_.x, enter_name_pos_.y, 5, 7};
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.h:71:11: note: Shadowed declaration
SDL_Rect rect_; // Posición y dimensiones del marcador
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.cpp:326:13: note: Shadow variable
SDL_Rect rect_ = {enter_name_pos_.x, enter_name_pos_.y, 5, 7};
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.cpp:133:50: performance: Function parameter 'name_' should be passed by const reference. [passedByValue]
void Scoreboard::setName(int panel_, std::string name_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.cpp:139:56: performance: Function parameter 'record_name_' should be passed by const reference. [passedByValue]
void Scoreboard::setRecordName(int panel_, std::string record_name_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/scoreboard.cpp:187:45: performance: Function parameter 'name_' should be passed by const reference. [passedByValue]
void Scoreboard::setHiScoreName(std::string name_)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/screen.cpp:50:5: performance: Variable 'src_rect_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
src_rect_ = {0, 0, param.game.width, param.game.height};
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/screen.cpp:51:5: performance: Variable 'dst_rect_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
dst_rect_ = {0, 0, param.game.width, param.game.height};
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/screen.cpp:52:5: performance: Variable 'border_color_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
border_color_ = {0, 0, 0};
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/screen.cpp:66:5: performance: Variable 'fps_ticks_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
fps_ticks_ = 0;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/screen.cpp:458:43: performance: Function parameter 'text1' should be passed by const reference. [passedByValue]
void Screen::showNotification(std::string text1, std::string text2, int icon)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/screen.cpp:458:62: performance: Function parameter 'text2' should be passed by const reference. [passedByValue]
void Screen::showNotification(std::string text1, std::string text2, int icon)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/screen.cpp:188:24: style: Variable 'options.video.mode' is reassigned a value before the old one has been used. [redundantAssignment]
options.video.mode = ScreenVideoMode::WINDOW;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/screen.cpp:186:24: note: options.video.mode is assigned
options.video.mode = videoMode;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/screen.cpp:188:24: note: options.video.mode is overwritten
options.video.mode = ScreenVideoMode::WINDOW;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/smart_sprite.cpp:26:19: warning: The class 'SmartSprite' defines member function with name 'update' also defined in its parent class 'AnimatedSprite'. [duplInheritedMember]
void SmartSprite::update()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/animated_sprite.h:88:10: note: Parent function 'AnimatedSprite::update'
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/smart_sprite.cpp:26:19: note: Derived function 'SmartSprite::update'
void SmartSprite::update()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/smart_sprite.cpp:26:19: warning: The class 'SmartSprite' defines member function with name 'update' also defined in its parent class 'MovingSprite'. [duplInheritedMember]
void SmartSprite::update()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/moving_sprite.h:45:10: note: Parent function 'MovingSprite::update'
void update();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/smart_sprite.cpp:26:19: note: Derived function 'SmartSprite::update'
void SmartSprite::update()
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/sprite.cpp:8:2: performance: Variable 'spriteClip_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
spriteClip_ = {0, 0, w, h};
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:82:49: performance: Function parameter 'text_file' should be passed by const reference. [passedByValue]
Text::Text(std::string bitmap_file, std::string text_file, SDL_Renderer *renderer)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:106:24: performance: Function parameter 'text_file' should be passed by const reference. [passedByValue]
Text::Text(std::string text_file, std::shared_ptr<Texture> texture)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:149:44: performance: Function parameter 'text' should be passed by const reference. [passedByValue]
void Text::write(int x, int y, std::string text, int kerning, int lenght)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:172:51: performance: Function parameter 'text' should be passed by const reference. [passedByValue]
void Text::writeColored(int x, int y, std::string text, Color color, int kerning, int lenght)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:180:52: performance: Function parameter 'text' should be passed by const reference. [passedByValue]
void Text::writeShadowed(int x, int y, std::string text, Color color, Uint8 shadow_distance, int kerning, int lenght)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:189:52: performance: Function parameter 'text' should be passed by const reference. [passedByValue]
void Text::writeCentered(int x, int y, std::string text, int kerning, int lenght)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:196:59: performance: Function parameter 'text' should be passed by const reference. [passedByValue]
void Text::writeDX(Uint8 flags, int x, int y, std::string text, int kerning, Color textColor, Uint8 shadow_distance, Color shadow_color, int lenght)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:238:30: performance: Function parameter 'text' should be passed by const reference. [passedByValue]
int Text::lenght(std::string text, int kerning) const
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:270:35: performance: Function parameter 'path' should be passed by const reference. [passedByValue]
void Text::addPalette(std::string path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/text.cpp:24:30: style: Variable 'file_name' is assigned a value that is never used. [unreadVariable]
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1).c_str();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.h:36:13: style: Unused private function: 'Texture::newSurface' [unusedPrivateFunction]
Surface newSurface(int w, int h);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:79:17: style: Condition 'req_format==STBI_rgb' is always false [knownConditionTrueFalse]
if (req_format == STBI_rgb)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:60:19: note: Assignment 'req_format=STBI_rgb_alpha', assigned value is 4
int req_format = STBI_rgb_alpha;
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:79:17: note: Condition 'req_format==STBI_rgb' is always false
if (req_format == STBI_rgb)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:99:66: style: C-style pointer casting [cstyleCast]
SDL_Surface *loadedSurface = SDL_CreateRGBSurfaceWithFormatFrom((void *)data, width, height, depth, pitch, pixel_format);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:244:18: style: C-style pointer casting [cstyleCast]
Surface surf = (Surface)malloc(sizeof(surface_s));
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:247:15: style: C-style pointer casting [cstyleCast]
surf->data = (Uint8 *)malloc(w * h);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:279:18: style: C-style pointer casting [cstyleCast]
Uint8 *buffer = (Uint8 *)malloc(size);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:290:21: style: C-style pointer casting [cstyleCast]
Surface surface = (Surface)malloc(sizeof(surface_s));
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:315:37: style: C-style pointer casting [cstyleCast]
SDL_LockTexture(texture_, nullptr, (void **)&pixels, &pitch);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:343:18: style: C-style pointer casting [cstyleCast]
Uint8 *buffer = (Uint8 *)malloc(size);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:14:54: performance: Function parameter 'path' should be passed by const reference. [passedByValue]
Texture::Texture(SDL_Renderer *renderer, std::string path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:57:40: performance: Function parameter 'path' should be passed by const reference. [passedByValue]
bool Texture::loadFromFile(std::string path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:364:38: performance: Function parameter 'path' should be passed by const reference. [passedByValue]
void Texture::addPalette(std::string path)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:41:4: performance: Passing the result of c_str() to a function that takes std::string as argument no. 1 is slow and redundant. [stlcstrParam]
addPalette(path_.c_str());
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/texture.cpp:59:30: style: Variable 'file_name' is assigned a value that is never used. [unreadVariable]
const std::string file_name = path.substr(path.find_last_of("\\/") + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/title.cpp:318:12: style: Local variable 'num_controllers_' shadows outer variable [shadowVariable]
const int num_controllers_ = input_->getNumControllers();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/title.h:70:6: note: Shadowed declaration
int num_controllers_; // Número de mandos conectados
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/title.cpp:318:12: note: Shadow variable
const int num_controllers_ = input_->getNumControllers();
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:187:19: style: C-style pointer casting [cstyleCast]
char *lower = (char *)malloc(str.size() + 1);
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:166:31: performance: Function parameter 'str' should be passed by const reference. [passedByValue]
bool stringToBool(std::string str)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:184:33: performance: Function parameter 'str' should be passed by const reference. [passedByValue]
std::string toLower(std::string str)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:200:45: performance: Function parameter 'sounds' should be passed by const reference. [passedByValue]
JA_Sound_t *getSound(std::vector<SoundFile> sounds, std::string name)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:200:65: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
JA_Sound_t *getSound(std::vector<SoundFile> sounds, std::string name)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:202:15: performance: Range variable 's' should be declared as const reference. [iterateByValue]
for (auto s : sounds)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:214:45: performance: Function parameter 'music' should be passed by const reference. [passedByValue]
JA_Music_t *getMusic(std::vector<MusicFile> music, std::string name)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:214:64: performance: Function parameter 'name' should be passed by const reference. [passedByValue]
JA_Music_t *getMusic(std::vector<MusicFile> music, std::string name)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:216:15: performance: Range variable 'm' should be declared as const reference. [iterateByValue]
for (auto m : music)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:228:44: performance: Function parameter 'entry1' should be passed by const reference. [passedByValue]
HiScoreEntry sortHiScoreTable(HiScoreEntry entry1, HiScoreEntry entry2)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:228:65: performance: Function parameter 'entry2' should be passed by const reference. [passedByValue]
HiScoreEntry sortHiScoreTable(HiScoreEntry entry1, HiScoreEntry entry2)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:32:29: style: Parameter 'a' can be declared as reference to const [constParameterReference]
bool checkCollision(Circle &a, Circle &b)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:32:40: style: Parameter 'b' can be declared as reference to const [constParameterReference]
bool checkCollision(Circle &a, Circle &b)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:50:29: style: Parameter 'a' can be declared as reference to const [constParameterReference]
bool checkCollision(Circle &a, SDL_Rect &b)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:50:42: style: Parameter 'b' can be declared as reference to const [constParameterReference]
bool checkCollision(Circle &a, SDL_Rect &b)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:95:31: style: Parameter 'a' can be declared as reference to const [constParameterReference]
bool checkCollision(SDL_Rect &a, SDL_Rect &b)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:95:44: style: Parameter 'b' can be declared as reference to const [constParameterReference]
bool checkCollision(SDL_Rect &a, SDL_Rect &b)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:135:32: style: Parameter 'p' can be declared as reference to const [constParameterReference]
bool checkCollision(SDL_Point &p, SDL_Rect &r)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:135:45: style: Parameter 'r' can be declared as reference to const [constParameterReference]
bool checkCollision(SDL_Point &p, SDL_Rect &r)
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:205:9: style: Consider using std::find_if algorithm instead of a raw loop. [useStlAlgorithm]
{
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/utils.cpp:219:9: style: Consider using std::find_if algorithm instead of a raw loop. [useStlAlgorithm]
{
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/writer.cpp:11:2: performance: Variable 'caption_' is assigned in constructor body. Consider performing initialization in initialization list. [useInitializationList]
caption_ = "";
^
/home/sergio/gitea/coffee_crisis_arcade_edition/source/writer.cpp:81:37: performance: Function parameter 'text' should be passed by const reference. [passedByValue]
void Writer::setCaption(std::string text)
^
nofile:0:0: information: Too many #ifdef configurations - cppcheck only checks 12 configurations. Use --force to check all configurations. For more details, use --enable=information. [toomanyconfigs]