Ticket #1574: shallowsOnMinimap.2.patch

File shallowsOnMinimap.2.patch, 2.1 KB (added by wraitii, 12 years ago)
  • source/gui/MiniMap.h

     
    7777
    7878    // 1.f if map is circular or 1.414f if square (to shrink it inside the circle)
    7979    float m_MapScale;
     80   
     81    // maximal water height to allow the passage of a unit (for underwater shallows).
     82    float m_ShallowPassageHeight;
    8083
    8184    void DrawTexture(float coordMax, float angle, float x, float y, float x2, float y2, float z);
    8285
  • source/gui/MiniMap.cpp

     
    4040#include "scriptinterface/ScriptInterface.h"
    4141#include "simulation2/Simulation2.h"
    4242#include "simulation2/components/ICmpMinimap.h"
    43 #include "simulation2/components/ICmpTerritoryManager.h"
     43//#include "simulation2/components/ICmpTerritoryManager.h"
     44#include "simulation2/system/ParamNode.h"
    4445
    4546bool g_GameRestarted = false;
    4647
     
    6061    AddSetting(GUIST_CStr,      "tooltip_style");
    6162    m_Clicking = false;
    6263    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;
    6373}
    6474
    6575CMiniMap::~CMiniMap()
     
    498508                    + m_Terrain->GetVertexGroundLevel((int)i+1, (int)j+1)
    499509                ) / 4.0f;
    500510
    501             if(avgHeight < waterHeight)
     511            if(avgHeight < waterHeight && avgHeight > waterHeight - m_ShallowPassageHeight)
    502512            {
     513                // shallow water
     514                *dataPtr++ = 0xff7098c0;
     515            } else if (avgHeight < waterHeight)
     516            {
    503517                // Set water as constant color for consistency on different maps
    504518                *dataPtr++ = 0xff5078a0;
    505519            }