Rename Peep::energy to Energy

This commit is contained in:
Tulio Leao 2020-06-08 23:34:35 -03:00
parent 1c59cc2aae
commit a993ad8408
13 changed files with 37 additions and 37 deletions

View File

@ -1418,7 +1418,7 @@ void window_guest_stats_paint(rct_window* w, rct_drawpixelinfo* dpi)
y += LIST_ROW_HEIGHT;
gfx_draw_string_left(dpi, STR_GUEST_STAT_ENERGY_LABEL, gCommonFormatArgs, COLOUR_BLACK, x, y);
int32_t energy = ((peep->energy - PEEP_MIN_ENERGY) * 255) / (PEEP_MAX_ENERGY - PEEP_MIN_ENERGY);
int32_t energy = ((peep->Energy - PEEP_MIN_ENERGY) * 255) / (PEEP_MAX_ENERGY - PEEP_MIN_ENERGY);
ebp = COLOUR_BRIGHT_GREEN;
if (energy < 50)
{

View File

@ -227,7 +227,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
COMPARE_FIELD(Peep, destination_y);
COMPARE_FIELD(Peep, destination_tolerance);
COMPARE_FIELD(Peep, var_37);
COMPARE_FIELD(Peep, energy);
COMPARE_FIELD(Peep, Energy);
COMPARE_FIELD(Peep, EnergyTarget);
COMPARE_FIELD(Peep, Happiness);
COMPARE_FIELD(Peep, HappinessTarget);

View File

@ -594,7 +594,7 @@ private:
}
break;
case GUEST_PARAMETER_ENERGY:
peep->energy = value;
peep->Energy = value;
peep->EnergyTarget = value;
break;
case GUEST_PARAMETER_HUNGER:
@ -734,7 +734,7 @@ private:
FOR_ALL_STAFF (spriteIndex, peep)
{
peep->energy = value;
peep->Energy = value;
peep->EnergyTarget = value;
}
}

View File

@ -242,7 +242,7 @@ private:
newPeep->trousers_colour = colour;
// Staff energy determines their walking speed
newPeep->energy = 0x60;
newPeep->Energy = 0x60;
newPeep->EnergyTarget = 0x60;
newPeep->StaffMowingTimeout = 0;

View File

@ -443,7 +443,7 @@ static int32_t cc_staff(InteractiveConsole& console, const arguments_t& argv)
{
auto name = peep->GetName();
console.WriteFormatLine(
"staff id %03d type: %02u energy %03u name %s", i, peep->staff_type, peep->energy, name.c_str());
"staff id %03d type: %02u energy %03u name %s", i, peep->staff_type, peep->Energy, name.c_str());
}
}
else if (argv[0] == "set")
@ -474,7 +474,7 @@ static int32_t cc_staff(InteractiveConsole& console, const arguments_t& argv)
{
Peep* peep = GET_PEEP(int_val[0]);
peep->energy = int_val[1];
peep->Energy = int_val[1];
peep->EnergyTarget = int_val[1];
}
}

View File

