Migrate DEFINE_INTERFACE_METHOD_* to the ScriptFunction wrappers.

The main benefits are more convenient code in the component interfaces
TU and no limit on the # of arguments that can be passed.

Differential Revision: https://code.wildfiregames.com/D3910
This was SVN commit r25350.
This commit is contained in:
wraitii 2021-05-01 08:01:30 +00:00
parent c62ad8fefa
commit 19b01dc710
29 changed files with 208 additions and 248 deletions

View File

@ -24,7 +24,6 @@
// but bring in a lot of headers indirectly. Adding these to the precompiled header
// cuts down compilation time by about half.
#include "simulation2/system/Interface.h"
#include "simulation2/system/InterfaceScripted.h"
#include "maths/FixedVector2D.h"
#include "maths/FixedVector3D.h"

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -28,9 +28,9 @@
#include <boost/filesystem.hpp>
BEGIN_INTERFACE_WRAPPER(AIManager)
DEFINE_INTERFACE_METHOD_4("AddPlayer", void, ICmpAIManager, AddPlayer, std::wstring, player_id_t, uint8_t, std::wstring)
DEFINE_INTERFACE_METHOD_0("TryLoadSharedComponent", void, ICmpAIManager, TryLoadSharedComponent)
DEFINE_INTERFACE_METHOD_0("RunGamestateInit", void, ICmpAIManager, RunGamestateInit)
DEFINE_INTERFACE_METHOD("AddPlayer", ICmpAIManager, AddPlayer)
DEFINE_INTERFACE_METHOD("TryLoadSharedComponent", ICmpAIManager, TryLoadSharedComponent)
DEFINE_INTERFACE_METHOD("RunGamestateInit", ICmpAIManager, RunGamestateInit)
END_INTERFACE_WRAPPER(AIManager)
// Implement the static method that finds all AI scripts

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,10 +22,10 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(CinemaManager)
DEFINE_INTERFACE_METHOD_1("AddPath", void, ICmpCinemaManager, AddPath, CCinemaPath)
DEFINE_INTERFACE_METHOD_1("AddCinemaPathToQueue", void, ICmpCinemaManager, AddCinemaPathToQueue, CStrW)
DEFINE_INTERFACE_METHOD_1("DeletePath", void, ICmpCinemaManager, DeletePath, CStrW)
DEFINE_INTERFACE_METHOD_CONST_0("IsPlaying", bool, ICmpCinemaManager, IsEnabled)
DEFINE_INTERFACE_METHOD_0("Play", void, ICmpCinemaManager, Play)
DEFINE_INTERFACE_METHOD_0("Stop", void, ICmpCinemaManager, Stop)
DEFINE_INTERFACE_METHOD("AddPath", ICmpCinemaManager, AddPath)
DEFINE_INTERFACE_METHOD("AddCinemaPathToQueue", ICmpCinemaManager, AddCinemaPathToQueue)
DEFINE_INTERFACE_METHOD("DeletePath", ICmpCinemaManager, DeletePath)
DEFINE_INTERFACE_METHOD("IsPlaying", ICmpCinemaManager, IsEnabled)
DEFINE_INTERFACE_METHOD("Play", ICmpCinemaManager, Play)
DEFINE_INTERFACE_METHOD("Stop", ICmpCinemaManager, Stop)
END_INTERFACE_WRAPPER(CinemaManager)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,7 +22,7 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(CommandQueue)
DEFINE_INTERFACE_METHOD_2("PushLocalCommand", void, ICmpCommandQueue, PushLocalCommand, player_id_t, JS::HandleValue)
DEFINE_INTERFACE_METHOD_1("PostNetworkCommand", void, ICmpCommandQueue, PostNetworkCommand, JS::HandleValue)
DEFINE_INTERFACE_METHOD("PushLocalCommand", ICmpCommandQueue, PushLocalCommand)
DEFINE_INTERFACE_METHOD("PostNetworkCommand", ICmpCommandQueue, PostNetworkCommand)
// Excluded: FlushTurn (doesn't make sense for scripts to call it)
END_INTERFACE_WRAPPER(CommandQueue)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -68,7 +68,7 @@ JS::Value ICmpFootprint::GetShape_wrapper() const
}
BEGIN_INTERFACE_WRAPPER(Footprint)
DEFINE_INTERFACE_METHOD_CONST_1("PickSpawnPoint", CFixedVector3D, ICmpFootprint, PickSpawnPoint, entity_id_t)
DEFINE_INTERFACE_METHOD_CONST_1("PickSpawnPointBothPass", CFixedVector3D, ICmpFootprint, PickSpawnPointBothPass, entity_id_t)
DEFINE_INTERFACE_METHOD_CONST_0("GetShape", JS::Value, ICmpFootprint, GetShape_wrapper)
DEFINE_INTERFACE_METHOD("PickSpawnPoint", ICmpFootprint, PickSpawnPoint)
DEFINE_INTERFACE_METHOD("PickSpawnPointBothPass", ICmpFootprint, PickSpawnPointBothPass)
DEFINE_INTERFACE_METHOD("GetShape", ICmpFootprint, GetShape_wrapper)
END_INTERFACE_WRAPPER(Footprint)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,5 +22,5 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(Minimap)
DEFINE_INTERFACE_METHOD_0("UpdateColor", void, ICmpMinimap, UpdateColor)
DEFINE_INTERFACE_METHOD("UpdateColor", ICmpMinimap, UpdateColor)
END_INTERFACE_WRAPPER(Minimap)

View File

