From 69209c38968c6f4066a772e0a51a2928749217de Mon Sep 17 00:00:00 2001 From: "FWoltermann@gmail.com" Date: Fri, 9 Dec 2011 19:00:23 +0000 Subject: Re-indenting the code to use standard tabs. Yes, I know this is pretty pointless, but who cares? --- Stars45/CampaignPlanAssignment.cpp | 210 ++++++++++++++++++------------------- 1 file changed, 105 insertions(+), 105 deletions(-) (limited to 'Stars45/CampaignPlanAssignment.cpp') diff --git a/Stars45/CampaignPlanAssignment.cpp b/Stars45/CampaignPlanAssignment.cpp index 3e2728b..7556445 100644 --- a/Stars45/CampaignPlanAssignment.cpp +++ b/Stars45/CampaignPlanAssignment.cpp @@ -1,17 +1,17 @@ /* Project Starshatter 4.5 - Destroyer Studios LLC - Copyright © 1997-2004. All Rights Reserved. + Destroyer Studios LLC + Copyright © 1997-2004. All Rights Reserved. - SUBSYSTEM: Stars.exe - FILE: CampaignPlanAssignment.cpp - AUTHOR: John DiCamillo + SUBSYSTEM: Stars.exe + FILE: CampaignPlanAssignment.cpp + AUTHOR: John DiCamillo - OVERVIEW - ======== - CampaignPlanAssignment creates combat assignments for - assets within each combat zone as the third step in - force tasking. + OVERVIEW + ======== + CampaignPlanAssignment creates combat assignments for + assets within each combat zone as the third step in + force tasking. */ #include "MemDebug.h" @@ -29,18 +29,18 @@ void CampaignPlanAssignment::ExecFrame() { - if (campaign && campaign->IsActive()) { - // once every few minutes is plenty: - if (Campaign::Stardate() - exec_time < 300) - return; - - ListIter iter = campaign->GetCombatants(); - while (++iter) { - ProcessCombatant(iter.value()); - } - - exec_time = Campaign::Stardate(); - } + if (campaign && campaign->IsActive()) { + // once every few minutes is plenty: + if (Campaign::Stardate() - exec_time < 300) + return; + + ListIter iter = campaign->GetCombatants(); + while (++iter) { + ProcessCombatant(iter.value()); + } + + exec_time = Campaign::Stardate(); + } } // +--------------------------------------------------------------------+ @@ -48,16 +48,16 @@ CampaignPlanAssignment::ExecFrame() void CampaignPlanAssignment::ProcessCombatant(Combatant* c) { - CombatGroup* force = c->GetForce(); - if (force) { - force->CalcValue(); - force->ClearAssignments(); - } - - ListIter zone = campaign->GetZones(); - while (++zone) { - ProcessZone(c, zone.value()); - } + CombatGroup* force = c->GetForce(); + if (force) { + force->CalcValue(); + force->ClearAssignments(); + } + + ListIter zone = campaign->GetZones(); + while (++zone) { + ProcessZone(c, zone.value()); + } } // +--------------------------------------------------------------------+ @@ -65,36 +65,36 @@ CampaignPlanAssignment::ProcessCombatant(Combatant* c) void CampaignPlanAssignment::BuildZoneList(CombatGroup* g, CombatZone* zone, List& groups) { - if (!g) - return; + if (!g) + return; - if (g->GetAssignedZone() == zone) - groups.append(g); + if (g->GetAssignedZone() == zone) + groups.append(g); - ListIter iter = g->GetComponents(); - while (++iter) - BuildZoneList(iter.value(), zone, groups); + ListIter iter = g->GetComponents(); + while (++iter) + BuildZoneList(iter.value(), zone, groups); } // +--------------------------------------------------------------------+ void CampaignPlanAssignment::BuildAssetList(const int* pref, - List& groups, - List& assets) +List& groups, +List& assets) { - if (!pref) - return; - - while (*pref) { - ListIter g = groups; - while (++g) { - if (g->Type() == *pref && g->CountUnits() > 0) - assets.append(g.value()); - } - - pref++; - } + if (!pref) + return; + + while (*pref) { + ListIter g = groups; + while (++g) { + if (g->Type() == *pref && g->CountUnits() > 0) + assets.append(g.value()); + } + + pref++; + } } // +--------------------------------------------------------------------+ @@ -102,57 +102,57 @@ CampaignPlanAssignment::BuildAssetList(const int* pref, void CampaignPlanAssignment::ProcessZone(Combatant* c, CombatZone* zone) { - List groups; - BuildZoneList(c->GetForce(), zone, groups); - - ZoneForce* force = zone->FindForce(c->GetIFF()); - - // defensive assignments: - ListIter def = force->GetDefendList(); - while (++def) { - List assets; - BuildAssetList(CombatGroup::PreferredDefender(def->Type()), groups, assets); - - ListIter g = assets; - while (++g) { - CombatAssignment* a = new(__FILE__,__LINE__) - CombatAssignment(Mission::DEFEND, - def.value(), - g.value()); - - if (a) - g->GetAssignments().append(a); - } - } - - // offensive assignments: - ListIter tgt = force->GetTargetList(); - while (++tgt) { - CombatGroup* target = tgt.value(); - - List assets; - BuildAssetList(CombatGroup::PreferredAttacker(tgt->Type()), groups, assets); - - ListIter g = assets; - while (++g) { - CombatGroup* asset = g.value(); - int mtype = Mission::ASSAULT; - - if (target->IsStrikeTarget()) - mtype = Mission::STRIKE; - - else if (target->IsFighterGroup()) - mtype = Mission::SWEEP; - - else if (target->Type() == CombatGroup::LCA_SQUADRON) - mtype = Mission::INTERCEPT; - - CombatAssignment* a = new(__FILE__,__LINE__) - CombatAssignment(mtype, target, asset); - - if (a) - g->GetAssignments().append(a); - } - } + List groups; + BuildZoneList(c->GetForce(), zone, groups); + + ZoneForce* force = zone->FindForce(c->GetIFF()); + + // defensive assignments: + ListIter def = force->GetDefendList(); + while (++def) { + List assets; + BuildAssetList(CombatGroup::PreferredDefender(def->Type()), groups, assets); + + ListIter g = assets; + while (++g) { + CombatAssignment* a = new(__FILE__,__LINE__) + CombatAssignment(Mission::DEFEND, + def.value(), + g.value()); + + if (a) + g->GetAssignments().append(a); + } + } + + // offensive assignments: + ListIter tgt = force->GetTargetList(); + while (++tgt) { + CombatGroup* target = tgt.value(); + + List assets; + BuildAssetList(CombatGroup::PreferredAttacker(tgt->Type()), groups, assets); + + ListIter g = assets; + while (++g) { + CombatGroup* asset = g.value(); + int mtype = Mission::ASSAULT; + + if (target->IsStrikeTarget()) + mtype = Mission::STRIKE; + + else if (target->IsFighterGroup()) + mtype = Mission::SWEEP; + + else if (target->Type() == CombatGroup::LCA_SQUADRON) + mtype = Mission::INTERCEPT; + + CombatAssignment* a = new(__FILE__,__LINE__) + CombatAssignment(mtype, target, asset); + + if (a) + g->GetAssignments().append(a); + } + } } -- cgit v1.1