diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 409c7eb6e7..79cd85066d 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -2704,11 +2704,14 @@ bool AfterLoadGame() /* yearly_expenses has 3*15 entries now, saveload code gave us 3*13. * Move the old data to the right place in the new array and clear the new data. * The move has to be done in reverse order (first 2, then 1). */ - MemMoveT(&c->yearly_expenses[2][0], &c->yearly_expenses[1][11], 13); - MemMoveT(&c->yearly_expenses[1][0], &c->yearly_expenses[0][13], 13); + // MemMoveT(&c->yearly_expenses[2][0], &c->yearly_expenses[1][11], 13); + // MemMoveT(&c->yearly_expenses[1][0], &c->yearly_expenses[0][13], 13); + // The below are equivalent to the MemMoveT calls above + std::copy_backward(&c->yearly_expenses[1][11], &c->yearly_expenses[1][11] + 13, &c->yearly_expenses[2][0] + 13); + std::copy_backward(&c->yearly_expenses[0][13], &c->yearly_expenses[0][13] + 13, &c->yearly_expenses[1][0] + 13); /* Clear the old location of just-moved data, so sharing income/expenses is set to 0 */ - MemSetT(&c->yearly_expenses[0][13], 0, 2); - MemSetT(&c->yearly_expenses[1][13], 0, 2); + std::fill_n(&c->yearly_expenses[0][13], 2, 0); + std::fill_n(&c->yearly_expenses[1][13], 2, 0); } } diff --git a/src/station_base.h b/src/station_base.h index 05a113c04c..022143b9b1 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -358,6 +358,8 @@ public: FlowStatMapIterator(const FlowStatMapIterator::iterator> &other) : fsm(other.fsm), current(other.current) {} + FlowStatMapIterator &operator=(const FlowStatMapIterator &) = default; + reference operator*() const { return this->fsm->flows_storage[this->current->second]; } pointer operator->() const { return &(this->fsm->flows_storage[this->current->second]); } diff --git a/src/zoning_cmd.cpp b/src/zoning_cmd.cpp index 8af7c929ef..b391936c57 100644 --- a/src/zoning_cmd.cpp +++ b/src/zoning_cmd.cpp @@ -194,8 +194,7 @@ SpriteID TileZoneCheckUnservedBuildingsEvaluation(TileIndex tile, Owner owner) } CargoArray dat; - - memset(&dat, 0, sizeof(dat)); + dat.Clear(); AddAcceptedCargo(tile, dat, nullptr); if (dat[CT_MAIL] + dat[CT_PASSENGERS] == 0) { // nothing is accepted, so now test if cargo is produced