summaryrefslogtreecommitdiffhomepage
path: root/Stars45/Combatant.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/Combatant.cpp')
-rw-r--r--Stars45/Combatant.cpp202
1 files changed, 101 insertions, 101 deletions
diff --git a/Stars45/Combatant.cpp b/Stars45/Combatant.cpp
index 21fcc78..6169292 100644
--- a/Stars45/Combatant.cpp
+++ b/Stars45/Combatant.cpp
@@ -1,15 +1,15 @@
/* 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: Combatant.cpp
- AUTHOR: John DiCamillo
+ SUBSYSTEM: Stars.exe
+ FILE: Combatant.cpp
+ AUTHOR: John DiCamillo
- OVERVIEW
- ========
- One side in a military conflict
+ OVERVIEW
+ ========
+ One side in a military conflict
*/
#include "MemDebug.h"
@@ -23,51 +23,51 @@
static void SetCombatant(CombatGroup* g, Combatant* c)
{
- if (!g) return;
+ if (!g) return;
- g->SetCombatant(c);
+ g->SetCombatant(c);
- ListIter<CombatGroup> iter = g->GetComponents();
- while (++iter)
- SetCombatant(iter.value(), c);
+ ListIter<CombatGroup> iter = g->GetComponents();
+ while (++iter)
+ SetCombatant(iter.value(), c);
}
// +--------------------------------------------------------------------+
Combatant::Combatant(const char* com_name, const char* fname, int team)
- : name(com_name), iff(team), score(0), force(0)
+: name(com_name), iff(team), score(0), force(0)
{
- for (int i = 0; i < 6; i++)
- target_factor[i] = 1;
+ for (int i = 0; i < 6; i++)
+ target_factor[i] = 1;
- target_factor[2] = 1000;
+ target_factor[2] = 1000;
- if (fname)
- force = CombatGroup::LoadOrderOfBattle(fname, iff, this);
+ if (fname)
+ force = CombatGroup::LoadOrderOfBattle(fname, iff, this);
}
Combatant::Combatant(const char* com_name, CombatGroup* f)
- : name(com_name), iff(0), score(0), force(f)
+: name(com_name), iff(0), score(0), force(f)
{
- for (int i = 0; i < 6; i++)
- target_factor[i] = 1;
+ for (int i = 0; i < 6; i++)
+ target_factor[i] = 1;
- target_factor[2] = 1000;
+ target_factor[2] = 1000;
- if (force) {
- SetCombatant(force, this);
- iff = force->GetIFF();
- }
+ if (force) {
+ SetCombatant(force, this);
+ iff = force->GetIFF();
+ }
}
// +--------------------------------------------------------------------+
Combatant::~Combatant()
{
- mission_list.clear();
- target_list.clear();
- defend_list.clear();
- delete force;
+ mission_list.clear();
+ target_list.clear();
+ defend_list.clear();
+ delete force;
}
// +--------------------------------------------------------------------+
@@ -75,10 +75,10 @@ Combatant::~Combatant()
CombatGroup*
Combatant::FindGroup(int type, int id)
{
- if (force)
- return force->FindGroup(type, id);
+ if (force)
+ return force->FindGroup(type, id);
- return 0;
+ return 0;
}
// +--------------------------------------------------------------------+
@@ -86,7 +86,7 @@ Combatant::FindGroup(int type, int id)
void
Combatant::AddMission(Mission* mission)
{
- mission_list.append(mission);
+ mission_list.append(mission);
}
// +--------------------------------------------------------------------+
@@ -94,36 +94,36 @@ Combatant::AddMission(Mission* mission)
double
Combatant::GetTargetStratFactor(int type)
{
- switch (type) {
- case CombatGroup::FLEET:
- case CombatGroup::CARRIER_GROUP:
- case CombatGroup::BATTLE_GROUP:
- case CombatGroup::DESTROYER_SQUADRON: return target_factor[0];
-
- case CombatGroup::WING:
- case CombatGroup::ATTACK_SQUADRON:
- case CombatGroup::INTERCEPT_SQUADRON:
- case CombatGroup::FIGHTER_SQUADRON: return target_factor[1];
-
- case CombatGroup::BATTERY:
- case CombatGroup::MISSILE: return target_factor[2];
-
- case CombatGroup::BATTALION:
- case CombatGroup::STARBASE:
- case CombatGroup::C3I:
- case CombatGroup::COMM_RELAY:
- case CombatGroup::EARLY_WARNING:
- case CombatGroup::FWD_CONTROL_CTR:
- case CombatGroup::ECM: return target_factor[3];
-
- case CombatGroup::SUPPORT:
- case CombatGroup::COURIER:
- case CombatGroup::MEDICAL:
- case CombatGroup::SUPPLY:
- case CombatGroup::REPAIR: return target_factor[4];
- }
-
- return target_factor[5];
+ switch (type) {
+ case CombatGroup::FLEET:
+ case CombatGroup::CARRIER_GROUP:
+ case CombatGroup::BATTLE_GROUP:
+ case CombatGroup::DESTROYER_SQUADRON: return target_factor[0];
+
+ case CombatGroup::WING:
+ case CombatGroup::ATTACK_SQUADRON:
+ case CombatGroup::INTERCEPT_SQUADRON:
+ case CombatGroup::FIGHTER_SQUADRON: return target_factor[1];
+
+ case CombatGroup::BATTERY:
+ case CombatGroup::MISSILE: return target_factor[2];
+
+ case CombatGroup::BATTALION:
+ case CombatGroup::STARBASE:
+ case CombatGroup::C3I:
+ case CombatGroup::COMM_RELAY:
+ case CombatGroup::EARLY_WARNING:
+ case CombatGroup::FWD_CONTROL_CTR:
+ case CombatGroup::ECM: return target_factor[3];
+
+ case CombatGroup::SUPPORT:
+ case CombatGroup::COURIER:
+ case CombatGroup::MEDICAL:
+ case CombatGroup::SUPPLY:
+ case CombatGroup::REPAIR: return target_factor[4];
+ }
+
+ return target_factor[5];
}
// +--------------------------------------------------------------------+
@@ -131,42 +131,42 @@ Combatant::GetTargetStratFactor(int type)
void
Combatant::SetTargetStratFactor(int type, double factor)
{
- switch (type) {
- case CombatGroup::FLEET:
- case CombatGroup::CARRIER_GROUP:
- case CombatGroup::BATTLE_GROUP:
- case CombatGroup::DESTROYER_SQUADRON: target_factor[0] = factor;
- break;
-
- case CombatGroup::WING:
- case CombatGroup::ATTACK_SQUADRON:
- case CombatGroup::INTERCEPT_SQUADRON:
- case CombatGroup::FIGHTER_SQUADRON: target_factor[1] = factor;
- break;
-
- case CombatGroup::BATTALION:
- case CombatGroup::STARBASE:
- case CombatGroup::BATTERY:
- case CombatGroup::MISSILE: target_factor[2] = factor;
- break;
-
- case CombatGroup::C3I:
- case CombatGroup::COMM_RELAY:
- case CombatGroup::EARLY_WARNING:
- case CombatGroup::FWD_CONTROL_CTR:
- case CombatGroup::ECM: target_factor[3] = factor;
- break;
-
- case CombatGroup::SUPPORT:
- case CombatGroup::COURIER:
- case CombatGroup::MEDICAL:
- case CombatGroup::SUPPLY:
- case CombatGroup::REPAIR: target_factor[4] = factor;
- break;
-
- default: target_factor[5] = factor;
- break;
- }
+ switch (type) {
+ case CombatGroup::FLEET:
+ case CombatGroup::CARRIER_GROUP:
+ case CombatGroup::BATTLE_GROUP:
+ case CombatGroup::DESTROYER_SQUADRON: target_factor[0] = factor;
+ break;
+
+ case CombatGroup::WING:
+ case CombatGroup::ATTACK_SQUADRON:
+ case CombatGroup::INTERCEPT_SQUADRON:
+ case CombatGroup::FIGHTER_SQUADRON: target_factor[1] = factor;
+ break;
+
+ case CombatGroup::BATTALION:
+ case CombatGroup::STARBASE:
+ case CombatGroup::BATTERY:
+ case CombatGroup::MISSILE: target_factor[2] = factor;
+ break;
+
+ case CombatGroup::C3I:
+ case CombatGroup::COMM_RELAY:
+ case CombatGroup::EARLY_WARNING:
+ case CombatGroup::FWD_CONTROL_CTR:
+ case CombatGroup::ECM: target_factor[3] = factor;
+ break;
+
+ case CombatGroup::SUPPORT:
+ case CombatGroup::COURIER:
+ case CombatGroup::MEDICAL:
+ case CombatGroup::SUPPLY:
+ case CombatGroup::REPAIR: target_factor[4] = factor;
+ break;
+
+ default: target_factor[5] = factor;
+ break;
+ }
}