# town_type.h

Go to the documentation of this file.

    00001 /* $Id$ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
    00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
    00008  */
    00009
    00012 #ifndef TOWN_TYPE_H
    00013 #define TOWN_TYPE_H
    00014
    00015 #include "core/enum_type.hpp"
    00016
    00017 typedef uint16 TownID;
    00018 struct Town;
    00019
    00021 enum TownSize {
    00022   TSZ_SMALL,
    00023   TSZ_MEDIUM,
    00024   TSZ_LARGE,
    00025   TSZ_RANDOM,
    00026
    00027   TSZ_END,
    00028 };
    00029 template <> struct EnumPropsT<TownSize> : MakeEnumPropsT<TownSize, byte, TSZ_SMALL, TSZ_END, TSZ_END, 2> {};
    00030
    00031 enum Ratings {
    00032   /* These refer to the maximums, so Appalling is -1000 to -400
    00033    * MAXIMUM RATINGS BOUNDARIES */
    00034   RATING_MINIMUM     = -1000,
    00035   RATING_APPALLING   =  -400,
    00036   RATING_VERYPOOR    =  -200,
    00037   RATING_POOR        =     0,
    00038   RATING_MEDIOCRE    =   200,
    00039   RATING_GOOD        =   400,
    00040   RATING_VERYGOOD    =   600,
    00041   RATING_EXCELLENT   =   800,
    00042   RATING_OUTSTANDING =  1000,
    00043
    00044   RATING_MAXIMUM = RATING_OUTSTANDING,
    00045
    00046   RATING_INITIAL = 500,
    00047
    00048   /* RATINGS AFFECTING NUMBERS */
    00049   RATING_TREE_DOWN_STEP = -35,
    00050   RATING_TREE_MINIMUM   = RATING_MINIMUM,
    00051   RATING_TREE_UP_STEP   = 7,
    00052   RATING_TREE_MAXIMUM   = 220,
    00053
    00054   RATING_GROWTH_UP_STEP    =   5,
    00055   RATING_GROWTH_MAXIMUM    = RATING_MEDIOCRE,
    00056   RATING_STATION_UP_STEP   =  12,
    00057   RATING_STATION_DOWN_STEP = -15,
    00058
    00059   RATING_TUNNEL_BRIDGE_DOWN_STEP = -250,
    00060   RATING_TUNNEL_BRIDGE_MINIMUM   =    0,
    00061   RATING_TUNNEL_BRIDGE_NEEDED_PERMISSIVE = 144,
    00062   RATING_TUNNEL_BRIDGE_NEEDED_NEUTRAL    = 208,
    00063   RATING_TUNNEL_BRIDGE_NEEDED_HOSTILE    = 400,
    00064
    00065   RATING_ROAD_DOWN_STEP_INNER =  -50,
    00066   RATING_ROAD_DOWN_STEP_EDGE  =  -18,
    00067   RATING_ROAD_MINIMUM         = -100,
    00068   RATING_ROAD_NEEDED_PERMISSIVE =  16,
    00069   RATING_ROAD_NEEDED_NEUTRAL    =  64,
    00070   RATING_ROAD_NEEDED_HOSTILE    = 112,
    00071
    00072   RATING_HOUSE_MINIMUM  = RATING_MINIMUM,
    00073
    00074   RATING_BRIBE_UP_STEP = 200,
    00075   RATING_BRIBE_MAXIMUM = 800,
    00076   RATING_BRIBE_DOWN_TO = -50        // XXX SHOULD BE SOMETHING LOWER?
    00077 };
    00078
    00082 enum TownLayout {
    00083   TL_BEGIN = 0,
    00084   TL_ORIGINAL = 0,
    00085   TL_BETTER_ROADS,
    00086   TL_2X2_GRID,
    00087   TL_3X3_GRID,
    00088
    00089   TL_RANDOM,
    00090
    00091   NUM_TLS,
    00092 };
    00093 template <> struct EnumPropsT<TownLayout> : MakeEnumPropsT<TownLayout, byte, TL_BEGIN, NUM_TLS, NUM_TLS, 3> {};
    00095 typedef SimpleTinyEnumT<TownLayout, byte> TownLayoutByte; // typedefing-enumification of TownLayout
    00096
    00098 enum TownFounding {
    00099   TF_BEGIN = 0,
    00100   TF_FORBIDDEN = 0,
    00101   TF_ALLOWED,
    00102   TF_CUSTOM_LAYOUT,
    00103   TF_END,
    00104 };
    00106 typedef SimpleTinyEnumT<TownFounding, byte> TownFoundingByte;
    00107
    00108 static const uint MAX_LENGTH_TOWN_NAME_CHARS = 32;
    00109
    00111 template <typename Tstorage>
    00112 struct TransportedCargoStat {
    00113   Tstorage old_max;
    00114   Tstorage new_max;
    00115   Tstorage old_act;
    00116   Tstorage new_act;
    00117
    00118   TransportedCargoStat() : old_max(0), new_max(0), old_act(0), new_act(0) {}
    00119
    00121   void NewMonth()
    00122   {
    00123     this->old_max = this->new_max; this->new_max = 0;
    00124     this->old_act = this->new_act; this->new_act = 0;
    00125   }
    00126 };
    00127
    00128 #endif /* TOWN_TYPE_H */