From 8d63c9dd1c6d1b78caee7aa21670185fe022d0df Mon Sep 17 00:00:00 2001 From: david Date: Sat, 25 Jul 2026 05:05:21 -0300 Subject: segfault if you go to negative numbers in the maze game... --- rat.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rat.c') diff --git a/rat.c b/rat.c index e713cc4..136659f 100644 --- a/rat.c +++ b/rat.c @@ -47,7 +47,7 @@ void load(void) { &rat.hunger, &rat.love, &rat.fun, &rat.clean, &rat.health, &rat.age) != 6){ fprintf(stderr, "error: failed to initialize save data.\n"); } - //this should shut the compiler up + /*this should shut the compiler up*/ fclose(f); } @@ -67,12 +67,12 @@ float decay(float current, float dayspassed, float rate) { void setstat(){ int timenow = time(NULL); int newage = timenow - rat.age; - float days = newage / 86400.0f; //one day + float days = newage / 86400.0f; /*one day*/ - rat.hunger = decay(rat.hunger, days, 50.0f); //hungry beast - rat.love = decay(rat.love, days, 1.1f); //rats love you they won't hate you easly + rat.hunger = decay(rat.hunger, days, 50.0f); /*hungry beast*/ + rat.love = decay(rat.love, days, 1.1f); /*rats love you they won't hate you easly*/ rat.fun = decay(rat.fun, days, 25.0f); - rat.clean = decay(rat.clean, days, 5.0f);//rats are surprisingly clean they clean themselves so slow + rat.clean = decay(rat.clean, days, 5.0f);/*rats are surprisingly clean they clean themselves so slow*/ rat.health = decay(rat.health, days, 0.6f); rat.age = timenow; -- cgit v1.3-2-g0d8e