Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DIRECTOR: LINGO: Implement STUB builtin b_union() #3926

Merged
merged 1 commit into from Jun 5, 2022
Merged

Conversation

r41k0u
Copy link
Contributor

@r41k0u r41k0u commented May 30, 2022

This change would implement the LB::b_union builtin which returns the smallest rect that can cover the two rects passed in the arguments.

res.type = RECT;

res.u.farr = new FArray();
res.u.farr->arr.push_back(Datum((int) fmin(rect1.u.farr->arr[0].u.i, rect2.u.farr->arr[0].u.i)));
Copy link
Member

@sev- sev- Jun 2, 2022

Choose a reason for hiding this comment

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

Why fmin() here? u.i is integer. Thus, please use Datum(MIN(rect1.u.farr->arr[0].u.i, rect2.u.farr->arr[0].u.i))


res.u.farr = new FArray();
res.u.farr->arr.push_back(Datum((int) fmin(rect1.u.farr->arr[0].u.i, rect2.u.farr->arr[0].u.i)));
res.u.farr->arr.push_back(Datum((int) fmax(rect1.u.farr->arr[1].u.i, rect2.u.farr->arr[1].u.i)));
Copy link
Member

@sev- sev- Jun 2, 2022

Choose a reason for hiding this comment

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

I think the order of operations is wrong here. As I understand, the sequence of coordinates in Rect are: [left, top, right, bottom]. Thus, you want MIN() or left and top and MAX() on right and bottom.

@r41k0u
Copy link
Contributor Author

@r41k0u r41k0u commented Jun 5, 2022

I corrected the code

@sev-
Copy link
Member

@sev- sev- commented Jun 5, 2022

Thanks!

@sev- sev- merged commit 6c71e89 into scummvm:master Jun 5, 2022
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants