lav-sdl

SDL верзија програма Лавиринт
Дневник | Датотеке | Референце | ПРОЧИТАЈМЕ | ЛИЦЕНЦА

чување 5da34196c11e494520c53f3b25d3f0d262164f27
родитељ b0f0e936d9700de6e94c9aca44acd57c8f712dda
Аутор: Страхиња Радић <contact@strahinja.org>
Датум:   Tue, 15 Aug 2023 07:41:14 +0200

clean.do: Add -f; lav-sdl.c: Remove unused functions, optimize next_step

Signed-off-by: Страхиња Радић <contact@strahinja.org>

Diffstat:
Mclean.do | 2+-
Mlav-sdl.c | 40++++------------------------------------
измењених датотека: 2, додавања: 5(+), брисања: 37(-)

diff --git a/clean.do b/clean.do @@ -1 +1 @@ -rm *.o lav-sdl +rm -f *.o lav-sdl diff --git a/lav-sdl.c b/lav-sdl.c @@ -86,10 +86,6 @@ static int state = STATE_SEARCHING_PAUSED; static SDL_Texture* ter16_texture = NULL; static SDL_Window* window = NULL; -void assign_point(const SDL_Point* from, SDL_Point* to); -void assign_point_xy(const int x, const int y, SDL_Point* to); -void assign_pointF(const SDL_FPoint* from, SDL_FPoint* to); -void assign_point_xyF(const float x, const float y, SDL_FPoint* to); void assign_pointIF(const SDL_Point* from, SDL_FPoint* to); void assign_point_xyIF(const int x, const int y, SDL_FPoint* to); void calculate_delta(void); @@ -115,34 +111,6 @@ void reset(void); void update_size(void); void -assign_point(const SDL_Point* from, SDL_Point* to) -{ - to->x = from->x; - to->y = from->y; -} - -void -assign_point_xy(const int x, const int y, SDL_Point* to) -{ - to->x = x; - to->y = y; -} - -void -assign_pointF(const SDL_FPoint* from, SDL_FPoint* to) -{ - to->x = from->x; - to->y = from->y; -} - -void -assign_point_xyF(const float x, const float y, SDL_FPoint* to) -{ - to->x = x; - to->y = y; -} - -void assign_pointIF(const SDL_Point* from, SDL_FPoint* to) { to->x = (float)from->x; @@ -619,7 +587,7 @@ next_step(void) print_debug("next_step: Success"); state = STATE_SUCCESS; } - else if (hero.x > 0 && passable(hero.x - 1, hero.y)) + else if (passable(hero.x - 1, hero.y)) { print_debug("next_step: Trying x-1, y: (%d, %d), " "pushed to stack (%d, %d)", @@ -634,7 +602,7 @@ next_step(void) animation.active = 1; // labyrinth.cells[hero.y][hero.x] = CELL_HERO; } - else if (hero.y > 0 && passable(hero.x, hero.y - 1)) + else if (passable(hero.x, hero.y - 1)) { print_debug("next_step: Trying x, y-1: (%d, %d), " "pushed to stack (%d, %d)", @@ -649,7 +617,7 @@ next_step(void) animation.active = 1; // labyrinth.cells[hero.y][hero.x] = CELL_HERO; } - else if (hero.x + 1 < labyrinth.width && passable(hero.x + 1, hero.y)) + else if (passable(hero.x + 1, hero.y)) { print_debug("next_step: Trying x+1, y: (%d, %d), " "pushed to stack (%d, %d)", @@ -664,7 +632,7 @@ next_step(void) animation.active = 1; // labyrinth.cells[hero.y][hero.x] = CELL_HERO; } - else if (hero.y + 1 < labyrinth.height && passable(hero.x, hero.y + 1)) + else if (passable(hero.x, hero.y + 1)) { print_debug("next_step: Trying x, y+1: (%d, %d), " "pushed to stack (%d, %d)",