Ticket #3215: t3215_fix_observer_statusbars_v4.patch
File t3215_fix_observer_statusbars_v4.patch, 21.1 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/gui/session/input.js
156 156 return true; 157 157 } 158 158 } 159 159 else if (placementSupport.mode === "wall") 160 160 { 161 161 if (placementSupport.wallSet && placementSupport.position) 162 162 { 163 163 // Fetch an updated list of snapping candidate entities 164 placementSupport.wallSnapEntities = Engine.PickSimilar FriendlyEntities(164 placementSupport.wallSnapEntities = Engine.PickSimilarPlayerEntities( 165 165 placementSupport.wallSet.templates.tower, 166 166 placementSupport.wallSnapEntitiesIncludeOffscreen, 167 167 true, // require exact template match 168 168 true // include foundations 169 169 ); 170 170 171 171 return Engine.GuiInterfaceCall("SetWallPlacementPreview", { 172 172 "wallSet": placementSupport.wallSet, … … 546 546 { 547 547 case INPUT_BANDBOXING: 548 548 var bandbox = Engine.GetGUIObjectByName("bandbox"); 549 549 switch (ev.type) 550 550 { 551 551 case "mousemotion": 552 552 var rect = updateBandbox(bandbox, ev, false); 553 553 554 var ents = Engine.Pick FriendlyEntitiesInRect(rect[0], rect[1], rect[2], rect[3], Engine.GetPlayerID());554 var ents = Engine.PickPlayerEntitiesInRect(rect[0], rect[1], rect[2], rect[3], Engine.GetPlayerID()); 555 555 var preferredEntities = getPreferredEntities(ents); 556 556 g_Selection.setHighlightList(preferredEntities); 557 557 558 558 return false; 559 559 560 560 case "mousebuttonup": 561 561 if (ev.button == SDL_BUTTON_LEFT) 562 562 { 563 563 var rect = updateBandbox(bandbox, ev, true); 564 564 565 565 // Get list of entities limited to preferred entities 566 var ents = getPreferredEntities(Engine.Pick FriendlyEntitiesInRect(rect[0], rect[1], rect[2], rect[3], Engine.GetPlayerID()));566 var ents = getPreferredEntities(Engine.PickPlayerEntitiesInRect(rect[0], rect[1], rect[2], rect[3], Engine.GetPlayerID())); 567 567 568 568 // Remove the bandbox hover highlighting 569 569 g_Selection.setHighlightList([]); 570 570 571 571 // Update the list of selected units 572 572 if (Engine.HotkeyIsPressed("selection.add")) 573 573 { 574 574 g_Selection.addList(ents); … … 1040 1040 else 1041 1041 { 1042 1042 // Double click has already occurred, so this is a triple click. 1043 1043 // Select units matching exact template name (same rank) 1044 1044 templateToMatch = GetEntityState(selectedEntity).template; 1045 1045 } 1046 1046 1047 1047 // TODO: Should we handle "control all units" here as well? 1048 ents = Engine.PickSimilar FriendlyEntities(templateToMatch, showOffscreen, matchRank, false);1048 ents = Engine.PickSimilarPlayerEntities(templateToMatch, showOffscreen, matchRank, false); 1049 1049 } 1050 1050 else 1051 1051 { 1052 1052 // It's single click right now but it may become double or triple click 1053 1053 doubleClicked = false; 1054 1054 doubleClickTimer = now.getTime(); 1055 1055 prevClickedEntity = selectedEntity; 1056 1056 -
binaries/data/mods/public/gui/session/session.js
792 792 for (var i = numButtons; i < 10; ++i) 793 793 Engine.GetGUIObjectByName("researchStartedButton[" + i + "]").hidden = true; 794 794 } 795 795 796 796 // Toggles the display of status bars for all of the player's entities. 797 797 function recalculateStatusBarDisplay() 798 798 { 799 799 if (g_ShowAllStatusBars) 800 var entities = Engine.PickFriendlyEntitiesOnScreen(Engine.GetPlayerID());800 var entities = g_IsObserver ? Engine.PickNonGaiaEntitiesOnScreen() : Engine.PickPlayerEntitiesOnScreen(Engine.GetPlayerID()); 801 801 else 802 802 { 803 803 var selected = g_Selection.toList(); 804 804 for each (var ent in g_Selection.highlighted) 805 805 selected.push(ent); 806 806 807 807 // Remove selected entities from the 'all entities' array, to avoid disabling their status bars. 808 var entities = Engine.GuiInterfaceCall("GetPlayerEntities").filter( 809 function(idx) { return (selected.indexOf(idx) == -1); } 810 ); 808 var entities = Engine.GuiInterfaceCall(g_IsObserver ? "GetNonGaiaEntities" : "GetPlayerEntities").filter(idx => selected.indexOf(idx) == -1); 811 809 } 812 810 813 811 Engine.GuiInterfaceCall("SetStatusBars", { "entities": entities, "enabled": g_ShowAllStatusBars }); 814 812 } 815 816 813 // Update the additional list of entities to be highlighted. 817 814 function updateAdditionalHighlight() 818 815 { 819 816 var entsAdd = []; // list of entities units to be highlighted 820 817 var entsRemove = []; 821 818 var highlighted = g_Selection.toList(); 822 819 for each (var ent in g_Selection.highlighted) 823 820 highlighted.push(ent); -
binaries/data/mods/public/simulation/components/GuiInterface.js
896 896 }; 897 897 898 898 GuiInterface.prototype.GetPlayerEntities = function(player) 899 899 { 900 900 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 901 901 return cmpRangeManager.GetEntitiesByPlayer(player); 902 902 }; 903 903 904 GuiInterface.prototype.GetNonGaiaEntities = function() 905 { 906 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 907 return cmpRangeManager.GetNonGaiaEntities(); 908 }; 909 904 910 /** 905 911 * Displays the rally points of a given list of entities (carried in cmd.entities). 906 912 * 907 913 * The 'cmd' object may carry its own x/z coordinate pair indicating the location where the rally point should 908 914 * be rendered, in order to support instantaneously rendering a rally point marker at a specified location 909 915 * instead of incurring a delay while PostNetworkCommand processes the set-rallypoint command (see input.js). 910 916 * If cmd doesn't carry a custom location, then the position to render the marker at will be read from the 911 917 * RallyPoint component. … … 1894 1900 "IsFormationSelected": 1, 1895 1901 "GetFormationInfoFromTemplate": 1, 1896 1902 "IsStanceSelected": 1, 1897 1903 1898 1904 "SetSelectionHighlight": 1, 1899 1905 "GetAllBuildableEntities": 1, 1900 1906 "SetStatusBars": 1, 1901 1907 "GetPlayerEntities": 1, 1908 "GetNonGaiaEntities": 1, 1902 1909 "DisplayRallyPoint": 1, 1903 1910 "SetBuildingPlacementPreview": 1, 1904 1911 "SetWallPlacementPreview": 1, 1905 1912 "GetFoundationSnapData": 1, 1906 1913 "PlaySound": 1, 1907 1914 "FindIdleUnits": 1, 1908 1915 "GetTradingRouteGain": 1, 1909 1916 "GetTradingDetails": 1, -
source/gui/scripting/ScriptFunctions.cpp
56 56 #include "ps/scripting/JSInterface_Console.h" 57 57 #include "ps/scripting/JSInterface_Mod.h" 58 58 #include "ps/scripting/JSInterface_VFS.h" 59 59 #include "renderer/scripting/JSInterface_Renderer.h" 60 60 #include "simulation2/Simulation2.h" 61 61 #include "simulation2/components/ICmpAIManager.h" 62 62 #include "simulation2/components/ICmpCommandQueue.h" 63 63 #include "simulation2/components/ICmpGuiInterface.h" 64 #include "simulation2/components/ICmpPlayerManager.h" 64 65 #include "simulation2/components/ICmpRangeManager.h" 65 66 #include "simulation2/components/ICmpSelectable.h" 66 67 #include "simulation2/components/ICmpTemplateManager.h" 67 68 #include "simulation2/helpers/Selection.h" 68 69 #include "soundmanager/SoundManager.h" 69 70 #include "soundmanager/scripting/JSInterface_Sound.h" 70 71 #include "tools/atlas/GameInterface/GameLoop.h" 71 72 … … 148 149 cmpCommandQueue->PostNetworkCommand(cmd2); 149 150 } 150 151 151 152 entity_id_t PickEntityAtPoint(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int x, int y) 152 153 { 153 154 return EntitySelection::PickEntityAtPoint(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), x, y, g_Game->GetPlayerID(), false); 154 155 } 155 156 156 std::vector<entity_id_t> Pick FriendlyEntitiesInRect(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int x0, int y0, int x1, int y1, int player)157 std::vector<entity_id_t> PickPlayerEntitiesInRect(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int x0, int y0, int x1, int y1, int player) 157 158 { 158 159 return EntitySelection::PickEntitiesInRect(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), x0, y0, x1, y1, player, false); 159 160 } 160 161 161 std::vector<entity_id_t> Pick FriendlyEntitiesOnScreen(ScriptInterface::CxPrivate* pCxPrivate, int player)162 std::vector<entity_id_t> PickPlayerEntitiesOnScreen(ScriptInterface::CxPrivate* pCxPrivate, int player) 162 163 { 163 return Pick FriendlyEntitiesInRect(pCxPrivate, 0, 0, g_xres, g_yres, player);164 return PickPlayerEntitiesInRect(pCxPrivate, 0, 0, g_xres, g_yres, player); 164 165 } 165 166 166 std::vector<entity_id_t> PickSimilarFriendlyEntities(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), std::string templateName, bool includeOffScreen, bool matchRank, bool allowFoundations) 167 std::vector<entity_id_t> PickNonGaiaEntitiesOnScreen(ScriptInterface::CxPrivate* pCxPrivate) 168 { 169 return PickPlayerEntitiesInRect(pCxPrivate, 0, 0, g_xres, g_yres, NON_GAIA_PLAYERS); 170 } 171 172 std::vector<entity_id_t> PickSimilarPlayerEntities(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), CStr templateName, bool includeOffScreen, bool matchRank, bool allowFoundations) 167 173 { 168 174 return EntitySelection::PickSimilarEntities(*g_Game->GetSimulation2(), *g_Game->GetView()->GetCamera(), templateName, g_Game->GetPlayerID(), includeOffScreen, matchRank, false, allowFoundations); 169 175 } 170 176 171 177 CFixedVector3D GetTerrainAtScreenPoint(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int x, int y) 172 178 { 173 179 CVector3D pos = g_Game->GetView()->GetCamera()->GetWorldCoordinates(x, y, true); 174 180 return CFixedVector3D(fixed::FromFloat(pos.X), fixed::FromFloat(pos.Y), fixed::FromFloat(pos.Z)); … … 939 945 scriptInterface.RegisterFunction<JS::Value, CStr, &GetGUIObjectByName>("GetGUIObjectByName"); 940 946 941 947 // Simulation<->GUI interface functions: 942 948 scriptInterface.RegisterFunction<JS::Value, std::wstring, JS::HandleValue, &GuiInterfaceCall>("GuiInterfaceCall"); 943 949 scriptInterface.RegisterFunction<void, JS::HandleValue, &PostNetworkCommand>("PostNetworkCommand"); 944 950 945 951 // Entity picking 946 952 scriptInterface.RegisterFunction<entity_id_t, int, int, &PickEntityAtPoint>("PickEntityAtPoint"); 947 scriptInterface.RegisterFunction<std::vector<entity_id_t>, int, int, int, int, int, &PickFriendlyEntitiesInRect>("PickFriendlyEntitiesInRect"); 948 scriptInterface.RegisterFunction<std::vector<entity_id_t>, int, &PickFriendlyEntitiesOnScreen>("PickFriendlyEntitiesOnScreen"); 949 scriptInterface.RegisterFunction<std::vector<entity_id_t>, std::string, bool, bool, bool, &PickSimilarFriendlyEntities>("PickSimilarFriendlyEntities"); 953 scriptInterface.RegisterFunction<std::vector<entity_id_t>, int, int, int, int, int, &PickPlayerEntitiesInRect>("PickPlayerEntitiesInRect"); 954 scriptInterface.RegisterFunction<std::vector<entity_id_t>, int, &PickPlayerEntitiesOnScreen>("PickPlayerEntitiesOnScreen"); 955 scriptInterface.RegisterFunction<std::vector<entity_id_t>, &PickNonGaiaEntitiesOnScreen>("PickNonGaiaEntitiesOnScreen"); 956 scriptInterface.RegisterFunction<std::vector<entity_id_t>, CStr, bool, bool, bool, &PickSimilarPlayerEntities>("PickSimilarPlayerEntities"); 950 957 scriptInterface.RegisterFunction<CFixedVector3D, int, int, &GetTerrainAtScreenPoint>("GetTerrainAtScreenPoint"); 951 958 952 959 // Network / game setup functions 953 960 scriptInterface.RegisterFunction<void, &StartNetworkGame>("StartNetworkGame"); 954 961 scriptInterface.RegisterFunction<void, JS::HandleValue, int, &StartGame>("StartGame"); 955 962 scriptInterface.RegisterFunction<void, &Script_EndGame>("EndGame"); 956 963 scriptInterface.RegisterFunction<void, std::wstring, &StartNetworkHost>("StartNetworkHost"); 957 964 scriptInterface.RegisterFunction<void, std::wstring, std::string, &StartNetworkJoin>("StartNetworkJoin"); -
source/simulation2/components/CCmpRangeManager.cpp
889 889 890 890 return r; 891 891 } 892 892 893 893 virtual std::vector<entity_id_t> GetEntitiesByPlayer(player_id_t player) 894 894 { 895 895 std::vector<entity_id_t> entities; 896 896 897 u32 ownerMask = CalcOwnerMask(player); 898 899 for (EntityMap<EntityData>::const_iterator it = m_EntityData.begin(); it != m_EntityData.end(); ++it) 900 { 901 // Check owner and add to list if it matches 902 if (CalcOwnerMask(it->second.owner) & ownerMask) 903 entities.push_back(it->first); 904 } 897 for (const EntityMap<EntityData>::key_val<unsigned int, EntityData>& entityData : m_EntityData) 898 if ((player == NON_GAIA_PLAYERS && entityData.second.owner != 0) || entityData.second.owner == player) 899 entities.emplace_back(entityData.first); 905 900 906 901 return entities; 907 902 } 908 903 904 virtual std::vector<entity_id_t> GetNonGaiaEntities() 905 { 906 return GetEntitiesByPlayer(NON_GAIA_PLAYERS); 907 } 908 909 909 virtual void SetDebugOverlay(bool enabled) 910 910 { 911 911 m_DebugOverlayEnabled = enabled; 912 912 m_DebugOverlayDirty = true; 913 913 if (!enabled) 914 914 m_DebugOverlayLines.clear(); 915 915 } 916 916 -
source/simulation2/components/ICmpRangeManager.cpp
40 40 DEFINE_INTERFACE_METHOD_7("CreateActiveParabolicQuery", ICmpRangeManager::tag_t, ICmpRangeManager, CreateActiveParabolicQuery, entity_id_t, entity_pos_t, entity_pos_t, entity_pos_t, std::vector<int>, int, u8) 41 41 DEFINE_INTERFACE_METHOD_1("DestroyActiveQuery", void, ICmpRangeManager, DestroyActiveQuery, ICmpRangeManager::tag_t) 42 42 DEFINE_INTERFACE_METHOD_1("EnableActiveQuery", void, ICmpRangeManager, EnableActiveQuery, ICmpRangeManager::tag_t) 43 43 DEFINE_INTERFACE_METHOD_1("DisableActiveQuery", void, ICmpRangeManager, DisableActiveQuery, ICmpRangeManager::tag_t) 44 44 DEFINE_INTERFACE_METHOD_1("ResetActiveQuery", std::vector<entity_id_t>, ICmpRangeManager, ResetActiveQuery, ICmpRangeManager::tag_t) 45 45 DEFINE_INTERFACE_METHOD_3("SetEntityFlag", void, ICmpRangeManager, SetEntityFlag, entity_id_t, std::string, bool) 46 46 DEFINE_INTERFACE_METHOD_1("GetEntityFlagMask", u8, ICmpRangeManager, GetEntityFlagMask, std::string) 47 47 DEFINE_INTERFACE_METHOD_1("GetEntitiesByPlayer", std::vector<entity_id_t>, ICmpRangeManager, GetEntitiesByPlayer, player_id_t) 48 DEFINE_INTERFACE_METHOD_0("GetNonGaiaEntities", std::vector<entity_id_t>, ICmpRangeManager, GetNonGaiaEntities) 48 49 DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpRangeManager, SetDebugOverlay, bool) 49 50 DEFINE_INTERFACE_METHOD_1("ExploreAllTiles", void, ICmpRangeManager, ExploreAllTiles, player_id_t) 50 51 DEFINE_INTERFACE_METHOD_0("ExploreTerritories", void, ICmpRangeManager, ExploreTerritories) 51 52 DEFINE_INTERFACE_METHOD_2("SetLosRevealAll", void, ICmpRangeManager, SetLosRevealAll, player_id_t, bool) 52 53 DEFINE_INTERFACE_METHOD_1("GetLosRevealAll", bool, ICmpRangeManager, GetLosRevealAll, player_id_t) 53 54 DEFINE_INTERFACE_METHOD_5("GetElevationAdaptedRange", entity_pos_t, ICmpRangeManager, GetElevationAdaptedRange, CFixedVector3D, CFixedVector3D, entity_pos_t, entity_pos_t, entity_pos_t) 54 55 DEFINE_INTERFACE_METHOD_2("ActivateScriptedVisibility", void, ICmpRangeManager, ActivateScriptedVisibility, entity_id_t, bool) 55 56 DEFINE_INTERFACE_METHOD_2("GetLosVisibility", std::string, ICmpRangeManager, GetLosVisibility_wrapper, entity_id_t, player_id_t) -
source/simulation2/components/ICmpRangeManager.h
174 174 * The next RangeUpdate message will say who has entered/left since this call, 175 175 * so you won't miss any notifications. 176 176 * @param tag identifier of query. 177 177 * @return list of entities matching the query, ordered by increasing distance from the source entity. 178 178 */ 179 179 virtual std::vector<entity_id_t> ResetActiveQuery(tag_t tag) = 0; 180 180 181 181 /** 182 * Returns list of all entities for specific player.182 * Returns a list of all entities for specific player. 183 183 * (This is on this interface because it shares a lot of the implementation. 184 184 * Maybe it should be extended to be more like ExecuteQuery without 185 185 * the range parameter.) 186 186 */ 187 187 virtual std::vector<entity_id_t> GetEntitiesByPlayer(player_id_t player) = 0; 188 188 189 189 /** 190 * Returns a list of all entities of all players except gaia. Also see GetEntitiesByPlayer. 191 */ 192 virtual std::vector<entity_id_t> GetNonGaiaEntities() = 0; 193 194 /** 190 195 * Toggle the rendering of debug info. 191 196 */ 192 197 virtual void SetDebugOverlay(bool enabled) = 0; 193 198 194 199 /** 195 200 * Returns the mask for the specified identifier. 196 201 */ 197 202 virtual u8 GetEntityFlagMask(std::string identifier) = 0; -
source/simulation2/helpers/Player.h
19 19 #define INCLUDED_PLAYER 20 20 21 21 /** 22 22 * valid player IDs are non-negative (see ICmpOwnership) 23 23 */ 24 24 typedef int32_t player_id_t; 25 25 26 26 static const player_id_t INVALID_PLAYER = -1; 27 static const player_id_t NON_GAIA_PLAYERS = -2; 27 28 28 29 #endif // INCLUDED_PLAYER -
source/simulation2/helpers/Selection.cpp
93 93 static bool CheckEntityVisibleAndInRect(CEntityHandle handle, CmpPtr<ICmpRangeManager> cmpRangeManager, const CCamera& camera, int sx0, int sy0, int sx1, int sy1, player_id_t owner, bool allowEditorSelectables) 94 94 { 95 95 // Check if this entity is only selectable in Atlas 96 96 CmpPtr<ICmpSelectable> cmpSelectable(handle); 97 97 if (!cmpSelectable || (!allowEditorSelectables && cmpSelectable->IsEditorOnly())) 98 98 return false; 99 99 100 100 // Ignore entities hidden by LOS (or otherwise hidden, e.g. when not IsInWorld) 101 if ( cmpRangeManager->GetLosVisibility(handle, owner) == ICmpRangeManager::VIS_HIDDEN)101 if (owner != NON_GAIA_PLAYERS && cmpRangeManager->GetLosVisibility(handle, owner) == ICmpRangeManager::VIS_HIDDEN) 102 102 return false; 103 103 104 104 // Find the current interpolated model position. 105 105 // (We just use the centre position and not the whole bounding box, because maybe 106 106 // that's better for users trying to select objects in busy areas) 107 107 108 108 CmpPtr<ICmpVisual> cmpVisual(handle); 109 109 if (!cmpVisual) … … 118 118 // Compare screen-space coordinates 119 119 float x, y; 120 120 camera.GetScreenCoordinates(position, x, y); 121 121 int ix = (int)x; 122 122 int iy = (int)y; 123 123 return sx0 <= ix && ix <= sx1 && sy0 <= iy && iy <= sy1; 124 124 } 125 125 126 /** 127 * Returns all entities visible in the given screen area and owned by the given player. 128 * If allowEditorSelectables is true, then all selectable entities, including decoratives will be returned. 129 */ 126 130 std::vector<entity_id_t> EntitySelection::PickEntitiesInRect(CSimulation2& simulation, const CCamera& camera, int sx0, int sy0, int sx1, int sy1, player_id_t owner, bool allowEditorSelectables) 127 131 { 128 132 PROFILE2("PickEntitiesInRect"); 133 129 134 // Make sure sx0 <= sx1, and sy0 <= sy1 130 135 if (sx0 > sx1) 131 136 std::swap(sx0, sx1); 132 137 if (sy0 > sy1) 133 138 std::swap(sy0, sy1); 134 139 135 140 CmpPtr<ICmpRangeManager> cmpRangeManager(simulation, SYSTEM_ENTITY); 136 141 ENSURE(cmpRangeManager); 137 142 138 143 std::vector<entity_id_t> hitEnts; 139 140 if (owner != INVALID_PLAYER) 141 { 142 CComponentManager& componentManager = simulation.GetSimContext().GetComponentManager(); 143 std::vector<entity_id_t> ents = cmpRangeManager->GetEntitiesByPlayer(owner); 144 for (std::vector<entity_id_t>::iterator it = ents.begin(); it != ents.end(); ++it) 145 { 146 if (CheckEntityVisibleAndInRect(componentManager.LookupEntityHandle(*it), cmpRangeManager, camera, sx0, sy0, sx1, sy1, owner, allowEditorSelectables)) 147 hitEnts.push_back(*it); 148 } 149 } 150 else // owner == INVALID_PLAYER; Used when selecting units in Atlas or other mods that allow all kinds of selectables to be selected. 151 { 152 const CSimulation2::InterfaceListUnordered& selectableEnts = simulation.GetEntitiesWithInterfaceUnordered(IID_Selectable); 153 for (CSimulation2::InterfaceListUnordered::const_iterator it = selectableEnts.begin(); it != selectableEnts.end(); ++it) 154 { 155 if (CheckEntityVisibleAndInRect(it->second->GetEntityHandle(), cmpRangeManager, camera, sx0, sy0, sx1, sy1, owner, allowEditorSelectables)) 156 hitEnts.push_back(it->first); 157 } 158 } 144 if (owner == INVALID_PLAYER) 145 // Get all selectable entities (including decoratives), used by Atlas 146 for (const std::pair<const unsigned int, IComponent*>& component : simulation.GetEntitiesWithInterfaceUnordered(IID_Selectable)) 147 hitEnts.emplace_back(component.first); 148 else 149 hitEnts = (owner == NON_GAIA_PLAYERS) ? cmpRangeManager->GetNonGaiaEntities() : cmpRangeManager->GetEntitiesByPlayer(owner); 150 151 // Remove all entities invisible or not in the given rectangle 152 CComponentManager& componentManager = simulation.GetSimContext().GetComponentManager(); 153 hitEnts.erase(std::remove_if(hitEnts.begin(), hitEnts.end(), 154 [&](const entity_id_t& ent) 155 { return !CheckEntityVisibleAndInRect(componentManager.LookupEntityHandle(ent), cmpRangeManager, camera, sx0, sy0, sx1, sy1, owner, allowEditorSelectables); } 156 ), hitEnts.end()); 159 157 160 158 return hitEnts; 161 159 } 162 160 163 161 std::vector<entity_id_t> EntitySelection::PickSimilarEntities(CSimulation2& simulation, const CCamera& camera, 164 162 const std::string& templateName, player_id_t owner, bool includeOffScreen, bool matchRank, 165 163 bool allowEditorSelectables, bool allowFoundations) 166 164 {