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->x = mapCoord.x;
|
||||||
info->y = mapCoord.y;
|
info->y = mapCoord.y;
|
||||||
tileElement = info->tileElement;
|
tileElement = info->tileElement;
|
||||||
sprite = (rct_sprite*)tileElement;
|
sprite = info->sprite;
|
||||||
|
|
||||||
switch (info->type)
|
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());
|
desyncType = atoi(argv[0].c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<rct_sprite*> peeps;
|
std::vector<Peep*> peeps;
|
||||||
std::vector<rct_sprite*> vehicles;
|
|
||||||
|
|
||||||
for (int i = 0; i < MAX_SPRITES; i++)
|
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)
|
if (sprite->generic.sprite_identifier == SPRITE_IDENTIFIER_NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (sprite->generic.sprite_identifier == SPRITE_IDENTIFIER_PEEP)
|
auto peep = sprite->AsPeep();
|
||||||
peeps.push_back(sprite);
|
if (peep != nullptr)
|
||||||
else if (sprite->generic.sprite_identifier == SPRITE_IDENTIFIER_VEHICLE)
|
peeps.push_back(peep);
|
||||||
vehicles.push_back(sprite);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (desyncType)
|
switch (desyncType)
|
||||||
|
@ -1543,11 +1541,11 @@ static int32_t cc_mp_desync(InteractiveConsole& console, const arguments_t& argv
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rct_sprite* sprite = peeps[0];
|
auto* peep = peeps[0];
|
||||||
if (peeps.size() > 1)
|
if (peeps.size() > 1)
|
||||||
sprite = peeps[util_rand() % peeps.size() - 1];
|
peep = peeps[util_rand() % peeps.size() - 1];
|
||||||
sprite->peep.tshirt_colour = util_rand() & 0xFF;
|
peep->tshirt_colour = util_rand() & 0xFF;
|
||||||
invalidate_sprite_0(sprite->AsPeep());
|
invalidate_sprite_0(peep);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1559,10 +1557,10 @@ static int32_t cc_mp_desync(InteractiveConsole& console, const arguments_t& argv
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rct_sprite* sprite = peeps[0];
|
auto* peep = peeps[0];
|
||||||
if (peeps.size() > 1)
|
if (peeps.size() > 1)
|
||||||
sprite = peeps[util_rand() % peeps.size() - 1];
|
peep = peeps[util_rand() % peeps.size() - 1];
|
||||||
sprite->AsPeep()->Remove();
|
peep->Remove();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ void misc_paint(paint_session* session, const rct_sprite* misc, int32_t imageDir
|
||||||
{
|
{
|
||||||
rct_drawpixelinfo* dpi = &session->DPI;
|
rct_drawpixelinfo* dpi = &session->DPI;
|
||||||
|
|
||||||
switch (misc->steam_particle.type)
|
switch (misc->generic.type)
|
||||||
{
|
{
|
||||||
case SPRITE_MISC_STEAM_PARTICLE: // 0
|
case SPRITE_MISC_STEAM_PARTICLE: // 0
|
||||||
{
|
{
|
||||||
|
|
|
@ -160,7 +160,7 @@ void reset_sprite_list()
|
||||||
_spriteFlashingList[i] = false;
|
_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)
|
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.next = SPRITE_INDEX_NULL;
|
||||||
spr->generic.linked_list_index = 0;
|
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;
|
spr->generic.previous = previous_spr->generic.sprite_index;
|
||||||
previous_spr->generic.next = i;
|
previous_spr->generic.next = i;
|
||||||
|
|
Loading…
Reference in New Issue