OpenTTD Source  1.11.2
depot_cmd.cpp File Reference
#include "stdafx.h"
#include "command_func.h"
#include "depot_base.h"
#include "company_func.h"
#include "string_func.h"
#include "town.h"
#include "vehicle_gui.h"
#include "vehiclelist.h"
#include "window_func.h"
#include "table/strings.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

static bool IsUniqueDepotName (const char *name)
 Check whether the given name is globally unique amongst depots. More...
 
CommandCost CmdRenameDepot (TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
 Rename a depot. More...
 

Detailed Description

Command Handling for depots.

Definition in file depot_cmd.cpp.

Function Documentation

◆ CmdRenameDepot()

CommandCost CmdRenameDepot ( TileIndex  tile,
DoCommandFlag  flags,
uint32  p1,
uint32  p2,
const char *  text 
)

Rename a depot.

Parameters
tileunused
flagstype of operation
p1id of depot
p2unused
textthe new name or an empty string when resetting to the default
Returns
the cost of this operation or an error

Definition at line 47 of file depot_cmd.cpp.

References CheckTileOwnership(), CMD_ERROR, DC_EXEC, CommandCost::Failed(), GetDepotVehicleType(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_depot_pool >::GetIfValid(), GetWindowClassForVehicleType(), IsUniqueDepotName(), MakeDefaultName(), MAX_LENGTH_DEPOT_NAME_CHARS, return_cmd_error, SetWindowClassesDirty(), SetWindowDirty(), StrEmpty(), Utf8StringLength(), WC_VEHICLE_DEPOT, and WC_VEHICLE_ORDERS.

◆ IsUniqueDepotName()

static bool IsUniqueDepotName ( const char *  name)
static

Check whether the given name is globally unique amongst depots.

Parameters
nameThe name to check.
Returns
True if there is no depot with the given name.

Definition at line 29 of file depot_cmd.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_depot_pool >::Iterate().

Referenced by CmdRenameDepot().