From 3c487c5cd69c53d6fea948643c0a76df03516605 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 1 Apr 2022 21:23:39 +0200 Subject: Moved Stars45 to StarsEx --- Stars45/CombatEvent.cpp | 151 ------------------------------------------------ 1 file changed, 151 deletions(-) delete mode 100644 Stars45/CombatEvent.cpp (limited to 'Stars45/CombatEvent.cpp') diff --git a/Stars45/CombatEvent.cpp b/Stars45/CombatEvent.cpp deleted file mode 100644 index 8c02142..0000000 --- a/Stars45/CombatEvent.cpp +++ /dev/null @@ -1,151 +0,0 @@ -/* Starshatter: The Open Source Project - Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors - Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors - Copyright (c) 1997-2006, Destroyer Studios LLC. - - AUTHOR: John DiCamillo - - - OVERVIEW - ======== - A significant (newsworthy) event in the dynamic campaign. -*/ - -#include "CombatEvent.h" -#include "CombatGroup.h" -#include "Campaign.h" -#include "Player.h" -#include "ShipDesign.h" -#include "Ship.h" - -#include "Term.h" -#include "ParseUtil.h" -#include "FormatUtil.h" -#include "DataLoader.h" - -// +----------------------------------------------------------------------+ - -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) -{ } - -// +----------------------------------------------------------------------+ - -const char* -CombatEvent::SourceName() const -{ - return SourceName(source); -} - -// +----------------------------------------------------------------------+ - -const char* -CombatEvent::TypeName() const -{ - return TypeName(type); -} - -// +----------------------------------------------------------------------+ - -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"; -} - -int -CombatEvent::SourceFromName(const char* n) -{ - for (int i = FORCOM; i <= NEWS; i++) - if (!_stricmp(n, SourceName(i))) - return i; - - return -1; -} - -// +----------------------------------------------------------------------+ - -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"; -} - -int -CombatEvent::TypeFromName(const char* n) -{ - for (int i = ATTACK; i <= CAMPAIGN_FAIL; i++) - if (!_stricmp(n, TypeName(i))) - return i; - - return -1; -} - -// +----------------------------------------------------------------------+ - -void -CombatEvent::Load() -{ - DataLoader* loader = DataLoader::GetLoader(); - - if (!campaign || !loader) - return; - - loader->SetDataPath(campaign->Path()); - - if (file.length() > 0) { - const char* filename = file.data(); - BYTE* block = 0; - - loader->LoadBuffer(filename, block, true); - info = (const char*) block; - loader->ReleaseBuffer(block); - - 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 (group) { - info = FormatTextReplace(info, "$GROUP", group->GetDescription()); - } - - 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); - } - - loader->SetDataPath(0); -} - -- cgit v1.1