[Plugin] Add banner index to banner creation result

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

No files matched your search

+23
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();
}