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
Merged

Fix player lifetime stats #21607

merged 4 commits into from
Aug 13, 2017

Conversation

BevapDin
Copy link
Contributor

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
Copy link
Contributor

ZhilkinSerg commented Aug 11, 2017

Will it change something in the lua 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.
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.
The constructor of the member is implicitly called and does the resetting on its own.
The reset function is not needed at all.
@BevapDin
Copy link
Contributor Author

I added it to be exported to Lua.

@kevingranade kevingranade merged commit 79a7a2c into CleverRaven:master Aug 13, 2017
@BevapDin BevapDin deleted the ps branch August 13, 2017 09:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants