Skip to content

Fix issues reported by zoeontheloose + Undefined Behaviour in ControlSwitches#3541

Open
Ghabry wants to merge 6 commits intoEasyRPG:masterfrom
Ghabry:fixes-zoe
Open

Fix issues reported by zoeontheloose + Undefined Behaviour in ControlSwitches#3541
Ghabry wants to merge 6 commits intoEasyRPG:masterfrom
Ghabry:fixes-zoe

Conversation

@Ghabry
Copy link
Copy Markdown
Member

@Ghabry Ghabry commented Apr 30, 2026

Various small stuff:

  • Touched extremely old code Control Switch code (I tested in RPG_RT and the new behaviour seems more accurate)
  • "Event exists" for Conditional Branch (very useful in combination with out Clone Event command)
  • String ToNum always uses decimal now
  • Var support for ShowStringPic sys/font name. This was a bit annoying to add as had to figure out how the numbers are encoded...

Most were reported by zoeontheloose in our community because is shadowbanned on GitHub: https://community.easyrpg.org/t/various-small-bug-reports-regarding-maniacs-features/1691

@Ghabry Ghabry added this to the 0.8.2 milestone Apr 30, 2026
@Ghabry Ghabry marked this pull request as ready for review May 3, 2026 11:01
Comment thread src/maniac_patch.cpp

out = 0;

if (!(str.size() > 0 && str.size() <= 6)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

str.empty()||size>6

Comment thread src/maniac_patch.cpp
return false;
}

out = static_cast<uint32_t>(result);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The casting here is a bit ugly, result variable is not really needed, when doing all unsigned. !in_range could be simplified to >=32 as well then.

Comment thread src/maniac_patch.cpp
out += static_cast<uint32_t>(result << (chidx * 5));
}

return out;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if out is 0, is this not valid?

Comment thread src/game_interpreter.cpp

if (start == end) {
if (val < 2) {
if (val == 0 || val == 1) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe any log entry/assert for val>2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants