ship_cmd.c
changeset 4352 8ddb01bc6075
parent 4351 63ae31104f07
child 4389 e4555522d257
equal deleted inserted replaced
4351:63ae31104f07 4352:8ddb01bc6075
   927  */
   927  */
   928 int32 CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   928 int32 CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   929 {
   929 {
   930 	Vehicle *v;
   930 	Vehicle *v;
   931 
   931 
   932 	if (!IsVehicleIndex(p1)) return CMD_ERROR;
   932 	if (!IsValidVehicleID(p1)) return CMD_ERROR;
   933 
   933 
   934 	v = GetVehicle(p1);
   934 	v = GetVehicle(p1);
   935 
   935 
   936 	if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
   936 	if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
   937 
   937 
   962 int32 CmdStartStopShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   962 int32 CmdStartStopShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   963 {
   963 {
   964 	Vehicle *v;
   964 	Vehicle *v;
   965 	uint16 callback;
   965 	uint16 callback;
   966 
   966 
   967 	if (!IsVehicleIndex(p1)) return CMD_ERROR;
   967 	if (!IsValidVehicleID(p1)) return CMD_ERROR;
   968 
   968 
   969 	v = GetVehicle(p1);
   969 	v = GetVehicle(p1);
   970 
   970 
   971 	if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
   971 	if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
   972 
   972 
  1000 int32 CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1000 int32 CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
  1001 {
  1001 {
  1002 	Vehicle *v;
  1002 	Vehicle *v;
  1003 	const Depot *dep;
  1003 	const Depot *dep;
  1004 
  1004 
  1005 	if (!IsVehicleIndex(p1)) return CMD_ERROR;
  1005 	if (!IsValidVehicleID(p1)) return CMD_ERROR;
  1006 
  1006 
  1007 	v = GetVehicle(p1);
  1007 	v = GetVehicle(p1);
  1008 
  1008 
  1009 	if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
  1009 	if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
  1010 
  1010 
  1054 	int32 cost;
  1054 	int32 cost;
  1055 	CargoID new_cid = GB(p2, 0, 8); //gets the cargo number
  1055 	CargoID new_cid = GB(p2, 0, 8); //gets the cargo number
  1056 	byte new_subtype = GB(p2, 8, 8);
  1056 	byte new_subtype = GB(p2, 8, 8);
  1057 	uint16 capacity = CALLBACK_FAILED;
  1057 	uint16 capacity = CALLBACK_FAILED;
  1058 
  1058 
  1059 	if (!IsVehicleIndex(p1)) return CMD_ERROR;
  1059 	if (!IsValidVehicleID(p1)) return CMD_ERROR;
  1060 
  1060 
  1061 	v = GetVehicle(p1);
  1061 	v = GetVehicle(p1);
  1062 
  1062 
  1063 	if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
  1063 	if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
  1064 
  1064