Codechange: Use .fill() to clear an array instead of assigning a new array. (#13880)

Avoids allocating a temporary on the stack.
This commit is contained in:
Peter Nelson
2025-03-23 22:09:45 +00:00
committed by GitHub
parent ca801d55d5
commit fc7b6c6cbb
4 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -787,7 +787,7 @@ static IntervalTimer<TimerGameEconomy> _economy_companies_yearly({TimerGameEcono
for (Company *c : Company::Iterate()) {
/* Move expenses to previous years. */
std::rotate(std::rbegin(c->yearly_expenses), std::rbegin(c->yearly_expenses) + 1, std::rend(c->yearly_expenses));
c->yearly_expenses[0] = {};
c->yearly_expenses[0].fill(0);
InvalidateWindowData(WC_FINANCES, c->index);
}