From d88d06faec694cbc72236619ead4d74cf0366179 Mon Sep 17 00:00:00 2001
From: mr-russ <>
Date: Tue, 23 Sep 2003 06:02:56 +0000
Subject: [PATCH] Fixed Bug #5294: -e switch doesn't work

---
 doc/ChangeLog.html          |  7 ++++---
 src/include/menus.h         |  2 ++
 src/stratagus/stratagus.cpp |  7 ++++++-
 src/ui/menus.cpp            | 16 +++++++++++++---
 4 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/doc/ChangeLog.html b/doc/ChangeLog.html
index 873d0e5d7..7f3ace4aa 100644
--- a/doc/ChangeLog.html
+++ b/doc/ChangeLog.html
@@ -21,21 +21,22 @@
 ----    02111-1307, USA.
 -->
 
-    <title>ChangeLog: Stratagus Version 1.18</title>
+    <title>ChangeLog: Stratagus Version 2.00</title>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 </head>
 
 <body>
     
-<h1>ChangeLog: Stratagus Version 1.18</h1>
+<h1>ChangeLog: Stratagus Version 2.00</h1>
 <hr>
 
 <a href="#current">Current</a><p>
 
 <ul>
-<li>Future 1.19 Release<p>
+<li>Future 2.00 Release<p>
     <ul>
     <li>++
+    <li>Fixed Bug #5294: -e switch doesn't work (from Russell Smith).
     <li>Merged Jarod spell patch. Still buggy, and saving not complete yet (from Joris Dauphin).
     <li>Made regeneration available to all units (from Russell Smith).
     <li>Made damage display missile configurable in ccl (from Russell Smith).
diff --git a/src/include/menus.h b/src/include/menus.h
index c5bf9dbd1..de5c33317 100644
--- a/src/include/menus.h
+++ b/src/include/menus.h
@@ -406,6 +406,8 @@ extern void EditorEditAiProperties(void);
 extern int EditorSaveMenu(void);
     /// Load map from the editor
 extern void EditorLoadMenu(void);
+    /// Setup Editor Paths
+extern void SetupEditor(void);
 
     /// Error menu
 extern void ErrorMenu(char *);
diff --git a/src/stratagus/stratagus.cpp b/src/stratagus/stratagus.cpp
index 899d093b7..4072b56ba 100644
--- a/src/stratagus/stratagus.cpp
+++ b/src/stratagus/stratagus.cpp
@@ -1094,6 +1094,9 @@ global void MenuLoop(char* filename, WorldMap* map)
 
 	    GuiGameStarted = 0;
 	    while (GuiGameStarted == 0) {
+		if( EditorRunning == 2 ) {
+		    SetupEditor();
+		}
 		if( EditorRunning ) {
 		    ProcessMenu("menu-editor-select", 1);
 		} else {
@@ -1104,6 +1107,8 @@ global void MenuLoop(char* filename, WorldMap* map)
 	    EnableRedraw=RedrawEverything;
 	    DebugLevel0Fn("Menu start: NetPlayers %d\n" _C_ NetPlayers);
 	    filename = CurrentMapPath;
+	} else {
+	    strcpy(CurrentMapPath,filename);
 	}
 	if( NetworkFildes!=-1 && NetPlayers<2 ) {
 	    ExitNetwork1();
@@ -1426,7 +1431,7 @@ global int main(int argc,char** argv)
                 StratagusLibPath=optarg;
                 continue;
 	    case 'e':
-		EditorRunning=1;
+		EditorRunning=2;
 		continue;
 	    case 'E':
 		EditorStartFile=optarg;
diff --git a/src/ui/menus.cpp b/src/ui/menus.cpp
index 2000b6d29..a5c8a7046 100644
--- a/src/ui/menus.cpp
+++ b/src/ui/menus.cpp
@@ -5033,13 +5033,24 @@ global void NetClientUpdateState(void)
 */
 local void StartEditor(void)
 {
-    char* s;
 
     VideoLockScreen();
     MenusSetBackground();
     VideoUnlockScreen();
     Invalidate();
 
+    SetupEditor();
+
+    EditorRunning = 1;
+    EndMenu();
+}
+
+/**
+**	Setup Editor Paths
+*/
+global void SetupEditor(void)
+{
+    char *s;
     //
     //  Create a default path + map.
     //
@@ -5066,10 +5077,9 @@ local void StartEditor(void)
 	*ScenSelectDisplayPath = '\0';
     }
 
-    EditorRunning = 1;
-    EndMenu();
 }
 
+
 /**
 **	Editor select cancel button callback
 */