summaryrefslogtreecommitdiffhomepage
path: root/Stars45/CmdDlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/CmdDlg.cpp')
-rw-r--r--Stars45/CmdDlg.cpp192
1 files changed, 96 insertions, 96 deletions
diff --git a/Stars45/CmdDlg.cpp b/Stars45/CmdDlg.cpp
index c6f5433..1fbe445 100644
--- a/Stars45/CmdDlg.cpp
+++ b/Stars45/CmdDlg.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: CmdDlg.cpp
- AUTHOR: John DiCamillo
+ SUBSYSTEM: Stars.exe
+ FILE: CmdDlg.cpp
+ AUTHOR: John DiCamillo
- OVERVIEW
- ========
- Operational Command Dialog Active Window class
+ OVERVIEW
+ ========
+ Operational Command Dialog Active Window class
*/
#include "MemDebug.h"
@@ -35,15 +35,15 @@
// +--------------------------------------------------------------------+
CmdDlg::CmdDlg(CmpnScreen* mgr)
- : cmpn_screen(mgr),
- txt_group(0), txt_score(0), txt_name(0), txt_time(0),
- btn_save(0), btn_exit(0), stars(0), campaign(0), mode(0)
+: cmpn_screen(mgr),
+txt_group(0), txt_score(0), txt_name(0), txt_time(0),
+btn_save(0), btn_exit(0), stars(0), campaign(0), mode(0)
{
- stars = Starshatter::GetInstance();
- campaign = Campaign::GetCampaign();
+ stars = Starshatter::GetInstance();
+ campaign = Campaign::GetCampaign();
- for (int i = 0; i < 5; i++)
- btn_mode[i] = 0;
+ for (int i = 0; i < 5; i++)
+ btn_mode[i] = 0;
}
CmdDlg::~CmdDlg()
@@ -55,17 +55,17 @@ CmdDlg::~CmdDlg()
void
CmdDlg::RegisterCmdControls(FormWindow* win)
{
- btn_save = (Button*) win->FindControl( 1);
- btn_exit = (Button*) win->FindControl( 2);
+ btn_save = (Button*) win->FindControl( 1);
+ btn_exit = (Button*) win->FindControl( 2);
- for (int i = 0; i < 5; i++) {
- btn_mode[i] = (Button*) win->FindControl(100 + i);
- }
+ for (int i = 0; i < 5; i++) {
+ btn_mode[i] = (Button*) win->FindControl(100 + i);
+ }
- txt_group = win->FindControl(200);
- txt_score = win->FindControl(201);
- txt_name = win->FindControl(300);
- txt_time = win->FindControl(301);
+ txt_group = win->FindControl(200);
+ txt_score = win->FindControl(201);
+ txt_name = win->FindControl(300);
+ txt_time = win->FindControl(301);
}
// +--------------------------------------------------------------------+
@@ -73,22 +73,22 @@ CmdDlg::RegisterCmdControls(FormWindow* win)
void
CmdDlg::ShowCmdDlg()
{
- campaign = Campaign::GetCampaign();
+ campaign = Campaign::GetCampaign();
- if (txt_name) {
- if (campaign)
- txt_name->SetText(campaign->Name());
- else
- txt_name->SetText("No Campaign Selected");
- }
+ if (txt_name) {
+ if (campaign)
+ txt_name->SetText(campaign->Name());
+ else
+ txt_name->SetText("No Campaign Selected");
+ }
- ShowMode();
+ ShowMode();
- if (btn_save)
- btn_save->SetEnabled(!campaign->IsTraining());
+ if (btn_save)
+ btn_save->SetEnabled(!campaign->IsTraining());
- if (btn_mode[MODE_FORCES]) btn_mode[MODE_FORCES]->SetEnabled(!campaign->IsTraining());
- if (btn_mode[MODE_INTEL]) btn_mode[MODE_INTEL]->SetEnabled(!campaign->IsTraining());
+ if (btn_mode[MODE_FORCES]) btn_mode[MODE_FORCES]->SetEnabled(!campaign->IsTraining());
+ if (btn_mode[MODE_INTEL]) btn_mode[MODE_INTEL]->SetEnabled(!campaign->IsTraining());
}
// +--------------------------------------------------------------------+
@@ -96,36 +96,36 @@ CmdDlg::ShowCmdDlg()
void
CmdDlg::ExecFrame()
{
- CombatGroup* g = campaign->GetPlayerGroup();
- if (g && txt_group)
- txt_group->SetText(g->GetDescription());
-
- if (txt_score) {
- char score[32];
- sprintf(score, "Team Score: %d", campaign->GetPlayerTeamScore());
- txt_score->SetText(score);
- txt_score->SetTextAlign(DT_RIGHT);
- }
-
- if (txt_time) {
- double t = campaign->GetTime();
- char daytime[32];
- FormatDayTime(daytime, t);
- txt_time->SetText(daytime);
- }
-
- int unread = campaign->CountNewEvents();
-
- if (btn_mode[MODE_INTEL]) {
- if (unread > 0) {
- char text[64];
- sprintf(text, "INTEL (%d)", unread);
- btn_mode[MODE_INTEL]->SetText(text);
- }
- else {
- btn_mode[MODE_INTEL]->SetText("INTEL");
- }
- }
+ CombatGroup* g = campaign->GetPlayerGroup();
+ if (g && txt_group)
+ txt_group->SetText(g->GetDescription());
+
+ if (txt_score) {
+ char score[32];
+ sprintf(score, "Team Score: %d", campaign->GetPlayerTeamScore());
+ txt_score->SetText(score);
+ txt_score->SetTextAlign(DT_RIGHT);
+ }
+
+ if (txt_time) {
+ double t = campaign->GetTime();
+ char daytime[32];
+ FormatDayTime(daytime, t);
+ txt_time->SetText(daytime);
+ }
+
+ int unread = campaign->CountNewEvents();
+
+ if (btn_mode[MODE_INTEL]) {
+ if (unread > 0) {
+ char text[64];
+ sprintf(text, "INTEL (%d)", unread);
+ btn_mode[MODE_INTEL]->SetText(text);
+ }
+ else {
+ btn_mode[MODE_INTEL]->SetText("INTEL");
+ }
+ }
}
// +--------------------------------------------------------------------+
@@ -133,54 +133,54 @@ CmdDlg::ExecFrame()
void
CmdDlg::ShowMode()
{
- for (int i = 0; i < 5; i++) {
- if (btn_mode[i]) btn_mode[i]->SetButtonState(0);
- }
+ for (int i = 0; i < 5; i++) {
+ if (btn_mode[i]) btn_mode[i]->SetButtonState(0);
+ }
- if (mode < 0 || mode > 4)
- mode = 0;
+ if (mode < 0 || mode > 4)
+ mode = 0;
- if (btn_mode[mode]) btn_mode[mode]->SetButtonState(1);
+ if (btn_mode[mode]) btn_mode[mode]->SetButtonState(1);
}
void
CmdDlg::OnMode(AWEvent* event)
{
- for (int i = MODE_ORDERS; i < NUM_MODES; i++) {
- Button* btn = btn_mode[i];
-
- if (event->window == btn) {
- mode = i;
- }
- }
-
- switch (mode) {
- case MODE_ORDERS: cmpn_screen->ShowCmdOrdersDlg(); break;
- case MODE_THEATER: cmpn_screen->ShowCmdTheaterDlg(); break;
- case MODE_FORCES: cmpn_screen->ShowCmdForceDlg(); break;
- case MODE_INTEL: cmpn_screen->ShowCmdIntelDlg(); break;
- case MODE_MISSIONS: cmpn_screen->ShowCmdMissionsDlg(); break;
- default: cmpn_screen->ShowCmdOrdersDlg(); break;
- }
+ for (int i = MODE_ORDERS; i < NUM_MODES; i++) {
+ Button* btn = btn_mode[i];
+
+ if (event->window == btn) {
+ mode = i;
+ }
+ }
+
+ switch (mode) {
+ case MODE_ORDERS: cmpn_screen->ShowCmdOrdersDlg(); break;
+ case MODE_THEATER: cmpn_screen->ShowCmdTheaterDlg(); break;
+ case MODE_FORCES: cmpn_screen->ShowCmdForceDlg(); break;
+ case MODE_INTEL: cmpn_screen->ShowCmdIntelDlg(); break;
+ case MODE_MISSIONS: cmpn_screen->ShowCmdMissionsDlg(); break;
+ default: cmpn_screen->ShowCmdOrdersDlg(); break;
+ }
}
void
CmdDlg::OnSave(AWEvent* event)
{
- if (campaign && cmpn_screen) {
- CmpFileDlg* fdlg = cmpn_screen->GetCmpFileDlg();
+ if (campaign && cmpn_screen) {
+ CmpFileDlg* fdlg = cmpn_screen->GetCmpFileDlg();
- cmpn_screen->ShowCmpFileDlg();
- }
+ cmpn_screen->ShowCmpFileDlg();
+ }
}
void
CmdDlg::OnExit(AWEvent* event)
{
- if (stars) {
- Mouse::Show(false);
- stars->SetGameMode(Starshatter::MENU_MODE);
- }
+ if (stars) {
+ Mouse::Show(false);
+ stars->SetGameMode(Starshatter::MENU_MODE);
+ }
}
// +--------------------------------------------------------------------+