summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup/configfile.h2
-rw-r--r--setup/mainmenu.c33
-rw-r--r--setup/multiplayer.c7
-rw-r--r--setup/multiplayer.h3
4 files changed, 38 insertions, 7 deletions
diff --git a/setup/configfile.h b/setup/configfile.h
index 9ea6f575..63113cc1 100644
--- a/setup/configfile.h
+++ b/setup/configfile.h
@@ -28,10 +28,12 @@
#ifndef __SETUP_CONFIG__
#define __SETUP_CONFIG__
+extern char *configdir;
void M_LoadDefaults (void);
void M_SaveDefaults (void);
+void M_SetConfigDir(void);
#endif
diff --git a/setup/mainmenu.c b/setup/mainmenu.c
index 23b9f6df..ca29e9cf 100644
--- a/setup/mainmenu.c
+++ b/setup/mainmenu.c
@@ -23,6 +23,9 @@
#include "config.h"
#include "textscreen.h"
+#include "configfile.h"
+#include "m_argv.h"
+
#include "compatibility.h"
#include "display.h"
#include "keyboard.h"
@@ -34,7 +37,7 @@ void DoQuit(void *widget, void *dosave)
{
if (dosave != NULL)
{
- printf("Saving config\n");
+ M_SaveDefaults();
}
exit(0);
@@ -101,7 +104,24 @@ void MainMenu(void)
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, quit_action);
}
-int main(int argc, char *argv[])
+//
+// Initialise all configuration variables, load config file, etc
+//
+
+static void InitConfig(void)
+{
+ SetChatMacroDefaults();
+ SetPlayerNameDefault();
+
+ M_SetConfigDir();
+ M_LoadDefaults();
+}
+
+//
+// Initialise and run the textscreen GUI.
+//
+
+static void RunGUI(void)
{
TXT_Init();
TXT_SetDesktopTitle(PACKAGE_NAME " Setup ver " PACKAGE_VERSION);
@@ -109,6 +129,15 @@ int main(int argc, char *argv[])
MainMenu();
TXT_GUIMainLoop();
+}
+
+int main(int argc, char *argv[])
+{
+ myargc = argc;
+ myargv = argv;
+
+ InitConfig();
+ RunGUI();
return 0;
}
diff --git a/setup/multiplayer.c b/setup/multiplayer.c
index 2ae143ba..82bad089 100644
--- a/setup/multiplayer.c
+++ b/setup/multiplayer.c
@@ -313,7 +313,7 @@ void JoinMultiGame(void)
TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, StartGameAction());
}
-static void SetChatMacroDefaults(void)
+void SetChatMacroDefaults(void)
{
int i;
char *defaults[] =
@@ -341,7 +341,7 @@ static void SetChatMacroDefaults(void)
}
}
-static void SetPlayerNameDefault(void)
+void SetPlayerNameDefault(void)
{
if (player_name == NULL)
{
@@ -367,9 +367,6 @@ void MultiplayerConfig(void)
char buf[10];
int i;
- SetChatMacroDefaults();
- SetPlayerNameDefault();
-
window = TXT_NewWindow("Multiplayer Configuration");
TXT_AddWidgets(window,
diff --git a/setup/multiplayer.h b/setup/multiplayer.h
index 6c8ea299..be35bd08 100644
--- a/setup/multiplayer.h
+++ b/setup/multiplayer.h
@@ -29,5 +29,8 @@ void StartMultiGame(void);
void JoinMultiGame(void);
void MultiplayerConfig(void);
+void SetChatMacroDefaults(void);
+void SetPlayerNameDefault(void);
+
#endif /* #ifndef SETUP_MULTIPLAYER_H */