Index: ps/trunk/binaries/data/mods/public/simulation/components/TerritoryDecay.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/TerritoryDecay.js +++ ps/trunk/binaries/data/mods/public/simulation/components/TerritoryDecay.js @@ -131,7 +131,7 @@ this.UpdateDecayState(); }; -TerritoryDecay.prototype.OnTerritoryPositionChanged = function(msg) +TerritoryDecay.prototype.OnPositionChanged = function(msg) { if (this.territoryOwnership) this.UpdateOwner(); Index: ps/trunk/source/simulation2/MessageTypes.h =================================================================== --- ps/trunk/source/simulation2/MessageTypes.h +++ ps/trunk/source/simulation2/MessageTypes.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2022 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -301,21 +301,6 @@ CVector3D pos1; }; -/*Sent whenever the territory type (neutral,own,enemy) differs from the former type*/ -class CMessageTerritoryPositionChanged final : public CMessage -{ -public: - DEFAULT_MESSAGE_IMPL(TerritoryPositionChanged) - - CMessageTerritoryPositionChanged(entity_id_t entity, player_id_t newTerritory) : - entity(entity), newTerritory(newTerritory) - { - } - - entity_id_t entity; - player_id_t newTerritory; -}; - /** * Sent by CCmpUnitMotion during Update if an event happened that might interest other components. */ Index: ps/trunk/source/simulation2/TypeList.h =================================================================== --- ps/trunk/source/simulation2/TypeList.h +++ ps/trunk/source/simulation2/TypeList.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -44,7 +44,6 @@ MESSAGE(OwnershipChanged) MESSAGE(PositionChanged) MESSAGE(InterpolatedPositionChanged) -MESSAGE(TerritoryPositionChanged) MESSAGE(MotionUpdate) MESSAGE(RangeUpdate) MESSAGE(TerrainChanged) Index: ps/trunk/source/simulation2/components/CCmpPosition.cpp =================================================================== --- ps/trunk/source/simulation2/components/CCmpPosition.cpp +++ ps/trunk/source/simulation2/components/CCmpPosition.cpp @@ -24,7 +24,6 @@ #include "simulation2/serialization/SerializedTypes.h" #include "ICmpTerrain.h" -#include "ICmpTerritoryManager.h" #include "ICmpVisual.h" #include "ICmpWaterManager.h" @@ -90,8 +89,6 @@ // relative to the parent entity entity_angle_t m_RotX, m_RotY, m_RotZ; - player_id_t m_Territory; - entity_id_t m_TurretParent; CFixedVector3D m_TurretPosition; std::set m_Turrets; @@ -161,7 +158,6 @@ m_RotX = m_RotY = m_RotZ = entity_angle_t::FromInt(0); m_InterpolatedRotX = m_InterpolatedRotY = m_InterpolatedRotZ = 0.f; m_LastInterpolatedRotX = m_LastInterpolatedRotZ = 0.f; - m_Territory = INVALID_PLAYER; m_TurretParent = INVALID_ENTITY; m_TurretPosition = CFixedVector3D(); @@ -187,7 +183,7 @@ serialize.NumberFixed_Unbounded("last y diff", m_LastYDifference); serialize.NumberFixed_Unbounded("last z", m_LastZ); } - serialize.NumberI32_Unbounded("territory", m_Territory); + serialize.NumberFixed_Unbounded("rot x", m_RotX); serialize.NumberFixed_Unbounded("rot y", m_RotY); serialize.NumberFixed_Unbounded("rot z", m_RotZ); @@ -246,7 +242,7 @@ deserialize.NumberFixed_Unbounded("last y diff", m_LastYDifference); deserialize.NumberFixed_Unbounded("last z", m_LastZ); } - deserialize.NumberI32_Unbounded("territory", m_Territory); + deserialize.NumberFixed_Unbounded("rot x", m_RotX); deserialize.NumberFixed_Unbounded("rot y", m_RotY); deserialize.NumberFixed_Unbounded("rot z", m_RotZ); @@ -839,29 +835,6 @@ m_LastZ = m_Z; m_LastYDifference = entity_pos_t::Zero(); - - // warn when a position change also causes a territory change under the entity - if (m_InWorld) - { - player_id_t newTerritory; - CmpPtr cmpTerritoryManager(GetSystemEntity()); - if (cmpTerritoryManager) - newTerritory = cmpTerritoryManager->GetOwner(m_X, m_Z); - else - newTerritory = INVALID_PLAYER; - if (newTerritory != m_Territory) - { - m_Territory = newTerritory; - CMessageTerritoryPositionChanged posMsg(GetEntityId(), m_Territory); - GetSimContext().GetComponentManager().PostMessage(GetEntityId(), posMsg); - } - } - else if (m_Territory != INVALID_PLAYER) - { - m_Territory = INVALID_PLAYER; - CMessageTerritoryPositionChanged posMsg(GetEntityId(), m_Territory); - GetSimContext().GetComponentManager().PostMessage(GetEntityId(), posMsg); - } break; } case MT_TerrainChanged: Index: ps/trunk/source/simulation2/scripting/MessageTypeConversions.cpp =================================================================== --- ps/trunk/source/simulation2/scripting/MessageTypeConversions.cpp +++ ps/trunk/source/simulation2/scripting/MessageTypeConversions.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2023 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -247,24 +247,6 @@ //////////////////////////////// -JS::Value CMessageTerritoryPositionChanged::ToJSVal(const ScriptInterface& scriptInterface) const -{ - TOJSVAL_SETUP(); - SET_MSG_PROPERTY(entity); - SET_MSG_PROPERTY(newTerritory); - return JS::ObjectValue(*obj); -} - -CMessage* CMessageTerritoryPositionChanged::FromJSVal(const ScriptInterface& scriptInterface, JS::HandleValue val) -{ - FROMJSVAL_SETUP(); - GET_MSG_PROPERTY(entity_id_t, entity); - GET_MSG_PROPERTY(player_id_t, newTerritory); - return new CMessageTerritoryPositionChanged(entity, newTerritory); -} - -//////////////////////////////// - const std::array CMessageMotionUpdate::UpdateTypeStr = { { "likelySuccess", "likelyFailure", "obstructed", "veryObstructed" } };