fix: cash wasn't set to 0 on reset
This commit is contained in:
parent
bee399a45e
commit
ba64ec7c81
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue