Changeset 27673
- Timestamp:
- Jun 13, 2023, 5:48:03 PM (14 months ago)
- Location:
- ps/trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/binaries/data/mods/public/simulation/components/TerritoryDecay.js
r25458 r27673 132 132 }; 133 133 134 TerritoryDecay.prototype.On TerritoryPositionChanged = function(msg)134 TerritoryDecay.prototype.OnPositionChanged = function(msg) 135 135 { 136 136 if (this.territoryOwnership) -
ps/trunk/source/simulation2/MessageTypes.h
r26537 r27673 1 /* Copyright (C) 202 2Wildfire Games.1 /* Copyright (C) 202 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * … … 302 302 }; 303 303 304 /*Sent whenever the territory type (neutral,own,enemy) differs from the former type*/305 class CMessageTerritoryPositionChanged final : public CMessage306 {307 public:308 DEFAULT_MESSAGE_IMPL(TerritoryPositionChanged)309 310 CMessageTerritoryPositionChanged(entity_id_t entity, player_id_t newTerritory) :311 entity(entity), newTerritory(newTerritory)312 {313 }314 315 entity_id_t entity;316 player_id_t newTerritory;317 };318 319 304 /** 320 305 * Sent by CCmpUnitMotion during Update if an event happened that might interest other components. -
ps/trunk/source/simulation2/TypeList.h
r25182 r27673 1 /* Copyright (C) 202 1Wildfire Games.1 /* Copyright (C) 202 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * … … 45 45 MESSAGE(PositionChanged) 46 46 MESSAGE(InterpolatedPositionChanged) 47 MESSAGE(TerritoryPositionChanged)48 47 MESSAGE(MotionUpdate) 49 48 MESSAGE(RangeUpdate) -
ps/trunk/source/simulation2/components/CCmpPosition.cpp
r26605 r27673 25 25 26 26 #include "ICmpTerrain.h" 27 #include "ICmpTerritoryManager.h"28 27 #include "ICmpVisual.h" 29 28 #include "ICmpWaterManager.h" … … 90 89 // relative to the parent entity 91 90 entity_angle_t m_RotX, m_RotY, m_RotZ; 92 93 player_id_t m_Territory;94 91 95 92 entity_id_t m_TurretParent; … … 162 159 m_InterpolatedRotX = m_InterpolatedRotY = m_InterpolatedRotZ = 0.f; 163 160 m_LastInterpolatedRotX = m_LastInterpolatedRotZ = 0.f; 164 m_Territory = INVALID_PLAYER;165 161 166 162 m_TurretParent = INVALID_ENTITY; … … 188 184 serialize.NumberFixed_Unbounded("last z", m_LastZ); 189 185 } 190 serialize.NumberI32_Unbounded("territory", m_Territory); 186 191 187 serialize.NumberFixed_Unbounded("rot x", m_RotX); 192 188 serialize.NumberFixed_Unbounded("rot y", m_RotY); … … 247 243 deserialize.NumberFixed_Unbounded("last z", m_LastZ); 248 244 } 249 deserialize.NumberI32_Unbounded("territory", m_Territory); 245 250 246 deserialize.NumberFixed_Unbounded("rot x", m_RotX); 251 247 deserialize.NumberFixed_Unbounded("rot y", m_RotY); … … 840 836 m_LastYDifference = entity_pos_t::Zero(); 841 837 842 843 // warn when a position change also causes a territory change under the entity844 if (m_InWorld)845 {846 player_id_t newTerritory;847 CmpPtr<ICmpTerritoryManager> cmpTerritoryManager(GetSystemEntity());848 if (cmpTerritoryManager)849 newTerritory = cmpTerritoryManager->GetOwner(m_X, m_Z);850 else851 newTerritory = INVALID_PLAYER;852 if (newTerritory != m_Territory)853 {854 m_Territory = newTerritory;855 CMessageTerritoryPositionChanged posMsg(GetEntityId(), m_Territory);856 GetSimContext().GetComponentManager().PostMessage(GetEntityId(), posMsg);857 }858 }859 else if (m_Territory != INVALID_PLAYER)860 {861 m_Territory = INVALID_PLAYER;862 CMessageTerritoryPositionChanged posMsg(GetEntityId(), m_Territory);863 GetSimContext().GetComponentManager().PostMessage(GetEntityId(), posMsg);864 }865 838 break; 866 839 } -
ps/trunk/source/simulation2/scripting/MessageTypeConversions.cpp
r25434 r27673 1 /* Copyright (C) 202 1Wildfire Games.1 /* Copyright (C) 202 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * … … 248 248 //////////////////////////////// 249 249 250 JS::Value CMessageTerritoryPositionChanged::ToJSVal(const ScriptInterface& scriptInterface) const251 {252 TOJSVAL_SETUP();253 SET_MSG_PROPERTY(entity);254 SET_MSG_PROPERTY(newTerritory);255 return JS::ObjectValue(*obj);256 }257 258 CMessage* CMessageTerritoryPositionChanged::FromJSVal(const ScriptInterface& scriptInterface, JS::HandleValue val)259 {260 FROMJSVAL_SETUP();261 GET_MSG_PROPERTY(entity_id_t, entity);262 GET_MSG_PROPERTY(player_id_t, newTerritory);263 return new CMessageTerritoryPositionChanged(entity, newTerritory);264 }265 266 ////////////////////////////////267 268 250 const std::array<const char*, CMessageMotionUpdate::UpdateType::LENGTH> CMessageMotionUpdate::UpdateTypeStr = { { 269 251 "likelySuccess", "likelyFailure", "obstructed", "veryObstructed"
Note:
See TracChangeset
for help on using the changeset viewer.