mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 15:24:30 +01:00
Move duck method into class
This commit is contained in:
committed by
Gymnasiast
parent
d17443b7b0
commit
c345396765
@@ -208,7 +208,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords)
|
||||
auto duck = entity->As<Duck>();
|
||||
if (duck != nullptr)
|
||||
{
|
||||
duck_press(duck);
|
||||
duck->Press();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ GameActions::Result::Ptr SetCheatAction::Execute() const
|
||||
CreateDucks(_param1);
|
||||
break;
|
||||
case CheatType::RemoveDucks:
|
||||
duck_remove_all();
|
||||
Duck::RemoveAll();
|
||||
break;
|
||||
case CheatType::AllowTrackPlaceInvalidHeights:
|
||||
gCheatsAllowTrackPlaceInvalidHeights = _param1 != 0;
|
||||
|
||||
@@ -153,7 +153,7 @@ void scenario_begin()
|
||||
award_reset();
|
||||
reset_all_ride_build_dates();
|
||||
date_reset();
|
||||
duck_remove_all();
|
||||
Duck::RemoveAll();
|
||||
park_calculate_size();
|
||||
map_count_remaining_land_rights();
|
||||
Staff::ResetStats();
|
||||
@@ -478,7 +478,7 @@ bool scenario_create_ducks()
|
||||
CoordsXY targetPos{ centrePos.x + innerPos.x - SquareRadiusSize, centrePos.y + innerPos.y - SquareRadiusSize };
|
||||
|
||||
Guard::Assert(map_is_location_valid(targetPos));
|
||||
create_duck(targetPos);
|
||||
Duck::Create(targetPos);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -279,7 +279,7 @@ uint32_t Duck::GetFrameImage(int32_t direction) const
|
||||
return imageId;
|
||||
}
|
||||
|
||||
void create_duck(const CoordsXY& pos)
|
||||
void Duck::Create(const CoordsXY& pos)
|
||||
{
|
||||
auto* duck = CreateEntity<Duck>();
|
||||
if (duck == nullptr)
|
||||
@@ -340,12 +340,12 @@ void Duck::Update()
|
||||
}
|
||||
}
|
||||
|
||||
void duck_press(Duck* duck)
|
||||
void Duck::Press()
|
||||
{
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Quack, { duck->x, duck->y, duck->z });
|
||||
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::Quack, { x, y, z });
|
||||
}
|
||||
|
||||
void duck_remove_all()
|
||||
void Duck::RemoveAll()
|
||||
{
|
||||
for (auto duck : EntityList<Duck>())
|
||||
{
|
||||
|
||||
@@ -29,6 +29,9 @@ struct Duck : MiscEntity
|
||||
int16_t target_y;
|
||||
DuckState state;
|
||||
|
||||
static void Create(const CoordsXY& pos);
|
||||
static void RemoveAll();
|
||||
void Press();
|
||||
void Update();
|
||||
uint32_t GetFrameImage(int32_t direction) const;
|
||||
bool IsFlying();
|
||||
@@ -42,7 +45,3 @@ private:
|
||||
void UpdateDoubleDrink();
|
||||
void UpdateFlyAway();
|
||||
};
|
||||
|
||||
void create_duck(const CoordsXY& pos);
|
||||
void duck_press(Duck* duck);
|
||||
void duck_remove_all();
|
||||
|
||||
Reference in New Issue
Block a user