From 575695db26a4faca4011e4eb4760517fb7f40a38 Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Sat, 6 Feb 2010 09:45:44 +0000 Subject: [PATCH] Indent another file --- include/ITrackSegment.hpp | 180 +++++++++++++++++++------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/include/ITrackSegment.hpp b/include/ITrackSegment.hpp index b9a54f5..176f02a 100644 --- a/include/ITrackSegment.hpp +++ b/include/ITrackSegment.hpp @@ -25,66 +25,66 @@ #include namespace xml { - struct element; + struct element; } // Types used for specifying track segments namespace track { - // TODO: This only needs (x, y) position and should contain - // separate layer field - but will do for now - typedef Point Position; - typedef Vector Direction; + // TODO: This only needs (x, y) position and should contain + // separate layer field - but will do for now + typedef Point Position; + typedef Vector Direction; - // Uniquely identifies the location of a train and its orientation - // along a piece of track - // Used for verifying whether bits of track can join together - typedef std::pair Connection; - - // Angles for curved track - typedef int Angle; - - struct TravelToken; - typedef function TransformFunc; - - // Choices that the player may make for a track segment - enum Choice { - CHOOSE_STRAIGHT_ON, - CHOOSE_GO_LEFT, - CHOOSE_GO_RIGHT - }; + // Uniquely identifies the location of a train and its orientation + // along a piece of track + // Used for verifying whether bits of track can join together + typedef std::pair Connection; + + // Angles for curved track + typedef int Angle; + + struct TravelToken; + typedef function TransformFunc; + + // Choices that the player may make for a track segment + enum Choice { + CHOOSE_STRAIGHT_ON, + CHOOSE_GO_LEFT, + CHOOSE_GO_RIGHT + }; - // Sums up all the information required to travel along a piece - // of track - struct TravelToken { - // Direction of travel at /entry/ - Direction direction; + // Sums up all the information required to travel along a piece + // of track + struct TravelToken { + // Direction of travel at /entry/ + Direction direction; - // Position of entry - Position position; + // Position of entry + Position position; - // Default choice - Choice activeChoice; + // Default choice + Choice activeChoice; - // A function that transforms the location of the train - // so it will render in the correct place for this track segment - // The functions assumes that it is initially placed at the origin - TransformFunc transformer; - - // Wrapper for the above - void transform(double aDelta) const - { - transformer(*this, aDelta); - } + // A function that transforms the location of the train + // so it will render in the correct place for this track segment + // The functions assumes that it is initially placed at the origin + TransformFunc transformer; + + // Wrapper for the above + void transform(double aDelta) const + { + transformer(*this, aDelta); + } - // Choices available to the player - set choices; - }; + // Choices available to the player + set choices; + }; } // Orientations for straight track namespace axis { - const track::Direction X = makeVector(1, 0, 0); - const track::Direction Y = makeVector(0, 0, 1); + const track::Direction X = makeVector(1, 0, 0); + const track::Direction Y = makeVector(0, 0, 1); } struct ITrackSegment; @@ -93,59 +93,59 @@ typedef std::tr1::shared_ptr ITrackSegmentPtr; // A segment of track which fits over a number of tiles // Each track segment has an origin and one or more exits struct ITrackSegment { - virtual ~ITrackSegment() {} + virtual ~ITrackSegment() {} - // Render the track with the origin in the centre - virtual void render() const = 0; + // Render the track with the origin in the centre + virtual void render() const = 0; - // Set the absolute position of the track in the world - virtual void setOrigin(int x, int y) = 0; + // Set the absolute position of the track in the world + virtual void setOrigin(int x, int y) = 0; - // Get the length of this track segment - virtual double segmentLength(const track::TravelToken& aToken) const = 0; + // Get the length of this track segment + virtual double segmentLength(const track::TravelToken& aToken) const = 0; - // Get a travel token for this track segment starting at a particular - // position and moving in a particular direciton - virtual track::TravelToken getTravelToken(track::Position aPosition, - track::Direction aDirection) const = 0; - - // True if a train can travel in this direction along the track - virtual bool isValidDirection(const track::Direction& aDirection) const = 0; + // Get a travel token for this track segment starting at a particular + // position and moving in a particular direciton + virtual track::TravelToken getTravelToken(track::Position aPosition, + track::Direction aDirection) const = 0; + + // True if a train can travel in this direction along the track + virtual bool isValidDirection(const track::Direction& aDirection) const = 0; - // Return the position of the next segment of track and the - // orientation of the train. - // Note that this may not actually be a valid track segment! - // You should call IMap::isValidTrack before using it (this - // will happen, e.g. if the train runs off the end of the line) - // The token passed here must have been generated by this track - // segment when the train entered it. - virtual track::Connection nextPosition(const track::TravelToken& aToken) - const = 0; - - // Add all the endpoints of the track segment to the given list - // Note that an endpoint is not the same as what is returned - // from `nextPosition' - e.g. a straight track that takes up - // one tile has a single endpoint which is its origin - virtual void getEndpoints(std::list >& aList) const = 0; - - // Add an exit to this section of track possibly generating - // a new track segment - // If this is not possible a null pointer is returned - // If it can be merged a new track segment is returned that - // may be bigger than the origin segment - // The track may already have an exit here in which case - // a pointer to itself will be returned - virtual ITrackSegmentPtr mergeExit(const Point& aPoint, - const track::Direction& aDirection) = 0; - - // Convert the track segment to XML for writing out in the - // map configuration file - virtual xml::element toXml() const = 0; + // Return the position of the next segment of track and the + // orientation of the train. + // Note that this may not actually be a valid track segment! + // You should call IMap::isValidTrack before using it (this + // will happen, e.g. if the train runs off the end of the line) + // The token passed here must have been generated by this track + // segment when the train entered it. + virtual track::Connection nextPosition(const track::TravelToken& aToken) + const = 0; + + // Add all the endpoints of the track segment to the given list + // Note that an endpoint is not the same as what is returned + // from `nextPosition' - e.g. a straight track that takes up + // one tile has a single endpoint which is its origin + virtual void getEndpoints(std::list >& aList) const = 0; + + // Add an exit to this section of track possibly generating + // a new track segment + // If this is not possible a null pointer is returned + // If it can be merged a new track segment is returned that + // may be bigger than the origin segment + // The track may already have an exit here in which case + // a pointer to itself will be returned + virtual ITrackSegmentPtr mergeExit(const Point& aPoint, + const track::Direction& aDirection) = 0; + + // Convert the track segment to XML for writing out in the + // map configuration file + virtual xml::element toXml() const = 0; }; ITrackSegmentPtr makeStraightTrack(const track::Direction& aDirection); ITrackSegmentPtr makeCurvedTrack(track::Angle aStartAngle, - track::Angle aFinishAngle, int aRadius); + track::Angle aFinishAngle, int aRadius); ITrackSegmentPtr makeCrossoverTrack(); ITrackSegmentPtr makePoints(track::Direction aDirection, bool reflect); -- 2.39.2