Rename Peep::happiness_target to use TitleCase

This commit is contained in:
Tulio Leao 2020-06-08 23:27:47 -03:00
parent e387539802
commit 1b7223462f
12 changed files with 59 additions and 59 deletions

View File

@ -230,7 +230,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
COMPARE_FIELD(Peep, energy);
COMPARE_FIELD(Peep, energy_target);
COMPARE_FIELD(Peep, happiness);
COMPARE_FIELD(Peep, happiness_target);
COMPARE_FIELD(Peep, HappinessTarget);
COMPARE_FIELD(Peep, Nausea);
COMPARE_FIELD(Peep, NauseaTarget);
COMPARE_FIELD(Peep, Hunger);

View File

@ -585,7 +585,7 @@ private:
{
case GUEST_PARAMETER_HAPPINESS:
peep->happiness = value;
peep->happiness_target = value;
peep->HappinessTarget = value;
// Clear the 'red-faced with anger' status if we're making the guest happy
if (value > 0)
{

View File

@ -577,7 +577,7 @@ void Guest::HandleEasterEggName()
if (CheckEasterEggName(EASTEREGG_PEEP_NAME_MELANIE_WARN))
{
happiness = 250;
happiness_target = 250;
HappinessTarget = 250;
energy = 127;
energy_target = 127;
Nausea = 0;
@ -740,7 +740,7 @@ void Guest::Tick128UpdateGuest(int32_t index)
if (PeepFlags & PEEP_FLAGS_HAPPINESS)
{
happiness_target = 5;
HappinessTarget = 5;
}
if (PeepFlags & PEEP_FLAGS_NAUSEA)
@ -766,7 +766,7 @@ void Guest::Tick128UpdateGuest(int32_t index)
if (thought_type != PEEP_THOUGHT_TYPE_NONE)
{
InsertNewThought(thought_type, PEEP_THOUGHT_ITEM_NONE);
happiness_target = std::min(PEEP_MAX_HAPPINESS, happiness_target + 45);
HappinessTarget = std::min(PEEP_MAX_HAPPINESS, HappinessTarget + 45);
}
}
}
@ -785,7 +785,7 @@ void Guest::Tick128UpdateGuest(int32_t index)
if (GuestTimeOnRide > 15)
{
happiness_target = std::max(0, happiness_target - 5);
HappinessTarget = std::max(0, HappinessTarget - 5);
if (GuestTimeOnRide > 22)
{
@ -814,7 +814,7 @@ void Guest::Tick128UpdateGuest(int32_t index)
if (GuestHeadingToRideId == RIDE_ID_NULL)
{
happiness_target = std::max(happiness_target - 128, 0);
HappinessTarget = std::max(HappinessTarget - 128, 0);
peep_leave_park(this);
peep_update_hunger(this);
goto loc_68F9F3;
@ -986,17 +986,17 @@ void Guest::Tick128UpdateGuest(int32_t index)
* slowly happier, up to a certain level. */
/* Why don't queue line TV monitors start affecting the peeps
* as soon as they join the queue?? */
if (happiness_target < 90)
happiness_target = 90;
if (HappinessTarget < 90)
HappinessTarget = 90;
if (happiness_target < 165)
happiness_target += 2;
if (HappinessTarget < 165)
HappinessTarget += 2;
}
else
{
/* Without a queue line TV monitor peeps waiting too long
* in a queue get less happy. */
happiness_target = std::max(happiness_target - 4, 0);
HappinessTarget = std::max(HappinessTarget - 4, 0);
}
}
peep_update_hunger(this);
@ -1014,10 +1014,10 @@ void Guest::Tick128UpdateGuest(int32_t index)
loc_68F9F3:
// Idle peep happiness tends towards 127 (50%).
if (happiness_target >= 128)
happiness_target--;
if (HappinessTarget >= 128)
HappinessTarget--;
else
happiness_target++;
HappinessTarget++;
NauseaTarget = std::max(NauseaTarget - 2, 0);
@ -1145,7 +1145,7 @@ void Guest::Tick128UpdateGuest(int32_t index)
}
uint8_t newHappiness = happiness;
uint8_t newHappinessGrowth = happiness_target;
uint8_t newHappinessGrowth = HappinessTarget;
if (newHappiness >= newHappinessGrowth)
{
newHappiness = std::max(newHappiness - 4, 0);
@ -1405,7 +1405,7 @@ void Guest::CheckIfLost()
}
InsertNewThought(PEEP_THOUGHT_TYPE_LOST, PEEP_THOUGHT_ITEM_NONE);
happiness_target = std::max(happiness_target - 30, 0);
HappinessTarget = std::max(HappinessTarget - 30, 0);
}
/**
@ -1422,7 +1422,7 @@ void Guest::CheckCantFindRide()
if (GuestIsLostCountdown == 30 || GuestIsLostCountdown == 60)
{
InsertNewThought(PEEP_THOUGHT_TYPE_CANT_FIND, GuestHeadingToRideId);
happiness_target = std::max(happiness_target - 30, 0);
HappinessTarget = std::max(HappinessTarget - 30, 0);
}
GuestIsLostCountdown--;
@ -1454,7 +1454,7 @@ void Guest::CheckCantFindExit()
if (GuestIsLostCountdown == 1)
{
InsertNewThought(PEEP_THOUGHT_TYPE_CANT_FIND_EXIT, PEEP_THOUGHT_ITEM_NONE);
happiness_target = std::max(happiness_target - 30, 0);
HappinessTarget = std::max(HappinessTarget - 30, 0);
}
if (--GuestIsLostCountdown == 0)
@ -1613,7 +1613,7 @@ loc_69B119:
}
int32_t happinessGrowth = itemValue * 4;
happiness_target = std::min((happiness_target + happinessGrowth), PEEP_MAX_HAPPINESS);
HappinessTarget = std::min((HappinessTarget + happinessGrowth), PEEP_MAX_HAPPINESS);
happiness = std::min((happiness + happinessGrowth), PEEP_MAX_HAPPINESS);
}
}
@ -1772,7 +1772,7 @@ void Guest::OnEnterRide(ride_id_t rideIndex)
SetHasRidden(ride);
peep_update_favourite_ride(this, ride);
happiness_target = std::clamp(happiness_target + satisfaction, 0, PEEP_MAX_HAPPINESS);
HappinessTarget = std::clamp(HappinessTarget + satisfaction, 0, PEEP_MAX_HAPPINESS);
peep_update_ride_nausea_growth(this, ride);
}
@ -1790,7 +1790,7 @@ void Guest::OnExitRide(ride_id_t rideIndex)
// TODO fix this flag name or add another one
WindowInvalidateFlags |= PEEP_INVALIDATE_STAFF_STATS;
}
happiness = happiness_target;
happiness = HappinessTarget;
Nausea = NauseaTarget;
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_STATS;
@ -2078,9 +2078,9 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t
if (peepAtRide)
{
InsertNewThought(PEEP_THOUGHT_TYPE_NOT_SAFE, ride->id);
if (happiness_target >= 64)
if (HappinessTarget >= 64)
{
happiness_target -= 8;
HappinessTarget -= 8;
}
ride_update_popularity(ride, 0);
}
@ -2108,9 +2108,9 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t
if (peepAtRide)
{
InsertNewThought(PEEP_THOUGHT_TYPE_NOT_WHILE_RAINING, ride->id);
if (happiness_target >= 64)
if (HappinessTarget >= 64)
{
happiness_target -= 8;
HappinessTarget -= 8;
}
ride_update_popularity(ride, 0);
}
@ -2130,9 +2130,9 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t
if (peepAtRide)
{
InsertNewThought(PEEP_THOUGHT_TYPE_MORE_THRILLING, ride->id);
if (happiness_target >= 64)
if (HappinessTarget >= 64)
{
happiness_target -= 8;
HappinessTarget -= 8;
}
ride_update_popularity(ride, 0);
}
@ -2153,9 +2153,9 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t
if (peepAtRide)
{
InsertNewThought(PEEP_THOUGHT_TYPE_SICKENING, ride->id);
if (happiness_target >= 64)
if (HappinessTarget >= 64)
{
happiness_target -= 8;
HappinessTarget -= 8;
}
ride_update_popularity(ride, 0);
}
@ -2209,9 +2209,9 @@ bool Guest::ShouldGoOnRide(Ride* ride, int32_t entranceNum, bool atQueue, bool t
if (peepAtRide)
{
InsertNewThought(PEEP_THOUGHT_TYPE_BAD_VALUE, ride->id);
if (happiness_target >= 60)
if (HappinessTarget >= 60)
{
happiness_target -= 16;
HappinessTarget -= 16;
}
ride_update_popularity(ride, 0);
}
@ -2276,9 +2276,9 @@ bool Guest::ShouldGoToShop(Ride* ride, bool peepAtShop)
if (peepAtShop)
{
InsertNewThought(PEEP_THOUGHT_TYPE_NOT_PAYING, ride->id);
if (happiness_target >= 60)
if (HappinessTarget >= 60)
{
happiness_target -= 16;
HappinessTarget -= 16;
}
ride_update_popularity(ride, 0);
}
@ -2444,9 +2444,9 @@ static void peep_ride_is_too_intense(Guest* peep, Ride* ride, bool peepAtRide)
if (peepAtRide)
{
peep->InsertNewThought(PEEP_THOUGHT_TYPE_INTENSE, ride->id);
if (peep->happiness_target >= 64)
if (peep->HappinessTarget >= 64)
{
peep->happiness_target -= 8;
peep->HappinessTarget -= 8;
}
ride_update_popularity(ride, 0);
}
@ -2714,7 +2714,7 @@ static void peep_update_favourite_ride(Peep* peep, Ride* ride)
uint8_t peepRideRating = std::clamp((ride->excitement / 4) + peep->happiness, 0, PEEP_MAX_HAPPINESS);
if (peepRideRating >= peep->FavouriteRideRating)
{
if (peep->happiness >= 160 && peep->happiness_target >= 160)
if (peep->happiness >= 160 && peep->HappinessTarget >= 160)
{
peep->FavouriteRideRating = peepRideRating;
peep->PeepFlags |= PEEP_FLAGS_RIDE_SHOULD_BE_MARKED_AS_FAVOURITE;
@ -2857,7 +2857,7 @@ static int16_t peep_calculate_ride_intensity_nausea_satisfaction(Peep* peep, Rid
*/
static void peep_update_ride_nausea_growth(Peep* peep, Ride* ride)
{
uint32_t nauseaMultiplier = std::clamp(256 - peep->happiness_target, 64, 200);
uint32_t nauseaMultiplier = std::clamp(256 - peep->HappinessTarget, 64, 200);
uint32_t nauseaGrowthRateChange = (ride->nausea * nauseaMultiplier) / 512;
nauseaGrowthRateChange *= std::max(static_cast<uint8_t>(128), peep->Hunger) / 64;
nauseaGrowthRateChange >>= (peep->NauseaTolerance & 3);
@ -5062,8 +5062,8 @@ void Guest::UpdateRideShopInteract()
destination_x = tileCenterX;
destination_y = tileCenterY;
destination_tolerance = 3;
happiness_target = std::min(happiness_target + 30, PEEP_MAX_HAPPINESS);
happiness = happiness_target;
HappinessTarget = std::min(HappinessTarget + 30, PEEP_MAX_HAPPINESS);
happiness = HappinessTarget;
}
else
{
@ -5091,8 +5091,8 @@ void Guest::UpdateRideShopInteract()
destination_y = tileCenterY;
destination_tolerance = 3;
happiness_target = std::min(happiness_target + 30, PEEP_MAX_HAPPINESS);
happiness = happiness_target;
HappinessTarget = std::min(HappinessTarget + 30, PEEP_MAX_HAPPINESS);
happiness = HappinessTarget;
StopPurchaseThought(ride->type);
}

