mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-16 03:23:15 +01:00
Small refactors and cleanups
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user