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

Removing long (part 4): Remove support for serializing longs #31483

Merged
merged 1 commit into from
Jun 15, 2019

Conversation

jbytheway
Copy link
Contributor

Summary

SUMMARY: None

Purpose of change

longs are of different size on Windows and Linux, which means serializing longs leads to non-portable savegames or game data.

Also, the serializing of longs was via doubles, which means we couldn't support longs with full precision anyway.

Describe the solution

All the things that were serialized as longs are now done as ints:

  • Charges of various sorts.
  • Cash amounts for the player and mission rewards.
  • Map symbols (which are usually unicode codepoints, or a handful of other special values).

Some changes for charges values becoming int are in this PR rather than #31453 because they were passed by reference to these long function.

Describe alternatives you've considered

I considered adding serialization of int64_t, but decided YAGNI.

Additional context

Part of my ongoing effort to remove all longs from the code.

@ZhilkinSerg ZhilkinSerg added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Jun 15, 2019
Longs are of different size on Windows and Linux, which means
serializing longs leads to non-portable savegames or game data.

Also, the serializing of longs was via doubles, which means we couldn't
support longs with full precision anyway.

All the things that were serialized as longs are now done as ints:
- Charges of various sorts.
- Cash amounts for the player and mission rewards.
- Map symbols (which are usually unicode codepoints, or a handful of
  other special values).
@ZhilkinSerg ZhilkinSerg merged commit 2b18892 into CleverRaven:master Jun 15, 2019
@jbytheway jbytheway deleted the no_longs_in_json branch June 16, 2019 07:19
@jbytheway jbytheway mentioned this pull request Jun 19, 2019
4 tasks
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants