From a12e588079700d55a0b788fea2df7727c2e41f52 Mon Sep 17 00:00:00 2001 From: Aki Date: Sun, 27 Mar 2022 17:42:26 +0200 Subject: Removed MemDebug from FoundationEx --- Stars45/CampaignMissionFighter.cpp | 125 ++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 63 deletions(-) (limited to 'Stars45/CampaignMissionFighter.cpp') diff --git a/Stars45/CampaignMissionFighter.cpp b/Stars45/CampaignMissionFighter.cpp index 16c3f7b..be39d58 100644 --- a/Stars45/CampaignMissionFighter.cpp +++ b/Stars45/CampaignMissionFighter.cpp @@ -13,7 +13,6 @@ dynamic campaign. */ -#include "MemDebug.h" #include "CampaignMissionFighter.h" #include "CampaignMissionRequest.h" #include "Campaign.h" @@ -176,7 +175,7 @@ CampaignMissionFighter::GenerateMission(int id) SelectType(); if (request && request->Script().length()) { - MissionTemplate* mt = new(__FILE__,__LINE__) MissionTemplate(id, request->Script(), campaign->Path()); + MissionTemplate* mt = new MissionTemplate(id, request->Script(), campaign->Path()); if (mt) mt->SetPlayerSquadron(squadron); mission = mt; @@ -188,13 +187,13 @@ CampaignMissionFighter::GenerateMission(int id) found = mission_info != 0; if (found) { - MissionTemplate* mt = new(__FILE__,__LINE__) MissionTemplate(id, mission_info->script, campaign->Path()); + MissionTemplate* mt = new MissionTemplate(id, mission_info->script, campaign->Path()); if (mt) mt->SetPlayerSquadron(squadron); mission = mt; } else { - mission = new(__FILE__,__LINE__) Mission(id); + mission = new Mission(id); if (mission) mission->SetType(mission_type); } @@ -241,7 +240,7 @@ CampaignMissionFighter::GenerateMission(int id) else { delete mission; - mission = new(__FILE__,__LINE__) Mission(id); + mission = new Mission(id); mission->SetType(mission_type); mission->SetName(name); mission->SetTeam(squadron->GetIFF()); @@ -465,7 +464,7 @@ CampaignMissionFighter::GenerateMissionElements() CreateEscorts(); if (player_elem) { - Instruction* obj = new(__FILE__,__LINE__) Instruction(mission->GetRegion(), + Instruction* obj = new Instruction(mission->GetRegion(), Point(0,0,0), Instruction::RTB); @@ -496,7 +495,7 @@ CampaignMissionFighter::CreateElements(CombatGroup* g) if (g->Type() == CombatGroup::CARRIER_GROUP && elem->MissionRole() == Mission::ESCORT) { - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ESCORT, cmdr->Name()); + Instruction* obj = new Instruction(Instruction::ESCORT, cmdr->Name()); if (obj) elem->AddObjective(obj); } @@ -531,7 +530,7 @@ CampaignMissionFighter::CreateSingleElement(CombatGroup* g, CombatUnit* u) return 0; } - MissionElement* elem = new(__FILE__,__LINE__) MissionElement; + MissionElement* elem = new MissionElement; if (!elem) { Exit(); return 0; @@ -618,7 +617,7 @@ CampaignMissionFighter::CreateSingleElement(CombatGroup* g, CombatUnit* u) Text src = name.substring(0, dash); Text dst = name.substring(dash+1, name.length() - (dash+1)); - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::VECTOR, dst + "-" + src); + Instruction* obj = new Instruction(Instruction::VECTOR, dst + "-" + src); elem->AddObjective(obj); } else if ((u->Type() & Ship::STARSHIPS) != 0) { @@ -659,7 +658,7 @@ CampaignMissionFighter::CreateSquadron(CombatGroup* g) int live_count = fighter->LiveCount(); int maint_count = (live_count > 4) ? live_count / 2 : 0; - MissionElement* elem = new(__FILE__,__LINE__) MissionElement; + MissionElement* elem = new MissionElement; if (!elem) { Exit(); @@ -719,13 +718,13 @@ CampaignMissionFighter::CreatePlayer(CombatGroup* g) double delta = (pickup - elem->Location()).length(); if (delta > 30e3) { - Instruction* n = new(__FILE__,__LINE__) Instruction(elem->Region(), pickup, Instruction::ESCORT); + Instruction* n = new Instruction(elem->Region(), pickup, Instruction::ESCORT); n->SetTarget(ward->Name()); n->SetSpeed(750); elem->AddNavPoint(n); } - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ESCORT, ward->Name()); + Instruction* obj = new Instruction(Instruction::ESCORT, ward->Name()); switch (mission->Type()) { case Mission::ESCORT_FREIGHT: @@ -880,7 +879,7 @@ CampaignMissionFighter::CreateWardFreight() npt_loc += delta; - n = new(__FILE__,__LINE__) Instruction(elem->Region(), + n = new Instruction(elem->Region(), npt_loc, Instruction::VECTOR); @@ -896,7 +895,7 @@ CampaignMissionFighter::CreateWardFreight() else rgn2 = *zones[zones.size()-1]->GetRegions()[0]; - n = new(__FILE__,__LINE__) Instruction(rgn2, + n = new Instruction(rgn2, Point(0, 0, 0), Instruction::VECTOR); @@ -944,7 +943,7 @@ CampaignMissionFighter::CreateWardShuttle() npt_loc += delta; - n = new(__FILE__,__LINE__) Instruction(elem->Region(), + n = new Instruction(elem->Region(), npt_loc, Instruction::VECTOR); @@ -953,7 +952,7 @@ CampaignMissionFighter::CreateWardShuttle() elem->AddNavPoint(n); } - n = new(__FILE__,__LINE__) Instruction(air_region, + n = new Instruction(air_region, Point(0, 0, 10.0e3), Instruction::VECTOR); @@ -971,7 +970,7 @@ CampaignMissionFighter::CreateWardShuttle() elem->SetLocation(src); - n = new(__FILE__,__LINE__) Instruction(elem->Region(), dst, Instruction::DOCK); + n = new Instruction(elem->Region(), dst, Instruction::DOCK); if (n) { n->SetTarget(carrier->Name()); n->SetSpeed(500); @@ -1009,7 +1008,7 @@ CampaignMissionFighter::CreateWardStrike() elem->SetRegion(squadron->GetRegion()); if (strike_target) { - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ASSAULT, strike_target->Name()); + Instruction* obj = new Instruction(Instruction::ASSAULT, strike_target->Name()); if (obj) { if (airborne) @@ -1034,7 +1033,7 @@ CampaignMissionFighter::CreateWardStrike() delta *= -30.0e3; npt_loc += delta; - n = new(__FILE__,__LINE__) Instruction(elem->Region(), + n = new Instruction(elem->Region(), npt_loc, Instruction::VECTOR); if (n) { @@ -1044,7 +1043,7 @@ CampaignMissionFighter::CreateWardStrike() npt_loc = Point(0, 0, 10.0e3); - n = new(__FILE__,__LINE__) Instruction(air_region, + n = new Instruction(air_region, npt_loc, Instruction::VECTOR); if (n) { @@ -1061,7 +1060,7 @@ CampaignMissionFighter::CreateWardStrike() npt_loc = strike_target->Location() + delta + Point(0, 0, 8.0e3); - n = new(__FILE__,__LINE__) Instruction(strike_target->GetRegion(), + n = new Instruction(strike_target->GetRegion(), npt_loc, Instruction::STRIKE); if (n) { @@ -1071,7 +1070,7 @@ CampaignMissionFighter::CreateWardStrike() } if (airborne) { - n = new(__FILE__,__LINE__) Instruction(air_region, + n = new Instruction(air_region, Point(0, 0, 30.0e3), Instruction::VECTOR); if (n) { @@ -1081,7 +1080,7 @@ CampaignMissionFighter::CreateWardStrike() } if (carrier) { - n = new(__FILE__,__LINE__) Instruction(elem->Region(), + n = new Instruction(elem->Region(), carrier->Location() - Point(0, -20.0e3, 0), Instruction::VECTOR); if (n) { @@ -1127,7 +1126,7 @@ CampaignMissionFighter::CreateEscorts() ListIter npt_iter = player_elem->NavList(); while (++npt_iter) { Instruction* npt = npt_iter.value(); - Instruction* n = new(__FILE__,__LINE__) Instruction(npt->RegionName(), + Instruction* n = new Instruction(npt->RegionName(), npt->Location() + offset, Instruction::ESCORT); if (n) { @@ -1190,7 +1189,7 @@ CampaignMissionFighter::CreateTargetsPatrol() RandomDirection() * Random(110e3, 160e3); } - Instruction* n = new(__FILE__,__LINE__) Instruction(region, + Instruction* n = new Instruction(region, patrol_loc, Instruction::PATROL); if (n) @@ -1208,12 +1207,12 @@ CampaignMissionFighter::CreateTargetsPatrol() OrbitalInsertion(player_elem); } - Instruction* obj = new(__FILE__,__LINE__) Instruction(*n); + Instruction* obj = new Instruction(*n); obj->SetTargetDesc("inbound enemy units"); player_elem->AddObjective(obj); if (carrier_elem && !airborne) { - obj = new(__FILE__,__LINE__) Instruction(Instruction::DEFEND, carrier_elem->Name()); + obj = new Instruction(Instruction::DEFEND, carrier_elem->Name()); if (obj) { obj->SetTargetDesc(Text("the ") + carrier_elem->Name() + " battle group"); player_elem->AddObjective(obj); @@ -1244,7 +1243,7 @@ CampaignMissionFighter::CreateTargetsSweep() sweep_loc += Point(sin(a), -cos(a), 0) * 100.0e3; - n = new(__FILE__,__LINE__) Instruction(region, + n = new Instruction(region, sweep_loc, Instruction::VECTOR); if (n) { @@ -1262,7 +1261,7 @@ CampaignMissionFighter::CreateTargetsSweep() sweep_loc += Point(sin(a), -cos(a), 0) * 80.0e3; - n = new(__FILE__,__LINE__) Instruction(region, + n = new Instruction(region, sweep_loc, Instruction::SWEEP); if (n) { @@ -1289,7 +1288,7 @@ CampaignMissionFighter::CreateTargetsSweep() sweep_loc = base_loc; sweep_loc.y += 30.0e3; - n = new(__FILE__,__LINE__) Instruction(region, + n = new Instruction(region, sweep_loc, Instruction::VECTOR); if (n) { @@ -1297,7 +1296,7 @@ CampaignMissionFighter::CreateTargetsSweep() player_elem->AddNavPoint(n); } - Instruction* obj = new(__FILE__,__LINE__) Instruction(region, + Instruction* obj = new Instruction(region, sweep_loc, Instruction::SWEEP); if (obj) { @@ -1306,7 +1305,7 @@ CampaignMissionFighter::CreateTargetsSweep() } if (carrier_elem && !airborne) { - obj = new(__FILE__,__LINE__) Instruction(Instruction::DEFEND, carrier_elem->Name()); + obj = new Instruction(Instruction::DEFEND, carrier_elem->Name()); if (obj) { obj->SetTargetDesc(Text("the ") + carrier_elem->Name() + " battle group"); player_elem->AddObjective(obj); @@ -1334,10 +1333,10 @@ CampaignMissionFighter::CreateTargetsIntercept() if (elem) { elem->SetIntelLevel(Intel::KNOWN); elem->Loadouts().destroy(); - elem->Loadouts().append(new(__FILE__,__LINE__) MissionLoad(-1, "Hvy Ship Strike")); + elem->Loadouts().append(new MissionLoad(-1, "Hvy Ship Strike")); if (carrier) { - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ASSAULT, carrier->Name()); + Instruction* obj = new Instruction(Instruction::ASSAULT, carrier->Name()); if (obj) { elem->AddObjective(obj); elem->SetLocation(carrier->Location() + RandomPoint() * 6); @@ -1353,7 +1352,7 @@ CampaignMissionFighter::CreateTargetsIntercept() if (!prime_target) { prime_target = elem; - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::INTERCEPT, attacker); + Instruction* obj = new Instruction(Instruction::INTERCEPT, attacker); if (obj) { obj->SetTargetDesc(Text("inbound strike package '") + elem->Name() + "'"); player_elem->AddObjective(obj); @@ -1365,7 +1364,7 @@ CampaignMissionFighter::CreateTargetsIntercept() e2->SetIntelLevel(Intel::KNOWN); e2->SetLocation(elem->Location() + RandomPoint() * 0.25); - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ESCORT, elem->Name()); + Instruction* obj = new Instruction(Instruction::ESCORT, elem->Name()); if (obj) e2->AddObjective(obj); mission->AddElement(e2); @@ -1383,7 +1382,7 @@ CampaignMissionFighter::CreateTargetsIntercept() Player* p = Player::GetCurrentPlayer(); elem->SetAlert(p ? !p->FlyingStart() : true); - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::INTERCEPT, attacker); + Instruction* obj = new Instruction(Instruction::INTERCEPT, attacker); if (obj) elem->AddObjective(obj); mission->AddElement(elem); @@ -1392,7 +1391,7 @@ CampaignMissionFighter::CreateTargetsIntercept() } if (carrier && !airborne) { - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::DEFEND, carrier->Name()); + Instruction* obj = new Instruction(Instruction::DEFEND, carrier->Name()); if (obj) { obj->SetTargetDesc(Text("the ") + carrier->Name() + " battle group"); player_elem->AddObjective(obj); @@ -1424,7 +1423,7 @@ CampaignMissionFighter::CreateTargetsFreightEscort() elem->SetLocation(ward->Location() + RandomPoint() * 5); - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ASSAULT, ward->Name()); + Instruction* obj = new Instruction(Instruction::ASSAULT, ward->Name()); if (obj) elem->AddObjective(obj); mission->AddElement(elem); @@ -1434,14 +1433,14 @@ CampaignMissionFighter::CreateTargetsFreightEscort() e2->SetIntelLevel(Intel::KNOWN); e2->SetLocation(elem->Location() + RandomPoint() * 0.25); - Instruction* obj2 = new(__FILE__,__LINE__) Instruction(Instruction::ESCORT, elem->Name()); + Instruction* obj2 = new Instruction(Instruction::ESCORT, elem->Name()); if (obj2) e2->AddObjective(obj2); mission->AddElement(e2); } } - Instruction* obj3 = new(__FILE__,__LINE__) Instruction(mission->GetRegion(), + Instruction* obj3 = new Instruction(mission->GetRegion(), Point(0,0,0), Instruction::PATROL); @@ -1470,7 +1469,7 @@ CampaignMissionFighter::CreateTargetsStrikeEscort() ListIter npt_iter = ward->NavList(); while (++npt_iter) { Instruction* npt = npt_iter.value(); - Instruction* n = new(__FILE__,__LINE__) Instruction(npt->RegionName(), + Instruction* n = new Instruction(npt->RegionName(), npt->Location() + offset, Instruction::ESCORT); if (n) { @@ -1500,7 +1499,7 @@ CampaignMissionFighter::CreateTargetsStrike() if (elem->GetCombatGroup() == strike_target) { prime_target = elem; - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::STRIKE, elem->Name()); + Instruction* obj = new Instruction(Instruction::STRIKE, elem->Name()); if (obj) { obj->SetTargetDesc(Text("preplanned target '") + elem->Name() + "'"); player_elem->AddObjective(obj); @@ -1527,7 +1526,7 @@ CampaignMissionFighter::CreateTargetsStrike() rloc.SetAzimuth(90*DEGREES); rloc.SetAzimuthVar(25*DEGREES); - n = new(__FILE__,__LINE__) Instruction(prime_target->Region(), + n = new Instruction(prime_target->Region(), Point(), Instruction::VECTOR); if (n) { @@ -1546,7 +1545,7 @@ CampaignMissionFighter::CreateTargetsStrike() loc = prime_target->Location() + delta; loc.z = 8.0e3; - n = new(__FILE__,__LINE__) Instruction(prime_target->Region(), + n = new Instruction(prime_target->Region(), loc, Instruction::STRIKE); if (n) { @@ -1562,7 +1561,7 @@ CampaignMissionFighter::CreateTargetsStrike() rloc.SetAzimuth(-90*DEGREES); rloc.SetAzimuthVar(25*DEGREES); - n = new(__FILE__,__LINE__) Instruction(prime_target->Region(), + n = new Instruction(prime_target->Region(), Point(), Instruction::VECTOR); if (n) { @@ -1579,7 +1578,7 @@ CampaignMissionFighter::CreateTargetsStrike() rloc.SetAzimuth(180*DEGREES); rloc.SetAzimuthVar(30*DEGREES); - n = new(__FILE__,__LINE__) Instruction(carrier_elem->Region(), + n = new Instruction(carrier_elem->Region(), Point(), Instruction::RTB); if (n) { @@ -1632,7 +1631,7 @@ CampaignMissionFighter::CreateTargetsAssault() if (prime_target) { MissionElement* elem = prime_target; - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ASSAULT, elem->Name()); + Instruction* obj = new Instruction(Instruction::ASSAULT, elem->Name()); if (obj) { obj->SetTargetDesc(Text("preplanned target '") + elem->Name() + "'"); player_elem->AddObjective(obj); @@ -1663,7 +1662,7 @@ CampaignMissionFighter::CreateTargetsAssault() rloc.SetAzimuth(90*DEGREES); rloc.SetAzimuthVar(45*DEGREES); - instr = new(__FILE__,__LINE__) Instruction(elem->Region(), dummy, Instruction::VECTOR); + instr = new Instruction(elem->Region(), dummy, Instruction::VECTOR); if (instr) { instr->SetSpeed(750); instr->GetRLoc() = rloc; @@ -1682,7 +1681,7 @@ CampaignMissionFighter::CreateTargetsAssault() rloc.SetAzimuth(120*DEGREES); rloc.SetAzimuthVar(15*DEGREES); - instr = new(__FILE__,__LINE__) Instruction(elem->Region(), dummy, Instruction::ASSAULT); + instr = new Instruction(elem->Region(), dummy, Instruction::ASSAULT); if (instr) { instr->SetSpeed(750); instr->GetRLoc() = rloc; @@ -1699,7 +1698,7 @@ CampaignMissionFighter::CreateTargetsAssault() rloc.SetAzimuth(180*DEGREES); rloc.SetAzimuthVar(60*DEGREES); - instr = new(__FILE__,__LINE__) Instruction(carrier_elem->Region(), dummy, Instruction::RTB); + instr = new Instruction(carrier_elem->Region(), dummy, Instruction::RTB); if (instr) { instr->SetSpeed(500); instr->GetRLoc() = rloc; @@ -1763,7 +1762,7 @@ CampaignMissionFighter::CreateRandomTarget(const char* rgn, Point base_loc) e2->SetRegion(rgn); e2->SetLocation(elem->Location() + RandomPoint() * 0.5); - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ESCORT, elem->Name()); + Instruction* obj = new Instruction(Instruction::ESCORT, elem->Name()); if (obj) e2->AddObjective(obj); mission->AddElement(e2); @@ -1815,7 +1814,7 @@ CampaignMissionFighter::CreateRandomTarget(const char* rgn, Point base_loc) e2->SetRegion(rgn); e2->SetLocation(elem->Location() + RandomPoint() * 0.5); - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ESCORT, elem->Name()); + Instruction* obj = new Instruction(Instruction::ESCORT, elem->Name()); if (obj) e2->AddObjective(obj); mission->AddElement(e2); @@ -1846,7 +1845,7 @@ CampaignMissionFighter::CreateRandomTarget(const char* rgn, Point base_loc) e2->SetRegion(rgn); e2->SetLocation(elem->Location() + RandomPoint() * 0.5); - Instruction* obj = new(__FILE__,__LINE__) Instruction(Instruction::ESCORT, elem->Name()); + Instruction* obj = new Instruction(Instruction::ESCORT, elem->Name()); if (obj) e2->AddObjective(obj); mission->AddElement(e2); @@ -1910,7 +1909,7 @@ CampaignMissionFighter::PlanetaryInsertion(MissionElement* elem) npt_loc += delta; - n = new(__FILE__,__LINE__) Instruction(elem->Region(), + n = new Instruction(elem->Region(), npt_loc, Instruction::VECTOR); if (n) { @@ -1919,7 +1918,7 @@ CampaignMissionFighter::PlanetaryInsertion(MissionElement* elem) } } - n = new(__FILE__,__LINE__) Instruction(air_region, + n = new Instruction(air_region, Point(0, 0, 15e3), Instruction::VECTOR); if (n) { @@ -1931,7 +1930,7 @@ CampaignMissionFighter::PlanetaryInsertion(MissionElement* elem) void CampaignMissionFighter::OrbitalInsertion(MissionElement* elem) { - Instruction* n = new(__FILE__,__LINE__) Instruction(air_region, + Instruction* n = new Instruction(air_region, Point(0, 0, 30.0e3), Instruction::VECTOR); if (n) { @@ -1965,7 +1964,7 @@ CampaignMissionFighter::CreateFighterPackage(CombatGroup* squadron, int count, i return 0; } - MissionElement* elem = new(__FILE__,__LINE__) MissionElement; + MissionElement* elem = new MissionElement; if (!elem) { Exit(); return 0; @@ -1994,17 +1993,17 @@ CampaignMissionFighter::CreateFighterPackage(CombatGroup* squadron, int count, i case Mission::ASSAULT: if (request->GetObjective() && request->GetObjective()->Type() == CombatGroup::MINEFIELD) - elem->Loadouts().append(new(__FILE__,__LINE__) MissionLoad(-1, "Rockets")); + elem->Loadouts().append(new MissionLoad(-1, "Rockets")); else - elem->Loadouts().append(new(__FILE__,__LINE__) MissionLoad(-1, "Ship Strike")); + elem->Loadouts().append(new MissionLoad(-1, "Ship Strike")); break; case Mission::STRIKE: - elem->Loadouts().append(new(__FILE__,__LINE__) MissionLoad(-1, "Ground Strike")); + elem->Loadouts().append(new MissionLoad(-1, "Ground Strike")); break; default: - elem->Loadouts().append(new(__FILE__,__LINE__) MissionLoad(-1, "ACM Medium Range")); + elem->Loadouts().append(new MissionLoad(-1, "ACM Medium Range")); break; } @@ -2125,7 +2124,7 @@ CampaignMissionFighter::DescribeMission() (const char*) player_elem->Name()); } - MissionInfo* info = new(__FILE__,__LINE__) MissionInfo; + MissionInfo* info = new MissionInfo; info->id = mission->Identity(); info->mission = mission; -- cgit v1.1