(svn r1897) - Fix: [ 1120424 ] Set name overwrites same name. Renamings because your name is in use are virtual though so if name "b" is in use your name will become "b #1", renaming yourself again to "b" will become "b #2", and will toggle between these two.
#ifndef DEPOT_H#define DEPOT_H#include"pool.h"#include"tile.h"structDepot{TileIndexxy;uint16town_index;uint16index;};externMemoryPool_depot_pool;/** * Get the pointer to the depot with index 'index' */staticinlineDepot*GetDepot(uintindex){return(Depot*)GetItemFromPool(&_depot_pool,index);}/** * Get the current size of the DepotPool */staticinlineuint16GetDepotPoolSize(void){return_depot_pool.total_items;}#define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1 < GetDepotPoolSize()) ? GetDepot(d->index + 1) : NULL)#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 800VARDEFTileIndex_last_built_train_depot_tile;VARDEFTileIndex_last_built_road_depot_tile;VARDEFTileIndex_last_built_aircraft_depot_tile;VARDEFTileIndex_last_built_ship_depot_tile;/** * Check if a depot really exists. */staticinlineboolIsValidDepot(Depot*depot){returndepot->xy!=0;/* XXX: Replace by INVALID_TILE someday */}/** * Check if a tile is a depot of the given type. */staticinlineboolIsTileDepotType(TileIndextile,TransportTypetype){switch(type){caseTRANSPORT_RAIL:returnIsTileType(tile,MP_RAILWAY)&&(_map5[tile]&0xFC)==0xC0;break;caseTRANSPORT_ROAD:returnIsTileType(tile,MP_STREET)&&(_map5[tile]&0xF0)==0x20;break;caseTRANSPORT_WATER:returnIsTileType(tile,MP_WATER)&&(_map5[tile]&~3)==0x80;break;default:assert(0);returnfalse;}}Depot*GetDepotByTile(uinttile);voidInitializeDepot(void);Depot*AllocateDepot(void);voidDoDeleteDepot(uinttile);#endif /* DEPOT_H */