View File

@ -803,7 +803,7 @@ bool Peep::Place(const TileCoordsXYZ& location, bool apply)
if (type == PEEP_TYPE_GUEST)
{
ActionSpriteType = PEEP_ACTION_SPRITE_TYPE_INVALID;
happiness_target = std::max(happiness_target - 10, 0);
HappinessTarget = std::max(HappinessTarget - 10, 0);
UpdateCurrentActionSpriteType();
}
}
@ -1691,7 +1691,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords)
int8_t happinessDelta = (scenario_rand() & 0x1F) - 15;
/* Adjust by the delta, clamping at min=0 and max=255. */
peep->happiness = std::clamp(peep->happiness + happinessDelta, 0, PEEP_MAX_HAPPINESS);
peep->happiness_target = peep->happiness;
peep->HappinessTarget = peep->happiness;
peep->Nausea = 0;
peep->NauseaTarget = 0;
@ -2663,7 +2663,7 @@ static void peep_footpath_move_forward(Peep* peep, int16_t x, int16_t y, TileEle
if ((scenario_rand() & 0xFFFF) <= 10922)
{
peep->InsertNewThought(PEEP_THOUGHT_TYPE_VANDALISM, PEEP_THOUGHT_ITEM_NONE);
peep->happiness_target = std::max(0, peep->happiness_target - 17);
peep->HappinessTarget = std::max(0, peep->HappinessTarget - 17);
}
vandalThoughtTimeout = 3;
}
@ -2711,7 +2711,7 @@ static void peep_footpath_move_forward(Peep* peep, int16_t x, int16_t y, TileEle
if (crowded >= 10 && peep->state == PEEP_STATE_WALKING && (scenario_rand() & 0xFFFF) <= 21845)
{
peep->InsertNewThought(PEEP_THOUGHT_TYPE_CROWDED, PEEP_THOUGHT_ITEM_NONE);
peep->happiness_target = std::max(0, peep->happiness_target - 14);
peep->HappinessTarget = std::max(0, peep->HappinessTarget - 14);
}
litter_count = std::min(static_cast<uint8_t>(3), litter_count);
@ -2737,7 +2737,7 @@ static void peep_footpath_move_forward(Peep* peep, int16_t x, int16_t y, TileEle
if (total_sick >= 3 && (scenario_rand() & 0xFFFF) <= 10922)
{
peep->InsertNewThought(PEEP_THOUGHT_TYPE_PATH_DISGUSTING, PEEP_THOUGHT_ITEM_NONE);
peep->happiness_target = std::max(0, peep->happiness_target - 17);
peep->HappinessTarget = std::max(0, peep->HappinessTarget - 17);
// Reset disgusting time
peep->DisgustingCount |= 0xC0;
}
@ -2763,7 +2763,7 @@ static void peep_footpath_move_forward(Peep* peep, int16_t x, int16_t y, TileEle
if (total_litter >= 3 && (scenario_rand() & 0xFFFF) <= 10922)
{
peep->InsertNewThought(PEEP_THOUGHT_TYPE_BAD_LITTER, PEEP_THOUGHT_ITEM_NONE);
peep->happiness_target = std::max(0, peep->happiness_target - 17);
peep->HappinessTarget = std::max(0, peep->HappinessTarget - 17);
// Reset litter time
peep->LitterCount |= 0xC0;
}

View File

@ -618,7 +618,7 @@ struct Peep : SpriteBase
uint8_t energy;
uint8_t energy_target;
uint8_t happiness;
uint8_t happiness_target;
uint8_t HappinessTarget;
uint8_t Nausea;
uint8_t NauseaTarget;
uint8_t Hunger;

View File

@ -1041,7 +1041,7 @@ static void staff_entertainer_update_nearby_peeps(Peep* peep)
if (peep->state == PEEP_STATE_WALKING)
{
peep->happiness_target = std::min(peep->happiness_target + 4, PEEP_MAX_HAPPINESS);
peep->HappinessTarget = std::min(peep->HappinessTarget + 4, PEEP_MAX_HAPPINESS);
}
else if (peep->state == PEEP_STATE_QUEUING)
{
@ -1053,7 +1053,7 @@ static void staff_entertainer_update_nearby_peeps(Peep* peep)
{
peep->TimeInQueue = 0;
}
peep->happiness_target = std::min(peep->happiness_target + 3, PEEP_MAX_HAPPINESS);
peep->HappinessTarget = std::min(peep->HappinessTarget + 3, PEEP_MAX_HAPPINESS);
}
}
}

View File

@ -1451,7 +1451,7 @@ private:
dst->energy = src->energy;
dst->energy_target = src->energy_target;
dst->happiness = src->happiness;
dst->happiness_target = src->happiness_target;
dst->HappinessTarget = src->happiness_target;
dst->Nausea = src->nausea;
dst->NauseaTarget = src->nausea_target;
dst->Hunger = src->hunger;

View File

@ -1152,7 +1152,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src)
dst->energy = src->energy;
dst->energy_target = src->energy_target;
dst->happiness = src->happiness;
dst->happiness_target = src->happiness_target;
dst->happiness_target = src->HappinessTarget;
dst->nausea = src->Nausea;
dst->nausea_target = src->NauseaTarget;
dst->hunger = src->Hunger;

