From 599a2ba6fb493903720225db625952a342f33b7e Mon Sep 17 00:00:00 2001 From: Frank Date: Fri, 5 Jun 2026 22:50:52 +0200 Subject: [PATCH] Database - Added COHORTs and LEGIONs to database --- Moose Development/Moose/Core/Database.lua | 36 +++++++++++++++++++++++ Moose Development/Moose/Ops/Cohort.lua | 3 ++ Moose Development/Moose/Ops/Legion.lua | 2 ++ 3 files changed, 41 insertions(+) diff --git a/Moose Development/Moose/Core/Database.lua b/Moose Development/Moose/Core/Database.lua index 1575e7296..3f7256d78 100644 --- a/Moose Development/Moose/Core/Database.lua +++ b/Moose Development/Moose/Core/Database.lua @@ -92,6 +92,8 @@ DATABASE = { ZONES_GOAL = {}, WAREHOUSES = {}, FLIGHTGROUPS = {}, + COHORTS={}, + LEGIONS={}, FLIGHTCONTROLS = {}, OPSZONES = {}, PATHLINES = {}, @@ -2086,6 +2088,40 @@ function DATABASE:FindOpsGroupFromUnit(unitname) end end +-- + +--- Add an OPS COHORT (SQUADRON, PLATOON, FLOTILLA) to the data base. +-- @param #DATABASE self +-- @param Ops.Cohort#COHORT cohort The cohort added to the DB. +function DATABASE:AddCohort(cohort) + self.COHORTS[cohort.name]=cohort +end + +--- Find an OPS COHORT (SQUADRON, PLATOON, FLOTILLA) in the data base. +-- @param #DATABASE self +-- @param #string cohortname Name of the cohort. +-- @return Ops.Cohort#COHORT Cohort object. +function DATABASE:FindCohort(cohortname) + return self.COHORTS[cohortname] +end + +--- Add an OPS LEGION (AIRWING, BRIGADE, FLEET) to the data base. +-- @param #DATABASE self +-- @param Ops.Legion#LEGION legion The legion added to the DB. +function DATABASE:AddLegion(legion) + self.COHORTS[legion.alias]=legion +end + +--- Find an OPS LEGION (AIRWING, BRIGADE, FLEET) in the data base. +-- @param #DATABASE self +-- @param #string legionname Name of the legion. +-- @return Ops.Legion#LEGION Legion object. +function DATABASE:FindLegion(legionname) + return self.COHORTS[legionname] +end + +-- + --- Add a flight control to the data base. -- @param #DATABASE self -- @param OPS.FlightControl#FLIGHTCONTROL flightcontrol diff --git a/Moose Development/Moose/Ops/Cohort.lua b/Moose Development/Moose/Ops/Cohort.lua index 8e0e1e834..28681ad8f 100644 --- a/Moose Development/Moose/Ops/Cohort.lua +++ b/Moose Development/Moose/Ops/Cohort.lua @@ -318,6 +318,9 @@ function COHORT:New(TemplateGroupName, Ngroups, CohortName) -- @param #string Event Event. -- @param #string To To state. + -- Add cohort to DB + _DATABASE:AddCohort(self) + return self end diff --git a/Moose Development/Moose/Ops/Legion.lua b/Moose Development/Moose/Ops/Legion.lua index 4f5a6c249..2525a6c3e 100644 --- a/Moose Development/Moose/Ops/Legion.lua +++ b/Moose Development/Moose/Ops/Legion.lua @@ -306,6 +306,8 @@ function LEGION:New(WarehouseName, LegionName) -- @param Ops.Cohort#COHORT Cohort The cohort the asset belongs to. -- @param Functional.Warehouse#WAREHOUSE.Assetitem Asset The asset that returned. + -- Add legion to DB + _DATABASE:AddLegion(self) return self end