Codechange: Make TileLayoutSpriteGroup::ProcessRegisters return a DrawTileSpriteSpan on the stack, instead of a reference to a global.
This commit is contained in:
@@ -287,21 +287,19 @@ static bool RangeHighComparator(const DeterministicSpriteGroupRange &range, uint
|
||||
* @param[in,out] stage Construction stage (0-3), or nullptr if not applicable.
|
||||
* @return sprite layout to draw.
|
||||
*/
|
||||
const DrawTileSprites *TileLayoutSpriteGroup::ProcessRegisters(uint8_t *stage) const
|
||||
DrawTileSpriteSpan TileLayoutSpriteGroup::ProcessRegisters(uint8_t *stage) const
|
||||
{
|
||||
if (!this->dts.NeedsPreprocessing()) {
|
||||
if (stage != nullptr && this->dts.consistent_max_offset > 0) *stage = GetConstructionStageOffset(*stage, this->dts.consistent_max_offset);
|
||||
return &this->dts;
|
||||
return {this->dts.ground, this->dts.seq};
|
||||
}
|
||||
|
||||
static DrawTileSpriteSpan result;
|
||||
uint8_t actual_stage = stage != nullptr ? *stage : 0;
|
||||
this->dts.PrepareLayout(0, 0, 0, actual_stage, false);
|
||||
this->dts.ProcessRegisters(0, 0, false);
|
||||
result.seq = this->dts.GetLayout(&result.ground);
|
||||
|
||||
/* Stage has been processed by PrepareLayout(), set it to zero. */
|
||||
if (stage != nullptr) *stage = 0;
|
||||
|
||||
return &result;
|
||||
return this->dts.GetLayout();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user