#DATABASE

* Small fix for CLIENT:FindByName()
This commit is contained in:
Applevangelist 2023-04-04 10:33:04 +02:00
parent cf94c4d043
commit 9e138aa149

View File

@ -88,6 +88,7 @@ DATABASE = {
WAREHOUSES = {}, WAREHOUSES = {},
FLIGHTGROUPS = {}, FLIGHTGROUPS = {},
FLIGHTCONTROLS = {}, FLIGHTCONTROLS = {},
OPSZONES = {},
PATHLINES = {}, PATHLINES = {},
} }
@ -580,6 +581,46 @@ do -- Zone_Goal
end end
end -- Zone_Goal end -- Zone_Goal
do -- OpsZone
--- Finds a @{Ops.OpsZone#OPSZONE} based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
-- @return Ops.OpsZone#OPSZONE The found OPSZONE.
function DATABASE:FindOpsZone( ZoneName )
local ZoneFound = self.OPSZONES[ZoneName]
return ZoneFound
end
--- Adds a @{Ops.OpsZone#OPSZONE} based on the zone name in the DATABASE.
-- @param #DATABASE self
-- @param Ops.OpsZone#OPSZONE OpsZone The zone.
function DATABASE:AddOpsZone( OpsZone )
if OpsZone then
local ZoneName=OpsZone:GetName()
if not self.OPSZONES[ZoneName] then
self.OPSZONES[ZoneName] = OpsZone
end
end
end
--- Deletes a @{Ops.OpsZone#OPSZONE} from the DATABASE based on the zone name.
-- @param #DATABASE self
-- @param #string ZoneName The name of the zone.
function DATABASE:DeleteOpsZone( ZoneName )
self.OPSZONES[ZoneName] = nil
end
end -- OpsZone
do -- cargo do -- cargo
--- Adds a Cargo based on the Cargo Name in the DATABASE. --- Adds a Cargo based on the Cargo Name in the DATABASE.
@ -1599,10 +1640,10 @@ end
-- @param #DATABASE self -- @param #DATABASE self
-- @param #function IteratorFunction The function that will be called object in the database. The function needs to accept a CLIENT parameter. -- @param #function IteratorFunction The function that will be called object in the database. The function needs to accept a CLIENT parameter.
-- @return #DATABASE self -- @return #DATABASE self
function DATABASE:ForEachClient( IteratorFunction, ... ) function DATABASE:ForEachClient( IteratorFunction, FinalizeFunction, ... )
self:F2( arg ) self:F2( arg )
self:ForEach( IteratorFunction, arg, self.CLIENTS ) self:ForEach( IteratorFunction, FinalizeFunction, arg, self.CLIENTS )
return self return self
end end
@ -1611,10 +1652,10 @@ end
-- @param #DATABASE self -- @param #DATABASE self
-- @param #function IteratorFunction The function that will be called for each object in the database. The function needs to accept a CLIENT parameter. -- @param #function IteratorFunction The function that will be called for each object in the database. The function needs to accept a CLIENT parameter.
-- @return #DATABASE self -- @return #DATABASE self
function DATABASE:ForEachCargo( IteratorFunction, ... ) function DATABASE:ForEachCargo( IteratorFunction, FinalizeFunction, ... )
self:F2( arg ) self:F2( arg )
self:ForEach( IteratorFunction, arg, self.CARGOS ) self:ForEach( IteratorFunction, FinalizeFunction, arg, self.CARGOS )
return self return self
end end