@ -46,18 +46,18 @@ std::string ICmpObstruction::CheckFoundation_wrapper(const std::string& classNam
}
BEGIN_INTERFACE_WRAPPER(Obstruction)
DEFINE_INTERFACE_METHOD_CONST_0("GetSize", entity_pos_t, ICmpObstruction, GetSize)
DEFINE_INTERFACE_METHOD_CONST_0("CheckShorePlacement", bool, ICmpObstruction, CheckShorePlacement)
DEFINE_INTERFACE_METHOD_CONST_2("CheckFoundation", std::string, ICmpObstruction, CheckFoundation_wrapper, std::string, bool)
DEFINE_INTERFACE_METHOD_CONST_0("CheckDuplicateFoundation", bool, ICmpObstruction, CheckDuplicateFoundation)
DEFINE_INTERFACE_METHOD_CONST_0("GetEntitiesBlockingMovement", std::vector<entity_id_t>, ICmpObstruction, GetEntitiesBlockingMovement)
DEFINE_INTERFACE_METHOD_CONST_0("GetEntitiesBlockingConstruction", std::vector<entity_id_t>, ICmpObstruction, GetEntitiesBlockingConstruction)
DEFINE_INTERFACE_METHOD_CONST_0("GetEntitiesDeletedUponConstruction", std::vector<entity_id_t>, ICmpObstruction, GetEntitiesDeletedUponConstruction)
DEFINE_INTERFACE_METHOD_1("SetActive", void, ICmpObstruction, SetActive, bool)
DEFINE_INTERFACE_METHOD_3("SetDisableBlockMovementPathfinding", void, ICmpObstruction, SetDisableBlockMovementPathfinding, bool, bool, int32_t)
DEFINE_INTERFACE_METHOD_CONST_1("GetBlockMovementFlag", bool, ICmpObstruction, GetBlockMovementFlag, bool)
DEFINE_INTERFACE_METHOD_1("SetControlGroup", void, ICmpObstruction, SetControlGroup, entity_id_t)
DEFINE_INTERFACE_METHOD_CONST_0("GetControlGroup", entity_id_t, ICmpObstruction, GetControlGroup)
DEFINE_INTERFACE_METHOD_1("SetControlGroup2", void, ICmpObstruction, SetControlGroup2, entity_id_t)
DEFINE_INTERFACE_METHOD_CONST_0("GetControlGroup2", entity_id_t, ICmpObstruction, GetControlGroup2)
DEFINE_INTERFACE_METHOD("GetSize", ICmpObstruction, GetSize)
DEFINE_INTERFACE_METHOD("CheckShorePlacement", ICmpObstruction, CheckShorePlacement)
DEFINE_INTERFACE_METHOD("CheckFoundation", ICmpObstruction, CheckFoundation_wrapper)
DEFINE_INTERFACE_METHOD("CheckDuplicateFoundation", ICmpObstruction, CheckDuplicateFoundation)
DEFINE_INTERFACE_METHOD("GetEntitiesBlockingMovement", ICmpObstruction, GetEntitiesBlockingMovement)
DEFINE_INTERFACE_METHOD("GetEntitiesBlockingConstruction", ICmpObstruction, GetEntitiesBlockingConstruction)
DEFINE_INTERFACE_METHOD("GetEntitiesDeletedUponConstruction", ICmpObstruction, GetEntitiesDeletedUponConstruction)
DEFINE_INTERFACE_METHOD("SetActive", ICmpObstruction, SetActive)
DEFINE_INTERFACE_METHOD("SetDisableBlockMovementPathfinding", ICmpObstruction, SetDisableBlockMovementPathfinding)
DEFINE_INTERFACE_METHOD("GetBlockMovementFlag", ICmpObstruction, GetBlockMovementFlag)
DEFINE_INTERFACE_METHOD("SetControlGroup", ICmpObstruction, SetControlGroup)
DEFINE_INTERFACE_METHOD("GetControlGroup", ICmpObstruction, GetControlGroup)
DEFINE_INTERFACE_METHOD("SetControlGroup2", ICmpObstruction, SetControlGroup2)
DEFINE_INTERFACE_METHOD("GetControlGroup2", ICmpObstruction, GetControlGroup2)
END_INTERFACE_WRAPPER(Obstruction)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,13 +22,13 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(ObstructionManager)
DEFINE_INTERFACE_METHOD_1("SetPassabilityCircular", void, ICmpObstructionManager, SetPassabilityCircular, bool)
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpObstructionManager, SetDebugOverlay, bool)
DEFINE_INTERFACE_METHOD_CONST_3("DistanceToPoint", fixed, ICmpObstructionManager, DistanceToPoint, entity_id_t, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_CONST_3("MaxDistanceToPoint", fixed, ICmpObstructionManager, MaxDistanceToPoint, entity_id_t, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_CONST_2("DistanceToTarget", fixed, ICmpObstructionManager, DistanceToTarget, entity_id_t, entity_id_t)
DEFINE_INTERFACE_METHOD_CONST_2("MaxDistanceToTarget", fixed, ICmpObstructionManager, MaxDistanceToTarget, entity_id_t, entity_id_t)
DEFINE_INTERFACE_METHOD_CONST_6("IsInPointRange", bool, ICmpObstructionManager, IsInPointRange, entity_id_t, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, bool)
DEFINE_INTERFACE_METHOD_CONST_5("IsInTargetRange", bool, ICmpObstructionManager, IsInTargetRange, entity_id_t, entity_id_t, entity_pos_t, entity_pos_t, bool)
DEFINE_INTERFACE_METHOD_CONST_6("IsPointInPointRange", bool, ICmpObstructionManager, IsPointInPointRange, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD("SetPassabilityCircular", ICmpObstructionManager, SetPassabilityCircular)
DEFINE_INTERFACE_METHOD("SetDebugOverlay", ICmpObstructionManager, SetDebugOverlay)
DEFINE_INTERFACE_METHOD("DistanceToPoint", ICmpObstructionManager, DistanceToPoint)
DEFINE_INTERFACE_METHOD("MaxDistanceToPoint", ICmpObstructionManager, MaxDistanceToPoint)
DEFINE_INTERFACE_METHOD("DistanceToTarget", ICmpObstructionManager, DistanceToTarget)
DEFINE_INTERFACE_METHOD("MaxDistanceToTarget", ICmpObstructionManager, MaxDistanceToTarget)
DEFINE_INTERFACE_METHOD("IsInPointRange", ICmpObstructionManager, IsInPointRange)
DEFINE_INTERFACE_METHOD("IsInTargetRange", ICmpObstructionManager, IsInTargetRange)
DEFINE_INTERFACE_METHOD("IsPointInPointRange", ICmpObstructionManager, IsPointInPointRange)
END_INTERFACE_WRAPPER(ObstructionManager)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2015 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,8 +22,8 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(OverlayRenderer)
DEFINE_INTERFACE_METHOD_0("Reset", void, ICmpOverlayRenderer, Reset)
DEFINE_INTERFACE_METHOD_5("AddSprite", void, ICmpOverlayRenderer, AddSprite, VfsPath, CFixedVector2D, CFixedVector2D, CFixedVector3D, std::string)
DEFINE_INTERFACE_METHOD("Reset", ICmpOverlayRenderer, Reset)
DEFINE_INTERFACE_METHOD("AddSprite", ICmpOverlayRenderer, AddSprite)
END_INTERFACE_WRAPPER(OverlayRenderer)
bool ICmpOverlayRenderer::m_OverrideVisible = true;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,7 +22,7 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(Ownership)
DEFINE_INTERFACE_METHOD_CONST_0("GetOwner", player_id_t, ICmpOwnership, GetOwner)
DEFINE_INTERFACE_METHOD_1("SetOwner", void, ICmpOwnership, SetOwner, player_id_t)
DEFINE_INTERFACE_METHOD_1("SetOwnerQuiet", void, ICmpOwnership, SetOwnerQuiet, player_id_t)
DEFINE_INTERFACE_METHOD("GetOwner", ICmpOwnership, GetOwner)
DEFINE_INTERFACE_METHOD("SetOwner", ICmpOwnership, SetOwner)
DEFINE_INTERFACE_METHOD("SetOwnerQuiet", ICmpOwnership, SetOwnerQuiet)
END_INTERFACE_WRAPPER(Ownership)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,8 +22,8 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(Pathfinder)
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpPathfinder, SetDebugOverlay, bool)
DEFINE_INTERFACE_METHOD_1("SetHierDebugOverlay", void, ICmpPathfinder, SetHierDebugOverlay, bool)
DEFINE_INTERFACE_METHOD_CONST_1("GetPassabilityClass", pass_class_t, ICmpPathfinder, GetPassabilityClass, std::string)
DEFINE_INTERFACE_METHOD_0("UpdateGrid", void, ICmpPathfinder, UpdateGrid)
DEFINE_INTERFACE_METHOD("SetDebugOverlay", ICmpPathfinder, SetDebugOverlay)
DEFINE_INTERFACE_METHOD("SetHierDebugOverlay", ICmpPathfinder, SetHierDebugOverlay)
DEFINE_INTERFACE_METHOD("GetPassabilityClass", ICmpPathfinder, GetPassabilityClass)
DEFINE_INTERFACE_METHOD("UpdateGrid", ICmpPathfinder, UpdateGrid)
END_INTERFACE_WRAPPER(Pathfinder)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,30 +22,30 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(Position)
DEFINE_INTERFACE_METHOD_2("SetTurretParent", void, ICmpPosition, SetTurretParent, entity_id_t, CFixedVector3D)
DEFINE_INTERFACE_METHOD_CONST_0("GetTurretParent", entity_id_t, ICmpPosition, GetTurretParent)
DEFINE_INTERFACE_METHOD_CONST_0("IsInWorld", bool, ICmpPosition, IsInWorld)
DEFINE_INTERFACE_METHOD_0("MoveOutOfWorld", void, ICmpPosition, MoveOutOfWorld)
DEFINE_INTERFACE_METHOD_2("MoveTo", void, ICmpPosition, MoveTo, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_3("MoveAndTurnTo", void, ICmpPosition, MoveAndTurnTo, entity_pos_t, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_2("JumpTo", void, ICmpPosition, JumpTo, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_1("SetHeightOffset", void, ICmpPosition, SetHeightOffset, entity_pos_t)
DEFINE_INTERFACE_METHOD_CONST_0("GetHeightOffset", entity_pos_t, ICmpPosition, GetHeightOffset)
DEFINE_INTERFACE_METHOD_1("SetHeightFixed", void, ICmpPosition, SetHeightFixed, entity_pos_t)
DEFINE_INTERFACE_METHOD_CONST_2("GetHeightAt", entity_pos_t, ICmpPosition, GetHeightAtFixed, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_CONST_0("IsHeightRelative", bool, ICmpPosition, IsHeightRelative)
DEFINE_INTERFACE_METHOD_1("SetHeightRelative", void, ICmpPosition, SetHeightRelative, bool)
DEFINE_INTERFACE_METHOD_CONST_0("CanFloat", bool, ICmpPosition, CanFloat)
DEFINE_INTERFACE_METHOD_1("SetFloating", void, ICmpPosition, SetFloating, bool)
DEFINE_INTERFACE_METHOD_1("SetConstructionProgress", void, ICmpPosition, SetConstructionProgress, fixed)
DEFINE_INTERFACE_METHOD_CONST_0("GetPosition", CFixedVector3D, ICmpPosition, GetPosition)
DEFINE_INTERFACE_METHOD_CONST_0("GetPosition2D", CFixedVector2D, ICmpPosition, GetPosition2D)
DEFINE_INTERFACE_METHOD_CONST_0("GetPreviousPosition", CFixedVector3D, ICmpPosition, GetPreviousPosition)
DEFINE_INTERFACE_METHOD_CONST_0("GetPreviousPosition2D", CFixedVector2D, ICmpPosition, GetPreviousPosition2D)
DEFINE_INTERFACE_METHOD_CONST_0("GetTurnRate", fixed, ICmpPosition, GetTurnRate)
DEFINE_INTERFACE_METHOD_1("TurnTo", void, ICmpPosition, TurnTo, entity_angle_t)
DEFINE_INTERFACE_METHOD_1("SetYRotation", void, ICmpPosition, SetYRotation, entity_angle_t)
DEFINE_INTERFACE_METHOD_2("SetXZRotation", void, ICmpPosition, SetXZRotation, entity_angle_t, entity_angle_t)
DEFINE_INTERFACE_METHOD_CONST_0("GetRotation", CFixedVector3D, ICmpPosition, GetRotation)
DEFINE_INTERFACE_METHOD("SetTurretParent", ICmpPosition, SetTurretParent)
DEFINE_INTERFACE_METHOD("GetTurretParent", ICmpPosition, GetTurretParent)
DEFINE_INTERFACE_METHOD("IsInWorld", ICmpPosition, IsInWorld)
DEFINE_INTERFACE_METHOD("MoveOutOfWorld", ICmpPosition, MoveOutOfWorld)
DEFINE_INTERFACE_METHOD("MoveTo", ICmpPosition, MoveTo)
DEFINE_INTERFACE_METHOD("MoveAndTurnTo", ICmpPosition, MoveAndTurnTo)
DEFINE_INTERFACE_METHOD("JumpTo", ICmpPosition, JumpTo)
DEFINE_INTERFACE_METHOD("SetHeightOffset", ICmpPosition, SetHeightOffset)
DEFINE_INTERFACE_METHOD("GetHeightOffset", ICmpPosition, GetHeightOffset)
DEFINE_INTERFACE_METHOD("SetHeightFixed", ICmpPosition, SetHeightFixed)
DEFINE_INTERFACE_METHOD("GetHeightAt", ICmpPosition, GetHeightAtFixed)
DEFINE_INTERFACE_METHOD("IsHeightRelative", ICmpPosition, IsHeightRelative)
DEFINE_INTERFACE_METHOD("SetHeightRelative", ICmpPosition, SetHeightRelative)
DEFINE_INTERFACE_METHOD("CanFloat", ICmpPosition, CanFloat)
DEFINE_INTERFACE_METHOD("SetFloating", ICmpPosition, SetFloating)
DEFINE_INTERFACE_METHOD("SetConstructionProgress", ICmpPosition, SetConstructionProgress)
DEFINE_INTERFACE_METHOD("GetPosition", ICmpPosition, GetPosition)
DEFINE_INTERFACE_METHOD("GetPosition2D", ICmpPosition, GetPosition2D)
DEFINE_INTERFACE_METHOD("GetPreviousPosition", ICmpPosition, GetPreviousPosition)
DEFINE_INTERFACE_METHOD("GetPreviousPosition2D", ICmpPosition, GetPreviousPosition2D)
DEFINE_INTERFACE_METHOD("GetTurnRate", ICmpPosition, GetTurnRate)
DEFINE_INTERFACE_METHOD("TurnTo", ICmpPosition, TurnTo)
DEFINE_INTERFACE_METHOD("SetYRotation", ICmpPosition, SetYRotation)
DEFINE_INTERFACE_METHOD("SetXZRotation", ICmpPosition, SetXZRotation)
DEFINE_INTERFACE_METHOD("GetRotation", ICmpPosition, GetRotation)
// Excluded: GetInterpolatedTransform (not safe for scripts)
END_INTERFACE_WRAPPER(Position)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,6 +22,6 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(ProjectileManager)
DEFINE_INTERFACE_METHOD_7("LaunchProjectileAtPoint", uint32_t, ICmpProjectileManager, LaunchProjectileAtPoint, CFixedVector3D, CFixedVector3D, fixed, fixed, std::wstring, std::wstring, fixed)
DEFINE_INTERFACE_METHOD_1("RemoveProjectile", void, ICmpProjectileManager, RemoveProjectile, uint32_t)
DEFINE_INTERFACE_METHOD("LaunchProjectileAtPoint", ICmpProjectileManager, LaunchProjectileAtPoint)
DEFINE_INTERFACE_METHOD("RemoveProjectile", ICmpProjectileManager, RemoveProjectile)
END_INTERFACE_WRAPPER(ProjectileManager)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -23,11 +23,11 @@
class CFixedVector2D;
BEGIN_INTERFACE_WRAPPER(RallyPointRenderer)
DEFINE_INTERFACE_METHOD_1("SetDisplayed", void, ICmpRallyPointRenderer, SetDisplayed, bool)
DEFINE_INTERFACE_METHOD_1("SetPosition", void, ICmpRallyPointRenderer, SetPosition, CFixedVector2D)
DEFINE_INTERFACE_METHOD_2("UpdatePosition", void, ICmpRallyPointRenderer, UpdatePosition, u32, CFixedVector2D)
DEFINE_INTERFACE_METHOD_1("AddPosition", void, ICmpRallyPointRenderer, AddPosition_wrapper, CFixedVector2D)
DEFINE_INTERFACE_METHOD_0("Reset", void, ICmpRallyPointRenderer, Reset)
DEFINE_INTERFACE_METHOD_CONST_0("IsSet", bool, ICmpRallyPointRenderer, IsSet)
DEFINE_INTERFACE_METHOD_0("UpdateColor", void, ICmpRallyPointRenderer, UpdateColor)
DEFINE_INTERFACE_METHOD("SetDisplayed", ICmpRallyPointRenderer, SetDisplayed)
DEFINE_INTERFACE_METHOD("SetPosition", ICmpRallyPointRenderer, SetPosition)
DEFINE_INTERFACE_METHOD("UpdatePosition", ICmpRallyPointRenderer, UpdatePosition)
DEFINE_INTERFACE_METHOD("AddPosition", ICmpRallyPointRenderer, AddPosition_wrapper)
DEFINE_INTERFACE_METHOD("Reset", ICmpRallyPointRenderer, Reset)
DEFINE_INTERFACE_METHOD("IsSet", ICmpRallyPointRenderer, IsSet)
DEFINE_INTERFACE_METHOD("UpdateColor", ICmpRallyPointRenderer, UpdateColor)
END_INTERFACE_WRAPPER(RallyPointRenderer)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -45,33 +45,33 @@ std::string ICmpRangeManager::GetLosVisibilityPosition_wrapper(entity_pos_t x, e
}
BEGIN_INTERFACE_WRAPPER(RangeManager)
DEFINE_INTERFACE_METHOD_6("ExecuteQuery", std::vector<entity_id_t>, ICmpRangeManager, ExecuteQuery, entity_id_t, entity_pos_t, entity_pos_t, std::vector<int>, int, bool)
DEFINE_INTERFACE_METHOD_6("ExecuteQueryAroundPos", std::vector<entity_id_t>, ICmpRangeManager, ExecuteQueryAroundPos, CFixedVector2D, entity_pos_t, entity_pos_t, std::vector<int>, int, bool)
DEFINE_INTERFACE_METHOD_7("CreateActiveQuery", ICmpRangeManager::tag_t, ICmpRangeManager, CreateActiveQuery, entity_id_t, entity_pos_t, entity_pos_t, std::vector<int>, int, u8, bool)
DEFINE_INTERFACE_METHOD_7("CreateActiveParabolicQuery", ICmpRangeManager::tag_t, ICmpRangeManager, CreateActiveParabolicQuery, entity_id_t, entity_pos_t, entity_pos_t, entity_pos_t, std::vector<int>, int, u8)
DEFINE_INTERFACE_METHOD_1("DestroyActiveQuery", void, ICmpRangeManager, DestroyActiveQuery, ICmpRangeManager::tag_t)
DEFINE_INTERFACE_METHOD_1("EnableActiveQuery", void, ICmpRangeManager, EnableActiveQuery, ICmpRangeManager::tag_t)
DEFINE_INTERFACE_METHOD_1("DisableActiveQuery", void, ICmpRangeManager, DisableActiveQuery, ICmpRangeManager::tag_t)
DEFINE_INTERFACE_METHOD_CONST_1("IsActiveQueryEnabled", bool, ICmpRangeManager, IsActiveQueryEnabled, ICmpRangeManager::tag_t)
DEFINE_INTERFACE_METHOD_1("ResetActiveQuery", std::vector<entity_id_t>, ICmpRangeManager, ResetActiveQuery, ICmpRangeManager::tag_t)
DEFINE_INTERFACE_METHOD_3("SetEntityFlag", void, ICmpRangeManager, SetEntityFlag, entity_id_t, std::string, bool)
DEFINE_INTERFACE_METHOD_CONST_1("GetEntityFlagMask", u8, ICmpRangeManager, GetEntityFlagMask, std::string)
DEFINE_INTERFACE_METHOD_CONST_1("GetEntitiesByPlayer", std::vector<entity_id_t>, ICmpRangeManager, GetEntitiesByPlayer, player_id_t)
DEFINE_INTERFACE_METHOD_CONST_0("GetNonGaiaEntities", std::vector<entity_id_t>, ICmpRangeManager, GetNonGaiaEntities)
DEFINE_INTERFACE_METHOD_CONST_0("GetGaiaAndNonGaiaEntities", std::vector<entity_id_t>, ICmpRangeManager, GetGaiaAndNonGaiaEntities)
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpRangeManager, SetDebugOverlay, bool)
DEFINE_INTERFACE_METHOD_1("ExploreMap", void, ICmpRangeManager, ExploreMap, player_id_t)
DEFINE_INTERFACE_METHOD_0("ExploreTerritories", void, ICmpRangeManager, ExploreTerritories)
DEFINE_INTERFACE_METHOD_2("SetLosRevealAll", void, ICmpRangeManager, SetLosRevealAll, player_id_t, bool)
DEFINE_INTERFACE_METHOD_CONST_1("GetLosRevealAll", bool, ICmpRangeManager, GetLosRevealAll, player_id_t)
DEFINE_INTERFACE_METHOD_CONST_5("GetElevationAdaptedRange", entity_pos_t, ICmpRangeManager, GetElevationAdaptedRange, CFixedVector3D, CFixedVector3D, entity_pos_t, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_2("ActivateScriptedVisibility", void, ICmpRangeManager, ActivateScriptedVisibility, entity_id_t, bool)
DEFINE_INTERFACE_METHOD_CONST_2("GetLosVisibility", std::string, ICmpRangeManager, GetLosVisibility_wrapper, entity_id_t, player_id_t)
DEFINE_INTERFACE_METHOD_CONST_3("GetLosVisibilityPosition", std::string, ICmpRangeManager, GetLosVisibilityPosition_wrapper, entity_pos_t, entity_pos_t, player_id_t)
DEFINE_INTERFACE_METHOD_1("RequestVisibilityUpdate", void, ICmpRangeManager, RequestVisibilityUpdate, entity_id_t)
DEFINE_INTERFACE_METHOD_1("SetLosCircular", void, ICmpRangeManager, SetLosCircular, bool)
DEFINE_INTERFACE_METHOD_CONST_0("GetLosCircular", bool, ICmpRangeManager, GetLosCircular)
DEFINE_INTERFACE_METHOD_2("SetSharedLos", void, ICmpRangeManager, SetSharedLos, player_id_t, std::vector<player_id_t>)
DEFINE_INTERFACE_METHOD_CONST_1("GetPercentMapExplored", u8, ICmpRangeManager, GetPercentMapExplored, player_id_t)
DEFINE_INTERFACE_METHOD_CONST_1("GetUnionPercentMapExplored", u8, ICmpRangeManager, GetUnionPercentMapExplored, std::vector<player_id_t>)
DEFINE_INTERFACE_METHOD("ExecuteQuery", ICmpRangeManager, ExecuteQuery)
DEFINE_INTERFACE_METHOD("ExecuteQueryAroundPos", ICmpRangeManager, ExecuteQueryAroundPos)
DEFINE_INTERFACE_METHOD("CreateActiveQuery", ICmpRangeManager, CreateActiveQuery)
DEFINE_INTERFACE_METHOD("CreateActiveParabolicQuery", ICmpRangeManager, CreateActiveParabolicQuery)
DEFINE_INTERFACE_METHOD("DestroyActiveQuery", ICmpRangeManager, DestroyActiveQuery)
DEFINE_INTERFACE_METHOD("EnableActiveQuery", ICmpRangeManager, EnableActiveQuery)
DEFINE_INTERFACE_METHOD("DisableActiveQuery", ICmpRangeManager, DisableActiveQuery)
DEFINE_INTERFACE_METHOD("IsActiveQueryEnabled", ICmpRangeManager, IsActiveQueryEnabled)
DEFINE_INTERFACE_METHOD("ResetActiveQuery", ICmpRangeManager, ResetActiveQuery)
DEFINE_INTERFACE_METHOD("SetEntityFlag", ICmpRangeManager, SetEntityFlag)
DEFINE_INTERFACE_METHOD("GetEntityFlagMask", ICmpRangeManager, GetEntityFlagMask)
DEFINE_INTERFACE_METHOD("GetEntitiesByPlayer", ICmpRangeManager, GetEntitiesByPlayer)
DEFINE_INTERFACE_METHOD("GetNonGaiaEntities", ICmpRangeManager, GetNonGaiaEntities)
DEFINE_INTERFACE_METHOD("GetGaiaAndNonGaiaEntities", ICmpRangeManager, GetGaiaAndNonGaiaEntities)
DEFINE_INTERFACE_METHOD("SetDebugOverlay", ICmpRangeManager, SetDebugOverlay)
DEFINE_INTERFACE_METHOD("ExploreMap", ICmpRangeManager, ExploreMap)
DEFINE_INTERFACE_METHOD("ExploreTerritories", ICmpRangeManager, ExploreTerritories)
DEFINE_INTERFACE_METHOD("SetLosRevealAll", ICmpRangeManager, SetLosRevealAll)
DEFINE_INTERFACE_METHOD("GetLosRevealAll", ICmpRangeManager, GetLosRevealAll)
DEFINE_INTERFACE_METHOD("GetElevationAdaptedRange", ICmpRangeManager, GetElevationAdaptedRange)
DEFINE_INTERFACE_METHOD("ActivateScriptedVisibility", ICmpRangeManager, ActivateScriptedVisibility)
DEFINE_INTERFACE_METHOD("GetLosVisibility", ICmpRangeManager, GetLosVisibility_wrapper)
DEFINE_INTERFACE_METHOD("GetLosVisibilityPosition", ICmpRangeManager, GetLosVisibilityPosition_wrapper)
DEFINE_INTERFACE_METHOD("RequestVisibilityUpdate", ICmpRangeManager, RequestVisibilityUpdate)
DEFINE_INTERFACE_METHOD("SetLosCircular", ICmpRangeManager, SetLosCircular)
DEFINE_INTERFACE_METHOD("GetLosCircular", ICmpRangeManager, GetLosCircular)
DEFINE_INTERFACE_METHOD("SetSharedLos", ICmpRangeManager, SetSharedLos)
DEFINE_INTERFACE_METHOD("GetPercentMapExplored", ICmpRangeManager, GetPercentMapExplored)
DEFINE_INTERFACE_METHOD("GetUnionPercentMapExplored", ICmpRangeManager, GetUnionPercentMapExplored)
END_INTERFACE_WRAPPER(RangeManager)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -21,7 +21,7 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(RangeOverlayRenderer)
DEFINE_INTERFACE_METHOD_4("AddRangeOverlay", void, ICmpRangeOverlayRenderer, AddRangeOverlay, float, std::string, std::string, float)
DEFINE_INTERFACE_METHOD_0("ResetRangeOverlays", void, ICmpRangeOverlayRenderer, ResetRangeOverlays)
DEFINE_INTERFACE_METHOD_0("UpdateColor", void, ICmpRangeOverlayRenderer, UpdateColor)
DEFINE_INTERFACE_METHOD("AddRangeOverlay", ICmpRangeOverlayRenderer, AddRangeOverlay)
DEFINE_INTERFACE_METHOD("ResetRangeOverlays", ICmpRangeOverlayRenderer, ResetRangeOverlays)
DEFINE_INTERFACE_METHOD("UpdateColor", ICmpRangeOverlayRenderer, UpdateColor)
END_INTERFACE_WRAPPER(RangeOverlayRenderer)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2019 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -24,8 +24,8 @@
#include "graphics/Color.h"
BEGIN_INTERFACE_WRAPPER(Selectable)
DEFINE_INTERFACE_METHOD_2("SetSelectionHighlight", void, ICmpSelectable, SetSelectionHighlight, CColor, bool)
DEFINE_INTERFACE_METHOD_0("UpdateColor", void, ICmpSelectable, UpdateColor)
DEFINE_INTERFACE_METHOD("SetSelectionHighlight", ICmpSelectable, SetSelectionHighlight)
DEFINE_INTERFACE_METHOD("UpdateColor", ICmpSelectable, UpdateColor)
END_INTERFACE_WRAPPER(Selectable)
bool ICmpSelectable::ms_EnableDebugOverlays = false;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,8 +22,8 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(SoundManager)
DEFINE_INTERFACE_METHOD_2("PlaySoundGroup", void, ICmpSoundManager, PlaySoundGroup, std::wstring, entity_id_t)
DEFINE_INTERFACE_METHOD_2("PlaySoundGroupAtPosition", void, ICmpSoundManager, PlaySoundGroupAtPosition, std::wstring, CFixedVector3D)
DEFINE_INTERFACE_METHOD_CONST_2("PlaySoundGroupForPlayer", void, ICmpSoundManager, PlaySoundGroupForPlayer, VfsPath, player_id_t)
DEFINE_INTERFACE_METHOD_0("StopMusic", void, ICmpSoundManager, StopMusic)
DEFINE_INTERFACE_METHOD("PlaySoundGroup", ICmpSoundManager, PlaySoundGroup)
DEFINE_INTERFACE_METHOD("PlaySoundGroupAtPosition", ICmpSoundManager, PlaySoundGroupAtPosition)
DEFINE_INTERFACE_METHOD("PlaySoundGroupForPlayer", ICmpSoundManager, PlaySoundGroupForPlayer)
DEFINE_INTERFACE_METHOD("StopMusic", ICmpSoundManager, StopMusic)
END_INTERFACE_WRAPPER(SoundManager)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,10 +22,10 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(TemplateManager)
DEFINE_INTERFACE_METHOD_1("GetTemplate", const CParamNode*, ICmpTemplateManager, GetTemplate, std::string)
DEFINE_INTERFACE_METHOD_1("GetTemplateWithoutValidation", const CParamNode*, ICmpTemplateManager, GetTemplateWithoutValidation, std::string)
DEFINE_INTERFACE_METHOD_CONST_1("TemplateExists", bool, ICmpTemplateManager, TemplateExists, std::string)
DEFINE_INTERFACE_METHOD_CONST_1("GetCurrentTemplateName", std::string, ICmpTemplateManager, GetCurrentTemplateName, entity_id_t)
DEFINE_INTERFACE_METHOD_CONST_1("FindAllTemplates", std::vector<std::string>, ICmpTemplateManager, FindAllTemplates, bool)
DEFINE_INTERFACE_METHOD_CONST_1("GetEntitiesUsingTemplate", std::vector<entity_id_t>, ICmpTemplateManager, GetEntitiesUsingTemplate, std::string)
DEFINE_INTERFACE_METHOD("GetTemplate", ICmpTemplateManager, GetTemplate)
DEFINE_INTERFACE_METHOD("GetTemplateWithoutValidation", ICmpTemplateManager, GetTemplateWithoutValidation)
DEFINE_INTERFACE_METHOD("TemplateExists", ICmpTemplateManager, TemplateExists)
DEFINE_INTERFACE_METHOD("GetCurrentTemplateName", ICmpTemplateManager, GetCurrentTemplateName)
DEFINE_INTERFACE_METHOD("FindAllTemplates", ICmpTemplateManager, FindAllTemplates)
DEFINE_INTERFACE_METHOD("GetEntitiesUsingTemplate", ICmpTemplateManager, GetEntitiesUsingTemplate)
END_INTERFACE_WRAPPER(TemplateManager)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,8 +22,8 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(Terrain)
DEFINE_INTERFACE_METHOD_CONST_2("GetGroundLevel", entity_pos_t, ICmpTerrain, GetGroundLevel, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_CONST_2("CalcNormal", CFixedVector3D, ICmpTerrain, CalcNormal, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_CONST_0("GetTilesPerSide", u16, ICmpTerrain, GetTilesPerSide)
DEFINE_INTERFACE_METHOD_CONST_0("GetMapSize", u32, ICmpTerrain, GetMapSize)
DEFINE_INTERFACE_METHOD("GetGroundLevel", ICmpTerrain, GetGroundLevel)
DEFINE_INTERFACE_METHOD("CalcNormal", ICmpTerrain, CalcNormal)
DEFINE_INTERFACE_METHOD("GetTilesPerSide", ICmpTerrain, GetTilesPerSide)
DEFINE_INTERFACE_METHOD("GetMapSize", ICmpTerrain, GetMapSize)
END_INTERFACE_WRAPPER(Terrain)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2018 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,11 +22,11 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(TerritoryManager)
DEFINE_INTERFACE_METHOD_2("GetOwner", player_id_t, ICmpTerritoryManager, GetOwner, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_3("GetNeighbours", std::vector<u32>, ICmpTerritoryManager, GetNeighbours, entity_pos_t, entity_pos_t, bool)
DEFINE_INTERFACE_METHOD_2("IsConnected", bool, ICmpTerritoryManager, IsConnected, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_3("SetTerritoryBlinking", void, ICmpTerritoryManager, SetTerritoryBlinking, entity_pos_t, entity_pos_t, bool)
DEFINE_INTERFACE_METHOD_2("IsTerritoryBlinking", bool, ICmpTerritoryManager, IsTerritoryBlinking, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_1("GetTerritoryPercentage", u8, ICmpTerritoryManager, GetTerritoryPercentage, player_id_t)
DEFINE_INTERFACE_METHOD_0("UpdateColors", void, ICmpTerritoryManager, UpdateColors)
DEFINE_INTERFACE_METHOD("GetOwner", ICmpTerritoryManager, GetOwner)
DEFINE_INTERFACE_METHOD("GetNeighbours", ICmpTerritoryManager, GetNeighbours)
DEFINE_INTERFACE_METHOD("IsConnected", ICmpTerritoryManager, IsConnected)
DEFINE_INTERFACE_METHOD("SetTerritoryBlinking", ICmpTerritoryManager, SetTerritoryBlinking)
DEFINE_INTERFACE_METHOD("IsTerritoryBlinking", ICmpTerritoryManager, IsTerritoryBlinking)
DEFINE_INTERFACE_METHOD("GetTerritoryPercentage", ICmpTerritoryManager, GetTerritoryPercentage)
DEFINE_INTERFACE_METHOD("UpdateColors", ICmpTerritoryManager, UpdateColors)
END_INTERFACE_WRAPPER(TerritoryManager)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2010 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -25,5 +25,5 @@ BEGIN_INTERFACE_WRAPPER(Test1)
END_INTERFACE_WRAPPER(Test1)
BEGIN_INTERFACE_WRAPPER(Test2)
DEFINE_INTERFACE_METHOD_0("GetX", int, ICmpTest2, GetX)
DEFINE_INTERFACE_METHOD("GetX", ICmpTest2, GetX)
END_INTERFACE_WRAPPER(Test2)

View File

@ -23,24 +23,24 @@
#include "simulation2/scripting/ScriptComponent.h"
BEGIN_INTERFACE_WRAPPER(UnitMotion)
DEFINE_INTERFACE_METHOD_4("MoveToPointRange", bool, ICmpUnitMotion, MoveToPointRange, entity_pos_t, entity_pos_t, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_3("MoveToTargetRange", bool, ICmpUnitMotion, MoveToTargetRange, entity_id_t, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_3("MoveToFormationOffset", void, ICmpUnitMotion, MoveToFormationOffset, entity_id_t, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_3("IsTargetRangeReachable", bool, ICmpUnitMotion, IsTargetRangeReachable, entity_id_t, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_2("FaceTowardsPoint", void, ICmpUnitMotion, FaceTowardsPoint, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD_0("StopMoving", void, ICmpUnitMotion, StopMoving)
DEFINE_INTERFACE_METHOD_CONST_0("GetCurrentSpeed", fixed, ICmpUnitMotion, GetCurrentSpeed)
DEFINE_INTERFACE_METHOD_CONST_0("IsMoveRequested", bool, ICmpUnitMotion, IsMoveRequested)
DEFINE_INTERFACE_METHOD_CONST_0("GetSpeed", fixed, ICmpUnitMotion, GetSpeed)
DEFINE_INTERFACE_METHOD_CONST_0("GetWalkSpeed", fixed, ICmpUnitMotion, GetWalkSpeed)
DEFINE_INTERFACE_METHOD_CONST_0("GetRunMultiplier", fixed, ICmpUnitMotion, GetRunMultiplier)
DEFINE_INTERFACE_METHOD_CONST_1("EstimateFuturePosition", CFixedVector2D, ICmpUnitMotion, EstimateFuturePosition, fixed)
DEFINE_INTERFACE_METHOD_1("SetSpeedMultiplier", void, ICmpUnitMotion, SetSpeedMultiplier, fixed)
DEFINE_INTERFACE_METHOD_CONST_0("GetPassabilityClassName", std::string, ICmpUnitMotion, GetPassabilityClassName)
DEFINE_INTERFACE_METHOD_CONST_0("GetUnitClearance", entity_pos_t, ICmpUnitMotion, GetUnitClearance)
DEFINE_INTERFACE_METHOD_1("SetFacePointAfterMove", void, ICmpUnitMotion, SetFacePointAfterMove, bool)
DEFINE_INTERFACE_METHOD_CONST_0("GetFacePointAfterMove", bool, ICmpUnitMotion, GetFacePointAfterMove)
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpUnitMotion, SetDebugOverlay, bool)
DEFINE_INTERFACE_METHOD("MoveToPointRange", ICmpUnitMotion, MoveToPointRange)
DEFINE_INTERFACE_METHOD("MoveToTargetRange", ICmpUnitMotion, MoveToTargetRange)
DEFINE_INTERFACE_METHOD("MoveToFormationOffset", ICmpUnitMotion, MoveToFormationOffset)
DEFINE_INTERFACE_METHOD("IsTargetRangeReachable", ICmpUnitMotion, IsTargetRangeReachable)
DEFINE_INTERFACE_METHOD("FaceTowardsPoint", ICmpUnitMotion, FaceTowardsPoint)
DEFINE_INTERFACE_METHOD("StopMoving", ICmpUnitMotion, StopMoving)
DEFINE_INTERFACE_METHOD("GetCurrentSpeed", ICmpUnitMotion, GetCurrentSpeed)
DEFINE_INTERFACE_METHOD("IsMoveRequested", ICmpUnitMotion, IsMoveRequested)
DEFINE_INTERFACE_METHOD("GetSpeed", ICmpUnitMotion, GetSpeed)
DEFINE_INTERFACE_METHOD("GetWalkSpeed", ICmpUnitMotion, GetWalkSpeed)
DEFINE_INTERFACE_METHOD("GetRunMultiplier", ICmpUnitMotion, GetRunMultiplier)
DEFINE_INTERFACE_METHOD("EstimateFuturePosition", ICmpUnitMotion, EstimateFuturePosition)
DEFINE_INTERFACE_METHOD("SetSpeedMultiplier", ICmpUnitMotion, SetSpeedMultiplier)
DEFINE_INTERFACE_METHOD("GetPassabilityClassName", ICmpUnitMotion, GetPassabilityClassName)
DEFINE_INTERFACE_METHOD("GetUnitClearance", ICmpUnitMotion, GetUnitClearance)
DEFINE_INTERFACE_METHOD("SetFacePointAfterMove", ICmpUnitMotion, SetFacePointAfterMove)
DEFINE_INTERFACE_METHOD("GetFacePointAfterMove", ICmpUnitMotion, GetFacePointAfterMove)
DEFINE_INTERFACE_METHOD("SetDebugOverlay", ICmpUnitMotion, SetDebugOverlay)
END_INTERFACE_WRAPPER(UnitMotion)
class CCmpUnitMotionScripted : public ICmpUnitMotion

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2014 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,5 +22,5 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(UnitRenderer)
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpUnitRenderer, SetDebugOverlay, bool)
DEFINE_INTERFACE_METHOD("SetDebugOverlay", ICmpUnitRenderer, SetDebugOverlay)
END_INTERFACE_WRAPPER(UnitRenderer)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,5 +22,5 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(Vision)
DEFINE_INTERFACE_METHOD_CONST_0("GetRange", entity_pos_t, ICmpVision, GetRange)
DEFINE_INTERFACE_METHOD("GetRange", ICmpVision, GetRange)
END_INTERFACE_WRAPPER(Vision)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2020 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,17 +22,17 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(Visual)
DEFINE_INTERFACE_METHOD_2("SetVariant", void, ICmpVisual, SetVariant, CStr, CStr)
DEFINE_INTERFACE_METHOD_CONST_0("GetAnimationName", std::string, ICmpVisual, GetAnimationName)
DEFINE_INTERFACE_METHOD_CONST_0("GetProjectileActor", std::wstring, ICmpVisual, GetProjectileActor)
DEFINE_INTERFACE_METHOD_CONST_0("GetProjectileLaunchPoint", CFixedVector3D, ICmpVisual, GetProjectileLaunchPoint)
DEFINE_INTERFACE_METHOD_3("SelectAnimation", void, ICmpVisual, SelectAnimation, std::string, bool, fixed)
DEFINE_INTERFACE_METHOD_1("SetAnimationSyncRepeat", void, ICmpVisual, SetAnimationSyncRepeat, fixed)
DEFINE_INTERFACE_METHOD_1("SetAnimationSyncOffset", void, ICmpVisual, SetAnimationSyncOffset, fixed)
DEFINE_INTERFACE_METHOD_4("SetShadingColor", void, ICmpVisual, SetShadingColor, fixed, fixed, fixed, fixed)
DEFINE_INTERFACE_METHOD_2("SetVariable", void, ICmpVisual, SetVariable, std::string, float)
DEFINE_INTERFACE_METHOD_CONST_0("GetActorSeed", u32, ICmpVisual, GetActorSeed)
DEFINE_INTERFACE_METHOD_1("SetActorSeed", void, ICmpVisual, SetActorSeed, u32)
DEFINE_INTERFACE_METHOD_0("RecomputeActorName", void, ICmpVisual, RecomputeActorName)
DEFINE_INTERFACE_METHOD_CONST_0("HasConstructionPreview", bool, ICmpVisual, HasConstructionPreview)
DEFINE_INTERFACE_METHOD("SetVariant", ICmpVisual, SetVariant)
DEFINE_INTERFACE_METHOD("GetAnimationName", ICmpVisual, GetAnimationName)
DEFINE_INTERFACE_METHOD("GetProjectileActor", ICmpVisual, GetProjectileActor)
DEFINE_INTERFACE_METHOD("GetProjectileLaunchPoint", ICmpVisual, GetProjectileLaunchPoint)
DEFINE_INTERFACE_METHOD("SelectAnimation", ICmpVisual, SelectAnimation)
DEFINE_INTERFACE_METHOD("SetAnimationSyncRepeat", ICmpVisual, SetAnimationSyncRepeat)
DEFINE_INTERFACE_METHOD("SetAnimationSyncOffset", ICmpVisual, SetAnimationSyncOffset)
DEFINE_INTERFACE_METHOD("SetShadingColor", ICmpVisual, SetShadingColor)
DEFINE_INTERFACE_METHOD("SetVariable", ICmpVisual, SetVariable)
DEFINE_INTERFACE_METHOD("GetActorSeed", ICmpVisual, GetActorSeed)
DEFINE_INTERFACE_METHOD("SetActorSeed", ICmpVisual, SetActorSeed)
DEFINE_INTERFACE_METHOD("RecomputeActorName", ICmpVisual, RecomputeActorName)
DEFINE_INTERFACE_METHOD("HasConstructionPreview", ICmpVisual, HasConstructionPreview)
END_INTERFACE_WRAPPER(Visual)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -22,7 +22,7 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(WaterManager)
DEFINE_INTERFACE_METHOD_0("RecomputeWaterData", void, ICmpWaterManager, RecomputeWaterData)
DEFINE_INTERFACE_METHOD_1("SetWaterLevel", void, ICmpWaterManager, SetWaterLevel, entity_pos_t)
DEFINE_INTERFACE_METHOD_CONST_2("GetWaterLevel", entity_pos_t, ICmpWaterManager, GetWaterLevel, entity_pos_t, entity_pos_t)
DEFINE_INTERFACE_METHOD("RecomputeWaterData", ICmpWaterManager, RecomputeWaterData)
DEFINE_INTERFACE_METHOD("SetWaterLevel", ICmpWaterManager, SetWaterLevel)
DEFINE_INTERFACE_METHOD("GetWaterLevel", ICmpWaterManager, GetWaterLevel)
END_INTERFACE_WRAPPER(WaterManager)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* ...the usual copyright header...
*/
@ -9,6 +9,6 @@
#include "simulation2/system/InterfaceScripted.h"
BEGIN_INTERFACE_WRAPPER(Example)
DEFINE_INTERFACE_METHOD_2("DoWhatever", int, ICmpExample, DoWhatever, int, int)
DEFINE_INTERFACE_METHOD("DoWhatever", ICmpExample, DoWhatever)
// DEFINE_INTERFACE_METHOD for all the other methods too
END_INTERFACE_WRAPPER(Example)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2017 Wildfire Games.
/* Copyright (C) 2021 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@ -18,6 +18,7 @@
#ifndef INCLUDED_INTERFACE_SCRIPTED
#define INCLUDED_INTERFACE_SCRIPTED
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/ScriptInterface.h"
#define BEGIN_INTERFACE_WRAPPER(iname) \
@ -41,53 +42,13 @@
ICmp##iname::InterfaceInit(scriptInterface); \
}
#define DEFINE_INTERFACE_METHOD_0(scriptname, rettype, classname, methodname) \
JS_FN(scriptname, (ScriptInterface::callMethod<rettype, &class_##classname, classname, &classname::methodname>), 0, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
template <typename T, JSClass* jsClass>
inline T* ComponentGetter(const ScriptRequest& rq, JS::CallArgs& args)
{
return ScriptInterface::GetPrivate<T>(rq, args, jsClass);
}
#define DEFINE_INTERFACE_METHOD_1(scriptname, rettype, classname, methodname, arg1) \
JS_FN(scriptname, (ScriptInterface::callMethod<rettype, arg1, &class_##classname, classname, &classname::methodname>), 1, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_2(scriptname, rettype, classname, methodname, arg1, arg2) \
JS_FN(scriptname, (ScriptInterface::callMethod<rettype, arg1, arg2, &class_##classname, classname, &classname::methodname>), 2, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_3(scriptname, rettype, classname, methodname, arg1, arg2, arg3) \
JS_FN(scriptname, (ScriptInterface::callMethod<rettype, arg1, arg2, arg3, &class_##classname, classname, &classname::methodname>), 3, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_4(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4) \
JS_FN(scriptname, (ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, &class_##classname, classname, &classname::methodname>), 4, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_5(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5) \
JS_FN(scriptname, (ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, arg5, &class_##classname, classname, &classname::methodname>), 5, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_6(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5, arg6) \
JS_FN(scriptname, (ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, arg5, arg6, &class_##classname, classname, &classname::methodname>), 6, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_7(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
JS_FN(scriptname, (ScriptInterface::callMethod<rettype, arg1, arg2, arg3, arg4, arg5, arg6, arg7, &class_##classname, classname, &classname::methodname>), 7, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
// const methods
#define DEFINE_INTERFACE_METHOD_CONST_0(scriptname, rettype, classname, methodname) \
JS_FN(scriptname, (ScriptInterface::callMethodConst<rettype, &class_##classname, classname, &classname::methodname>), 0, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_CONST_1(scriptname, rettype, classname, methodname, arg1) \
JS_FN(scriptname, (ScriptInterface::callMethodConst<rettype, arg1, &class_##classname, classname, &classname::methodname>), 1, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_CONST_2(scriptname, rettype, classname, methodname, arg1, arg2) \
JS_FN(scriptname, (ScriptInterface::callMethodConst<rettype, arg1, arg2, &class_##classname, classname, &classname::methodname>), 2, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_CONST_3(scriptname, rettype, classname, methodname, arg1, arg2, arg3) \
JS_FN(scriptname, (ScriptInterface::callMethodConst<rettype, arg1, arg2, arg3, &class_##classname, classname, &classname::methodname>), 3, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_CONST_4(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4) \
JS_FN(scriptname, (ScriptInterface::callMethodConst<rettype, arg1, arg2, arg3, arg4, &class_##classname, classname, &classname::methodname>), 4, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_CONST_5(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5) \
JS_FN(scriptname, (ScriptInterface::callMethodConst<rettype, arg1, arg2, arg3, arg4, arg5, &class_##classname, classname, &classname::methodname>), 5, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_CONST_6(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5, arg6) \
JS_FN(scriptname, (ScriptInterface::callMethodConst<rettype, arg1, arg2, arg3, arg4, arg5, arg6, &class_##classname, classname, &classname::methodname>), 6, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD_CONST_7(scriptname, rettype, classname, methodname, arg1, arg2, arg3, arg4, arg5, arg6, arg7) \
JS_FN(scriptname, (ScriptInterface::callMethodConst<rettype, arg1, arg2, arg3, arg4, arg5, arg6, arg7, &class_##classname, classname, &classname::methodname>), 7, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT),
#define DEFINE_INTERFACE_METHOD(scriptname, classname, methodname) \
ScriptFunction::Wrap<&classname::methodname, ComponentGetter<classname, &class_##classname>>(scriptname),
#endif // INCLUDED_INTERFACE_SCRIPTED