From 26c5448a30b7f4df87d1831257817f6e5237a5bf Mon Sep 17 00:00:00 2001 From: Linus Probert Date: Sat, 11 Jul 2020 10:16:57 +0200 Subject: [PATCH] Fixes linting and some lint warnings --- CMakeLists.txt | 2 +- src/player.c | 2 +- src/vector2d.c | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 67c7577..67aadc3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -309,7 +309,7 @@ ENDIF () # LINT: if (CPPCHECK_FOUND) add_custom_target(lint - COMMAND ${CPPCHECK_EXECUTABLE} --force --language=c --template=gcc --error-exitcode=1 --quiet --suppress=unreadVariable --suppress=missingInclude --enable=warning,style,performance,portability,information,missingInclude src/ + COMMAND ${CPPCHECK_EXECUTABLE} --force --language=c --template=gcc --error-exitcode=1 --quiet --suppress=missingInclude --enable=warning,style,performance,portability,information,missingInclude src/ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} COMMENT "Run cppcheck" ) diff --git a/src/player.c b/src/player.c index 9e399fd..292417a 100644 --- a/src/player.c +++ b/src/player.c @@ -524,6 +524,7 @@ player_create(class_t class, Camera *cam) player->gold = 500; #else player->daggers = 0; + player->gold = 0; #endif player->stat_data.total_steps = 0; player->stat_data.steps = 0; @@ -531,7 +532,6 @@ player_create(class_t class, Camera *cam) player->stat_data.kills = 0; player->stat_data.misses = 0; player->xp = 0; - player->gold = 0; player->potion_sips = 0; player->phase_count = 0; player->class = class; diff --git a/src/vector2d.c b/src/vector2d.c index 67ed945..1efa796 100644 --- a/src/vector2d.c +++ b/src/vector2d.c @@ -27,16 +27,12 @@ vector2d_to_direction(const Vector2d *vec) if (new.x > 0) new.x = 1; - else if (new.x == 0) - new.x = 0; - else + else if (new.x < 0) new.x = -1; if (new.y > 0) new.y = 1; - else if (new.y == 0) - new.y = 0; - else + else if (new.y < 0) new.y = -1; return new;