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

Remove old Rect, Point and Size classes #3316

Merged
merged 14 commits into from
May 4, 2021
Merged

Remove old Rect, Point and Size classes #3316

merged 14 commits into from
May 4, 2021

Conversation

ihhub
Copy link
Owner

@ihhub ihhub commented May 1, 2021

to allow to use proper types and fix a lot of compilation warnings.

to allow to use proper types and fix a lot of compilation warnings.
@ihhub ihhub added the improvement New feature, request or improvement label May 1, 2021
@ihhub ihhub added this to the 0.9.4 milestone May 1, 2021
@ihhub ihhub self-assigned this May 1, 2021
@ihhub
Copy link
Owner Author

ihhub commented May 1, 2021

Hi @oleg-derevenetz and @idshibanov ,

This pull request is made to complete our long term transition from old engine to new engine, which we initially introduced in 0.8.1 version. Old Rect, Size and Point classes were based on 16-bit values, causing a lot of compilation warnings. This was one of the reasons why we disable implicit type casting checks during compilation.
Since we remove the old classes we can freely use 32-bit computations everywhere, including localevent class.

Could you please review it as it's a huge one and I might missed something or overdid?

const int16_t x = static_cast<int16_t>( st.center.x );
const int16_t y = static_cast<int16_t>( st.center.y );

return sb << x << y;
Copy link
Collaborator

@idshibanov idshibanov May 1, 2021

Choose a reason for hiding this comment

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

Great, that's what I was looking for. Every time we serialize a point, we'll have to convert to 16bit for now for compatibility.

Tested branch locally, looks good to me.

Copy link
Collaborator

@oleg-derevenetz oleg-derevenetz left a comment

Choose a reason for hiding this comment

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

LGTM. Just curious - is it worth to move such base classes like Point, Size and Rect to separate namespace and add fheroes2:: everywhere?

@ihhub
Copy link
Owner Author

ihhub commented May 2, 2021

LGTM. Just curious - is it worth to move such base classes like Point, Size and Rect to separate namespace and add fheroes2:: everywhere?

That's what we have right now. Old classes were outside any namespace while new Point, Size and Rect classes are within fheroes2 namespace. They both existed before.

@oleg-derevenetz
Copy link
Collaborator

oleg-derevenetz commented May 2, 2021

That's what we have right now. Old classes were outside any namespace while new Point, Size and Rect classes are within fheroes2 namespace. They both existed before.

I mean, is it justified? Why not move new classes to global namespace instead of adding fheroes2:: everywhere? It's not a library after all that should co-exist with another unknown libraries that may also have symbols with popular names like Point or Rect :)

@ihhub
Copy link
Owner Author

ihhub commented May 2, 2021

That's what we have right now. Old classes were outside any namespace while new Point, Size and Rect classes are within fheroes2 namespace. They both existed before.

I mean, is it justified? Why not move new classes to global namespace instead of adding fheroes2:: everywhere? It's not a library after all that should co-exist with another unknown libraries that may also have symbols with popular names like Point or Rect :)

We already had a lot of places using fheroes2 namespace so it was easier to just add namespace to the rest of places.

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 4, 2021

@ihhub ihhub merged commit ded320d into master May 4, 2021
@ihhub ihhub deleted the 32_bit branch May 4, 2021 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement New feature, request or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants