mirror of https://github.com/OpenRCT2/OpenRCT2.git
Move ScRide into a cpp file
This commit is contained in:
parent
fe57dece6b
commit
2bd348c39e
|
@ -788,6 +788,7 @@
|
||||||
F08623EA69E7456DB79F3E06 /* ScNetwork.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 200F0E6CAD3B41499A3CFC36 /* ScNetwork.cpp */; };
|
F08623EA69E7456DB79F3E06 /* ScNetwork.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 200F0E6CAD3B41499A3CFC36 /* ScNetwork.cpp */; };
|
||||||
CDC72A71A28542F4AD73A91C /* ScRideStation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 522FE124ED4F4E18BCF79042 /* ScRideStation.cpp */; };
|
CDC72A71A28542F4AD73A91C /* ScRideStation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 522FE124ED4F4E18BCF79042 /* ScRideStation.cpp */; };
|
||||||
63858E295E3F451283987982 /* ScRideStation.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 1260386710BF4EA4B4FC31D3 /* ScRideStation.hpp */; };
|
63858E295E3F451283987982 /* ScRideStation.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 1260386710BF4EA4B4FC31D3 /* ScRideStation.hpp */; };
|
||||||
|
705A4B342C7D4F38B26BAFA4 /* ScRide.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F3B00C9900ED42AFA72764ED /* ScRide.cpp */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
|
@ -1878,6 +1879,7 @@
|
||||||
200F0E6CAD3B41499A3CFC36 /* ScNetwork.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScNetwork.cpp; path = src/openrct2/scripting/bindings/network/ScNetwork.cpp; sourceTree = SOURCE_ROOT; };
|
200F0E6CAD3B41499A3CFC36 /* ScNetwork.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScNetwork.cpp; path = src/openrct2/scripting/bindings/network/ScNetwork.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
522FE124ED4F4E18BCF79042 /* ScRideStation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScRideStation.cpp; path = src/openrct2/scripting/bindings/ride/ScRideStation.cpp; sourceTree = SOURCE_ROOT; };
|
522FE124ED4F4E18BCF79042 /* ScRideStation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScRideStation.cpp; path = src/openrct2/scripting/bindings/ride/ScRideStation.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
1260386710BF4EA4B4FC31D3 /* ScRideStation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ScRideStation.hpp; path = src/openrct2/scripting/bindings/ride/ScRideStation.hpp; sourceTree = SOURCE_ROOT; };
|
1260386710BF4EA4B4FC31D3 /* ScRideStation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = ScRideStation.hpp; path = src/openrct2/scripting/bindings/ride/ScRideStation.hpp; sourceTree = SOURCE_ROOT; };
|
||||||
|
F3B00C9900ED42AFA72764ED /* ScRide.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScRide.cpp; path = src/openrct2/scripting/bindings/ride/ScRide.cpp; sourceTree = SOURCE_ROOT; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -3444,6 +3446,7 @@
|
||||||
AD97B712FDF7454CADC7A328 /* ScRide.hpp */,
|
AD97B712FDF7454CADC7A328 /* ScRide.hpp */,
|
||||||
522FE124ED4F4E18BCF79042 /* ScRideStation.cpp */,
|
522FE124ED4F4E18BCF79042 /* ScRideStation.cpp */,
|
||||||
1260386710BF4EA4B4FC31D3 /* ScRideStation.hpp */,
|
1260386710BF4EA4B4FC31D3 /* ScRideStation.hpp */,
|
||||||
|
F3B00C9900ED42AFA72764ED /* ScRide.cpp */,
|
||||||
);
|
);
|
||||||
name = ride;
|
name = ride;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -4425,6 +4428,7 @@
|
||||||
E436DE7807A74621B7BF2276 /* ScPlayer.cpp in Sources */,
|
E436DE7807A74621B7BF2276 /* ScPlayer.cpp in Sources */,
|
||||||
F08623EA69E7456DB79F3E06 /* ScNetwork.cpp in Sources */,
|
F08623EA69E7456DB79F3E06 /* ScNetwork.cpp in Sources */,
|
||||||
CDC72A71A28542F4AD73A91C /* ScRideStation.cpp in Sources */,
|
CDC72A71A28542F4AD73A91C /* ScRideStation.cpp in Sources */,
|
||||||
|
705A4B342C7D4F38B26BAFA4 /* ScRide.cpp in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -864,6 +864,7 @@
|
||||||
<ClCompile Include="scripting\bindings\network\ScNetwork.cpp" />
|
<ClCompile Include="scripting\bindings\network\ScNetwork.cpp" />
|
||||||
<ClCompile Include="scripting\bindings\network\ScPlayer.cpp" />
|
<ClCompile Include="scripting\bindings\network\ScPlayer.cpp" />
|
||||||
<ClCompile Include="scripting\bindings\network\ScPlayerGroup.cpp" />
|
<ClCompile Include="scripting\bindings\network\ScPlayerGroup.cpp" />
|
||||||
|
<ClCompile Include="scripting\bindings\ride\ScRide.cpp" />
|
||||||
<ClCompile Include="scripting\bindings\ride\ScRideStation.cpp" />
|
<ClCompile Include="scripting\bindings\ride\ScRideStation.cpp" />
|
||||||
<ClCompile Include="scripting\HookEngine.cpp" />
|
<ClCompile Include="scripting\HookEngine.cpp" />
|
||||||
<ClCompile Include="scripting\Plugin.cpp" />
|
<ClCompile Include="scripting\Plugin.cpp" />
|
||||||
|
|
|
@ -0,0 +1,532 @@
|
||||||
|
/*****************************************************************************
|
||||||
|
* Copyright (c) 2020 OpenRCT2 developers
|
||||||
|
*
|
||||||
|
* For a complete list of all authors, please refer to contributors.md
|
||||||
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||||
|
*
|
||||||
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef ENABLE_SCRIPTING
|
||||||
|
|
||||||
|
# include "ScRide.hpp"
|
||||||
|
|
||||||
|
# include "../../../Context.h"
|
||||||
|
# include "../../../common.h"
|
||||||
|
# include "../../../ride/Ride.h"
|
||||||
|
# include "../../Duktape.hpp"
|
||||||
|
# include "../../ScriptEngine.h"
|
||||||
|
# include "../object/ScObject.hpp"
|
||||||
|
|
||||||
|
namespace OpenRCT2::Scripting
|
||||||
|
{
|
||||||
|
ScRide::ScRide(ride_id_t rideId)
|
||||||
|
: _rideId(rideId)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ScRide::id_get() const
|
||||||
|
{
|
||||||
|
return _rideId;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<ScRideObject> ScRide::object_get()
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
auto rideObject = GetContext()->GetObjectManager().GetLoadedObject(ObjectType::Ride, ride->subtype);
|
||||||
|
if (rideObject != nullptr)
|
||||||
|
{
|
||||||
|
return std::make_shared<ScRideObject>(ObjectType::Ride, ride->subtype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ScRide::type_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->type : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ScRide::classification_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
switch (ride->GetClassification())
|
||||||
|
{
|
||||||
|
case RideClassification::Ride:
|
||||||
|
return "ride";
|
||||||
|
case RideClassification::ShopOrStall:
|
||||||
|
return "stall";
|
||||||
|
case RideClassification::KioskOrFacility:
|
||||||
|
return "facility";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ScRide::name_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->GetName() : std::string();
|
||||||
|
}
|
||||||
|
void ScRide::name_set(std::string value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->custom_name = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string ScRide::status_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
switch (ride->status)
|
||||||
|
{
|
||||||
|
case RideStatus::Closed:
|
||||||
|
return "closed";
|
||||||
|
case RideStatus::Open:
|
||||||
|
return "open";
|
||||||
|
case RideStatus::Testing:
|
||||||
|
return "testing";
|
||||||
|
case RideStatus::Simulating:
|
||||||
|
return "simulating";
|
||||||
|
case RideStatus::Count: // Meaningless but necessary to satisfy -Wswitch
|
||||||
|
return "count";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t ScRide::lifecycleFlags_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->lifecycle_flags : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::lifecycleFlags_set(uint32_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->lifecycle_flags = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ScRide::mode_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? static_cast<uint8_t>(ride->mode) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::mode_set(uint8_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->mode = static_cast<RideMode>(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ScRide::departFlags_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->depart_flags : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::departFlags_set(uint8_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->depart_flags = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ScRide::minimumWaitingTime_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->min_waiting_time : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::minimumWaitingTime_set(uint8_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->min_waiting_time = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ScRide::maximumWaitingTime_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->max_waiting_time : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::maximumWaitingTime_set(uint8_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->max_waiting_time = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<uint16_t> ScRide::vehicles_get() const
|
||||||
|
{
|
||||||
|
std::vector<uint16_t> result;
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
result.insert(result.begin(), std::begin(ride->vehicles), std::begin(ride->vehicles) + ride->num_vehicles);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<DukValue> ScRide::vehicleColours_get() const
|
||||||
|
{
|
||||||
|
std::vector<DukValue> result;
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
||||||
|
for (const auto& vehicleColour : ride->vehicle_colours)
|
||||||
|
{
|
||||||
|
result.push_back(ToDuk(ctx, vehicleColour));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::vehicleColours_set(const std::vector<DukValue>& value)
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
auto count = std::min(value.size(), std::size(ride->vehicle_colours));
|
||||||
|
for (size_t i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
ride->vehicle_colours[i] = FromDuk<VehicleColour>(value[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<DukValue> ScRide::colourSchemes_get() const
|
||||||
|
{
|
||||||
|
std::vector<DukValue> result;
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
||||||
|
for (const auto& trackColour : ride->track_colour)
|
||||||
|
{
|
||||||
|
result.push_back(ToDuk(ctx, trackColour));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::colourSchemes_set(const std::vector<DukValue>& value)
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
auto count = std::min(value.size(), std::size(ride->track_colour));
|
||||||
|
for (size_t i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
ride->track_colour[i] = FromDuk<TrackColour>(value[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ScRide::stationStyle_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->entrance_style : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::stationStyle_set(uint8_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->entrance_style = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ScRide::music_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->music : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::music_set(uint8_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->music = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<ScRideStation>> ScRide::stations_get() const
|
||||||
|
{
|
||||||
|
std::vector<std::shared_ptr<ScRideStation>> result;
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < std::size(ride->stations); i++)
|
||||||
|
{
|
||||||
|
result.push_back(std::make_shared<ScRideStation>(ride->id, static_cast<StationIndex>(i)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int32_t> ScRide::price_get() const
|
||||||
|
{
|
||||||
|
std::vector<int32_t> result;
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
auto numPrices = ride->GetNumPrices();
|
||||||
|
for (size_t i = 0; i < numPrices; i++)
|
||||||
|
{
|
||||||
|
result.push_back(ride->price[i]);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::price_set(const std::vector<int32_t>& value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
auto numPrices = std::min(value.size(), ride->GetNumPrices());
|
||||||
|
for (size_t i = 0; i < numPrices; i++)
|
||||||
|
{
|
||||||
|
ride->price[i] = static_cast<money16>(value[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ScRide::excitement_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->excitement : 0;
|
||||||
|
}
|
||||||
|
void ScRide::excitement_set(int32_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->excitement = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ScRide::intensity_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->intensity : 0;
|
||||||
|
}
|
||||||
|
void ScRide::intensity_set(int32_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->intensity = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ScRide::nausea_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->nausea : 0;
|
||||||
|
}
|
||||||
|
void ScRide::nausea_set(int32_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->nausea = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ScRide::totalCustomers_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->total_customers : 0;
|
||||||
|
}
|
||||||
|
void ScRide::totalCustomers_set(int32_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->total_customers = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ScRide::buildDate_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->build_date : 0;
|
||||||
|
}
|
||||||
|
void ScRide::buildDate_set(int32_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->build_date = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ScRide::age_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->GetAge() : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int16_t ScRide::runningCost_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->upkeep_cost : 0;
|
||||||
|
}
|
||||||
|
void ScRide::runningCost_set(int16_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->upkeep_cost = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int32_t ScRide::totalProfit_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->total_profit : 0;
|
||||||
|
}
|
||||||
|
void ScRide::totalProfit_set(int32_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->total_profit = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ScRide::inspectionInterval_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->inspection_interval : 0;
|
||||||
|
}
|
||||||
|
void ScRide::inspectionInterval_set(uint8_t value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
ride->inspection_interval = std::clamp<uint8_t>(value, RIDE_INSPECTION_EVERY_10_MINUTES, RIDE_INSPECTION_NEVER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DukValue ScRide::value_get() const
|
||||||
|
{
|
||||||
|
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr && ride->value != RIDE_VALUE_UNDEFINED)
|
||||||
|
{
|
||||||
|
return ToDuk<int32_t>(ctx, ride->value);
|
||||||
|
}
|
||||||
|
return ToDuk(ctx, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::value_set(const DukValue& value)
|
||||||
|
{
|
||||||
|
ThrowIfGameStateNotMutable();
|
||||||
|
auto ride = GetRide();
|
||||||
|
if (ride != nullptr)
|
||||||
|
{
|
||||||
|
if (value.type() == DukValue::Type::NUMBER)
|
||||||
|
{
|
||||||
|
ride->value = value.as_int();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ride->value = RIDE_VALUE_UNDEFINED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ride* ScRide::GetRide() const
|
||||||
|
{
|
||||||
|
return get_ride(_rideId);
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t ScRide::downtime_get() const
|
||||||
|
{
|
||||||
|
auto ride = GetRide();
|
||||||
|
return ride != nullptr ? ride->downtime : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ScRide::Register(duk_context* ctx)
|
||||||
|
{
|
||||||
|
dukglue_register_property(ctx, &ScRide::id_get, nullptr, "id");
|
||||||
|
dukglue_register_property(ctx, &ScRide::object_get, nullptr, "object");
|
||||||
|
dukglue_register_property(ctx, &ScRide::type_get, nullptr, "type");
|
||||||
|
dukglue_register_property(ctx, &ScRide::classification_get, nullptr, "classification");
|
||||||
|
dukglue_register_property(ctx, &ScRide::name_get, &ScRide::name_set, "name");
|
||||||
|
dukglue_register_property(ctx, &ScRide::status_get, nullptr, "status");
|
||||||
|
dukglue_register_property(ctx, &ScRide::lifecycleFlags_get, &ScRide::lifecycleFlags_set, "lifecycleFlags");
|
||||||
|
dukglue_register_property(ctx, &ScRide::mode_get, &ScRide::mode_set, "mode");
|
||||||
|
dukglue_register_property(ctx, &ScRide::departFlags_get, &ScRide::departFlags_set, "departFlags");
|
||||||
|
dukglue_register_property(ctx, &ScRide::minimumWaitingTime_get, &ScRide::minimumWaitingTime_set, "minimumWaitingTime");
|
||||||
|
dukglue_register_property(ctx, &ScRide::maximumWaitingTime_get, &ScRide::maximumWaitingTime_set, "maximumWaitingTime");
|
||||||
|
dukglue_register_property(ctx, &ScRide::vehicles_get, nullptr, "vehicles");
|
||||||
|
dukglue_register_property(ctx, &ScRide::vehicleColours_get, &ScRide::vehicleColours_set, "vehicleColours");
|
||||||
|
dukglue_register_property(ctx, &ScRide::colourSchemes_get, &ScRide::colourSchemes_set, "colourSchemes");
|
||||||
|
dukglue_register_property(ctx, &ScRide::stationStyle_get, &ScRide::stationStyle_set, "stationStyle");
|
||||||
|
dukglue_register_property(ctx, &ScRide::music_get, &ScRide::music_set, "music");
|
||||||
|
dukglue_register_property(ctx, &ScRide::stations_get, nullptr, "stations");
|
||||||
|
dukglue_register_property(ctx, &ScRide::price_get, &ScRide::price_set, "price");
|
||||||
|
dukglue_register_property(ctx, &ScRide::excitement_get, &ScRide::excitement_set, "excitement");
|
||||||
|
dukglue_register_property(ctx, &ScRide::intensity_get, &ScRide::intensity_set, "intensity");
|
||||||
|
dukglue_register_property(ctx, &ScRide::nausea_get, &ScRide::nausea_set, "nausea");
|
||||||
|
dukglue_register_property(ctx, &ScRide::totalCustomers_get, &ScRide::totalCustomers_set, "totalCustomers");
|
||||||
|
dukglue_register_property(ctx, &ScRide::buildDate_get, &ScRide::buildDate_set, "buildDate");
|
||||||
|
dukglue_register_property(ctx, &ScRide::age_get, nullptr, "age");
|
||||||
|
dukglue_register_property(ctx, &ScRide::runningCost_get, &ScRide::runningCost_set, "runningCost");
|
||||||
|
dukglue_register_property(ctx, &ScRide::totalProfit_get, &ScRide::totalProfit_set, "totalProfit");
|
||||||
|
dukglue_register_property(ctx, &ScRide::inspectionInterval_get, &ScRide::inspectionInterval_set, "inspectionInterval");
|
||||||
|
dukglue_register_property(ctx, &ScRide::value_get, &ScRide::value_set, "value");
|
||||||
|
dukglue_register_property(ctx, &ScRide::downtime_get, nullptr, "downtime");
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace OpenRCT2::Scripting
|
||||||
|
|
||||||
|
#endif
|
|
@ -63,515 +63,102 @@ namespace OpenRCT2::Scripting
|
||||||
ride_id_t _rideId = RIDE_ID_NULL;
|
ride_id_t _rideId = RIDE_ID_NULL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ScRide(ride_id_t rideId)
|
ScRide(ride_id_t rideId);
|
||||||
: _rideId(rideId)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32_t id_get() const
|
int32_t id_get() const;
|
||||||
{
|
|
||||||
return _rideId;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::shared_ptr<ScRideObject> object_get()
|
std::shared_ptr<ScRideObject> object_get();
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
auto rideObject = GetContext()->GetObjectManager().GetLoadedObject(ObjectType::Ride, ride->subtype);
|
|
||||||
if (rideObject != nullptr)
|
|
||||||
{
|
|
||||||
return std::make_shared<ScRideObject>(ObjectType::Ride, ride->subtype);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t type_get() const
|
int32_t type_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->type : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string classification_get() const
|
std::string classification_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
switch (ride->GetClassification())
|
|
||||||
{
|
|
||||||
case RideClassification::Ride:
|
|
||||||
return "ride";
|
|
||||||
case RideClassification::ShopOrStall:
|
|
||||||
return "stall";
|
|
||||||
case RideClassification::KioskOrFacility:
|
|
||||||
return "facility";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string name_get() const
|
std::string name_get() const;
|
||||||
{
|
void name_set(std::string value);
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->GetName() : std::string();
|
|
||||||
}
|
|
||||||
void name_set(std::string value)
|
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->custom_name = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string status_get() const
|
std::string status_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
switch (ride->status)
|
|
||||||
{
|
|
||||||
case RideStatus::Closed:
|
|
||||||
return "closed";
|
|
||||||
case RideStatus::Open:
|
|
||||||
return "open";
|
|
||||||
case RideStatus::Testing:
|
|
||||||
return "testing";
|
|
||||||
case RideStatus::Simulating:
|
|
||||||
return "simulating";
|
|
||||||
case RideStatus::Count: // Meaningless but necessary to satisfy -Wswitch
|
|
||||||
return "count";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t lifecycleFlags_get() const
|
uint32_t lifecycleFlags_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->lifecycle_flags : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void lifecycleFlags_set(uint32_t value)
|
void lifecycleFlags_set(uint32_t value);
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->lifecycle_flags = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t mode_get() const
|
uint8_t mode_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? static_cast<uint8_t>(ride->mode) : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mode_set(uint8_t value)
|
void mode_set(uint8_t value);
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->mode = static_cast<RideMode>(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t departFlags_get() const
|
uint8_t departFlags_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->depart_flags : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void departFlags_set(uint8_t value)
|
void departFlags_set(uint8_t value);
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->depart_flags = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t minimumWaitingTime_get() const
|
uint8_t minimumWaitingTime_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->min_waiting_time : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void minimumWaitingTime_set(uint8_t value)
|
void minimumWaitingTime_set(uint8_t value);
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->min_waiting_time = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t maximumWaitingTime_get() const
|
uint8_t maximumWaitingTime_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->max_waiting_time : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void maximumWaitingTime_set(uint8_t value)
|
void maximumWaitingTime_set(uint8_t value);
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->max_waiting_time = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<uint16_t> vehicles_get() const
|
std::vector<uint16_t> vehicles_get() const;
|
||||||
{
|
|
||||||
std::vector<uint16_t> result;
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
result.insert(result.begin(), std::begin(ride->vehicles), std::begin(ride->vehicles) + ride->num_vehicles);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<DukValue> vehicleColours_get() const
|
std::vector<DukValue> vehicleColours_get() const;
|
||||||
{
|
|
||||||
std::vector<DukValue> result;
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
|
||||||
for (const auto& vehicleColour : ride->vehicle_colours)
|
|
||||||
{
|
|
||||||
result.push_back(ToDuk(ctx, vehicleColour));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void vehicleColours_set(const std::vector<DukValue>& value)
|
void vehicleColours_set(const std::vector<DukValue>& value);
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
auto count = std::min(value.size(), std::size(ride->vehicle_colours));
|
|
||||||
for (size_t i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
ride->vehicle_colours[i] = FromDuk<VehicleColour>(value[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<DukValue> colourSchemes_get() const
|
std::vector<DukValue> colourSchemes_get() const;
|
||||||
{
|
|
||||||
std::vector<DukValue> result;
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
|
||||||
for (const auto& trackColour : ride->track_colour)
|
|
||||||
{
|
|
||||||
result.push_back(ToDuk(ctx, trackColour));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void colourSchemes_set(const std::vector<DukValue>& value)
|
void colourSchemes_set(const std::vector<DukValue>& value);
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
auto count = std::min(value.size(), std::size(ride->track_colour));
|
|
||||||
for (size_t i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
ride->track_colour[i] = FromDuk<TrackColour>(value[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t stationStyle_get() const
|
uint8_t stationStyle_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->entrance_style : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void stationStyle_set(uint8_t value)
|
void stationStyle_set(uint8_t value);
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->entrance_style = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t music_get() const
|
uint8_t music_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->music : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void music_set(uint8_t value)
|
void music_set(uint8_t value);
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->music = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::shared_ptr<ScRideStation>> stations_get() const
|
std::vector<std::shared_ptr<ScRideStation>> stations_get() const;
|
||||||
{
|
|
||||||
std::vector<std::shared_ptr<ScRideStation>> result;
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
for (size_t i = 0; i < std::size(ride->stations); i++)
|
|
||||||
{
|
|
||||||
result.push_back(std::make_shared<ScRideStation>(ride->id, static_cast<StationIndex>(i)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<int32_t> price_get() const
|
std::vector<int32_t> price_get() const;
|
||||||
{
|
|
||||||
std::vector<int32_t> result;
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
auto numPrices = ride->GetNumPrices();
|
|
||||||
for (size_t i = 0; i < numPrices; i++)
|
|
||||||
{
|
|
||||||
result.push_back(ride->price[i]);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void price_set(const std::vector<int32_t>& value)
|
void price_set(const std::vector<int32_t>& value);
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
auto numPrices = std::min(value.size(), ride->GetNumPrices());
|
|
||||||
for (size_t i = 0; i < numPrices; i++)
|
|
||||||
{
|
|
||||||
ride->price[i] = static_cast<money16>(value[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t excitement_get() const
|
int32_t excitement_get() const;
|
||||||
{
|
void excitement_set(int32_t value);
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->excitement : 0;
|
|
||||||
}
|
|
||||||
void excitement_set(int32_t value)
|
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->excitement = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t intensity_get() const
|
int32_t intensity_get() const;
|
||||||
{
|
void intensity_set(int32_t value);
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->intensity : 0;
|
|
||||||
}
|
|
||||||
void intensity_set(int32_t value)
|
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->intensity = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t nausea_get() const
|
int32_t nausea_get() const;
|
||||||
{
|
void nausea_set(int32_t value);
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->nausea : 0;
|
|
||||||
}
|
|
||||||
void nausea_set(int32_t value)
|
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->nausea = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t totalCustomers_get() const
|
int32_t totalCustomers_get() const;
|
||||||
{
|
void totalCustomers_set(int32_t value);
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->total_customers : 0;
|
|
||||||
}
|
|
||||||
void totalCustomers_set(int32_t value)
|
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->total_customers = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t buildDate_get() const
|
int32_t buildDate_get() const;
|
||||||
{
|
void buildDate_set(int32_t value);
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->build_date : 0;
|
|
||||||
}
|
|
||||||
void buildDate_set(int32_t value)
|
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->build_date = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t age_get() const
|
int32_t age_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->GetAge() : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t runningCost_get() const
|
int16_t runningCost_get() const;
|
||||||
{
|
void runningCost_set(int16_t value);
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->upkeep_cost : 0;
|
|
||||||
}
|
|
||||||
void runningCost_set(int16_t value)
|
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->upkeep_cost = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t totalProfit_get() const
|
int32_t totalProfit_get() const;
|
||||||
{
|
void totalProfit_set(int32_t value);
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->total_profit : 0;
|
|
||||||
}
|
|
||||||
void totalProfit_set(int32_t value)
|
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->total_profit = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t inspectionInterval_get() const
|
uint8_t inspectionInterval_get() const;
|
||||||
{
|
void inspectionInterval_set(uint8_t value);
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->inspection_interval : 0;
|
|
||||||
}
|
|
||||||
void inspectionInterval_set(uint8_t value)
|
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
ride->inspection_interval = std::clamp<uint8_t>(value, RIDE_INSPECTION_EVERY_10_MINUTES, RIDE_INSPECTION_NEVER);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DukValue value_get() const
|
DukValue value_get() const;
|
||||||
{
|
|
||||||
auto ctx = GetContext()->GetScriptEngine().GetContext();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr && ride->value != RIDE_VALUE_UNDEFINED)
|
|
||||||
{
|
|
||||||
return ToDuk<int32_t>(ctx, ride->value);
|
|
||||||
}
|
|
||||||
return ToDuk(ctx, nullptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void value_set(const DukValue& value)
|
void value_set(const DukValue& value);
|
||||||
{
|
|
||||||
ThrowIfGameStateNotMutable();
|
|
||||||
auto ride = GetRide();
|
|
||||||
if (ride != nullptr)
|
|
||||||
{
|
|
||||||
if (value.type() == DukValue::Type::NUMBER)
|
|
||||||
{
|
|
||||||
ride->value = value.as_int();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ride->value = RIDE_VALUE_UNDEFINED;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t downtime_get() const
|
uint8_t downtime_get() const;
|
||||||
{
|
|
||||||
auto ride = GetRide();
|
|
||||||
return ride != nullptr ? ride->downtime : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ride* GetRide() const
|
Ride* GetRide() const;
|
||||||
{
|
|
||||||
return get_ride(_rideId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void Register(duk_context* ctx)
|
static void Register(duk_context* ctx);
|
||||||
{
|
|
||||||
dukglue_register_property(ctx, &ScRide::id_get, nullptr, "id");
|
|
||||||
dukglue_register_property(ctx, &ScRide::object_get, nullptr, "object");
|
|
||||||
dukglue_register_property(ctx, &ScRide::type_get, nullptr, "type");
|
|
||||||
dukglue_register_property(ctx, &ScRide::classification_get, nullptr, "classification");
|
|
||||||
dukglue_register_property(ctx, &ScRide::name_get, &ScRide::name_set, "name");
|
|
||||||
dukglue_register_property(ctx, &ScRide::status_get, nullptr, "status");
|
|
||||||
dukglue_register_property(ctx, &ScRide::lifecycleFlags_get, &ScRide::lifecycleFlags_set, "lifecycleFlags");
|
|
||||||
dukglue_register_property(ctx, &ScRide::mode_get, &ScRide::mode_set, "mode");
|
|
||||||
dukglue_register_property(ctx, &ScRide::departFlags_get, &ScRide::departFlags_set, "departFlags");
|
|
||||||
dukglue_register_property(
|
|
||||||
ctx, &ScRide::minimumWaitingTime_get, &ScRide::minimumWaitingTime_set, "minimumWaitingTime");
|
|
||||||
dukglue_register_property(
|
|
||||||
ctx, &ScRide::maximumWaitingTime_get, &ScRide::maximumWaitingTime_set, "maximumWaitingTime");
|
|
||||||
dukglue_register_property(ctx, &ScRide::vehicles_get, nullptr, "vehicles");
|
|
||||||
dukglue_register_property(ctx, &ScRide::vehicleColours_get, &ScRide::vehicleColours_set, "vehicleColours");
|
|
||||||
dukglue_register_property(ctx, &ScRide::colourSchemes_get, &ScRide::colourSchemes_set, "colourSchemes");
|
|
||||||
dukglue_register_property(ctx, &ScRide::stationStyle_get, &ScRide::stationStyle_set, "stationStyle");
|
|
||||||
dukglue_register_property(ctx, &ScRide::music_get, &ScRide::music_set, "music");
|
|
||||||
dukglue_register_property(ctx, &ScRide::stations_get, nullptr, "stations");
|
|
||||||
dukglue_register_property(ctx, &ScRide::price_get, &ScRide::price_set, "price");
|
|
||||||
dukglue_register_property(ctx, &ScRide::excitement_get, &ScRide::excitement_set, "excitement");
|
|
||||||
dukglue_register_property(ctx, &ScRide::intensity_get, &ScRide::intensity_set, "intensity");
|
|
||||||
dukglue_register_property(ctx, &ScRide::nausea_get, &ScRide::nausea_set, "nausea");
|
|
||||||
dukglue_register_property(ctx, &ScRide::totalCustomers_get, &ScRide::totalCustomers_set, "totalCustomers");
|
|
||||||
dukglue_register_property(ctx, &ScRide::buildDate_get, &ScRide::buildDate_set, "buildDate");
|
|
||||||
dukglue_register_property(ctx, &ScRide::age_get, nullptr, "age");
|
|
||||||
dukglue_register_property(ctx, &ScRide::runningCost_get, &ScRide::runningCost_set, "runningCost");
|
|
||||||
dukglue_register_property(ctx, &ScRide::totalProfit_get, &ScRide::totalProfit_set, "totalProfit");
|
|
||||||
dukglue_register_property(
|
|
||||||
ctx, &ScRide::inspectionInterval_get, &ScRide::inspectionInterval_set, "inspectionInterval");
|
|
||||||
dukglue_register_property(ctx, &ScRide::value_get, &ScRide::value_set, "value");
|
|
||||||
dukglue_register_property(ctx, &ScRide::downtime_get, nullptr, "downtime");
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
} // namespace OpenRCT2::Scripting
|
} // namespace OpenRCT2::Scripting
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue