summaryrefslogtreecommitdiff
path: root/src/smallmap_gui.cpp
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-02-06 19:18:09 +0000
committeralberth <alberth@openttd.org>2010-02-06 19:18:09 +0000
commit5cd81526d8913e0fa1caf5aec3e2be6e95bb8dc8 (patch)
tree0e5e1f103136aa145035338f9b35cbdf58da0a66 /src/smallmap_gui.cpp
parent97341248352966a975654ed7098bb7b038df1f55 (diff)
downloadopenttd-5cd81526d8913e0fa1caf5aec3e2be6e95bb8dc8.tar.xz
(svn r19046) -Codechange: Move retrieval of tile colour data in smallmap.
Diffstat (limited to 'src/smallmap_gui.cpp')
-rw-r--r--src/smallmap_gui.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/smallmap_gui.cpp b/src/smallmap_gui.cpp
index 24b72aca6..05fe9cc2f 100644
--- a/src/smallmap_gui.cpp
+++ b/src/smallmap_gui.cpp
@@ -586,14 +586,15 @@ class SmallMapWindow : public Window {
}
/**
- * Decide which tile to show to the user from a group of tiles.
- * @param ta Tile area to investigate.
- * @return Most interesting tile. May be #INVALID_TILE if off-map.
+ * Decide which colours to show to the user for a group of tiles.
+ * @param ta Tile area to investigate.
+ * @param proc Pointer to the colour function.
+ * @return Colours to display.
*/
- inline TileIndex GetMostImportantTileFromGroup(const TileArea &ta) const
+ inline uint32 GetTileColours(const TileArea &ta, GetSmallMapPixels *proc) const
{
int importance = 0;
- TileIndex tile = INVALID_TILE;
+ TileIndex tile = INVALID_TILE; // Position of the most important tile.
TILE_AREA_LOOP(ti, ta) {
TileType ttype = GetEffectiveTileType(ti);
@@ -602,7 +603,7 @@ class SmallMapWindow : public Window {
tile = ti;
}
}
- return tile;
+ return proc(tile);
}
/**
@@ -644,7 +645,7 @@ class SmallMapWindow : public Window {
}
ta.ClampToMap(); // Clamp to map boundaries (may contain MP_VOID tiles!).
- uint32 val = proc(this->GetMostImportantTileFromGroup(ta));
+ uint32 val = this->GetTileColours(ta, proc);
uint8 *val8 = (uint8 *)&val;
int idx = max(0, -start_pos);
for (int pos = max(0, start_pos); pos < end_pos; pos++) {