Fix -Wdeprecated-copy and -Wclass-memaccess warnings on GCC 9
This commit is contained in:
@@ -2704,11 +2704,14 @@ bool AfterLoadGame()
|
|||||||
/* yearly_expenses has 3*15 entries now, saveload code gave us 3*13.
|
/* 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.
|
* 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). */
|
* 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[2][0], &c->yearly_expenses[1][11], 13);
|
||||||
MemMoveT(&c->yearly_expenses[1][0], &c->yearly_expenses[0][13], 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 */
|
/* Clear the old location of just-moved data, so sharing income/expenses is set to 0 */
|
||||||
MemSetT(&c->yearly_expenses[0][13], 0, 2);
|
std::fill_n(&c->yearly_expenses[0][13], 2, 0);
|
||||||
MemSetT(&c->yearly_expenses[1][13], 0, 2);
|
std::fill_n(&c->yearly_expenses[1][13], 2, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -358,6 +358,8 @@ public:
|
|||||||
FlowStatMapIterator(const FlowStatMapIterator<FlowStat, FlowStatMap, btree::btree_map<StationID, uint16>::iterator> &other) :
|
FlowStatMapIterator(const FlowStatMapIterator<FlowStat, FlowStatMap, btree::btree_map<StationID, uint16>::iterator> &other) :
|
||||||
fsm(other.fsm), current(other.current) {}
|
fsm(other.fsm), current(other.current) {}
|
||||||
|
|
||||||
|
FlowStatMapIterator &operator=(const FlowStatMapIterator &) = default;
|
||||||
|
|
||||||
reference operator*() const { return this->fsm->flows_storage[this->current->second]; }
|
reference operator*() const { return this->fsm->flows_storage[this->current->second]; }
|
||||||
pointer operator->() const { return &(this->fsm->flows_storage[this->current->second]); }
|
pointer operator->() const { return &(this->fsm->flows_storage[this->current->second]); }
|
||||||
|
|
||||||
|
@@ -194,8 +194,7 @@ SpriteID TileZoneCheckUnservedBuildingsEvaluation(TileIndex tile, Owner owner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CargoArray dat;
|
CargoArray dat;
|
||||||
|
dat.Clear();
|
||||||
memset(&dat, 0, sizeof(dat));
|
|
||||||
AddAcceptedCargo(tile, dat, nullptr);
|
AddAcceptedCargo(tile, dat, nullptr);
|
||||||
if (dat[CT_MAIL] + dat[CT_PASSENGERS] == 0) {
|
if (dat[CT_MAIL] + dat[CT_PASSENGERS] == 0) {
|
||||||
// nothing is accepted, so now test if cargo is produced
|
// nothing is accepted, so now test if cargo is produced
|
||||||
|
Reference in New Issue
Block a user