mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #11075: SpriteListHead Refactor
Refactor "for (spriteIndex = gSpriteListHead[SPRITE_LIST_PEEP]; spriteIndex != SPRITE_INDEX_NULL; spriteIndex = nextSpriteIndex)" like for loops across files with replacing them by FOR_ALL_PEEPS(sprite_index, peep). The same for FOR_ALL_STAFF, FOR_ALL_GUESTS where necessary. modify incorrect codestyle modifying incorrect codestyle of the first attempted PR of issue 11075 (missing space after FOR_ALL_GUEST, FOR_ALL_STUFF ...) modify codestyle further Forgot to add one more space, correcting it. another codestyle correction apparently there is someting wrong with src/openrct2/peep/Peeps.cpp adding a newline after i = 0; event further modifying codestyle changing i = 0; to int i = 0; another codestyle modification, at this point just trying to pass CI clang adding another newline another modification
This commit is contained in:
parent
81ebacc0cf
commit
401504aff9
|
@ -138,6 +138,7 @@ The following people are not part of the development team, but have been contrib
|
|||
* Kevin Laframboise (klaframboise)
|
||||
* Tushar Sariya (TusharSariya)
|
||||
* (WantDiscussion)
|
||||
* Tomáš Žilínek (TomasZilinek)
|
||||
|
||||
## Toolchain
|
||||
* (Balletie) - macOS
|
||||
|
|
|
@ -642,7 +642,7 @@ private:
|
|||
|
||||
void RemoveAllGuests() const
|
||||
{
|
||||
uint16_t spriteIndex, nextSpriteIndex;
|
||||
uint16_t spriteIndex;
|
||||
for (auto& ride : GetRideManager())
|
||||
{
|
||||
ride.num_riders = 0;
|
||||
|
@ -685,14 +685,12 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
for (spriteIndex = gSpriteListHead[SPRITE_LIST_PEEP]; spriteIndex != SPRITE_INDEX_NULL; spriteIndex = nextSpriteIndex)
|
||||
Peep* peep;
|
||||
uint16_t sprite_index;
|
||||
|
||||
FOR_ALL_GUESTS (sprite_index, peep)
|
||||
{
|
||||
auto peep = &(get_sprite(spriteIndex)->peep);
|
||||
nextSpriteIndex = peep->next;
|
||||
if (peep->type == PEEP_TYPE_GUEST)
|
||||
{
|
||||
peep->Remove();
|
||||
}
|
||||
peep->Remove();
|
||||
}
|
||||
|
||||
window_invalidate_by_class(WC_RIDE);
|
||||
|
|
|
@ -67,9 +67,9 @@ public:
|
|||
// Update each staff member's uniform
|
||||
int32_t spriteIndex;
|
||||
Peep* peep;
|
||||
FOR_ALL_PEEPS (spriteIndex, peep)
|
||||
FOR_ALL_STAFF (spriteIndex, peep)
|
||||
{
|
||||
if (peep->type == PEEP_TYPE_STAFF && peep->staff_type == _staffType)
|
||||
if (peep->staff_type == _staffType)
|
||||
{
|
||||
peep->tshirt_colour = _colour;
|
||||
peep->trousers_colour = _colour;
|
||||
|
|
|
@ -404,19 +404,15 @@ int32_t peep_get_staff_count()
|
|||
*/
|
||||
void peep_update_all()
|
||||
{
|
||||
int32_t i;
|
||||
int32_t i = 0;
|
||||
uint16_t spriteIndex;
|
||||
Peep* peep;
|
||||
|
||||
if (gScreenFlags & SCREEN_FLAGS_EDITOR)
|
||||
return;
|
||||
|
||||
spriteIndex = gSpriteListHead[SPRITE_LIST_PEEP];
|
||||
i = 0;
|
||||
while (spriteIndex != SPRITE_INDEX_NULL)
|
||||
FOR_ALL_PEEPS (spriteIndex, peep)
|
||||
{
|
||||
peep = &(get_sprite(spriteIndex)->peep);
|
||||
spriteIndex = peep->next;
|
||||
|
||||
if ((uint32_t)(i & 0x7F) != (gCurrentTicks & 0x7F))
|
||||
{
|
||||
|
|
|
@ -143,6 +143,7 @@ bool staff_hire_new_member(STAFF_TYPE staffType, ENTERTAINER_COSTUME entertainer
|
|||
void staff_update_greyed_patrol_areas()
|
||||
{
|
||||
Peep* peep;
|
||||
uint16_t sprite_index;
|
||||
|
||||
for (int32_t staff_type = 0; staff_type < STAFF_TYPE_COUNT; ++staff_type)
|
||||
{
|
||||
|
@ -152,8 +153,7 @@ void staff_update_greyed_patrol_areas()
|
|||
gStaffPatrolAreas[staffPatrolOffset + i] = 0;
|
||||
}
|
||||
|
||||
for (uint16_t sprite_index = gSpriteListHead[SPRITE_LIST_PEEP]; sprite_index != SPRITE_INDEX_NULL;
|
||||
sprite_index = peep->next)
|
||||
FOR_ALL_STAFF (sprite_index, peep)
|
||||
{
|
||||
peep = GET_PEEP(sprite_index);
|
||||
|
||||
|
|
Loading…
Reference in New Issue