~ubuntu-branches/ubuntu/maverick/lordsawar/maverick

« back to all changes in this revision

Viewing changes to src/road.h

  • Committer: Bazaar Package Importer
  • Author(s): Barry deFreese
  • Date: 2010-04-10 09:29:33 UTC
  • mfrom: (1.1.9 upstream) (5.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20100410092933-23uq4dxig30kmtcw
Tags: 0.1.8-1
* New upstream release.
* Add misc:Depends for -data package.
* Bump Standards Version to 3.8.4. (No changes needed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
49
49
          CONNECTS_EAST = 13,
50
50
          CONNECTS_SOUTH = 14,
51
51
        };
52
 
        static std::string roadTypeToString(const Road::Type type);
53
 
        static Road::Type roadTypeFromString(const std::string str);
54
52
 
55
53
        //! Default constructor.
56
54
        /**
57
55
          * @param pos          The location of the road.
58
56
          * @param type         The type of road.
59
57
          */
60
 
        Road(Vector<int> pos, int type = 7);
 
58
        Road(Vector<int> pos, int type = CONNECTS_ALL_DIRECTIONS);
61
59
 
62
60
        //! Copy constructor.
63
61
        Road(const Road&);
 
62
 
 
63
        //! Alternative copy constructor that changes the road's position.
 
64
        Road(const Road&, Vector<int> pos);
 
65
 
64
66
        //! Loading constructor.
65
67
        /**
66
68
         * Make a new road object by reading lordsawar.roadlist.road XML 
69
71
         * @param helper  The opened saved-game file to load the road from.
70
72
         */
71
73
        Road(XML_Helper* helper);
 
74
 
72
75
        //! Destructor.
73
76
        ~Road();
74
77
 
 
78
 
 
79
        // Get Methods
 
80
 
75
81
        //! Returns the type of the road.
76
 
        int getType() {return d_type;};
 
82
        int getType() const {return d_type;};
 
83
 
 
84
 
 
85
        // Set Methods
77
86
 
78
87
        //! Sets the type of the road.
79
88
        void setType(int type) {d_type = type;};
80
89
 
 
90
 
 
91
        // Methods that operate on class data but do not modify the class
 
92
 
81
93
        //! Save the road data to an opened saved-game file.
82
94
        bool save(XML_Helper* helper) const;
83
95
 
 
96
 
 
97
        // Static Methods
 
98
 
 
99
        //! Convert a Road::Type enumerated value to a string.
 
100
        static std::string roadTypeToString(const Road::Type type);
 
101
 
 
102
        //! Convert a string containing a Road::Type to it's enumerated value.
 
103
        static Road::Type roadTypeFromString(const std::string str);
 
104
 
84
105
    protected:
 
106
 
 
107
        // DATA
 
108
 
85
109
        //! The type of the road.
86
110
        /**
87
111
         * The type of road refers to the look of the road on the map.  It 
88
 
         * can be any one of the following values:
89
 
         * 0 = a road that connects to other roads to the east and the west.
90
 
         * 1 = a road that connects to other roads to the north and the south.
91
 
         * 2 = a road that connects to other roads to all directions.
92
 
         * 3 = a road that connects to other roads to the north and the west.
93
 
         * 4 = a road that connects to other roads to the north and the east.
94
 
         * 5 = a road that connects to other roads to the south and the east.
95
 
         * 6 = a road that connects to other roads to the west and the south.
96
 
         * 7 = a road that connects to roads to the north, south and east.
97
 
         * 8 = a road that connects to roads to east, west and north.
98
 
         * 9 = a road that connects to roads to the east, west, and south.
99
 
         * 10 = a road that connects to roads to the north, south and west.
 
112
         * can be any one of the values found in Road::Type.
100
113
         *
101
 
         * The Roadlist::calculateType method can sometimes set this value.
 
114
         * The Roadlist::calculateType method can calculate this value.
102
115
         */
103
116
        int d_type;
104
117