From 24bbb821d606c2cb1ccb0cc4892faab5de550505 Mon Sep 17 00:00:00 2001 From: ElwinBran Date: Thu, 2 May 2024 10:11:06 +0200 Subject: [PATCH] Trying to resolve only one roamer moving on pokedex --- src/roamer.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/roamer.c b/src/roamer.c index c962f2cc5..dc500c27d 100644 --- a/src/roamer.c +++ b/src/roamer.c @@ -129,30 +129,35 @@ void UpdateLocationHistoryForRoamer(void) } } -void RoamerMoveToOtherLocationSet(void) +void SlotRoamerMoveToOtherLocationSet(u8 slot) { u8 mapNum = 0; - u32 i; - // Choose a location set that starts with a map // different from the roamer's current map - for (i = 0; i < MAX_ROAMERS; i++) + if (GetRoamer(slot)->active) { - if (GetRoamer(i)->active) + while (1) { - while (1) + mapNum = sRoamerLocations[Random() % NUM_LOCATION_SETS][0]; + if (sRoamerLocation[slot][MAP_NUM] != mapNum) { - mapNum = sRoamerLocations[Random() % NUM_LOCATION_SETS][0]; - if (sRoamerLocation[i][MAP_NUM] != mapNum) - { - sRoamerLocation[i][MAP_NUM] = mapNum; - return; - } + sRoamerLocation[slot][MAP_NUM] = mapNum; + return; } } } } + +void RoamerMoveToOtherLocationSet(void) +{ + u32 i; + for (i = 0; i < MAX_ROAMERS; i++) + { + SlotRoamerMoveToOtherLocationSet(i); + } +} + void RoamerMove(void) { u32 i; //roamer slot @@ -163,7 +168,7 @@ void RoamerMove(void) continue; if ((Random() % 16) == 0) { - RoamerMoveToOtherLocationSet(); + SlotRoamerMoveToOtherLocationSet(i); } else {