Fixes linting and some lint warnings

This commit is contained in:
Linus Probert 2020-07-11 10:16:57 +02:00
parent 1a559741e2
commit 26c5448a30
No known key found for this signature in database
GPG Key ID: 644D2A477DF85CB4
3 changed files with 4 additions and 8 deletions

View File

@ -309,7 +309,7 @@ ENDIF ()
# LINT: # LINT:
if (CPPCHECK_FOUND) if (CPPCHECK_FOUND)
add_custom_target(lint 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} WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Run cppcheck" COMMENT "Run cppcheck"
) )

View File

@ -524,6 +524,7 @@ player_create(class_t class, Camera *cam)
player->gold = 500; player->gold = 500;
#else #else
player->daggers = 0; player->daggers = 0;
player->gold = 0;
#endif #endif
player->stat_data.total_steps = 0; player->stat_data.total_steps = 0;
player->stat_data.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.kills = 0;
player->stat_data.misses = 0; player->stat_data.misses = 0;
player->xp = 0; player->xp = 0;
player->gold = 0;
player->potion_sips = 0; player->potion_sips = 0;
player->phase_count = 0; player->phase_count = 0;
player->class = class; player->class = class;

View File

@ -27,16 +27,12 @@ vector2d_to_direction(const Vector2d *vec)
if (new.x > 0) if (new.x > 0)
new.x = 1; new.x = 1;
else if (new.x == 0) else if (new.x < 0)
new.x = 0;
else
new.x = -1; new.x = -1;
if (new.y > 0) if (new.y > 0)
new.y = 1; new.y = 1;
else if (new.y == 0) else if (new.y < 0)
new.y = 0;
else
new.y = -1; new.y = -1;
return new; return new;