From 19b01dc7104b788d3386c51b0dedc081293b14dc Mon Sep 17 00:00:00 2001 From: wraitii Date: Sat, 1 May 2021 08:01:30 +0000 Subject: [PATCH] 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. --- source/pch/simulation2/precompiled.h | 1 - .../simulation2/components/ICmpAIManager.cpp | 8 +-- .../components/ICmpCinemaManager.cpp | 14 ++--- .../components/ICmpCommandQueue.cpp | 6 +- .../simulation2/components/ICmpFootprint.cpp | 8 +-- source/simulation2/components/ICmpMinimap.cpp | 4 +- .../components/ICmpObstruction.cpp | 28 ++++----- .../components/ICmpObstructionManager.cpp | 20 +++---- .../components/ICmpOverlayRenderer.cpp | 6 +- .../simulation2/components/ICmpOwnership.cpp | 8 +-- .../simulation2/components/ICmpPathfinder.cpp | 10 ++-- .../simulation2/components/ICmpPosition.cpp | 52 ++++++++-------- .../components/ICmpProjectileManager.cpp | 6 +- .../components/ICmpRallyPointRenderer.cpp | 16 ++--- .../components/ICmpRangeManager.cpp | 60 +++++++++---------- .../components/ICmpRangeOverlayRenderer.cpp | 8 +-- .../simulation2/components/ICmpSelectable.cpp | 6 +- .../components/ICmpSoundManager.cpp | 10 ++-- .../components/ICmpTemplateManager.cpp | 14 ++--- source/simulation2/components/ICmpTerrain.cpp | 10 ++-- .../components/ICmpTerritoryManager.cpp | 16 ++--- source/simulation2/components/ICmpTest.cpp | 4 +- .../simulation2/components/ICmpUnitMotion.cpp | 36 +++++------ .../components/ICmpUnitRenderer.cpp | 4 +- source/simulation2/components/ICmpVision.cpp | 4 +- source/simulation2/components/ICmpVisual.cpp | 28 ++++----- .../components/ICmpWaterManager.cpp | 8 +-- source/simulation2/docs/ICmpExample.cpp | 4 +- source/simulation2/system/InterfaceScripted.h | 57 +++--------------- 29 files changed, 208 insertions(+), 248 deletions(-) diff --git a/source/pch/simulation2/precompiled.h b/source/pch/simulation2/precompiled.h index 4f11431259..09a09baa31 100644 --- a/source/pch/simulation2/precompiled.h +++ b/source/pch/simulation2/precompiled.h @@ -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" diff --git a/source/simulation2/components/ICmpAIManager.cpp b/source/simulation2/components/ICmpAIManager.cpp index 3954d5355a..d598178bdb 100644 --- a/source/simulation2/components/ICmpAIManager.cpp +++ b/source/simulation2/components/ICmpAIManager.cpp @@ -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 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 diff --git a/source/simulation2/components/ICmpCinemaManager.cpp b/source/simulation2/components/ICmpCinemaManager.cpp index 95c117a93e..a111096e17 100644 --- a/source/simulation2/components/ICmpCinemaManager.cpp +++ b/source/simulation2/components/ICmpCinemaManager.cpp @@ -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) diff --git a/source/simulation2/components/ICmpCommandQueue.cpp b/source/simulation2/components/ICmpCommandQueue.cpp index 59e2ba2461..1637da66e7 100644 --- a/source/simulation2/components/ICmpCommandQueue.cpp +++ b/source/simulation2/components/ICmpCommandQueue.cpp @@ -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) diff --git a/source/simulation2/components/ICmpFootprint.cpp b/source/simulation2/components/ICmpFootprint.cpp index 41d1cd0333..2934cbe851 100644 --- a/source/simulation2/components/ICmpFootprint.cpp +++ b/source/simulation2/components/ICmpFootprint.cpp @@ -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) diff --git a/source/simulation2/components/ICmpMinimap.cpp b/source/simulation2/components/ICmpMinimap.cpp index 9a84762134..0b853b8dcc 100644 --- a/source/simulation2/components/ICmpMinimap.cpp +++ b/source/simulation2/components/ICmpMinimap.cpp @@ -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) diff --git a/source/simulation2/components/ICmpObstruction.cpp b/source/simulation2/components/ICmpObstruction.cpp index 406f6fe3c1..1a18def0fa 100644 --- a/source/simulation2/components/ICmpObstruction.cpp +++ b/source/simulation2/components/ICmpObstruction.cpp @@ -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, ICmpObstruction, GetEntitiesBlockingMovement) -DEFINE_INTERFACE_METHOD_CONST_0("GetEntitiesBlockingConstruction", std::vector, ICmpObstruction, GetEntitiesBlockingConstruction) -DEFINE_INTERFACE_METHOD_CONST_0("GetEntitiesDeletedUponConstruction", std::vector, 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) diff --git a/source/simulation2/components/ICmpObstructionManager.cpp b/source/simulation2/components/ICmpObstructionManager.cpp index ad9d281c0b..9a458758bf 100644 --- a/source/simulation2/components/ICmpObstructionManager.cpp +++ b/source/simulation2/components/ICmpObstructionManager.cpp @@ -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) diff --git a/source/simulation2/components/ICmpOverlayRenderer.cpp b/source/simulation2/components/ICmpOverlayRenderer.cpp index dc6c996432..21f5efd355 100644 --- a/source/simulation2/components/ICmpOverlayRenderer.cpp +++ b/source/simulation2/components/ICmpOverlayRenderer.cpp @@ -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; diff --git a/source/simulation2/components/ICmpOwnership.cpp b/source/simulation2/components/ICmpOwnership.cpp index debe2cb3a4..2c8c418247 100644 --- a/source/simulation2/components/ICmpOwnership.cpp +++ b/source/simulation2/components/ICmpOwnership.cpp @@ -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) diff --git a/source/simulation2/components/ICmpPathfinder.cpp b/source/simulation2/components/ICmpPathfinder.cpp index 43888c38ea..04212dee93 100644 --- a/source/simulation2/components/ICmpPathfinder.cpp +++ b/source/simulation2/components/ICmpPathfinder.cpp @@ -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) diff --git a/source/simulation2/components/ICmpPosition.cpp b/source/simulation2/components/ICmpPosition.cpp index 7523b606d7..23be3ad06d 100644 --- a/source/simulation2/components/ICmpPosition.cpp +++ b/source/simulation2/components/ICmpPosition.cpp @@ -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) diff --git a/source/simulation2/components/ICmpProjectileManager.cpp b/source/simulation2/components/ICmpProjectileManager.cpp index b598a46f83..48ffe7f4e2 100644 --- a/source/simulation2/components/ICmpProjectileManager.cpp +++ b/source/simulation2/components/ICmpProjectileManager.cpp @@ -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) diff --git a/source/simulation2/components/ICmpRallyPointRenderer.cpp b/source/simulation2/components/ICmpRallyPointRenderer.cpp index aaba61c3a3..4b487f3aca 100644 --- a/source/simulation2/components/ICmpRallyPointRenderer.cpp +++ b/source/simulation2/components/ICmpRallyPointRenderer.cpp @@ -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) diff --git a/source/simulation2/components/ICmpRangeManager.cpp b/source/simulation2/components/ICmpRangeManager.cpp index 290fd9e797..14daf2b665 100644 --- a/source/simulation2/components/ICmpRangeManager.cpp +++ b/source/simulation2/components/ICmpRangeManager.cpp @@ -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, ICmpRangeManager, ExecuteQuery, entity_id_t, entity_pos_t, entity_pos_t, std::vector, int, bool) -DEFINE_INTERFACE_METHOD_6("ExecuteQueryAroundPos", std::vector, ICmpRangeManager, ExecuteQueryAroundPos, CFixedVector2D, entity_pos_t, entity_pos_t, std::vector, int, bool) -DEFINE_INTERFACE_METHOD_7("CreateActiveQuery", ICmpRangeManager::tag_t, ICmpRangeManager, CreateActiveQuery, entity_id_t, entity_pos_t, entity_pos_t, std::vector, 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, 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, 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, ICmpRangeManager, GetEntitiesByPlayer, player_id_t) -DEFINE_INTERFACE_METHOD_CONST_0("GetNonGaiaEntities", std::vector, ICmpRangeManager, GetNonGaiaEntities) -DEFINE_INTERFACE_METHOD_CONST_0("GetGaiaAndNonGaiaEntities", std::vector, 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) -DEFINE_INTERFACE_METHOD_CONST_1("GetPercentMapExplored", u8, ICmpRangeManager, GetPercentMapExplored, player_id_t) -DEFINE_INTERFACE_METHOD_CONST_1("GetUnionPercentMapExplored", u8, ICmpRangeManager, GetUnionPercentMapExplored, std::vector) +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) diff --git a/source/simulation2/components/ICmpRangeOverlayRenderer.cpp b/source/simulation2/components/ICmpRangeOverlayRenderer.cpp index 50b13e6935..a942969f76 100644 --- a/source/simulation2/components/ICmpRangeOverlayRenderer.cpp +++ b/source/simulation2/components/ICmpRangeOverlayRenderer.cpp @@ -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) diff --git a/source/simulation2/components/ICmpSelectable.cpp b/source/simulation2/components/ICmpSelectable.cpp index 6bf6d808ff..f9b31c5c71 100644 --- a/source/simulation2/components/ICmpSelectable.cpp +++ b/source/simulation2/components/ICmpSelectable.cpp @@ -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; diff --git a/source/simulation2/components/ICmpSoundManager.cpp b/source/simulation2/components/ICmpSoundManager.cpp index 25a0f2c6f2..d3cede9377 100644 --- a/source/simulation2/components/ICmpSoundManager.cpp +++ b/source/simulation2/components/ICmpSoundManager.cpp @@ -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) diff --git a/source/simulation2/components/ICmpTemplateManager.cpp b/source/simulation2/components/ICmpTemplateManager.cpp index ffeb279002..fd35b08a7b 100644 --- a/source/simulation2/components/ICmpTemplateManager.cpp +++ b/source/simulation2/components/ICmpTemplateManager.cpp @@ -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, ICmpTemplateManager, FindAllTemplates, bool) -DEFINE_INTERFACE_METHOD_CONST_1("GetEntitiesUsingTemplate", std::vector, 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) diff --git a/source/simulation2/components/ICmpTerrain.cpp b/source/simulation2/components/ICmpTerrain.cpp index 4a13a7a688..0bca137fe2 100644 --- a/source/simulation2/components/ICmpTerrain.cpp +++ b/source/simulation2/components/ICmpTerrain.cpp @@ -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) diff --git a/source/simulation2/components/ICmpTerritoryManager.cpp b/source/simulation2/components/ICmpTerritoryManager.cpp index 232dbf5dd2..6a9d096eb0 100644 --- a/source/simulation2/components/ICmpTerritoryManager.cpp +++ b/source/simulation2/components/ICmpTerritoryManager.cpp @@ -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, 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) diff --git a/source/simulation2/components/ICmpTest.cpp b/source/simulation2/components/ICmpTest.cpp index f4e184a818..ba7fff7163 100644 --- a/source/simulation2/components/ICmpTest.cpp +++ b/source/simulation2/components/ICmpTest.cpp @@ -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) diff --git a/source/simulation2/components/ICmpUnitMotion.cpp b/source/simulation2/components/ICmpUnitMotion.cpp index 196a88d319..09068e7107 100644 --- a/source/simulation2/components/ICmpUnitMotion.cpp +++ b/source/simulation2/components/ICmpUnitMotion.cpp @@ -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 diff --git a/source/simulation2/components/ICmpUnitRenderer.cpp b/source/simulation2/components/ICmpUnitRenderer.cpp index c32e1b9557..235e3b790c 100644 --- a/source/simulation2/components/ICmpUnitRenderer.cpp +++ b/source/simulation2/components/ICmpUnitRenderer.cpp @@ -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) diff --git a/source/simulation2/components/ICmpVision.cpp b/source/simulation2/components/ICmpVision.cpp index 58bb98ad19..adec867f4f 100644 --- a/source/simulation2/components/ICmpVision.cpp +++ b/source/simulation2/components/ICmpVision.cpp @@ -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) diff --git a/source/simulation2/components/ICmpVisual.cpp b/source/simulation2/components/ICmpVisual.cpp index 911146e185..1fe389e1e3 100644 --- a/source/simulation2/components/ICmpVisual.cpp +++ b/source/simulation2/components/ICmpVisual.cpp @@ -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) diff --git a/source/simulation2/components/ICmpWaterManager.cpp b/source/simulation2/components/ICmpWaterManager.cpp index f97e7f65c6..4a6b98b36a 100644 --- a/source/simulation2/components/ICmpWaterManager.cpp +++ b/source/simulation2/components/ICmpWaterManager.cpp @@ -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) diff --git a/source/simulation2/docs/ICmpExample.cpp b/source/simulation2/docs/ICmpExample.cpp index aaeee710c3..df1538005a 100644 --- a/source/simulation2/docs/ICmpExample.cpp +++ b/source/simulation2/docs/ICmpExample.cpp @@ -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) diff --git a/source/simulation2/system/InterfaceScripted.h b/source/simulation2/system/InterfaceScripted.h index 81832d79f7..53df238326 100644 --- a/source/simulation2/system/InterfaceScripted.h +++ b/source/simulation2/system/InterfaceScripted.h @@ -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), 0, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT), +template +inline T* ComponentGetter(const ScriptRequest& rq, JS::CallArgs& args) +{ + return ScriptInterface::GetPrivate(rq, args, jsClass); +} -#define DEFINE_INTERFACE_METHOD_1(scriptname, rettype, classname, methodname, arg1) \ - JS_FN(scriptname, (ScriptInterface::callMethod), 1, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT), - -#define DEFINE_INTERFACE_METHOD_2(scriptname, rettype, classname, methodname, arg1, arg2) \ - JS_FN(scriptname, (ScriptInterface::callMethod), 2, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT), - -#define DEFINE_INTERFACE_METHOD_3(scriptname, rettype, classname, methodname, arg1, arg2, arg3) \ - JS_FN(scriptname, (ScriptInterface::callMethod), 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), 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), 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), 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), 7, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT), - -// const methods -#define DEFINE_INTERFACE_METHOD_CONST_0(scriptname, rettype, classname, methodname) \ - JS_FN(scriptname, (ScriptInterface::callMethodConst), 0, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT), - -#define DEFINE_INTERFACE_METHOD_CONST_1(scriptname, rettype, classname, methodname, arg1) \ - JS_FN(scriptname, (ScriptInterface::callMethodConst), 1, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT), - -#define DEFINE_INTERFACE_METHOD_CONST_2(scriptname, rettype, classname, methodname, arg1, arg2) \ - JS_FN(scriptname, (ScriptInterface::callMethodConst), 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), 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), 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), 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), 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), 7, JSPROP_ENUMERATE|JSPROP_READONLY|JSPROP_PERMANENT), +#define DEFINE_INTERFACE_METHOD(scriptname, classname, methodname) \ + ScriptFunction::Wrap<&classname::methodname, ComponentGetter>(scriptname), #endif // INCLUDED_INTERFACE_SCRIPTED