diff --git a/Makefile b/Makefile index 39940d8..c1bf8f5 100644 --- a/Makefile +++ b/Makefile @@ -7,12 +7,12 @@ release: .PHONY: release clean: - @make clean -sC _build/debug - @make clean -sC _build/release + @make -sC _build/debug clean + @make -sC _build/release clean .PHONY: clean test: - @make test -sC _build/debug + @make -sC _build/debug test .PHONY: test run: $(all) @@ -24,11 +24,11 @@ playtest: $(all) .PHONY: playtest lint: - @make lint -sC _build/debug + @make -sC _build/debug lint .PHONY: lint package: - @make package -sC _build/release + @make -sC _build/release package .PHONY: package setup: @@ -46,4 +46,5 @@ setup: teardown: @rm -rf _build + @rm compile_commands.json .PHONY: teardown diff --git a/src/actiontext.c b/src/actiontext.c index ed55dd5..c9771f6 100644 --- a/src/actiontext.c +++ b/src/actiontext.c @@ -47,7 +47,7 @@ actiontext_render(ActionText *t, Camera *cam) if (t->dead) return; - if (!t->dead && !timer_started(t->timer)) + if (!timer_started(t->timer)) timer_start(t->timer); if (timer_get_ticks(t->timer) < 500) { diff --git a/src/actiontextbuilder.c b/src/actiontextbuilder.c index 31c8bfd..bfffa51 100644 --- a/src/actiontextbuilder.c +++ b/src/actiontextbuilder.c @@ -32,7 +32,7 @@ actiontextbuilder_init(SDL_Renderer *renderer) } void -actiontextbuilder_create_text(const char *msg, SDL_Color color, Position *p) +actiontextbuilder_create_text(const char *msg, SDL_Color color, const Position *p) { assert (gRenderer != NULL); Sprite *sprite = sprite_create(); diff --git a/src/actiontextbuilder.h b/src/actiontextbuilder.h index 6c60435..82467d0 100644 --- a/src/actiontextbuilder.h +++ b/src/actiontextbuilder.h @@ -34,7 +34,7 @@ void actiontextbuilder_render(Camera*); void -actiontextbuilder_create_text(const char *msg, SDL_Color, Position*); +actiontextbuilder_create_text(const char *msg, SDL_Color, const Position*); void actiontextbuilder_close(void); diff --git a/src/animation.c b/src/animation.c index 15a1f54..7fdf058 100644 --- a/src/animation.c +++ b/src/animation.c @@ -86,7 +86,7 @@ animation_render(Animation *animation, Camera *camera) } void -animation_set_frames(Animation *animation, AnimationClip clips[]) +animation_set_frames(Animation *animation, const AnimationClip clips[]) { for (size_t i = 0; i < animation->clipCount; i++) { animation->clips[i] = clips[i]; diff --git a/src/animation.h b/src/animation.h index b6f8031..b21ee3e 100644 --- a/src/animation.h +++ b/src/animation.h @@ -53,7 +53,7 @@ void animation_load_texture(Animation *, const char *path, SDL_Renderer*); void -animation_set_frames(Animation*, AnimationClip clips[]); +animation_set_frames(Animation*, const AnimationClip clips[]); void animation_run(Animation*); diff --git a/src/artifact.c b/src/artifact.c index 97ffa66..ddd01bf 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -303,7 +303,7 @@ artifact_create(MagicalEffect effect) } Artifact * -artifact_copy(Artifact *a) +artifact_copy(const Artifact *a) { Artifact *new = ec_malloc(sizeof(Artifact)); *new = *a; diff --git a/src/artifact.h b/src/artifact.h index 8c58603..0a00870 100644 --- a/src/artifact.h +++ b/src/artifact.h @@ -66,7 +66,7 @@ Artifact * artifact_create(MagicalEffect); Artifact * -artifact_copy(Artifact*); +artifact_copy(const Artifact*); void artifact_render(Artifact*, Camera*); diff --git a/src/item_builder.c b/src/item_builder.c index f015efb..bcc2f6a 100644 --- a/src/item_builder.c +++ b/src/item_builder.c @@ -204,7 +204,6 @@ create_treasure(int current_level) unsigned int value; amt = (unsigned int) 1 + get_random(5*current_level) % 40; - amt = amt == 0 ? 1 : amt; if (current_level > 9) { highest_treasure = PLATINUM; diff --git a/src/linkedlist.c b/src/linkedlist.c index 7f98854..636b884 100644 --- a/src/linkedlist.c +++ b/src/linkedlist.c @@ -109,7 +109,7 @@ void* linkedlist_get(LinkedList **head, unsigned int index) return linkedlist_get(&(*head)->next, --index); } -void linkedlist_each(LinkedList **head, void (*fun)(void*)) +void linkedlist_each(const LinkedList **head, void (*fun)(void*)) { LinkedList *next = *head; diff --git a/src/linkedlist.h b/src/linkedlist.h index 3496bd1..f52741a 100644 --- a/src/linkedlist.h +++ b/src/linkedlist.h @@ -37,7 +37,7 @@ void* linkedlist_poplast(LinkedList **head); void* linkedlist_get(LinkedList **head, unsigned int index); -void linkedlist_each(LinkedList **head, void (*fun)(void*)); +void linkedlist_each(const LinkedList **head, void (*fun)(void*)); void linkedlist_destroy(LinkedList **head); diff --git a/src/menu.c b/src/menu.c index 33da9a2..81d59d2 100644 --- a/src/menu.c +++ b/src/menu.c @@ -110,7 +110,7 @@ menu_create_character_selector(void (*onCharacterSelect)(const char *), Camera * "Commissions/Mage.png" }; - static char *callbackData[] = { + static const char *callbackData[] = { "warrior", "rogue", "mage" diff --git a/src/mixer.c b/src/mixer.c index bfe1ab1..dea48d2 100644 --- a/src/mixer.c +++ b/src/mixer.c @@ -114,7 +114,7 @@ mixer_toggle_sound(void) } bool -mixer_toggle_music(GameState *state) +mixer_toggle_music(const GameState *state) { Settings *settings = settings_get(); settings->music_enabled = !settings->music_enabled; diff --git a/src/mixer.h b/src/mixer.h index 3d31c8e..f4f7098 100644 --- a/src/mixer.h +++ b/src/mixer.h @@ -79,7 +79,7 @@ bool mixer_toggle_sound(void); bool -mixer_toggle_music(GameState*); +mixer_toggle_music(const GameState*); void mixer_play_effect(Fx fx); diff --git a/src/monster.c b/src/monster.c index fe6e150..0042384 100644 --- a/src/monster.c +++ b/src/monster.c @@ -474,7 +474,7 @@ monster_coward_walk(Monster *m, RoomMatrix *rm) } static void -on_monster_move(Monster *m, Position *origPos, Map *map, RoomMatrix *rm) +on_monster_move(Monster *m, const Position *origPos, Map *map, RoomMatrix *rm) { Position currentTilePos = position_to_matrix_coords(&m->sprite->pos); Player *player = rm->spaces[rm->playerRoomPos.x][rm->playerRoomPos.y].player; diff --git a/src/skillbar.c b/src/skillbar.c index 67f1a41..961edad 100644 --- a/src/skillbar.c +++ b/src/skillbar.c @@ -64,7 +64,7 @@ load_texture(SkillBar *bar, const char *path, SDL_Renderer *renderer) s->dim = (Dimension) { 8, 8 }; s->fixed = true; sprite_load_text_texture(s, "GUI/SDS_8x8.ttf", 0, 8, 0); - m_sprintf(buffer, 4, "%u", i + 1 < 10 ? i + 1 : 0); + m_sprintf(buffer, 4, "%u", i + 1); texture_load_from_text(s->textures[0], buffer, C_YELLOW, C_BLACK, renderer); linkedlist_append(&bar->sprites, s); }