mirror of https://github.com/OpenRCT2/OpenRCT2.git
Rename `command` to avoid ghosting
It's curious that gcc complains about ghosting here, since the lambda has its own stack pointer, and doesn't capture the outer `command`.
This commit is contained in:
parent
8e439b9895
commit
79ae03fc5e
|
@ -69,44 +69,44 @@ namespace OpenRCT2::Scripting
|
|||
using namespace OpenRCT2::Title;
|
||||
DukObject obj(ctx);
|
||||
std::visit(
|
||||
[&obj](auto&& value) {
|
||||
using T = std::decay_t<decltype(value)>;
|
||||
[&obj](auto&& command) {
|
||||
using T = std::decay_t<decltype(command)>;
|
||||
obj.Set("type", T::ScriptingName);
|
||||
if constexpr (std::is_same_v<T, LoadParkCommand>)
|
||||
{
|
||||
obj.Set("index", value.SaveIndex);
|
||||
obj.Set("index", command.SaveIndex);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, SetLocationCommand>)
|
||||
{
|
||||
obj.Set("x", value.Location.X);
|
||||
obj.Set("y", value.Location.Y);
|
||||
obj.Set("x", command.Location.X);
|
||||
obj.Set("y", command.Location.Y);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, RotateViewCommand>)
|
||||
{
|
||||
obj.Set("rotations", value.Rotations);
|
||||
obj.Set("rotations", command.Rotations);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, SetZoomCommand>)
|
||||
{
|
||||
obj.Set("zoom", value.Zoom);
|
||||
obj.Set("zoom", command.Zoom);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, FollowEntityCommand>)
|
||||
{
|
||||
if (value.Follow.SpriteIndex.IsNull())
|
||||
if (command.Follow.SpriteIndex.IsNull())
|
||||
obj.Set("id", nullptr);
|
||||
else
|
||||
obj.Set("id", value.Follow.SpriteIndex.ToUnderlying());
|
||||
obj.Set("id", command.Follow.SpriteIndex.ToUnderlying());
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, SetSpeedCommand>)
|
||||
{
|
||||
obj.Set("speed", value.Speed);
|
||||
obj.Set("speed", command.Speed);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, WaitCommand>)
|
||||
{
|
||||
obj.Set("duration", value.Milliseconds);
|
||||
obj.Set("duration", command.Milliseconds);
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, LoadScenarioCommand>)
|
||||
{
|
||||
obj.Set("scenario", String::ToStringView(value.Scenario, sizeof(value.Scenario)));
|
||||
obj.Set("scenario", String::ToStringView(command.Scenario, sizeof(command.Scenario)));
|
||||
}
|
||||
},
|
||||
value);
|
||||
|
|
|
@ -275,7 +275,7 @@ namespace OpenRCT2::Title
|
|||
seq.Saves.erase(seq.Saves.begin() + index);
|
||||
|
||||
// Update load commands
|
||||
for (auto& command : seq.Commands)
|
||||
for (auto& seqCommand : seq.Commands)
|
||||
{
|
||||
std::visit(
|
||||
[index](auto&& command) {
|
||||
|
@ -293,7 +293,7 @@ namespace OpenRCT2::Title
|
|||
}
|
||||
}
|
||||
},
|
||||
command);
|
||||
seqCommand);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -507,7 +507,7 @@ namespace OpenRCT2::Title
|
|||
sb.Append("# SCRIPT FOR ");
|
||||
sb.Append(seq.Name.c_str());
|
||||
sb.Append("\n");
|
||||
for (const auto& command : seq.Commands)
|
||||
for (const auto& seqCommand : seq.Commands)
|
||||
{
|
||||
std::visit(
|
||||
[&buffer, &seq, &sb](auto&& command) {
|
||||
|
@ -576,7 +576,7 @@ namespace OpenRCT2::Title
|
|||
sb.Append("END");
|
||||
}
|
||||
},
|
||||
command);
|
||||
seqCommand);
|
||||
sb.Append("\n");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue