summaryrefslogtreecommitdiffhomepage
path: root/Stars45/NetServerDlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Stars45/NetServerDlg.cpp')
-rw-r--r--Stars45/NetServerDlg.cpp194
1 files changed, 97 insertions, 97 deletions
diff --git a/Stars45/NetServerDlg.cpp b/Stars45/NetServerDlg.cpp
index 0135b34..adb869c 100644
--- a/Stars45/NetServerDlg.cpp
+++ b/Stars45/NetServerDlg.cpp
@@ -1,15 +1,15 @@
/* Project Starshatter 5.0
- Destroyer Studios LLC
- Copyright © 1997-2007. All Rights Reserved.
+ Destroyer Studios LLC
+ Copyright © 1997-2007. All Rights Reserved.
- SUBSYSTEM: Stars.exe
- FILE: NetServerDlg.cpp
- AUTHOR: John DiCamillo
+ SUBSYSTEM: Stars.exe
+ FILE: NetServerDlg.cpp
+ AUTHOR: John DiCamillo
- OVERVIEW
- ========
- Main Menu Dialog Active Window class
+ OVERVIEW
+ ========
+ Main Menu Dialog Active Window class
*/
#include "MemDebug.h"
@@ -39,10 +39,10 @@ DEF_MAP_CLIENT(NetServerDlg, OnCancel);
// +--------------------------------------------------------------------+
NetServerDlg::NetServerDlg(Screen* s, FormDef& def, MenuScreen* mgr)
- : FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr)
+: FormWindow(s, 0, 0, s->Width(), s->Height()), manager(mgr)
{
- config = NetServerConfig::GetInstance();
- Init(def);
+ config = NetServerConfig::GetInstance();
+ Init(def);
}
NetServerDlg::~NetServerDlg()
@@ -54,19 +54,19 @@ NetServerDlg::~NetServerDlg()
void
NetServerDlg::RegisterControls()
{
- edt_name = (EditBox*) FindControl(200);
- cmb_type = (ComboBox*) FindControl(201);
- edt_game_port = (EditBox*) FindControl(202);
- edt_admin_port = (EditBox*) FindControl(203);
- edt_game_pass = (EditBox*) FindControl(204);
- edt_admin_name = (EditBox*) FindControl(205);
- edt_admin_pass = (EditBox*) FindControl(206);
-
- btn_apply = (Button*) FindControl(1);
- btn_cancel = (Button*) FindControl(2);
-
- REGISTER_CLIENT(EID_CLICK, btn_apply, NetServerDlg, OnApply);
- REGISTER_CLIENT(EID_CLICK, btn_cancel, NetServerDlg, OnCancel);
+ edt_name = (EditBox*) FindControl(200);
+ cmb_type = (ComboBox*) FindControl(201);
+ edt_game_port = (EditBox*) FindControl(202);
+ edt_admin_port = (EditBox*) FindControl(203);
+ edt_game_pass = (EditBox*) FindControl(204);
+ edt_admin_name = (EditBox*) FindControl(205);
+ edt_admin_pass = (EditBox*) FindControl(206);
+
+ btn_apply = (Button*) FindControl(1);
+ btn_cancel = (Button*) FindControl(2);
+
+ REGISTER_CLIENT(EID_CLICK, btn_apply, NetServerDlg, OnApply);
+ REGISTER_CLIENT(EID_CLICK, btn_cancel, NetServerDlg, OnCancel);
}
// +--------------------------------------------------------------------+
@@ -74,44 +74,44 @@ NetServerDlg::RegisterControls()
void
NetServerDlg::Show()
{
- if (!IsShown())
- FormWindow::Show();
+ if (!IsShown())
+ FormWindow::Show();
- NetServerConfig::Initialize();
- config = NetServerConfig::GetInstance();
+ NetServerConfig::Initialize();
+ config = NetServerConfig::GetInstance();
- if (config) {
- config->Load();
+ if (config) {
+ config->Load();
- char buff[32];
+ char buff[32];
- if (edt_name) {
- edt_name->SetText(config->Name());
- edt_name->SetFocus();
- }
+ if (edt_name) {
+ edt_name->SetText(config->Name());
+ edt_name->SetFocus();
+ }
- if (cmb_type)
- cmb_type->SetSelection(config->GetGameType());
+ if (cmb_type)
+ cmb_type->SetSelection(config->GetGameType());
- if (edt_game_port) {
- sprintf(buff, "%d", config->GetLobbyPort());
- edt_game_port->SetText(buff);
- }
+ if (edt_game_port) {
+ sprintf(buff, "%d", config->GetLobbyPort());
+ edt_game_port->SetText(buff);
+ }
- if (edt_admin_port) {
- sprintf(buff, "%d", config->GetAdminPort());
- edt_admin_port->SetText(buff);
- }
+ if (edt_admin_port) {
+ sprintf(buff, "%d", config->GetAdminPort());
+ edt_admin_port->SetText(buff);
+ }
- if (edt_game_pass)
- edt_game_pass->SetText(config->GetGamePass());
+ if (edt_game_pass)
+ edt_game_pass->SetText(config->GetGamePass());
- if (edt_admin_name)
- edt_admin_name->SetText(config->GetAdminName());
+ if (edt_admin_name)
+ edt_admin_name->SetText(config->GetAdminName());
- if (edt_admin_pass)
- edt_admin_pass->SetText(config->GetAdminPass());
- }
+ if (edt_admin_pass)
+ edt_admin_pass->SetText(config->GetAdminPass());
+ }
}
// +--------------------------------------------------------------------+
@@ -126,54 +126,54 @@ NetServerDlg::ExecFrame()
void
NetServerDlg::OnApply(AWEvent* event)
{
- if (config) {
- if (edt_name)
- config->SetName(edt_name->GetText());
-
- if (cmb_type)
- config->SetGameType(cmb_type->GetSelectedIndex());
-
- if (edt_game_port) {
- int port = 0;
- sscanf(edt_game_port->GetText(), "%d", &port);
- config->SetLobbyPort((WORD) port);
- config->SetGamePort((WORD) port+1);
- }
-
- if (edt_admin_port) {
- int port = 0;
- sscanf(edt_admin_port->GetText(), "%d", &port);
- config->SetAdminPort((WORD) port);
- }
-
- if (edt_game_pass)
- config->SetGamePass(edt_game_pass->GetText());
-
- if (edt_admin_name)
- config->SetAdminName(edt_admin_name->GetText());
-
- if (edt_admin_pass)
- config->SetAdminPass(edt_admin_pass->GetText());
-
-
- config->Save();
- }
-
- Starshatter* stars = Starshatter::GetInstance();
-
- if (stars) {
- ::Print("\nSTART LOCAL SERVER\n\n");
- stars->SetLobbyMode(Starshatter::NET_LOBBY_SERVER);
- manager->ShowNetLobbyDlg();
- }
- else {
- manager->ShowMenuDlg();
- }
+ if (config) {
+ if (edt_name)
+ config->SetName(edt_name->GetText());
+
+ if (cmb_type)
+ config->SetGameType(cmb_type->GetSelectedIndex());
+
+ if (edt_game_port) {
+ int port = 0;
+ sscanf(edt_game_port->GetText(), "%d", &port);
+ config->SetLobbyPort((WORD) port);
+ config->SetGamePort((WORD) port+1);
+ }
+
+ if (edt_admin_port) {
+ int port = 0;
+ sscanf(edt_admin_port->GetText(), "%d", &port);
+ config->SetAdminPort((WORD) port);
+ }
+
+ if (edt_game_pass)
+ config->SetGamePass(edt_game_pass->GetText());
+
+ if (edt_admin_name)
+ config->SetAdminName(edt_admin_name->GetText());
+
+ if (edt_admin_pass)
+ config->SetAdminPass(edt_admin_pass->GetText());
+
+
+ config->Save();
+ }
+
+ Starshatter* stars = Starshatter::GetInstance();
+
+ if (stars) {
+ ::Print("\nSTART LOCAL SERVER\n\n");
+ stars->SetLobbyMode(Starshatter::NET_LOBBY_SERVER);
+ manager->ShowNetLobbyDlg();
+ }
+ else {
+ manager->ShowMenuDlg();
+ }
}
void
NetServerDlg::OnCancel(AWEvent* event)
{
- NetServerConfig::Close();
- manager->ShowNetClientDlg();
+ NetServerConfig::Close();
+ manager->ShowNetClientDlg();
}