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

Part of #21421: replace define with constexpr #21760

Merged

Conversation

janclod
Copy link
Contributor

@janclod janclod commented Apr 9, 2024

Part of #21421

Different refactor (mostly few lines of code per replaced define), some unused #define deleted, one define (ADD_CLAMP_BODY) replaced with a template function.

I realize that this PR may be too big to review at once, please let me know if I should split it.
Since this PR is a duplicate of #21705 and it incorporates all the feedback given there, I am leaving as is.

@ZehMatt
Copy link
Member

ZehMatt commented Apr 9, 2024

Please don't close PRs if you start over, instead force push.

@janclod
Copy link
Contributor Author

janclod commented Apr 9, 2024

Please don't close PRs if you start over, instead force push.

That was my initial idea, but I failed 😔 after a rebase, I did delete the upstream branch, this automatically closed the PR and I could not reopen. What is a good workflow, rebase and then force push? I am not familiar with force-push, can I do this after a rebase?

@ZehMatt
Copy link
Member

ZehMatt commented Apr 9, 2024

Please don't close PRs if you start over, instead force push.

That was my initial idea, but I failed 😔 after a rebase, I did delete the upstream branch, this automatically closed the PR and I could not reopen. What is a good workflow, rebase and then force push? I am not familiar with force-push, can I do this after a rebase?

Force push just means it will overwrite the branch forcefully which means also its rewriting its history. You can always reset a branch to its base by using git reset --hard upstream/develop and then force push, then you can start adding commits again.

@Broxzier
Copy link
Member

Broxzier commented Apr 9, 2024

Push only after you've already made a new commit, because otherwise your branch will be the same as develop (or even behind) and GitHub will automatically close the PR.

@janclod janclod force-pushed the replace-define-with-constexpr-fixvalue branch from cb19807 to c5b07f3 Compare April 11, 2024 18:48
janclod added a commit to janclod/OpenRCT2 that referenced this pull request Apr 11, 2024
@janclod
Copy link
Contributor Author

janclod commented Apr 11, 2024

Yeeey :D this time I forced pushed... Thanks for teaching me!

Oh no 😞 now everything is there twice 😓

Ok I see that only the latest commits show up in the summary at the top, not sure if this is right... Feedback welcome :)

@janclod janclod force-pushed the replace-define-with-constexpr-fixvalue branch from c5b07f3 to 78c5d02 Compare April 22, 2024 18:38
janclod added a commit to janclod/OpenRCT2 that referenced this pull request Apr 22, 2024
@janclod janclod force-pushed the replace-define-with-constexpr-fixvalue branch from c8f1654 to ab41350 Compare April 29, 2024 20:14
janclod added a commit to janclod/OpenRCT2 that referenced this pull request Apr 29, 2024
@janclod janclod requested a review from Gymnasiast April 29, 2024 20:20
@tupaschoal tupaschoal added the squash merge A PR that should be squashed on merge. label Apr 30, 2024
Copy link
Member

@tupaschoal tupaschoal left a comment

Choose a reason for hiding this comment

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

This LGTM. Should definitely be squash merged due to the confusion on some merges.

Might require a few rebases still due to network version changing (for #21850 and maybe more by the time you see it)

Copy link
Member

@ZehMatt ZehMatt left a comment

Choose a reason for hiding this comment

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

Left a few remarks, we don't do snake_case, the rest seems fine to me.

src/openrct2/util/Util.cpp Outdated Show resolved Hide resolved
src/openrct2/util/Util.cpp Outdated Show resolved Hide resolved
src/openrct2/util/Util.cpp Outdated Show resolved Hide resolved
@janclod janclod force-pushed the replace-define-with-constexpr-fixvalue branch from 19f44eb to cc6d69c Compare May 6, 2024 14:37
@janclod
Copy link
Contributor Author

janclod commented May 6, 2024

@ZehMatt thanks for catching the camel cases, incorporated suggestions.

Also improved further the template function AddClamp in Util.h, please have a last look, do not expect big surprises.

@tupaschoal also rebased on develop with correct network versioning.

@janclod janclod requested a review from ZehMatt May 6, 2024 14:42
Copy link
Contributor Author

@janclod janclod left a comment

Choose a reason for hiding this comment

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

Incorporated changes.

@tupaschoal
Copy link
Member

@Gymnasiast or @ZehMatt this looks ready to go (before another merge conflict)

Copy link
Member

@ZehMatt ZehMatt left a comment

Choose a reason for hiding this comment

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

LGTM, Thanks.

@tupaschoal tupaschoal merged commit 10a5d79 into OpenRCT2:develop May 9, 2024
22 checks passed
@tupaschoal tupaschoal added this to the v0.4.12 milestone May 9, 2024
mrmbernardi pushed a commit to mrmbernardi/OpenRCT2 that referenced this pull request May 10, 2024
* Part of OpenRCT2#21421: refactor TUNNEL_MAX_COUNT

* Part of OpenRCT2#21421: deleted unused OBJECT_SELECTION_NOT_...

* Part of OpenRCT2#21421: refactor MAX_SERVER_DESCRIPTION_LENGTH

* Part of OpenRCT2#21421: refactor EXPENDITURE_TABLE_MONTH_COUNT

* Part of OpenRCT2#21421: refactor FINANCE_GRAPH_SIZE

* Part of OpenRCT2#21421: refactor NETWORK_STREAM_VERSION and _ID

* Part of OpenRCT2#21421: MONEY_STRING_MAXLENGTH

* Part of OpenRCT2#21421: deleted MAX_USER_STRINGS

* Part of OpenRCT2#21421: refactor USER_STRING_MAX_LENGTH

* Part of OpenRCT2#21421: deleted USER_STRING_END

* Part of OpenRCT2#21421: refactor REAL_NAME_START

* Part of OpenRCT2#21421: refactor REAL_NAME_END

* Part of OpenRCT2#21421: deleted FONT(X) and FONT_OPENRCT2_SPRITE

* Part of OpenRCT2#21421: refactor CURRENCY_SYMBOL_MAX_SIZE

* Part of OpenRCT2#21421: refactor CURRENCY_RATE_MAX_NUM_DIGITS

* Part of OpenRCT2#21421: refactor SCROLLABLE_ROW_HEIGHT

* Part of OpenRCT2#21421: refactor ADD_CLAMP_BODY

* Part of OpenRCT2#21421: applied clang-format to Util.cpp

* Part of OpenRCT2#21421: incorporate feedback from OpenRCT2#21760

* Part of OpenRCT2#21421: revert to nbsp in Currency.cpp

* Part of OpenRCT2#21421: fix merge conflict

* Part of OpenRCT2#21421: fix more merge conflict

* Part of OpenRCT2#21421: apply clang format

* Part of OpenRCT2#21421: using std::numerics for finding bounds

* Part of OpenRCT2#21421: fix reference to kAddClampBody

* Part of OpenRCT2#21421: improved on comments about AddClamp func

* Part of OpenRCT2#21421: apply correct network stream version number

* Part of OpenRCT2#21421: apply clang-format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squash merge A PR that should be squashed on merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants