autoslope.h

Go to the documentation of this file.
00001 /* $Id: autoslope.h 18809 2010-01-15 16:41:15Z rubidium $ */
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 AUTOSLOPE_H
00013 #define AUTOSLOPE_H
00014 
00015 #include "company_func.h"
00016 #include "depot_func.h"
00017 #include "slope_func.h"
00018 #include "tile_map.h"
00019 #include "openttd.h"
00020 
00035 static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, uint z_new, Slope tileh_new, DiagDirection entrance)
00036 {
00037   if (IsSteepSlope(tileh_new) || (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new))) return false;
00038   return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new));
00039 }
00040 
00048 static inline bool AutoslopeEnabled()
00049 {
00050   return (_settings_game.construction.autoslope &&
00051           (_current_company < MAX_COMPANIES ||
00052            (_current_company == OWNER_NONE && _game_mode == GM_EDITOR)));
00053 }
00054 
00055 #endif /* AUTOSLOPE_H */

Generated on Thu Feb 4 17:20:22 2010 for OpenTTD by  doxygen 1.5.6