summaryrefslogtreecommitdiffhomepage
path: root/Stars45/CombatEvent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/CombatEvent.cpp')
-rw-r--r--Stars45/CombatEvent.cpp144
1 files changed, 72 insertions, 72 deletions
diff --git a/Stars45/CombatEvent.cpp b/Stars45/CombatEvent.cpp
index eea73a9..6af78ee 100644
--- a/Stars45/CombatEvent.cpp
+++ b/Stars45/CombatEvent.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: CombatEvent.cpp
- AUTHOR: John DiCamillo
+ SUBSYSTEM: Stars.exe
+ FILE: CombatEvent.cpp
+ AUTHOR: John DiCamillo
- OVERVIEW
- ========
- A significant (newsworthy) event in the dynamic campaign.
+ OVERVIEW
+ ========
+ A significant (newsworthy) event in the dynamic campaign.
*/
#include "MemDebug.h"
@@ -28,9 +28,9 @@
// +----------------------------------------------------------------------+
CombatEvent::CombatEvent(Campaign* c, int typ, int tim, int tem,
- int src, const char* rgn)
- : campaign(c), type(typ), time(tim), team(tem), source(src),
- region(rgn), points(0), visited(false)
+int src, const char* rgn)
+: campaign(c), type(typ), time(tim), team(tem), source(src),
+region(rgn), points(0), visited(false)
{ }
// +----------------------------------------------------------------------+
@@ -38,7 +38,7 @@ CombatEvent::CombatEvent(Campaign* c, int typ, int tim, int tem,
const char*
CombatEvent::SourceName() const
{
- return SourceName(source);
+ return SourceName(source);
}
// +----------------------------------------------------------------------+
@@ -46,7 +46,7 @@ CombatEvent::SourceName() const
const char*
CombatEvent::TypeName() const
{
- return TypeName(type);
+ return TypeName(type);
}
// +----------------------------------------------------------------------+
@@ -54,25 +54,25 @@ CombatEvent::TypeName() const
const char*
CombatEvent::SourceName(int n)
{
- switch (n) {
- case FORCOM: return "FORCOM";
- case TACNET: return "TACNET";
- case INTEL: return "SECURE";
- case MAIL: return "Mail";
- case NEWS: return "News";
- }
-
- return "Unknown";
+ switch (n) {
+ case FORCOM: return "FORCOM";
+ case TACNET: return "TACNET";
+ case INTEL: return "SECURE";
+ case MAIL: return "Mail";
+ case NEWS: return "News";
+ }
+
+ return "Unknown";
}
int
CombatEvent::SourceFromName(const char* n)
{
- for (int i = FORCOM; i <= NEWS; i++)
- if (!stricmp(n, SourceName(i)))
- return i;
+ for (int i = FORCOM; i <= NEWS; i++)
+ if (!stricmp(n, SourceName(i)))
+ return i;
- return -1;
+ return -1;
}
// +----------------------------------------------------------------------+
@@ -80,29 +80,29 @@ CombatEvent::SourceFromName(const char* n)
const char*
CombatEvent::TypeName(int n)
{
- switch (n) {
- case ATTACK: return "ATTACK";
- case DEFEND: return "DEFEND";
- case MOVE_TO: return "MOVE_TO";
- case CAPTURE: return "CAPTURE";
- case STRATEGY: return "STRATEGY";
- case STORY: return "STORY";
- case CAMPAIGN_START: return "CAMPAIGN_START";
- case CAMPAIGN_END: return "CAMPAIGN_END";
- case CAMPAIGN_FAIL: return "CAMPAIGN_FAIL";
- }
-
- return "Unknown";
+ switch (n) {
+ case ATTACK: return "ATTACK";
+ case DEFEND: return "DEFEND";
+ case MOVE_TO: return "MOVE_TO";
+ case CAPTURE: return "CAPTURE";
+ case STRATEGY: return "STRATEGY";
+ case STORY: return "STORY";
+ case CAMPAIGN_START: return "CAMPAIGN_START";
+ case CAMPAIGN_END: return "CAMPAIGN_END";
+ case CAMPAIGN_FAIL: return "CAMPAIGN_FAIL";
+ }
+
+ return "Unknown";
}
int
CombatEvent::TypeFromName(const char* n)
{
- for (int i = ATTACK; i <= CAMPAIGN_FAIL; i++)
- if (!stricmp(n, TypeName(i)))
- return i;
+ for (int i = ATTACK; i <= CAMPAIGN_FAIL; i++)
+ if (!stricmp(n, TypeName(i)))
+ return i;
- return -1;
+ return -1;
}
// +----------------------------------------------------------------------+
@@ -110,44 +110,44 @@ CombatEvent::TypeFromName(const char* n)
void
CombatEvent::Load()
{
- DataLoader* loader = DataLoader::GetLoader();
+ DataLoader* loader = DataLoader::GetLoader();
- if (!campaign || !loader)
- return;
+ if (!campaign || !loader)
+ return;
- loader->SetDataPath(campaign->Path());
+ loader->SetDataPath(campaign->Path());
- if (file.length() > 0) {
- const char* filename = file.data();
- BYTE* block = 0;
+ if (file.length() > 0) {
+ const char* filename = file.data();
+ BYTE* block = 0;
- loader->LoadBuffer(filename, block, true);
- info = (const char*) block;
- loader->ReleaseBuffer(block);
+ loader->LoadBuffer(filename, block, true);
+ info = (const char*) block;
+ loader->ReleaseBuffer(block);
- if (info.contains('$')) {
- Player* player = Player::GetCurrentPlayer();
- CombatGroup* group = campaign->GetPlayerGroup();
+ if (info.contains('$')) {
+ Player* player = Player::GetCurrentPlayer();
+ CombatGroup* group = campaign->GetPlayerGroup();
- if (player) {
- info = FormatTextReplace(info, "$NAME", player->Name().data());
- info = FormatTextReplace(info, "$RANK", Player::RankName(player->Rank()));
- }
+ if (player) {
+ info = FormatTextReplace(info, "$NAME", player->Name().data());
+ info = FormatTextReplace(info, "$RANK", Player::RankName(player->Rank()));
+ }
- if (group) {
- info = FormatTextReplace(info, "$GROUP", group->GetDescription());
- }
+ if (group) {
+ info = FormatTextReplace(info, "$GROUP", group->GetDescription());
+ }
- char timestr[32];
- FormatDayTime(timestr, campaign->GetTime(), true);
- info = FormatTextReplace(info, "$TIME", timestr);
- }
- }
+ char timestr[32];
+ FormatDayTime(timestr, campaign->GetTime(), true);
+ info = FormatTextReplace(info, "$TIME", timestr);
+ }
+ }
- if (type < CAMPAIGN_END && image_file.length() > 0) {
- loader->LoadBitmap(image_file, image);
- }
+ if (type < CAMPAIGN_END && image_file.length() > 0) {
+ loader->LoadBitmap(image_file, image);
+ }
- loader->SetDataPath(0);
+ loader->SetDataPath(0);
}