fix: cash wasn't set to 0 on reset

This commit is contained in:
KikooDX 2021-06-05 18:36:05 +02:00
parent bee399a45e
commit ba64ec7c81
3 changed files with 10 additions and 1 deletions

View File

@ -12,6 +12,7 @@ struct Player {
};
struct Player player_init(int x, int y);
void reset_cash(void);
int player_draw(struct Player, int scr_x, int scr_y);
/* return 1 on zone transition */
int player_update(struct Player *restrict, struct Grid *restrict);

View File

@ -10,6 +10,7 @@ game_init(void)
grid_random_walker(&game.floor);
game.player = player_init(0, game.floor.height / 2);
game.rest = grid_new(25, 14);
reset_cash();
return game;
}

View File

@ -1,12 +1,19 @@
#include "player.h"
static int cash = 0;
struct Player
player_init(int x, int y)
{
static int cash = 0;
struct Player player;
player.x = x;
player.y = y;
player.cash = &cash;
return player;
}
void
reset_cash(void)
{
cash = 0;
}