Added bugfix for missing no weather case in Cmd_weather_get (#2203)
Some checks failed
CI / build (push) Has been cancelled

This commit is contained in:
Mitsunee 2025-12-10 04:22:08 +01:00 committed by GitHub
parent f0e351b33d
commit 02c44242f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#define AI_EFFECTIVENESS_x0 0
// ai weather
#define AI_WEATHER_NONE UINT32_MAX // added as part of bugfix, see Cmd_weather_get in battle_ai_script_commands.c
#define AI_WEATHER_SUN 0
#define AI_WEATHER_RAIN 1
#define AI_WEATHER_SANDSTORM 2

View File

@ -1643,6 +1643,15 @@ static void Cmd_if_status_not_in_party(void)
static void Cmd_get_weather(void)
{
// BUG: due to the lack of an assignment in the case of there not being any
// weather set any previously set value could possibly be interpreted
// as a result of this function.
// Assigning AI_WEATHER_NONE here matches the fix implemented in future
// generations.
#ifdef BUGFIX
AI_THINKING_STRUCT->funcResult = AI_WEATHER_NONE;
#endif
if (gBattleWeather & B_WEATHER_RAIN)
AI_THINKING_STRUCT->funcResult = AI_WEATHER_RAIN;
if (gBattleWeather & B_WEATHER_SANDSTORM)