summaryrefslogtreecommitdiff
path: root/src/engine/clock.c
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2017-10-23 19:09:35 -0400
committerProjectRevoTPP <projectrevotpp@hotmail.com>2017-10-23 19:09:35 -0400
commitb4f9d6d92ea3bf2ce0227324e85311aaa0f828f0 (patch)
treec025c724147983e9f07b77f12a983877ea213927 /src/engine/clock.c
parentc1774eb429a99f0252fd449c174c963c036e4e03 (diff)
document berry.c.
Diffstat (limited to 'src/engine/clock.c')
-rw-r--r--src/engine/clock.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/engine/clock.c b/src/engine/clock.c
index 9635514d2..12b82018d 100644
--- a/src/engine/clock.c
+++ b/src/engine/clock.c
@@ -61,19 +61,18 @@ static void UpdatePerDay(struct Time *time)
static void UpdatePerMinute(struct Time *time)
{
struct Time newTime;
- s32 minutes;
+ s32 totalMinutes;
CalcTimeDifference(&newTime, &gSaveBlock2.lastBerryTreeUpdate, time);
- minutes = 1440 * newTime.days + 60 * newTime.hours + newTime.minutes;
+ totalMinutes = 1440 * newTime.days + 60 * newTime.hours + newTime.minutes;
- // there's no way to get the correct assembly other than with this nested if check. so dumb.
- if (minutes != 0)
+ if (totalMinutes == 0) // do not do the update for the first minute.
+ return;
+
+ if (totalMinutes > -1) // do not perform an update on invalid totalMinutes.
{
- if (minutes >= 0)
- {
- BerryTreeTimeUpdate(minutes);
- gSaveBlock2.lastBerryTreeUpdate = *time;
- }
+ BerryTreeTimeUpdate(totalMinutes);
+ gSaveBlock2.lastBerryTreeUpdate = *time;
}
}