1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-18 20:43:04 +01:00

[Plugin] Add banner index to banner creation result

This commit is contained in:
Stephan Spengler
2024-05-29 22:35:35 +02:00
committed by GitHub
parent c00fe1e7d6
commit 73043106ed
5 changed files with 36 additions and 7 deletions

View File

@@ -12,10 +12,13 @@
# include "ScriptEngine.h"
# include "../PlatformEnvironment.h"
# include "../actions/BannerPlaceAction.h"
# include "../actions/CustomAction.h"
# include "../actions/GameAction.h"
# include "../actions/LargeSceneryPlaceAction.h"
# include "../actions/RideCreateAction.h"
# include "../actions/StaffHireNewAction.h"
# include "../actions/WallPlaceAction.h"
# include "../config/Config.h"
# include "../core/EnumMap.hpp"
# include "../core/File.h"
@@ -1222,6 +1225,26 @@ DukValue ScriptEngine::GameActionResultToDuk(const GameAction& action, const Gam
}
}
}
// BannerPlaceAction, LargeSceneryPlaceAction, WallPlaceAction
auto bannerId = BannerIndex::GetNull();
switch (action.GetType())
{
case GameCommand::PlaceBanner:
bannerId = result.GetData<BannerPlaceActionResult>().bannerId;
break;
case GameCommand::PlaceLargeScenery:
bannerId = result.GetData<LargeSceneryPlaceActionResult>().bannerId;
break;
case GameCommand::PlaceWall:
bannerId = result.GetData<WallPlaceActionResult>().BannerId;
break;
default:
break;
}
if (!bannerId.IsNull())
{
obj.Set("bannerIndex", bannerId.ToUnderlying());
}
return obj.Take();
}