View File

@ -1417,7 +1417,7 @@ public:
dst->energy = src->energy;
dst->energy_target = src->energy_target;
dst->happiness = src->happiness;
dst->happiness_target = src->happiness_target;
dst->HappinessTarget = src->happiness_target;
dst->Nausea = src->nausea;
dst->NauseaTarget = src->nausea_target;
dst->Hunger = src->hunger;

View File

@ -1130,8 +1130,8 @@ void ride_remove_peeps(Ride* ride)
peep->state = PEEP_STATE_FALLING;
peep->SwitchToSpecialSprite(0);
peep->happiness = std::min(peep->happiness, peep->happiness_target) / 2;
peep->happiness_target = peep->happiness;
peep->happiness = std::min(peep->happiness, peep->HappinessTarget) / 2;
peep->HappinessTarget = peep->happiness;
peep->WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_STATS;
}
}

View File

@ -476,7 +476,7 @@ namespace OpenRCT2::Scripting
uint8_t happinessTarget_get() const
{
auto peep = GetPeep();
return peep != nullptr ? peep->happiness_target : 0;
return peep != nullptr ? peep->HappinessTarget : 0;
}
void happinessTarget_set(uint8_t value)
{
@ -484,7 +484,7 @@ namespace OpenRCT2::Scripting
auto peep = GetPeep();
if (peep != nullptr)
{
peep->happiness_target = value;
peep->HappinessTarget = value;
}
}

View File

@ -174,7 +174,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right)
COMPARE_FIELD(energy);
COMPARE_FIELD(energy_target);
COMPARE_FIELD(happiness);
COMPARE_FIELD(happiness_target);
COMPARE_FIELD(HappinessTarget);
COMPARE_FIELD(Nausea);
COMPARE_FIELD(NauseaTarget);
COMPARE_FIELD(Hunger);