From 09662eea246c93a4cc19bdd0aa9233261f26942f Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Fri, 5 Jun 2009 15:25:15 +0100 Subject: [PATCH] Store stations in map tiles --- include/IStation.hpp | 7 +++++++ src/Map.cpp | 10 ++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/include/IStation.hpp b/include/IStation.hpp index 372089a..4697b13 100644 --- a/include/IStation.hpp +++ b/include/IStation.hpp @@ -20,8 +20,15 @@ #include +// The different types of cargo that may be carried +enum Cargo { + COAL +}; + // A station occupies one of more track segments and supplies and // accepts a set of cargo +// The information about which track segments it actually occupies +// are stored in the map struct IStation { virtual ~IStation() {} }; diff --git a/src/Map.cpp b/src/Map.cpp index 3e6d0cb..26d4ceb 100644 --- a/src/Map.cpp +++ b/src/Map.cpp @@ -24,6 +24,7 @@ #include "IXMLParser.hpp" #include "XMLBuilder.hpp" #include "IMesh.hpp" +#include "IStation.hpp" #include #include @@ -105,7 +106,8 @@ public: private: // Tiles on the map struct Tile { - TrackNodePtr track; // Track at this location, if any + TrackNodePtr track; // Track at this location, if any + IStationPtr station; // Station on this tile, if any } *myTiles; // Vertices on the terrain @@ -495,9 +497,9 @@ void Map::buildMesh(int id, Point botLeft, Point topRight) static const tuple colourMap[] = { // Start height colour make_tuple( 5.0f, RGB(255, 255, 255) ), - make_tuple( 3.0f, RGB(187, 156, 83) ), - make_tuple( 0.0f, RGB(133, 204, 98) ), - make_tuple( -1.0f, RGB(224, 223, 134) ), + make_tuple( 3.0f, RGB(187, 156, 83) ), + make_tuple( 0.0f, RGB(133, 204, 98) ), + make_tuple( -1.0f, RGB(224, 223, 134) ), make_tuple( -1e10f, RGB(178, 247, 220) ) }; -- 2.39.2