mirror of https://github.com/OpenRCT2/OpenRCT2.git
Small refactors and cleanups
This commit is contained in:
parent
5e9e9df7ce
commit
08ea5585ee
|
@ -72,7 +72,7 @@ int32_t viewport_interaction_get_item_left(ScreenCoordsXY screenCoords, viewport
|
|||
info->x = mapCoord.x;
|
||||
info->y = mapCoord.y;
|
||||
tileElement = info->tileElement;
|
||||
sprite = (rct_sprite*)tileElement;
|
||||
sprite = info->sprite;
|
||||
|
||||
switch (info->type)
|
||||
{
|
||||
|
|
|
@ -1518,8 +1518,7 @@ static int32_t cc_mp_desync(InteractiveConsole& console, const arguments_t& argv
|
|||
desyncType = atoi(argv[0].c_str());
|
||||
}
|
||||
|
||||
std::vector<rct_sprite*> peeps;
|
||||
std::vector<rct_sprite*> vehicles;
|
||||
std::vector<Peep*> peeps;
|
||||
|
||||
for (int i = 0; i < MAX_SPRITES; i++)
|
||||
{
|
||||
|
@ -1527,10 +1526,9 @@ static int32_t cc_mp_desync(InteractiveConsole& console, const arguments_t& argv
|
|||
if (sprite->generic.sprite_identifier == SPRITE_IDENTIFIER_NULL)
|
||||
continue;
|
||||
|
||||
if (sprite->generic.sprite_identifier == SPRITE_IDENTIFIER_PEEP)
|
||||
peeps.push_back(sprite);
|
||||
else if (sprite->generic.sprite_identifier == SPRITE_IDENTIFIER_VEHICLE)
|
||||
vehicles.push_back(sprite);
|
||||
auto peep = sprite->AsPeep();
|
||||
if (peep != nullptr)
|
||||
peeps.push_back(peep);
|
||||
}
|
||||
|
||||
switch (desyncType)
|
||||
|
@ -1543,11 +1541,11 @@ static int32_t cc_mp_desync(InteractiveConsole& console, const arguments_t& argv
|
|||
}
|
||||
else
|
||||
{
|
||||
rct_sprite* sprite = peeps[0];
|
||||
auto* peep = peeps[0];
|
||||
if (peeps.size() > 1)
|
||||
sprite = peeps[util_rand() % peeps.size() - 1];
|
||||
sprite->peep.tshirt_colour = util_rand() & 0xFF;
|
||||
invalidate_sprite_0(sprite->AsPeep());
|
||||
peep = peeps[util_rand() % peeps.size() - 1];
|
||||
peep->tshirt_colour = util_rand() & 0xFF;
|
||||
invalidate_sprite_0(peep);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1559,10 +1557,10 @@ static int32_t cc_mp_desync(InteractiveConsole& console, const arguments_t& argv
|
|||
}
|
||||
else
|
||||
{
|
||||
rct_sprite* sprite = peeps[0];
|
||||
auto* peep = peeps[0];
|
||||
if (peeps.size() > 1)
|
||||
sprite = peeps[util_rand() % peeps.size() - 1];
|
||||
sprite->AsPeep()->Remove();
|
||||
peep = peeps[util_rand() % peeps.size() - 1];
|
||||
peep->Remove();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ void misc_paint(paint_session* session, const rct_sprite* misc, int32_t imageDir
|
|||
{
|
||||
rct_drawpixelinfo* dpi = &session->DPI;
|
||||
|
||||
switch (misc->steam_particle.type)
|
||||
switch (misc->generic.type)
|
||||
{
|
||||
case SPRITE_MISC_STEAM_PARTICLE: // 0
|
||||
{
|
||||
|
|
|
@ -160,7 +160,7 @@ void reset_sprite_list()
|
|||
_spriteFlashingList[i] = false;
|
||||
}
|
||||
|
||||
rct_sprite* previous_spr = (rct_sprite*)SPRITE_INDEX_NULL;
|
||||
rct_sprite* previous_spr = nullptr;
|
||||
|
||||
for (int32_t i = 0; i < MAX_SPRITES; ++i)
|
||||
{
|
||||
|
@ -170,7 +170,7 @@ void reset_sprite_list()
|
|||
spr->generic.next = SPRITE_INDEX_NULL;
|
||||
spr->generic.linked_list_index = 0;
|
||||
|
||||
if (previous_spr != (rct_sprite*)SPRITE_INDEX_NULL)
|
||||
if (previous_spr != nullptr)
|
||||
{
|
||||
spr->generic.previous = previous_spr->generic.sprite_index;
|
||||
previous_spr->generic.next = i;
|
||||
|
|
Loading…
Reference in New Issue