Ticket #2913: visibility-performance+958.patch
File visibility-performance+958.patch, 24.8 KB (added by , 9 years ago) |
---|
-
binaries/data/mods/public/simulation/components/BuildingAI.js
340 340 if (cmpFogging && cmpFogging.IsMiraged(cmpOwnership.GetOwner())) 341 341 return true; 342 342 343 if (cmpRangeManager.GetLosVisibility(target, cmpOwnership.GetOwner() , false) == "hidden")343 if (cmpRangeManager.GetLosVisibility(target, cmpOwnership.GetOwner()) == "hidden") 344 344 return false; 345 345 346 346 // Either visible directly, or visible in fog -
binaries/data/mods/public/simulation/components/BuildRestrictions.js
95 95 if (!cmpPlayer.IsAI()) 96 96 { 97 97 // Check whether it's in a visible or fogged region 98 // tell GetLosVisibility to force RetainInFog because preview entities set this to false,99 // which would show them as hidden instead of fogged100 98 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 101 99 var cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); 102 100 if (!cmpRangeManager || !cmpOwnership) 103 101 return result; // Fail 104 102 105 var explored = (cmpRangeManager.GetLosVisibility(this.entity, cmpOwnership.GetOwner() , true) != "hidden");103 var explored = (cmpRangeManager.GetLosVisibility(this.entity, cmpOwnership.GetOwner()) != "hidden"); 106 104 if (!explored) 107 105 { 108 106 result.message = markForTranslation("%(name)s cannot be built in unexplored area"); -
binaries/data/mods/public/simulation/components/Fogging.js
160 160 for (var player = 0; player < this.mirages.length; ++player) 161 161 { 162 162 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 163 if (cmpRangeManager.GetLosVisibility(this.mirages[player], player , false) == "hidden")163 if (cmpRangeManager.GetLosVisibility(this.mirages[player], player) == "hidden") 164 164 { 165 165 Engine.DestroyEntity(this.mirages[player]); 166 166 continue; -
binaries/data/mods/public/simulation/components/GuiInterface.js
381 381 } 382 382 383 383 var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager); 384 ret.visibility = cmpRangeManager.GetLosVisibility(ent, player , false);384 ret.visibility = cmpRangeManager.GetLosVisibility(ent, player); 385 385 386 386 return ret; 387 387 }; … … 1433 1433 cmpOwnership.SetOwner(player); 1434 1434 1435 1435 // Check whether it's in a visible or fogged region 1436 // tell GetLosVisibility to force RetainInFog because preview entities set this to false,1437 // which would show them as hidden instead of fogged1438 1436 // TODO: should definitely reuse SetBuildingPlacementPreview, this is just straight up copy/pasta 1439 var visible = (cmpRangeManager.GetLosVisibility(ent, player , true) != "hidden");1437 var visible = (cmpRangeManager.GetLosVisibility(ent, player) != "hidden"); 1440 1438 if (visible) 1441 1439 { 1442 1440 var cmpBuildRestrictions = Engine.QueryInterface(ent, IID_BuildRestrictions); -
binaries/data/mods/public/simulation/components/UnitAI.js
4397 4397 if (cmpFogging && cmpFogging.IsMiraged(cmpOwnership.GetOwner())) 4398 4398 return true; 4399 4399 4400 if (cmpRangeManager.GetLosVisibility(target, cmpOwnership.GetOwner() , false) == "hidden")4400 if (cmpRangeManager.GetLosVisibility(target, cmpOwnership.GetOwner()) == "hidden") 4401 4401 return false; 4402 4402 4403 4403 // Either visible directly, or visible in fog -
binaries/data/mods/public/simulation/components/Visibility.js
10 10 "</element>" + 11 11 "<element name='AlwaysVisible'>" + 12 12 "<data type='boolean'/>" + 13 "</element>" + 14 "<element name='Preview'>" + 15 "<data type='boolean'/>" + 13 16 "</element>"; 14 17 15 18 Visibility.prototype.Init = function() 16 19 { 20 this.retainInFog = this.template.RetainInFog == "true"; 21 this.alwaysVisible = this.template.AlwaysVisible == "true"; 22 this.preview = this.template.Preview == "true"; 17 23 24 this.activated = false; 25 26 if (this.preview) 27 this.activated = true; 18 28 }; 19 29 20 30 /** 21 * This function is called for entities in explored territory. 22 * isOutsideFog: true if we're in the vision range of a unit, false otherwise 23 * forceRetainInFog: useful for previewed entities, see the RangeManager system component documentation 31 * If this function returns true, the range manager will call the GetVisibility function 32 * instead of computing the visibility. 24 33 */ 25 Visibility.prototype. GetLosVisibility = function(player, isOutsideFog, forceRetainInFog)34 Visibility.prototype.IsActivated = function() 26 35 { 27 if (isOutsideFog) 28 { 29 var cmpMirage = Engine.QueryInterface(this.entity, IID_Mirage); 30 if (cmpMirage) 31 return VIS_HIDDEN; 36 return this.activated; 37 }; 32 38 33 return VIS_VISIBLE; 34 } 39 /** 40 * This function is called if IsActivated returns true. 41 * If so, the return value supersedes the visibility computed by the range manager. 42 * isVisible: true if the entity is in the vision range of a unit, false otherwise 43 * isExplored: true if the entity is in explored territory, false otherwise 44 */ 45 Visibility.prototype.GetVisibility = function(player, isVisible, isExplored) 46 { 47 if (!this.activated) 48 warn("The Visibility component was asked to provide a superseding visibility while not activated, this should not happen"); 35 49 36 // Fogged if the 'retain in fog' flag is set, and in a non-visible explored region 37 if (!forceRetainInFog && !this.GetRetainInFog()) 38 return VIS_HIDDEN; 39 40 var cmpMirage = Engine.QueryInterface(this.entity, IID_Mirage); 41 if (cmpMirage && cmpMirage.GetPlayer() == player) 42 return VIS_FOGGED; 43 44 var cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); 45 if (!cmpOwnership) 46 return VIS_FOGGED; 47 48 if (cmpOwnership.GetOwner() == player) 50 if (this.preview) 49 51 { 50 var cmpFogging = Engine.QueryInterface(this.entity, IID_Fogging); 51 if (!cmpFogging) 52 return VIS_FOGGED; 52 // For the owner only, mock the "RetainInFog" behaviour 53 53 54 // Fogged entities must not disappear while the mirage is not ready55 if ( !cmpFogging.IsMiraged(player))56 return VIS_FOGGED;54 let cmpOwnership = Engine.QueryInterface(this.entity, IID_Ownership); 55 if (cmpOwnership && cmpOwnership.GetOwner() == player && isExplored) 56 return isVisible ? VIS_VISIBLE : VIS_FOGGED; 57 57 58 58 return VIS_HIDDEN; 59 59 } 60 60 61 // Fogged entities must not disappear while the mirage is not ready 62 var cmpFogging = Engine.QueryInterface(this.entity, IID_Fogging); 63 if (cmpFogging && cmpFogging.WasSeen(player) && !cmpFogging.IsMiraged(player)) 64 return VIS_FOGGED; 65 66 return VIS_HIDDEN; 61 return VIS_VISIBLE; 67 62 }; 68 63 69 64 Visibility.prototype.GetRetainInFog = function() 70 65 { 71 return this. template.RetainInFog == "true";66 return this.retainInFog; 72 67 }; 73 68 74 69 Visibility.prototype.GetAlwaysVisible = function() 75 70 { 76 return this. template.AlwaysVisible == "true";71 return this.alwaysVisible; 77 72 }; 78 73 79 74 Engine.RegisterComponentType(IID_Visibility, "Visibility", Visibility); -
binaries/data/mods/public/simulation/templates/special/actor.xml
9 9 <Visibility> 10 10 <RetainInFog>true</RetainInFog> 11 11 <AlwaysVisible>false</AlwaysVisible> 12 <Preview>false</Preview> 12 13 </Visibility> 13 14 <Vision> 14 15 <Range>0</Range> -
binaries/data/mods/public/simulation/templates/template_gaia.xml
23 23 <Visibility> 24 24 <RetainInFog>true</RetainInFog> 25 25 <AlwaysVisible>false</AlwaysVisible> 26 <Preview>false</Preview> 26 27 </Visibility> 27 28 <Vision> 28 29 <Range>0</Range> -
binaries/data/mods/public/simulation/templates/template_rubble.xml
17 17 <Visibility> 18 18 <RetainInFog>true</RetainInFog> 19 19 <AlwaysVisible>false</AlwaysVisible> 20 <Preview>false</Preview> 20 21 </Visibility> 21 22 <Vision> 22 23 <Range>0</Range> -
binaries/data/mods/public/simulation/templates/template_structure.xml
105 105 <Visibility> 106 106 <RetainInFog>true</RetainInFog> 107 107 <AlwaysVisible>false</AlwaysVisible> 108 <Preview>false</Preview> 108 109 </Visibility> 109 110 <Vision> 110 111 <Range>40</Range> -
binaries/data/mods/public/simulation/templates/template_structure_gaia_settlement.xml
29 29 <Visibility> 30 30 <RetainInFog>true</RetainInFog> 31 31 <AlwaysVisible>false</AlwaysVisible> 32 <Preview>false</Preview> 32 33 </Visibility> 33 34 <Vision> 34 35 <Range>0</Range> -
binaries/data/mods/public/simulation/templates/template_unit.xml
118 118 <Visibility> 119 119 <RetainInFog>false</RetainInFog> 120 120 <AlwaysVisible>false</AlwaysVisible> 121 <Preview>false</Preview> 121 122 </Visibility> 122 123 <Vision> 123 124 <Range>10</Range> -
binaries/data/mods/public/simulation/templates/template_unit_fauna_decorative.xml
41 41 <Visibility> 42 42 <RetainInFog>true</RetainInFog> 43 43 <AlwaysVisible>false</AlwaysVisible> 44 <Preview>false</Preview> 44 45 </Visibility> 45 46 <Vision> 46 47 <Range>0</Range> -
source/graphics/GameView.cpp
1 /* Copyright (C) 201 4Wildfire Games.1 /* Copyright (C) 2015 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 717 717 CmpPtr<ICmpPosition> cmpPosition(*(m->Game->GetSimulation2()), m->FollowEntity); 718 718 CmpPtr<ICmpRangeManager> cmpRangeManager(*(m->Game->GetSimulation2()), SYSTEM_ENTITY); 719 719 if (cmpPosition && cmpPosition->IsInWorld() && 720 cmpRangeManager && cmpRangeManager->GetLosVisibility(m->FollowEntity, m->Game->GetPlayerID() , false) == ICmpRangeManager::VIS_VISIBLE)720 cmpRangeManager && cmpRangeManager->GetLosVisibility(m->FollowEntity, m->Game->GetPlayerID()) == ICmpRangeManager::VIS_VISIBLE) 721 721 { 722 722 // Get the most recent interpolated position 723 723 float frameOffset = m->Game->GetSimulation2()->GetLastFrameOffset(); -
source/ps/TemplateLoader.cpp
388 388 CParamNode::LoadXMLString(out, "<Entity><VisualActor><DisableShadows/></VisualActor></Entity>"); 389 389 390 390 // Previews should always be visible in fog-of-war/etc 391 CParamNode::LoadXMLString(out, "<Entity><Visibility><RetainInFog>false</RetainInFog><AlwaysVisible>true</AlwaysVisible>< /Visibility></Entity>");391 CParamNode::LoadXMLString(out, "<Entity><Visibility><RetainInFog>false</RetainInFog><AlwaysVisible>true</AlwaysVisible><Preview>true</Preview></Visibility></Entity>"); 392 392 } 393 393 394 394 if (corpse) … … 402 402 CParamNode::LoadXMLString(out, "<Entity><VisualActor><SilhouetteDisplay>false</SilhouetteDisplay></VisualActor></Entity>"); 403 403 404 404 // Corpses should remain visible in fog-of-war 405 CParamNode::LoadXMLString(out, "<Entity><Visibility><RetainInFog>true</RetainInFog><AlwaysVisible>false</AlwaysVisible>< /Visibility></Entity>");405 CParamNode::LoadXMLString(out, "<Entity><Visibility><RetainInFog>true</RetainInFog><AlwaysVisible>false</AlwaysVisible><Preview>false</Preview></Visibility></Entity>"); 406 406 } 407 407 } 408 408 … … 437 437 438 438 // Set the entity as mirage entity 439 439 CParamNode::LoadXMLString(out, "<Entity><Mirage/></Entity>"); 440 CParamNode::LoadXMLString(out, "<Entity><Visibility><RetainInFog>true</RetainInFog><AlwaysVisible>false</AlwaysVisible>< /Visibility></Entity>");440 CParamNode::LoadXMLString(out, "<Entity><Visibility><RetainInFog>true</RetainInFog><AlwaysVisible>false</AlwaysVisible><Preview>false</Preview></Visibility></Entity>"); 441 441 } 442 442 443 443 void CTemplateLoader::CopyFoundationSubset(CParamNode& out, const CParamNode& in) -
source/simulation2/components/CCmpRangeManager.cpp
1386 1386 return CLosQuerier(GetSharedLosMask(player), m_LosState, m_TerrainVerticesPerSide); 1387 1387 } 1388 1388 1389 ELosVisibility ComputeLosVisibility(CEntityHandle ent, player_id_t player , bool forceRetainInFog)1389 ELosVisibility ComputeLosVisibility(CEntityHandle ent, player_id_t player) 1390 1390 { 1391 1391 // Entities not with positions in the world are never visible 1392 1392 if (ent.GetId() == INVALID_ENTITY) … … 1413 1413 return VIS_VISIBLE; 1414 1414 } 1415 1415 1416 // Visible if within a visible region1416 // Get visible regions 1417 1417 CLosQuerier los(GetSharedLosMask(player), m_LosState, m_TerrainVerticesPerSide); 1418 1418 1419 // Ask the Visibility component about special situations 1420 CmpPtr<ICmpVisibility> cmpVisibility(ent); 1421 if (cmpVisibility && cmpVisibility->IsActivated()) 1422 return cmpVisibility->GetVisibility(player, los.IsVisible(i, j), los.IsExplored(i, j)); 1423 1424 // Else, default behavior 1425 1426 if (los.IsVisible(i, j)) 1427 return VIS_VISIBLE; 1428 1419 1429 if (!los.IsExplored(i, j)) 1420 1430 return VIS_HIDDEN; 1421 1431 1422 // Try to ask the Visibility component of the entity, if any 1423 CmpPtr<ICmpVisibility> cmpVisibility(ent); 1424 if (cmpVisibility) 1425 return cmpVisibility->GetLosVisibility(player, los.IsVisible(i, j), forceRetainInFog); 1432 // Invisible if the 'retain in fog' flag is not set, and in a non-visible explored region 1433 if (!(cmpVisibility && cmpVisibility->GetRetainInFog())) 1434 return VIS_HIDDEN; 1426 1435 1427 // Default behaviour 1428 if (los.IsVisible(i, j)) 1436 if (cmpMirage && cmpMirage->GetPlayer() == player) 1437 return VIS_FOGGED; 1438 1439 CmpPtr<ICmpOwnership> cmpOwnership(ent); 1440 if (!cmpOwnership) 1429 1441 return VIS_VISIBLE; 1430 1431 if (forceRetainInFog) 1442 1443 if (cmpOwnership->GetOwner() == player) 1444 { 1445 CmpPtr<ICmpFogging> cmpFogging(ent); 1446 if (!cmpFogging) 1447 return VIS_VISIBLE; 1448 1449 // Fogged entities must not disappear while the mirage is not ready 1450 if (!cmpFogging->IsMiraged(player)) 1451 return VIS_FOGGED; 1452 1453 return VIS_HIDDEN; 1454 } 1455 1456 // Fogged entities must not disappear while the mirage is not ready 1457 CmpPtr<ICmpFogging> cmpFogging(ent); 1458 if (cmpFogging && cmpFogging->WasSeen(player) && !cmpFogging->IsMiraged(player)) 1432 1459 return VIS_FOGGED; 1433 1460 1434 1461 return VIS_HIDDEN; 1435 1462 } 1436 1463 1437 ELosVisibility ComputeLosVisibility(entity_id_t ent, player_id_t player , bool forceRetainInFog)1464 ELosVisibility ComputeLosVisibility(entity_id_t ent, player_id_t player) 1438 1465 { 1439 1466 CEntityHandle handle = GetSimContext().GetComponentManager().LookupEntityHandle(ent); 1440 return ComputeLosVisibility(handle, player , forceRetainInFog);1467 return ComputeLosVisibility(handle, player); 1441 1468 } 1442 1469 1443 virtual ELosVisibility GetLosVisibility(CEntityHandle ent, player_id_t player , bool forceRetainInFog)1470 virtual ELosVisibility GetLosVisibility(CEntityHandle ent, player_id_t player) 1444 1471 { 1445 1472 entity_id_t entId = ent.GetId(); 1446 1473 … … 1455 1482 i32 n = PosToLosTilesHelper(pos.X, pos.Y); 1456 1483 1457 1484 if (m_DirtyVisibility[n]) 1458 return ComputeLosVisibility(ent, player , forceRetainInFog);1485 return ComputeLosVisibility(ent, player); 1459 1486 1460 1487 if (std::find(m_ModifiedEntities.begin(), m_ModifiedEntities.end(), entId) != m_ModifiedEntities.end()) 1461 return ComputeLosVisibility(ent, player , forceRetainInFog);1488 return ComputeLosVisibility(ent, player); 1462 1489 1463 1490 EntityMap<EntityData>::iterator it = m_EntityData.find(entId); 1464 1491 if (it == m_EntityData.end()) 1465 return ComputeLosVisibility(ent, player , forceRetainInFog);1492 return ComputeLosVisibility(ent, player); 1466 1493 1467 1494 return static_cast<ELosVisibility>(GetPlayerVisibility(it->second.visibilities, player)); 1468 1495 } 1469 1496 1470 virtual ELosVisibility GetLosVisibility(entity_id_t ent, player_id_t player , bool forceRetainInFog)1497 virtual ELosVisibility GetLosVisibility(entity_id_t ent, player_id_t player) 1471 1498 { 1472 1499 CEntityHandle handle = GetSimContext().GetComponentManager().LookupEntityHandle(ent); 1473 return GetLosVisibility(handle, player , forceRetainInFog);1500 return GetLosVisibility(handle, player); 1474 1501 } 1475 1502 1476 1503 i32 PosToLosTilesHelper(entity_pos_t x, entity_pos_t z) … … 1549 1576 for (player_id_t player = 1; player < MAX_LOS_PLAYER_ID+1; ++player) 1550 1577 { 1551 1578 u8 oldVis = GetPlayerVisibility(itEnts->second.visibilities, player); 1552 u8 newVis = ComputeLosVisibility(itEnts->first, player , false);1579 u8 newVis = ComputeLosVisibility(itEnts->first, player); 1553 1580 1554 1581 oldVisibilities.push_back(oldVis); 1555 1582 newVisibilities.push_back(newVis); -
source/simulation2/components/ICmpRangeManager.cpp
1 /* Copyright (C) 201 4Wildfire Games.1 /* Copyright (C) 2015 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 21 21 22 22 #include "simulation2/system/InterfaceScripted.h" 23 23 24 std::string ICmpRangeManager::GetLosVisibility_wrapper(entity_id_t ent, int player , bool forceRetainInFog)24 std::string ICmpRangeManager::GetLosVisibility_wrapper(entity_id_t ent, int player) 25 25 { 26 ELosVisibility visibility = GetLosVisibility(ent, player , forceRetainInFog);26 ELosVisibility visibility = GetLosVisibility(ent, player); 27 27 switch (visibility) 28 28 { 29 29 case VIS_HIDDEN: return "hidden"; … … 51 51 DEFINE_INTERFACE_METHOD_2("SetLosRevealAll", void, ICmpRangeManager, SetLosRevealAll, player_id_t, bool) 52 52 DEFINE_INTERFACE_METHOD_1("GetLosRevealAll", bool, ICmpRangeManager, GetLosRevealAll, player_id_t) 53 53 DEFINE_INTERFACE_METHOD_5("GetElevationAdaptedRange", entity_pos_t, ICmpRangeManager, GetElevationAdaptedRange, CFixedVector3D, CFixedVector3D, entity_pos_t, entity_pos_t, entity_pos_t) 54 DEFINE_INTERFACE_METHOD_ 3("GetLosVisibility", std::string, ICmpRangeManager, GetLosVisibility_wrapper, entity_id_t, player_id_t, bool)54 DEFINE_INTERFACE_METHOD_2("GetLosVisibility", std::string, ICmpRangeManager, GetLosVisibility_wrapper, entity_id_t, player_id_t) 55 55 DEFINE_INTERFACE_METHOD_1("SetLosCircular", void, ICmpRangeManager, SetLosCircular, bool) 56 56 DEFINE_INTERFACE_METHOD_0("GetLosCircular", bool, ICmpRangeManager, GetLosCircular) 57 57 DEFINE_INTERFACE_METHOD_2("SetSharedLos", void, ICmpRangeManager, SetSharedLos, player_id_t, std::vector<player_id_t>) -
source/simulation2/components/ICmpRangeManager.h
1 /* Copyright (C) 201 4Wildfire Games.1 /* Copyright (C) 2015 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 319 319 * Returns the visibility status of the given entity, with respect to the given player. 320 320 * Returns VIS_HIDDEN if the entity doesn't exist or is not in the world. 321 321 * This respects the GetLosRevealAll flag. 322 * If forceRetainInFog is true, the visibility acts as if CCmpVision's RetainInFog flag were set.323 * TODO: This is a hack to allow preview entities in FoW to return fogged instead of hidden,324 * see http://trac.wildfiregames.com/ticket/958325 322 */ 326 virtual ELosVisibility GetLosVisibility(CEntityHandle ent, player_id_t player , bool forceRetainInFog = false) = 0;327 virtual ELosVisibility GetLosVisibility(entity_id_t ent, player_id_t player , bool forceRetainInFog = false) = 0;323 virtual ELosVisibility GetLosVisibility(CEntityHandle ent, player_id_t player) = 0; 324 virtual ELosVisibility GetLosVisibility(entity_id_t ent, player_id_t player) = 0; 328 325 329 326 330 327 /** … … 331 328 * GetLosVisibility wrapped for script calls. 332 329 * Returns "hidden", "fogged" or "visible". 333 330 */ 334 std::string GetLosVisibility_wrapper(entity_id_t ent, player_id_t player , bool forceRetainInFog);331 std::string GetLosVisibility_wrapper(entity_id_t ent, player_id_t player); 335 332 336 333 /** 337 334 * Explore all tiles (but leave them in the FoW) for player p -
source/simulation2/components/ICmpVisibility.cpp
1 /* Copyright (C) 201 4Wildfire Games.1 /* Copyright (C) 2015 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 30 30 public: 31 31 DEFAULT_SCRIPT_WRAPPER(VisibilityScripted) 32 32 33 virtual ICmpRangeManager::ELosVisibility GetLosVisibility(player_id_t player, bool isOutsideFog, bool forceRetainInFog)33 virtual bool IsActivated() 34 34 { 35 int visibility = m_Script.Call<int, player_id_t, bool, bool>("GetLosVisibility", player, isOutsideFog, forceRetainInFog); 35 return m_Script.Call<bool>("IsActivated"); 36 } 36 37 38 virtual ICmpRangeManager::ELosVisibility GetVisibility(player_id_t player, bool isVisible, bool isExplored) 39 { 40 int visibility = m_Script.Call<int, player_id_t, bool, bool>("GetVisibility", player, isVisible, isExplored); 41 37 42 switch (visibility) 38 43 { 39 44 case ICmpRangeManager::VIS_HIDDEN: -
source/simulation2/components/ICmpVisibility.h
1 /* Copyright (C) 201 4Wildfire Games.1 /* Copyright (C) 2015 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * 4 4 * 0 A.D. is free software: you can redistribute it and/or modify … … 22 22 23 23 #include "simulation2/components/ICmpRangeManager.h" 24 24 25 /** 26 * The Visibility component is a scripted component that allows any part of the simulation to 27 * influence the visibility of an entity. 28 * 29 * This component: 30 * - Holds the template values RetainInFog and AlwaysVisible, used by the range manager to compute 31 * the visibility of the entity; 32 * - Can supersede the range manager if it is "activated". This is to avoid useless calls to the scripts. 33 */ 34 25 35 class ICmpVisibility : public IComponent 26 36 { 27 37 public: 28 virtual ICmpRangeManager::ELosVisibility GetLosVisibility(player_id_t player, bool isOutsideFog, bool forceRetainInFog) = 0;38 virtual bool IsActivated() = 0; 29 39 40 virtual ICmpRangeManager::ELosVisibility GetVisibility(player_id_t player, bool isVisible, bool isExplored) = 0; 41 30 42 virtual bool GetRetainInFog() = 0; 31 43 32 44 virtual bool GetAlwaysVisible() = 0;