示例#1
0
/* static */ bool AIGroup::StopAutoReplace(GroupID group_id, EngineID engine_id)
{
	EnforcePrecondition(false, IsValidGroup(group_id) || group_id == GROUP_ALL);

	return AIObject::DoCommand(0, group_id << 16, (::INVALID_ENGINE << 16) | engine_id, CMD_SET_AUTOREPLACE);
}
示例#2
0
/* static */ bool ScriptGoal::CloseQuestion(uint16 uniqueid)
{
	EnforcePrecondition(false, ScriptObject::GetCompany() == OWNER_DEITY);

	return ScriptObject::DoCommand(0, uniqueid, 0, CMD_GOAL_QUESTION_ANSWER);
}
/* static */ bool AITunnel::RemoveTunnel(TileIndex tile)
{
	EnforcePrecondition(false, IsTunnelTile(tile));

	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
}
示例#4
0
/* static */ bool ScriptCompany::SetAutoRenewMoney(Money money)
{
	EnforcePrecondition(false, money >= 0);
	EnforcePrecondition(false, (int64)money <= UINT32_MAX);
	return ScriptObject::DoCommand(0, ::GetCompanySettingIndex("company.engine_renew_money"), money, CMD_CHANGE_COMPANY_SETTING);
}
示例#5
0
/* static */ bool AIMarine::BuildLock(TileIndex tile)
{
    EnforcePrecondition(false, ::IsValidTile(tile));

    return AIObject::DoCommand(tile, 0, 0, CMD_BUILD_LOCK);
}
示例#6
0
/* static */ bool ScriptRoad::BuildOneWayRoadFull(TileIndex start, TileIndex end)
{
	EnforcePrecondition(false, ScriptObject::GetCompany() != OWNER_DEITY);
	return _BuildRoadInternal(start, end, true, true);
}
/* static */ bool ScriptBase::Chance(uint out, uint max)
{
	EnforcePrecondition(false, out <= max);
	return (uint16)Rand() <= (uint16)((65535 * out) / max);
}
示例#8
0
/* static */ bool AIVehicle::SendVehicleToDepotForServicing(VehicleID vehicle_id)
{
	EnforcePrecondition(false, IsValidVehicle(vehicle_id));

	return AIObject::DoCommand(0, vehicle_id, DEPOT_SERVICE, GetCmdSendToDepot(::Vehicle::Get(vehicle_id)));
}
示例#9
0
/* static */ bool AIVehicle::StartStopVehicle(VehicleID vehicle_id)
{
	EnforcePrecondition(false, IsValidVehicle(vehicle_id));

	return AIObject::DoCommand(0, vehicle_id, 0, CMD_START_STOP_VEHICLE);
}
/* static */ bool AITile::PlantTree(TileIndex tile)
{
	EnforcePrecondition(false, ::IsValidTile(tile));

	return AIObject::DoCommand(tile, TREE_INVALID, tile, CMD_PLANT_TREE);
}
示例#11
0
/* static */ bool AIVehicle::RefitVehicle(VehicleID vehicle_id, CargoID cargo)
{
	EnforcePrecondition(false, IsValidVehicle(vehicle_id) && AICargo::IsValidCargo(cargo));

	return AIObject::DoCommand(0, vehicle_id, cargo, GetCmdRefitVeh(::Vehicle::Get(vehicle_id)));
}
/* static */ bool AITile::DemolishTile(TileIndex tile)
{
	EnforcePrecondition(false, ::IsValidTile(tile));

	return AIObject::DoCommand(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
}
/* static */ bool AITile::LowerTile(TileIndex tile, int32 slope)
{
	EnforcePrecondition(false, tile < ::MapSize());

	return AIObject::DoCommand(tile, slope, 0, CMD_TERRAFORM_LAND);
}
示例#14
0
/* static */ bool AIMarine::BuildCanal(TileIndex tile)
{
	EnforcePrecondition(false, ::IsValidTile(tile));

	return AIObject::DoCommand(tile, tile, WATER_CLASS_CANAL, CMD_BUILD_CANAL);
}
示例#15
0
/* static */ bool AIGroup::DeleteGroup(GroupID group_id)
{
	EnforcePrecondition(false, IsValidGroup(group_id));

	return AIObject::DoCommand(0, group_id, 0, CMD_DELETE_GROUP);
}
示例#16
0
/* static */ uint32 ScriptStoryPage::GetPageElementSortValue(StoryPageElementID story_page_element_id)
{
	EnforcePrecondition(false, IsValidStoryPageElement(story_page_element_id));

	return StoryPageElement::Get(story_page_element_id)->sort_value;
}
示例#17
0
/* static */ bool AIGroup::EnableAutoReplaceProtection(GroupID group_id, bool enable)
{
	EnforcePrecondition(false, IsValidGroup(group_id));

	return AIObject::DoCommand(0, group_id, enable ? 1 : 0, CMD_SET_GROUP_REPLACE_PROTECTION);
}
示例#18
0
/* static */ bool ScriptBase::Chance(uint out, uint max)
{
	EnforcePrecondition(false, out <= max);
	return ScriptBase::RandRange(max) < out;
}