src/command_type.h
changeset 8854 d3f0e0960fb9
parent 8841 4a72a01136fc
child 9359 3a8554ac1cb8
equal deleted inserted replaced
8853:3266f0374302 8854:d3f0e0960fb9
    47 	 * Adds the cost of the given command return value to this cost.
    47 	 * Adds the cost of the given command return value to this cost.
    48 	 * Also takes a possible error message when it is set.
    48 	 * Also takes a possible error message when it is set.
    49 	 * @param ret the command to add the cost of.
    49 	 * @param ret the command to add the cost of.
    50 	 * @return this class.
    50 	 * @return this class.
    51 	 */
    51 	 */
    52 	CommandCost AddCost(CommandCost ret)
    52 	CommandCost AddCost(CommandCost ret);
    53 	{
       
    54 		this->AddCost(ret.cost);
       
    55 		if (this->success && !ret.success) {
       
    56 			this->message = ret.message;
       
    57 			this->success = false;
       
    58 		}
       
    59 		return *this;
       
    60 	}
       
    61 
    53 
    62 	/**
    54 	/**
    63 	 * Adds the given cost to the cost of the command.
    55 	 * Adds the given cost to the cost of the command.
    64 	 * @param cost the cost to add
    56 	 * @param cost the cost to add
    65 	 * @return this class.
    57 	 * @return this class.