Opened 12 years ago

Closed 12 years ago

#1574 closed enhancement (fixed)

[PATCH] Show shallows (walkable water) on minimap.

Reported by: wraitii Owned by: wraitii
Priority: Should Have Milestone: Alpha 11
Component: UI & Simulation Keywords: minimap shallows
Cc: Patch:

Description

I couldn't find any post discussing why this wasn't in the game yet, so I assume it's because no-one put it in.

The attached patch reads the value from "pathfinder.xml" for maximum depth of passable water (assuming "default"), stores it and uses it to display shallow water in a lighter color, to clearly show where units can traverse and where they can't. It's neat on map such as the RM "Rivers".

Attachments (2)

shallowsOnMinimap.patch (1.9 KB ) - added by wraitii 12 years ago.
shallowsOnMinimap.2.patch (2.1 KB ) - added by wraitii 12 years ago.

Download all attachments as: .zip

Change History (7)

by wraitii, 12 years ago

Attachment: shallowsOnMinimap.patch added

comment:1 by historic_bruno, 12 years ago

Nice idea, it seems to work correctly. Looks like ICmpTerritoryManager.h got included twice by mistake in MiniMap.cpp. You might want to use some ENSURE statements because you're relying on the existence of a "default" passability class with a MaxWaterDepth element (CParamNodes have an IsOk() method for verifying the node exists). It looks like nothing awful will happen if they don't exist, ToFloat() will return 0, but it would be a difficult bug to find.

by wraitii, 12 years ago

Attachment: shallowsOnMinimap.2.patch added

comment:2 by wraitii, 12 years ago

Changed the code to explicitly handle the case where there is no "default" passability class... I don't check for the existence of passability classes or the pathfinder file itself because I believe other things would break before.

This changes nothing, as "0" means "no shallows", but it makes it more explicit. (I commented include "ICmpTerritoryManager.h" to check if it was needed... It actually seems not to be, I forgot to remove it).

comment:3 by historic_bruno, 12 years ago

I think you can commit the patch, and indeed ICmpTerritoryManager is never referenced in that file so just remove the include.

comment:4 by wraitii, 12 years ago

Okay, committed in #12277.

comment:5 by wraitii, 12 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.