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

Fix player lifetime stats #21607

Merged
merged 4 commits into from Aug 13, 2017

Conversation

Projects
None yet
3 participants
@BevapDin
Copy link
Contributor

commented Aug 11, 2017

Store as member of player instead of global object.

Access directly (will be written by various code all over the place, a setter/modifier function seems unnecessary).
Name it lifetime_stats to distinguish it more clearly from the other stats like hunger, pain.

Remove stats::reset as it's not needed, instead set initial values of members of stats.

@Night-Pryanik Night-Pryanik changed the title Fix player lifetim stats Fix player lifetime stats Aug 11, 2017

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor

commented Aug 11, 2017

Will it change something in the lua player_stats?

BevapDin added some commits Aug 11, 2017

Fix player stats:
Store as member of player class instead of global object.

Access directly (will be written by various code all over the place, a setter/modifier function seems unnecessary).
Names it `lifetime_stats` to distinguish it more clearly from the other stats like hinger, pain.
Set initial values of members of struct stat
This allows to skip resetting in the constructor (which makes no sense anyway, why would one *re*set a freshly constructed object).
And the `reset` function now simply assigns a default constructed object.

The behaviour is essentially unchanged.
Remove call to reset player::lifetime_stats in constructor
The constructor of the member is implicitly called and does the resetting on its own.
The reset function is not needed at all.

@BevapDin BevapDin force-pushed the BevapDin:ps branch to 79a7a2c Aug 11, 2017

@BevapDin

This comment has been minimized.

Copy link
Contributor Author

commented Aug 11, 2017

I added it to be exported to Lua.

@kevingranade kevingranade merged commit 79a7a2c into CleverRaven:master Aug 13, 2017

3 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage decreased (-0.06%) to 22.792%
Details
gorgon-ghprb Build finished.
Details

@BevapDin BevapDin deleted the BevapDin:ps branch Aug 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.