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

Improve submap encapsulation #37893

Merged
merged 8 commits into from
Feb 13, 2020

Conversation

ifreund
Copy link
Contributor

@ifreund ifreund commented Feb 10, 2020

Summary

SUMMARY: Infrastructure "Improve submap encapsulation"

Purpose of change

Further progress towards #29674

Describe the solution

Add additional getter/setter functions to submap and make the inheritance from maptile_soa private.

This does not yet achieve complete encapsulation as get_field() and get_items() have non-const versions allowing free access to fld and itm. However, this PR does successfully encapsulate the rest of the members of maptile_soa and sets the stage for followup PRs completing the encapsulation of fld and itm.

There should be no observable differences in game due to these changes.

Testing

Compiled and ran the tests. Loaded in to a game without issues.

There are still two loose ends on proper encapsulation here. Namely, the
non-const get_field() and get_items(). These need to be replaced with
either the necessary setters or by moving necessary code to submap.
@ifreund ifreund added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. labels Feb 10, 2020
src/submap.h Outdated Show resolved Hide resolved
@Rivet-the-Zombie Rivet-the-Zombie merged commit 3a8c5fb into CleverRaven:master Feb 13, 2020
@ifreund ifreund deleted the submap-encapsulation branch February 13, 2020 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style Fields / Furniture / Terrain / Traps Objects that are part of the map or its features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants