2026-01-12 05:51:15 -08:00
|
|
|
/* Copyright (C) 2026 Wildfire Games.
|
2023-12-02 16:30:12 -08:00
|
|
|
* This file is part of 0 A.D.
|
2010-07-29 13:39:23 -07:00
|
|
|
*
|
2023-12-02 16:30:12 -08:00
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
2010-07-29 13:39:23 -07:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
2023-12-02 16:30:12 -08:00
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
2010-07-29 13:39:23 -07:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2023-12-02 16:30:12 -08:00
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
2010-07-29 13:39:23 -07:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "precompiled.h"
|
|
|
|
|
|
|
|
|
|
#include "ICmpRangeManager.h"
|
|
|
|
|
|
|
|
|
|
#include "simulation2/system/InterfaceScripted.h"
|
|
|
|
|
|
2019-09-01 07:10:02 -07:00
|
|
|
namespace {
|
2020-06-13 02:05:40 -07:00
|
|
|
std::string VisibilityToString(LosVisibility visibility)
|
2010-10-04 10:34:33 -07:00
|
|
|
{
|
2019-09-01 07:10:02 -07:00
|
|
|
switch (visibility)
|
|
|
|
|
{
|
2020-06-13 02:05:40 -07:00
|
|
|
case LosVisibility::HIDDEN: return "hidden";
|
|
|
|
|
case LosVisibility::FOGGED: return "fogged";
|
|
|
|
|
case LosVisibility::VISIBLE: return "visible";
|
2019-09-01 07:10:02 -07:00
|
|
|
default: return "error"; // should never happen
|
|
|
|
|
}
|
2010-10-04 10:34:33 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-01 07:10:02 -07:00
|
|
|
std::string ICmpRangeManager::GetLosVisibility_wrapper(entity_id_t ent, int player) const
|
|
|
|
|
{
|
|
|
|
|
return VisibilityToString(GetLosVisibility(ent, player));
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-01 00:35:32 -07:00
|
|
|
std::string ICmpRangeManager::GetLosVisibilityPosition_wrapper(entity_pos_t x, entity_pos_t z, int player) const
|
|
|
|
|
{
|
2019-09-01 07:10:02 -07:00
|
|
|
return VisibilityToString(GetLosVisibilityPosition(x, z, player));
|
2019-09-01 00:35:32 -07:00
|
|
|
}
|
|
|
|
|
|
2010-07-29 13:39:23 -07:00
|
|
|
BEGIN_INTERFACE_WRAPPER(RangeManager)
|
2021-05-01 01:01:30 -07:00
|
|
|
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)
|
2026-01-12 05:51:15 -08:00
|
|
|
DEFINE_INTERFACE_METHOD("SetLosRevealWholeMap", ICmpRangeManager, SetLosRevealWholeMap)
|
|
|
|
|
DEFINE_INTERFACE_METHOD("GetLosRevealWholeMap", ICmpRangeManager, GetLosRevealWholeMap)
|
2026-01-03 02:24:13 -08:00
|
|
|
DEFINE_INTERFACE_METHOD("SetLosRevealWholeMapForAll", ICmpRangeManager, SetLosRevealWholeMapForAll)
|
|
|
|
|
DEFINE_INTERFACE_METHOD("GetLosRevealWholeMapForAll", ICmpRangeManager, GetLosRevealWholeMapForAll)
|
2022-02-15 12:31:55 -08:00
|
|
|
DEFINE_INTERFACE_METHOD("GetEffectiveParabolicRange", ICmpRangeManager, GetEffectiveParabolicRange)
|
2021-05-01 01:01:30 -07:00
|
|
|
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)
|
2010-07-29 13:39:23 -07:00
|
|
|
END_INTERFACE_WRAPPER(RangeManager)
|