Line data Source code
1 : /* Copyright (C) 2021 Wildfire Games.
2 : * This file is part of 0 A.D.
3 : *
4 : * 0 A.D. is free software: you can redistribute it and/or modify
5 : * it under the terms of the GNU General Public License as published by
6 : * the Free Software Foundation, either version 2 of the License, or
7 : * (at your option) any later version.
8 : *
9 : * 0 A.D. is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 : * GNU General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU General Public License
15 : * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16 : */
17 :
18 : #include "precompiled.h"
19 :
20 : #include "ICmpObstruction.h"
21 :
22 : #include "simulation2/system/InterfaceScripted.h"
23 :
24 : #include "simulation2/system/SimContext.h"
25 :
26 0 : std::string ICmpObstruction::CheckFoundation_wrapper(const std::string& className, bool onlyCenterPoint) const
27 : {
28 0 : EFoundationCheck check = CheckFoundation(className, onlyCenterPoint);
29 :
30 0 : switch (check)
31 : {
32 0 : case FOUNDATION_CHECK_SUCCESS:
33 0 : return "success";
34 0 : case FOUNDATION_CHECK_FAIL_ERROR:
35 0 : return "fail_error";
36 0 : case FOUNDATION_CHECK_FAIL_NO_OBSTRUCTION:
37 0 : return "fail_no_obstruction";
38 0 : case FOUNDATION_CHECK_FAIL_OBSTRUCTS_FOUNDATION:
39 0 : return "fail_obstructs_foundation";
40 0 : case FOUNDATION_CHECK_FAIL_TERRAIN_CLASS:
41 0 : return "fail_terrain_class";
42 0 : default:
43 0 : debug_warn(L"Unexpected result from CheckFoundation");
44 0 : return "";
45 : }
46 : }
47 :
48 1 : BEGIN_INTERFACE_WRAPPER(Obstruction)
49 : DEFINE_INTERFACE_METHOD("GetSize", ICmpObstruction, GetSize)
50 : DEFINE_INTERFACE_METHOD("CheckShorePlacement", ICmpObstruction, CheckShorePlacement)
51 : DEFINE_INTERFACE_METHOD("CheckFoundation", ICmpObstruction, CheckFoundation_wrapper)
52 : DEFINE_INTERFACE_METHOD("CheckDuplicateFoundation", ICmpObstruction, CheckDuplicateFoundation)
53 : DEFINE_INTERFACE_METHOD("GetEntitiesBlockingMovement", ICmpObstruction, GetEntitiesBlockingMovement)
54 : DEFINE_INTERFACE_METHOD("GetEntitiesBlockingConstruction", ICmpObstruction, GetEntitiesBlockingConstruction)
55 : DEFINE_INTERFACE_METHOD("GetEntitiesDeletedUponConstruction", ICmpObstruction, GetEntitiesDeletedUponConstruction)
56 : DEFINE_INTERFACE_METHOD("SetActive", ICmpObstruction, SetActive)
57 : DEFINE_INTERFACE_METHOD("SetDisableBlockMovementPathfinding", ICmpObstruction, SetDisableBlockMovementPathfinding)
58 : DEFINE_INTERFACE_METHOD("GetBlockMovementFlag", ICmpObstruction, GetBlockMovementFlag)
59 : DEFINE_INTERFACE_METHOD("SetControlGroup", ICmpObstruction, SetControlGroup)
60 : DEFINE_INTERFACE_METHOD("GetControlGroup", ICmpObstruction, GetControlGroup)
61 : DEFINE_INTERFACE_METHOD("SetControlGroup2", ICmpObstruction, SetControlGroup2)
62 : DEFINE_INTERFACE_METHOD("GetControlGroup2", ICmpObstruction, GetControlGroup2)
63 235 : END_INTERFACE_WRAPPER(Obstruction)
|