summaryrefslogtreecommitdiff
path: root/depot.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-01-02 19:19:48 +0000
committerrubidium <rubidium@openttd.org>2007-01-02 19:19:48 +0000
commit66bbf336c6af7353ef0aeed58002c46543b30635 (patch)
treead4a63860df2626b22f77e7dac712e958bea54cb /depot.h
parentccc0a3f4dbf58c005b22341ac8874252924690cd (diff)
downloadopenttd-66bbf336c6af7353ef0aeed58002c46543b30635.tar.xz
(svn r7759) -Merge: makefile rewrite. This merge features:
- A proper ./configure, so everything needs to be configured only once, not for every make. - Usage of makedepend when available. This greatly reduces the time needed for generating the dependencies. - A generator for all project files. There is a single file with sources, which is used to generate Makefiles and the project files for MSVC. - Proper support for OSX universal binaries. - Object files for non-MSVC compiles are also placed in separate directories, making is faster to switch between debug and release compiles and it does not touch the directory with the source files. - Functionality to make a bundle of all needed files for for example a nightly or distribution of a binary with all needed GRFs and language files. Note: as this merge moves almost all files, it is recommended to make a backup of your working copy before updating your working copy.
Diffstat (limited to 'depot.h')
-rw-r--r--depot.h112
1 files changed, 0 insertions, 112 deletions
diff --git a/depot.h b/depot.h
deleted file mode 100644
index 7cf25a1b1..000000000
--- a/depot.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* $Id$ */
-
-#ifndef DEPOT_H
-#define DEPOT_H
-
-/** @file depot.h Header files for depots (not hangars)
- * @see depot.c */
-
-#include "direction.h"
-#include "oldpool.h"
-#include "tile.h"
-#include "variables.h"
-
-struct Depot {
- TileIndex xy;
- TownID town_index;
- DepotID index;
-};
-
-DECLARE_OLD_POOL(Depot, Depot, 3, 8000)
-
-/**
- * Check if a depot really exists.
- */
-static inline bool IsValidDepot(const Depot *depot)
-{
- return depot != NULL && depot->xy != 0;
-}
-
-static inline bool IsValidDepotID(uint index)
-{
- return index < GetDepotPoolSize() && IsValidDepot(GetDepot(index));
-}
-
-void DestroyDepot(Depot *depot);
-
-static inline void DeleteDepot(Depot *depot)
-{
- DestroyDepot(depot);
- depot->xy = 0;
-}
-
-void ShowDepotWindow(TileIndex tile, byte type);
-
-#define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1U < GetDepotPoolSize()) ? GetDepot(d->index + 1U) : NULL) if (IsValidDepot(d))
-#define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0)
-
-#define MIN_SERVINT_PERCENT 5
-#define MAX_SERVINT_PERCENT 90
-#define MIN_SERVINT_DAYS 30
-#define MAX_SERVINT_DAYS 800
-
-/**
- * Get the service interval domain.
- * Get the new proposed service interval for the vehicle is indeed, clamped
- * within the given bounds. @see MIN_SERVINT_PERCENT ,etc.
- * @param index proposed service interval
- */
-static inline Date GetServiceIntervalClamped(uint index)
-{
- return (_patches.servint_ispercent) ? clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
-}
-
-/**
- * Check if a tile is a depot of the given type.
- */
-static inline bool IsTileDepotType(TileIndex tile, TransportType type)
-{
- switch (type) {
- case TRANSPORT_RAIL:
- return IsTileType(tile, MP_RAILWAY) && (_m[tile].m5 & 0xFC) == 0xC0;
-
- case TRANSPORT_ROAD:
- return IsTileType(tile, MP_STREET) && (_m[tile].m5 & 0xF0) == 0x20;
-
- case TRANSPORT_WATER:
- return IsTileType(tile, MP_WATER) && (_m[tile].m5 & ~3) == 0x80;
-
- default:
- assert(0);
- return false;
- }
-}
-
-
-/**
- * Find out if the slope of the tile is suitable to build a depot of given direction
- * @param direction The direction in which the depot's exit points. Starts with 0 as NE and goes Clockwise
- * @param tileh The slope of the tile in question
- * @return true if the construction is possible
-
- * This is checked by the ugly 0x4C >> direction magic, which does the following:
- * 0x4C is 0100 1100 and tileh has only bits 0..3 set (steep tiles are ruled out)
- * So: for direction (only the significant bits are shown)<p>
- * 00 (exit towards NE) we need either bit 2 or 3 set in tileh: 0x4C >> 0 = 1100<p>
- * 01 (exit towards SE) we need either bit 1 or 2 set in tileh: 0x4C >> 1 = 0110<p>
- * 02 (exit towards SW) we need either bit 0 or 1 set in tileh: 0x4C >> 2 = 0011<p>
- * 03 (exit towards NW) we need either bit 0 or 4 set in tileh: 0x4C >> 3 = 1001<p>
- * So ((0x4C >> direction) & tileh) determines whether the depot can be built on the current tileh
- */
-static inline bool CanBuildDepotByTileh(uint32 direction, Slope tileh)
-{
- return ((0x4C >> direction) & tileh) != 0;
-}
-
-Depot *GetDepotByTile(TileIndex tile);
-void InitializeDepots(void);
-Depot *AllocateDepot(void);
-
-void DeleteDepotHighlightOfVehicle(const Vehicle *v);
-
-#endif /* DEPOT_H */