OpenTTD Source 20260531-master-g0e951f3528
depot_cmd.cpp File Reference

Command Handling for depots. More...

#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 "depot_cmd.h"
#include "table/strings.h"
#include "safeguards.h"

Go to the source code of this file.

Functions

static bool IsUniqueDepotName (const std::string &name)
 Check whether the given name is globally unique amongst depots.
CommandCost CmdRenameDepot (DoCommandFlags flags, DepotID depot_id, const std::string &text)
 Rename a depot.

Detailed Description

Command Handling for depots.

Definition in file depot_cmd.cpp.

Function Documentation

◆ CmdRenameDepot()

CommandCost CmdRenameDepot ( DoCommandFlags flags,
DepotID depot_id,
const std::string & text )

Rename a depot.

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

Definition at line 46 of file depot_cmd.cpp.

References CheckTileOwnership(), CMD_ERROR, Execute, CommandCost::Failed(), GetDepotVehicleType(), GetTileOwner(), GetWindowClassForVehicleType(), IsUniqueDepotName(), MakeDefaultName(), MAX_LENGTH_DEPOT_NAME_CHARS, SetWindowClassesDirty(), SetWindowDirty(), BaseBitSet< Timpl, Tvalue_type, Tstorage, Tmask >::Test(), VehicleListIdentifier::ToWindowNumber(), Utf8StringLength(), and VL_DEPOT_LIST.

◆ IsUniqueDepotName()

bool IsUniqueDepotName ( const std::string & 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 30 of file depot_cmd.cpp.

Referenced by CmdRenameDepot().