@ -578,7 +578,7 @@ void Guest::HandleEasterEggName()
{
Happiness = 250;
HappinessTarget = 250;
energy = 127;
Energy = 127;
EnergyTarget = 127;
Nausea = 0;
NauseaTarget = 0;
@ -846,7 +846,7 @@ void Guest::Tick128UpdateGuest(int32_t index)
}
else
{
if (energy <= 70 && Happiness < 128)
if (Energy <= 70 && Happiness < 128)
{
possible_thoughts[num_thoughts++] = PEEP_THOUGHT_TYPE_TIRED;
}
@ -866,7 +866,7 @@ void Guest::Tick128UpdateGuest(int32_t index)
possible_thoughts[num_thoughts++] = PEEP_THOUGHT_TYPE_TOILET;
}
if (!(gParkFlags & PARK_FLAGS_NO_MONEY) && CashInPocket <= MONEY(9, 00) && Happiness >= 105 && energy >= 70)
if (!(gParkFlags & PARK_FLAGS_NO_MONEY) && CashInPocket <= MONEY(9, 00) && Happiness >= 105 && Energy >= 70)
{
/* The energy check was originally a second check on happiness.
* This was superfluous so should probably check something else.
@ -1021,9 +1021,9 @@ void Guest::Tick128UpdateGuest(int32_t index)
NauseaTarget = std::max(NauseaTarget - 2, 0);
if (energy <= 50)
if (Energy <= 50)
{
energy = std::max(energy - 2, 0);
Energy = std::max(Energy - 2, 0);
}
if (Hunger < 10)
@ -1117,7 +1117,7 @@ void Guest::Tick128UpdateGuest(int32_t index)
}
}
uint8_t newEnergy = energy;
uint8_t newEnergy = Energy;
uint8_t newTargetEnergy = EnergyTarget;
if (newEnergy >= newTargetEnergy)
{
@ -1138,9 +1138,9 @@ void Guest::Tick128UpdateGuest(int32_t index)
/* Previous code here suggested maximum energy is 128. */
newEnergy = std::min(static_cast<uint8_t>(PEEP_MAX_ENERGY), newEnergy);
if (newEnergy != energy)
if (newEnergy != Energy)
{
energy = newEnergy;
Energy = newEnergy;
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_2;
}
@ -1239,7 +1239,7 @@ void Guest::UpdateSitting()
sub_state = PEEP_SITTING_SAT_DOWN;
// Sets time to sit on seat
TimeToSitdown = (129 - energy) * 16 + 50;
TimeToSitdown = (129 - Energy) * 16 + 50;
}
else if (sub_state == PEEP_SITTING_SAT_DOWN)
{
@ -2874,7 +2874,7 @@ static bool peep_should_go_on_ride_again(Peep* peep, Ride* ride)
return false;
if (peep->Happiness < 180)
return false;
if (peep->energy < 100)
if (peep->Energy < 100)
return false;
if (peep->Nausea > 160)
return false;
@ -3086,14 +3086,14 @@ static void peep_decide_whether_to_leave_park(Peep* peep)
{
if (gParkFlags & PARK_FLAGS_NO_MONEY)
{
if (peep->energy >= 70 && peep->Happiness >= 60)
if (peep->Energy >= 70 && peep->Happiness >= 60)
{
return;
}
}
else
{
if (peep->energy >= 55 && peep->Happiness >= 45 && peep->CashInPocket >= MONEY(5, 00))
if (peep->Energy >= 55 && peep->Happiness >= 45 && peep->CashInPocket >= MONEY(5, 00))
{
return;
}
@ -3330,7 +3330,7 @@ static bool peep_should_use_cash_machine(Peep* peep, ride_id_t rideIndex)
return false;
if (115 + (scenario_rand() % 128) > peep->Happiness)
return false;
if (peep->energy < 80)
if (peep->Energy < 80)
return false;
auto ride = get_ride(rideIndex);
@ -4837,7 +4837,7 @@ void Guest::UpdateRideMazePathfinding()
if (Action >= PEEP_ACTION_NONE_1)
{
if (energy > 64 && (scenario_rand() & 0xFFFF) <= 2427)
if (Energy > 64 && (scenario_rand() & 0xFFFF) <= 2427)
{
Action = PEEP_ACTION_JUMP;
ActionFrame = 0;
@ -5749,7 +5749,7 @@ void Guest::UpdateWatching()
sub_state++;
TimeToStand = std::clamp(((129 - energy) * 16 + 50) / 2, 0, 255);
TimeToStand = std::clamp(((129 - Energy) * 16 + 50) / 2, 0, 255);
UpdateSpriteType();
}
else if (sub_state == 1)
@ -6003,7 +6003,7 @@ bool Guest::ShouldFindBench()
}
}
if (Nausea <= 170 && energy > 50)
if (Nausea <= 170 && Energy > 50)
{
return false;
}
@ -6206,7 +6206,7 @@ static void peep_update_walking_break_scenery(Peep* peep)
{
if (peep->Happiness >= 48)
return;
if (peep->energy < 85)
if (peep->Energy < 85)
return;
if (peep->state != PEEP_STATE_WALKING)
return;
@ -6920,13 +6920,13 @@ void Guest::UpdateSpriteType()
return;
}
if (energy <= 64 && Happiness < 128)
if (Energy <= 64 && Happiness < 128)
{
SetSpriteType(PEEP_SPRITE_TYPE_HEAD_DOWN);
return;
}
if (energy <= 80 && Happiness < 128)
if (Energy <= 80 && Happiness < 128)
{
SetSpriteType(PEEP_SPRITE_TYPE_ARMS_CROSSED);
return;

View File

@ -1110,7 +1110,7 @@ void Peep::Update()
}
// Walking speed logic
uint32_t stepsToTake = energy;
uint32_t stepsToTake = Energy;
if (stepsToTake < 95 && state == PEEP_STATE_QUEUING)
stepsToTake = 95;
if ((PeepFlags & PEEP_FLAGS_SLOW_WALK) && state != PEEP_STATE_QUEUING)
@ -1775,7 +1775,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords)
/* Minimum energy is capped at 32 and maximum at 128, so this initialises
* a peep with approx 34%-100% energy. (65 - 32) / (128 - 32) 34% */
uint8_t energy = (scenario_rand() % 64) + 65;
peep->energy = energy;
peep->Energy = energy;
peep->EnergyTarget = energy;
increment_guests_heading_for_park();
@ -2178,11 +2178,11 @@ static int32_t get_face_sprite_offset(Peep* peep)
return PEEP_FACE_OFFSET_SICK;
// VERY_TIRED
if (peep->energy < 46)
if (peep->Energy < 46)
return PEEP_FACE_OFFSET_VERY_TIRED;
// TIRED
if (peep->energy < 70)
if (peep->Energy < 70)
return PEEP_FACE_OFFSET_TIRED;
int32_t offset = PEEP_FACE_OFFSET_VERY_VERY_UNHAPPY;

View File

@ -615,7 +615,7 @@ struct Peep : SpriteBase
uint16_t destination_y;
uint8_t destination_tolerance; // How close to destination before next action/state 0 = exact
uint8_t var_37;
uint8_t energy;
uint8_t Energy;
uint8_t EnergyTarget;
uint8_t Happiness;
uint8_t HappinessTarget;

View File

@ -1448,7 +1448,7 @@ private:
dst->destination_tolerance = src->destination_tolerance;
dst->PeepDirection = src->direction;
dst->energy = src->energy;
dst->Energy = src->energy;
dst->EnergyTarget = src->energy_target;
dst->Happiness = src->happiness;
dst->HappinessTarget = src->happiness_target;

View File

@ -1149,7 +1149,7 @@ void S6Exporter::ExportSpritePeep(RCT2SpritePeep* dst, const Peep* src)
dst->destination_y = src->destination_y;
dst->destination_tolerance = src->destination_tolerance;
dst->var_37 = src->var_37;
dst->energy = src->energy;
dst->energy = src->Energy;
dst->energy_target = src->EnergyTarget;
dst->happiness = src->Happiness;
dst->happiness_target = src->HappinessTarget;

View File

@ -1414,7 +1414,7 @@ public:
dst->destination_y = src->destination_y;
dst->destination_tolerance = src->destination_tolerance;
dst->var_37 = src->var_37;
dst->energy = src->energy;
dst->Energy = src->energy;
dst->EnergyTarget = src->energy_target;
dst->Happiness = src->happiness;
dst->HappinessTarget = src->happiness_target;

View File

@ -303,7 +303,7 @@ namespace OpenRCT2::Scripting
uint8_t energy_get() const
{
auto peep = GetPeep();
return peep != nullptr ? peep->energy : 0;
return peep != nullptr ? peep->Energy : 0;
}
void energy_set(uint8_t value)
{
@ -311,7 +311,7 @@ namespace OpenRCT2::Scripting
auto peep = GetPeep();
if (peep != nullptr)
{
peep->energy = value;
peep->Energy = value;
}
}

View File

@ -171,7 +171,7 @@ static void CompareSpriteDataPeep(const Peep& left, const Peep& right)
COMPARE_FIELD(destination_y);
COMPARE_FIELD(destination_tolerance);
COMPARE_FIELD(var_37);
COMPARE_FIELD(energy);
COMPARE_FIELD(Energy);
COMPARE_FIELD(EnergyTarget);
COMPARE_FIELD(Happiness);
COMPARE_FIELD(HappinessTarget);