summaryrefslogtreecommitdiff
path: root/src/engine/clock.c
diff options
context:
space:
mode:
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;
}
}