Ticket #1574: shallowsOnMinimap.2.patch
File shallowsOnMinimap.2.patch, 2.1 KB (added by , 12 years ago) |
---|
-
source/gui/MiniMap.h
77 77 78 78 // 1.f if map is circular or 1.414f if square (to shrink it inside the circle) 79 79 float m_MapScale; 80 81 // maximal water height to allow the passage of a unit (for underwater shallows). 82 float m_ShallowPassageHeight; 80 83 81 84 void DrawTexture(float coordMax, float angle, float x, float y, float x2, float y2, float z); 82 85 -
source/gui/MiniMap.cpp
40 40 #include "scriptinterface/ScriptInterface.h" 41 41 #include "simulation2/Simulation2.h" 42 42 #include "simulation2/components/ICmpMinimap.h" 43 #include "simulation2/components/ICmpTerritoryManager.h" 43 //#include "simulation2/components/ICmpTerritoryManager.h" 44 #include "simulation2/system/ParamNode.h" 44 45 45 46 bool g_GameRestarted = false; 46 47 … … 60 61 AddSetting(GUIST_CStr, "tooltip_style"); 61 62 m_Clicking = false; 62 63 m_MouseHovering = false; 64 65 // Get the maximum height for unit passage in water. 66 CParamNode externalParamNode; 67 CParamNode::LoadXML(externalParamNode, L"simulation/data/pathfinder.xml"); 68 const CParamNode pathingSettings = externalParamNode.GetChild("Pathfinder").GetChild("PassabilityClasses"); 69 if (pathingSettings.GetChild("default").IsOk() && pathingSettings.GetChild("default").GetChild("MaxWaterDepth").IsOk()) 70 m_ShallowPassageHeight = pathingSettings.GetChild("default").GetChild("MaxWaterDepth").ToFloat(); 71 else 72 m_ShallowPassageHeight = 0.0f; 63 73 } 64 74 65 75 CMiniMap::~CMiniMap() … … 498 508 + m_Terrain->GetVertexGroundLevel((int)i+1, (int)j+1) 499 509 ) / 4.0f; 500 510 501 if(avgHeight < waterHeight )511 if(avgHeight < waterHeight && avgHeight > waterHeight - m_ShallowPassageHeight) 502 512 { 513 // shallow water 514 *dataPtr++ = 0xff7098c0; 515 } else if (avgHeight < waterHeight) 516 { 503 517 // Set water as constant color for consistency on different maps 504 518 *dataPtr++ = 0xff5078a0; 505 519 }