diff options
| author | david <[email protected]> | 2026-07-25 05:05:21 -0300 |
|---|---|---|
| committer | david <[email protected]> | 2026-07-25 05:05:21 -0300 |
| commit | 8d63c9dd1c6d1b78caee7aa21670185fe022d0df (patch) | |
| tree | c37120e07efa864d191a9f067ffcc97f5fdb5abd /rat.c | |
| parent | 20da733459123ccb1c83e7a5689b34741711ad5c (diff) | |
| download | petratc-8d63c9dd1c6d1b78caee7aa21670185fe022d0df.tar.gz petratc-8d63c9dd1c6d1b78caee7aa21670185fe022d0df.zip | |
segfault if you go to negative numbers in the maze game...
Diffstat (limited to 'rat.c')
| -rw-r--r-- | rat.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -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; |
