Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpPosition.cpp
/* Copyright (C) 2019 Wildfire Games. | /* Copyright (C) 2020 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 820 Lines • ▼ Show 20 Lines | case MT_TurnStart: | ||||
CmpPtr<ICmpTerritoryManager> cmpTerritoryManager(GetSystemEntity()); | CmpPtr<ICmpTerritoryManager> cmpTerritoryManager(GetSystemEntity()); | ||||
if (cmpTerritoryManager) | if (cmpTerritoryManager) | ||||
newTerritory = cmpTerritoryManager->GetOwner(m_X, m_Z); | newTerritory = cmpTerritoryManager->GetOwner(m_X, m_Z); | ||||
else | else | ||||
newTerritory = INVALID_PLAYER; | newTerritory = INVALID_PLAYER; | ||||
if (newTerritory != m_Territory) | if (newTerritory != m_Territory) | ||||
{ | { | ||||
m_Territory = newTerritory; | m_Territory = newTerritory; | ||||
CMessageTerritoryPositionChanged msg(GetEntityId(), m_Territory); | CMessageTerritoryPositionChanged posMsg(GetEntityId(), m_Territory); | ||||
GetSimContext().GetComponentManager().PostMessage(GetEntityId(), msg); | GetSimContext().GetComponentManager().PostMessage(GetEntityId(), posMsg); | ||||
wraitii: Utterly redundant, `posmsg`or something would be better as it makes the lines shorter and more… | |||||
} | } | ||||
} | } | ||||
else if (m_Territory != INVALID_PLAYER) | else if (m_Territory != INVALID_PLAYER) | ||||
{ | { | ||||
m_Territory = INVALID_PLAYER; | m_Territory = INVALID_PLAYER; | ||||
CMessageTerritoryPositionChanged msg(GetEntityId(), m_Territory); | CMessageTerritoryPositionChanged posMsg(GetEntityId(), m_Territory); | ||||
GetSimContext().GetComponentManager().PostMessage(GetEntityId(), msg); | GetSimContext().GetComponentManager().PostMessage(GetEntityId(), posMsg); | ||||
} | } | ||||
break; | break; | ||||
} | } | ||||
case MT_TerrainChanged: | case MT_TerrainChanged: | ||||
case MT_WaterChanged: | case MT_WaterChanged: | ||||
{ | { | ||||
AdvertiseInterpolatedPositionChanges(); | AdvertiseInterpolatedPositionChanges(); | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 127 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Utterly redundant, posmsgor something would be better as it makes the lines shorter and more parseable imo