mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-06-16 05:13:58 -07:00
This was SVN commit r18223.
This commit is contained in:
parent
33f6713f94
commit
9cc98aaf47
6 changed files with 24 additions and 14 deletions
|
|
@ -534,7 +534,7 @@ function handleInputBeforeGui(ev, hoveredObject)
|
|||
case "mousemotion":
|
||||
var rect = updateBandbox(bandbox, ev, false);
|
||||
|
||||
var ents = Engine.PickPlayerEntitiesInRect(rect[0], rect[1], rect[2], rect[3], g_IsObserver ? -1 : Engine.GetPlayerID());
|
||||
var ents = Engine.PickPlayerEntitiesInRect(rect[0], rect[1], rect[2], rect[3], g_ViewedPlayer);
|
||||
var preferredEntities = getPreferredEntities(ents);
|
||||
g_Selection.setHighlightList(preferredEntities);
|
||||
|
||||
|
|
@ -546,7 +546,7 @@ function handleInputBeforeGui(ev, hoveredObject)
|
|||
var rect = updateBandbox(bandbox, ev, true);
|
||||
|
||||
// Get list of entities limited to preferred entities
|
||||
var ents = getPreferredEntities(Engine.PickPlayerEntitiesInRect(rect[0], rect[1], rect[2], rect[3], g_IsObserver ? -1 : Engine.GetPlayerID()));
|
||||
var ents = getPreferredEntities(Engine.PickPlayerEntitiesInRect(rect[0], rect[1], rect[2], rect[3], g_ViewedPlayer));
|
||||
|
||||
// Remove the bandbox hover highlighting
|
||||
g_Selection.setHighlightList([]);
|
||||
|
|
|
|||
|
|
@ -983,18 +983,27 @@ function recalculateStatusBarDisplay()
|
|||
{
|
||||
let entities;
|
||||
if (g_ShowAllStatusBars)
|
||||
entities = g_IsObserver ? Engine.PickNonGaiaEntitiesOnScreen() : Engine.PickPlayerEntitiesOnScreen(Engine.GetPlayerID());
|
||||
entities = g_ViewedPlayer == -1 ?
|
||||
Engine.PickNonGaiaEntitiesOnScreen() :
|
||||
Engine.PickPlayerEntitiesOnScreen(g_ViewedPlayer);
|
||||
else
|
||||
{
|
||||
let selected = g_Selection.toList();
|
||||
for (let ent in g_Selection.highlighted)
|
||||
selected.push(g_Selection.highlighted[ent]);
|
||||
|
||||
// Remove selected entities from the 'all entities' array, to avoid disabling their status bars.
|
||||
entities = Engine.GuiInterfaceCall(g_IsObserver ? "GetNonGaiaEntities" : "GetPlayerEntities").filter(idx => selected.indexOf(idx) == -1);
|
||||
// Remove selected entities from the 'all entities' array,
|
||||
// to avoid disabling their status bars.
|
||||
entities = Engine.GuiInterfaceCall(
|
||||
g_ViewedPlayer == -1 ? "GetNonGaiaEntities" : "GetPlayerEntities", {
|
||||
"viewedPlayer": g_ViewedPlayer
|
||||
}).filter(idx => selected.indexOf(idx) == -1);
|
||||
}
|
||||
|
||||
Engine.GuiInterfaceCall("SetStatusBars", { "entities": entities, "enabled": g_ShowAllStatusBars });
|
||||
Engine.GuiInterfaceCall("SetStatusBars", {
|
||||
"entities": entities,
|
||||
"enabled": g_ShowAllStatusBars
|
||||
});
|
||||
}
|
||||
|
||||
// Update the additional list of entities to be highlighted.
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ function getTradingTooltip(gain)
|
|||
if (!gain)
|
||||
return "";
|
||||
|
||||
var playerID = Engine.GetPlayerID();
|
||||
var playerID = g_ViewedPlayer;
|
||||
var simState = GetSimState();
|
||||
|
||||
|
||||
var gainString = gain.traderGain;
|
||||
if (gain.market1Gain && gain.market1Owner == gain.traderOwner)
|
||||
gainString += translate("+") + gain.market1Gain;
|
||||
|
|
@ -90,12 +90,13 @@ function getTradingTooltip(gain)
|
|||
"gain": gainString,
|
||||
"player": simState.players[gain.traderOwner].name
|
||||
});
|
||||
|
||||
|
||||
if (gain.market1Gain && gain.market1Owner != gain.traderOwner)
|
||||
tooltip += translateWithContext("Separation mark in an enumeration", ", ") + sprintf(translate("%(gain)s (%(player)s)"), {
|
||||
"gain": gain.market1Gain,
|
||||
"player": simState.players[gain.market1Owner].name
|
||||
});
|
||||
|
||||
if (gain.market2Gain && gain.market2Owner != gain.traderOwner)
|
||||
tooltip += translateWithContext("Separation mark in an enumeration", ", ") + sprintf(translate("%(gain)s (%(player)s)"), {
|
||||
"gain": gain.market2Gain,
|
||||
|
|
|
|||
|
|
@ -888,9 +888,9 @@ GuiInterface.prototype.SetStatusBars = function(player, cmd)
|
|||
}
|
||||
};
|
||||
|
||||
GuiInterface.prototype.GetPlayerEntities = function(player)
|
||||
GuiInterface.prototype.GetPlayerEntities = function(player, data)
|
||||
{
|
||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetEntitiesByPlayer(player);
|
||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetEntitiesByPlayer(data.viewedPlayer);
|
||||
};
|
||||
|
||||
GuiInterface.prototype.GetNonGaiaEntities = function()
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ void CGameView::Update(const float deltaRealTime)
|
|||
CmpPtr<ICmpPosition> cmpPosition(*(m->Game->GetSimulation2()), m->FollowEntity);
|
||||
CmpPtr<ICmpRangeManager> cmpRangeManager(*(m->Game->GetSimulation2()), SYSTEM_ENTITY);
|
||||
if (cmpPosition && cmpPosition->IsInWorld() &&
|
||||
cmpRangeManager && cmpRangeManager->GetLosVisibility(m->FollowEntity, m->Game->GetPlayerID()) == ICmpRangeManager::VIS_VISIBLE)
|
||||
cmpRangeManager && cmpRangeManager->GetLosVisibility(m->FollowEntity, m->Game->GetViewedPlayerID()) == ICmpRangeManager::VIS_VISIBLE)
|
||||
{
|
||||
// Get the most recent interpolated position
|
||||
float frameOffset = m->Game->GetSimulation2()->GetLastFrameOffset();
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ void PostNetworkCommand(ScriptInterface::CxPrivate* pCxPrivate, JS::HandleValue
|
|||
|
||||
entity_id_t PickEntityAtPoint(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int x, int y)
|
||||
{
|
||||
return EntitySelection::PickEntityAtPoint(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), x, y, g_Game->GetPlayerID(), false);
|
||||
return EntitySelection::PickEntityAtPoint(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), x, y, g_Game->GetViewedPlayerID(), false);
|
||||
}
|
||||
|
||||
std::vector<entity_id_t> PickPlayerEntitiesInRect(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int x0, int y0, int x1, int y1, int player)
|
||||
|
|
@ -187,7 +187,7 @@ std::vector<entity_id_t> PickNonGaiaEntitiesOnScreen(ScriptInterface::CxPrivate*
|
|||
|
||||
std::vector<entity_id_t> PickSimilarPlayerEntities(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& templateName, bool includeOffScreen, bool matchRank, bool allowFoundations)
|
||||
{
|
||||
return EntitySelection::PickSimilarEntities(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), templateName, g_Game->GetPlayerID(), includeOffScreen, matchRank, false, allowFoundations);
|
||||
return EntitySelection::PickSimilarEntities(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), templateName, g_Game->GetViewedPlayerID(), includeOffScreen, matchRank, false, allowFoundations);
|
||||
}
|
||||
|
||||
CFixedVector3D GetTerrainAtScreenPoint(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int x, int y)
|
||||
|
|
|
|||
Loading…
Reference in a new issue