| 1 | /*************************************************************************** |
| 2 | pathstructure.h - description |
| 3 | ------------------- |
| 4 | begin : june 17th, 2003 |
| 5 | copyright : (C) 2003-2007 by Duong Khang NGUYEN |
| 6 | email : neoneurone @ gmail com |
| 7 | |
| 8 | $Id: pathstructure.h 450 2010-11-21 19:11:43Z neoneurone $ |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | /*************************************************************************** |
| 12 | * * |
| 13 | * This program is free software; you can redistribute it and/or modify * |
| 14 | * it under the terms of the GNU General Public License as published by * |
| 15 | * the Free Software Foundation; either version 2 of the License, or * |
| 16 | * any later version. * |
| 17 | * * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | #ifndef _OPENCITY_PATHSTRUCTURE_H_ |
| 21 | #define _OPENCITY_PATHSTRUCTURE_H_ 1 |
| 22 | |
| 23 | #include "structure.h" |
| 24 | |
| 25 | enum OPENCITY_DIRECTION; |
| 26 | |
| 27 | |
| 28 | /** This is a specialization of Structure. It regroups all structures |
| 29 | like Road, Rails, WaterPipe, GasPipe, HighWay, ElecLine etc... |
| 30 | */ |
| 31 | class PathStructure : public Structure { |
| 32 | public: |
| 33 | /** Should not be used */ |
| 34 | PathStructure(); |
| 35 | PathStructure( const OPENCITY_STRUCTURE_CODE & enumStructCode ); |
| 36 | virtual ~PathStructure(); // virtual since Structure's one is |
| 37 | |
| 38 | |
| 39 | //======================================================================== |
| 40 | /** Overload the Structure::SaveTo |
| 41 | \param rfs A reference to a file stream which is ready for writing |
| 42 | \see Structure::SaveTo() |
| 43 | */ |
| 44 | void |
| 45 | SaveTo( std::fstream& rfs ); |
| 46 | |
| 47 | |
| 48 | //======================================================================== |
| 49 | /** Overload the Structure::LoadFrom |
| 50 | \param rfs A reference to a file stream which is ready for reading |
| 51 | \see Structure::LoadFrom |
| 52 | */ |
| 53 | void |
| 54 | LoadFrom( std::fstream& rfs ); |
| 55 | |
| 56 | |
| 57 | void |
| 58 | AddNeighbour( |
| 59 | const PathStructure & rcNeighbour, |
| 60 | const OPENCITY_DIRECTION & enumDir ); |
| 61 | |
| 62 | |
| 63 | void |
| 64 | RemoveNeighbour( |
| 65 | const PathStructure & rcNeighbour, |
| 66 | const OPENCITY_DIRECTION & enumDir ); |
| 67 | |
| 68 | |
| 69 | const OC_BYTE & |
| 70 | GetTraffic() const; |
| 71 | |
| 72 | void |
| 73 | SetTraffic( |
| 74 | const OC_BYTE & rubTraffic ); |
| 75 | |
| 76 | const uint & |
| 77 | GetLength() const; |
| 78 | |
| 79 | void |
| 80 | SetLength( |
| 81 | const uint & rcuiValue ); |
| 82 | |
| 83 | |
| 84 | private: |
| 85 | OC_BYTE ubNumberNeighbour; |
| 86 | OC_BYTE ubTraffic; |
| 87 | |
| 88 | uint uiLength; // for pathfinding purpose |
| 89 | }; |
| 90 | |
| 91 | #endif |