diff options
author | Charles Pigott <charlespigott@googlemail.com> | 2018-05-13 18:34:57 +0100 |
---|---|---|
committer | frosch <github@elsenhans.name> | 2018-06-27 22:54:46 +0200 |
commit | 5f86e1a390b4aa9510d43f97251484ca67934f1c (patch) | |
tree | 8a9a74e4beeefb3ebe5585f0f10aac80d2ba078a /src/economy.cpp | |
parent | e1b9187e9b39ff2ce1982a8fbcb4f2a018662ce7 (diff) | |
download | openttd-5f86e1a390b4aa9510d43f97251484ca67934f1c.tar.xz |
Codechange: Silence -Wclass-memaccess warnings with GCC8
Diffstat (limited to 'src/economy.cpp')
-rw-r--r-- | src/economy.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index 70b0bd837..fae71f3e4 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -696,9 +696,10 @@ static void CompaniesGenStatistics() if (!HasBit(1 << 0 | 1 << 3 | 1 << 6 | 1 << 9, _cur_month)) return; FOR_ALL_COMPANIES(c) { - memmove(&c->old_economy[1], &c->old_economy[0], sizeof(c->old_economy) - sizeof(c->old_economy[0])); + /* Drop the oldest history off the end */ + std::copy_backward(c->old_economy, c->old_economy + MAX_HISTORY_QUARTERS - 1, c->old_economy + MAX_HISTORY_QUARTERS); c->old_economy[0] = c->cur_economy; - memset(&c->cur_economy, 0, sizeof(c->cur_economy)); + c->cur_economy = {}; if (c->num_valid_stat_ent != MAX_HISTORY_QUARTERS) c->num_valid_stat_ent++; |