MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / AddCost

Method AddCost

src/command.cpp:401–409  ·  view source on GitHub ↗

* Adds the cost of the given command return value to this cost. * Also takes a possible error message when it is set. * @param ret The command to add the cost of. */

Source from the content-addressed store, hash-verified

399 * @param ret The command to add the cost of.
400 */
401void CommandCost::AddCost(CommandCost &&ret)
402{
403 this->AddCost(ret.cost);
404 if (this->success && !ret.success) {
405 this->message = ret.message;
406 this->encoded_message = std::move(ret.encoded_message);
407 this->success = false;
408 }
409}
410
411/**
412 * Return an error status, with string and parameter.

Callers 15

BuildReplacementVehicleFunction · 0.45
CopyHeadSpecificThingsFunction · 0.45
ReplaceFreeUnitFunction · 0.45
ReplaceChainFunction · 0.45
CmdAutoreplaceVehicleFunction · 0.45
CmdBuildShipDepotFunction · 0.45
DoBuildLockFunction · 0.45
CmdBuildCanalFunction · 0.45
CmdLandscapeClearFunction · 0.45
CmdClearAreaFunction · 0.45
CmdBuildSingleRailFunction · 0.45
CmdRemoveSingleRailFunction · 0.45

Calls

no outgoing calls

Tested by 1

TestAutoslopeOnRailTileFunction · 0.36