netpanzer-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netPanzer-CVS] netpanzer ./ChangeLog docs/netpanzer.6 src/NetP...


From: Matthias Braun
Subject: [netPanzer-CVS] netpanzer ./ChangeLog docs/netpanzer.6 src/NetP...
Date: Fri, 21 Nov 2003 09:47:11 -0500

CVSROOT:        /cvsroot/netpanzer
Module name:    netpanzer
Branch:         
Changes by:     Matthias Braun <address@hidden> 03/11/21 09:47:11

Modified files:
        .              : ChangeLog 
        docs           : netpanzer.6 
        src/NetPanzer/Core: main.cpp 
        src/NetPanzer/Interfaces: BaseGameManager.cpp 
                                  BaseGameManager.hpp BotGameManager.cpp 
                                  BotGameManager.hpp 
                                  DedicatedGameManager.cpp 
                                  DedicatedGameManager.hpp 

Log message:
        -added a possibility to use custom config files. This makes it possible 
to
        spawn several different bots or servers on the same user account.

Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.33 netpanzer/ChangeLog:1.34
--- netpanzer/ChangeLog:1.33    Fri Nov 21 09:23:54 2003
+++ netpanzer/ChangeLog Fri Nov 21 09:47:10 2003
@@ -1,6 +1,8 @@
 21-Nov-2003 by Matthias Braun
 -Applied a patch by Michel Metzger (address@hidden) which makes it possible to
  select the location where built units move.
+-added a possibility to use custom config files. This makes it possible to
+ spawn several different bots or servers on the same user account.
 
 20-Nov-2003 by Matthias Braun
 -removed lots of remaining nonused code handling with UDP networking
Index: netpanzer/docs/netpanzer.6
diff -u netpanzer/docs/netpanzer.6:1.5 netpanzer/docs/netpanzer.6:1.6
--- netpanzer/docs/netpanzer.6:1.5      Mon Nov 17 18:00:04 2003
+++ netpanzer/docs/netpanzer.6  Fri Nov 21 09:47:11 2003
@@ -43,6 +43,9 @@
 .B     --lobby-server=VALUE
 Use the specified irc server as lobby server. You can use 'none' to
 disable lobby announcement.
+.B -c, --game_config=VALUE
+Use the specified file as config file. The file will be read from the netpanzer
+config directory (ie. ~/.netpanzer/config)
 .PD
 
 .SH "AUTHORS"
Index: netpanzer/src/NetPanzer/Core/main.cpp
diff -u netpanzer/src/NetPanzer/Core/main.cpp:1.24 
netpanzer/src/NetPanzer/Core/main.cpp:1.25
--- netpanzer/src/NetPanzer/Core/main.cpp:1.24  Thu Nov 20 19:19:26 2003
+++ netpanzer/src/NetPanzer/Core/main.cpp       Fri Nov 21 09:47:11 2003
@@ -182,6 +182,10 @@
     option<std::string, true, false> lobby_server_option('\0', "lobby_server",
         "Use 'none' if you dont want to use the lobby", "");
     commandline.add(&lobby_server_option);
+    option<std::string, true, false> game_config_option('c', "game_config",
+        "Which config file should be used (only files inside config 
directory)",
+        "");
+    commandline.add(&game_config_option);
 
     if(!commandline.process() || commandline.help() || commandline.version())
         exit(0);
@@ -238,8 +242,12 @@
             }
         }
 
-
-        manager->initialize();
+        std::string game_config;
+        if(game_config_option.value() != "") {
+            game_config = "/config/";
+            game_config += game_config_option.value();
+        }
+        manager->initialize(game_config);
 
         // gameconfig exists now...
         if (lobby_server_option.value().size() > 0) {
Index: netpanzer/src/NetPanzer/Interfaces/BaseGameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/BaseGameManager.cpp:1.4 
netpanzer/src/NetPanzer/Interfaces/BaseGameManager.cpp:1.5
--- netpanzer/src/NetPanzer/Interfaces/BaseGameManager.cpp:1.4  Fri Nov 21 
09:38:49 2003
+++ netpanzer/src/NetPanzer/Interfaces/BaseGameManager.cpp      Fri Nov 21 
09:47:11 2003
@@ -94,9 +94,12 @@
     }
 }
 //-----------------------------------------------------------------
-void BaseGameManager::initializeGameConfig()
+void BaseGameManager::initializeGameConfig(const std::string& configfile)
 {
-    gameconfig = new GameConfig("config/netpanzer.xml");
+    if(configfile == "")
+        gameconfig = new GameConfig("config/netpanzer.xml");
+    else
+        gameconfig = new GameConfig(configfile);
 }
 //-----------------------------------------------------------------
 void BaseGameManager::shutdownGameConfig()
@@ -177,12 +180,12 @@
 }
 //-----------------------------------------------------------------
 // boots up netPanzer; initializes all subsystems, game objects etc.
-void BaseGameManager::initialize()
+void BaseGameManager::initialize(const std::string& configfile)
 {
     try {
         if(!FileSystem::exists("config"))
             FileSystem::mkdir("config");
-        initializeGameConfig();
+        initializeGameConfig(configfile);
         initializeSoundSubSystem();
         initializeVideoSubSystem();
         initializeGameObjects();
Index: netpanzer/src/NetPanzer/Interfaces/BaseGameManager.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/BaseGameManager.hpp:1.1 
netpanzer/src/NetPanzer/Interfaces/BaseGameManager.hpp:1.2
--- netpanzer/src/NetPanzer/Interfaces/BaseGameManager.hpp:1.1  Wed Oct 22 
09:19:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/BaseGameManager.hpp      Fri Nov 21 
09:47:11 2003
@@ -18,6 +18,8 @@
 #ifndef _BASEGAMEMANAGER_HPP
 #define _BASEGAMEMANAGER_HPP
 
+#include <string>
+
 class BaseGameManager
 {
 private:
@@ -38,7 +40,7 @@
     virtual void initializeSoundSubSystem();
     virtual void shutdownSoundSubSystem();
 
-    virtual void initializeGameConfig();
+    virtual void initializeGameConfig(const std::string& configfile);
     virtual void shutdownGameConfig();
 
     // initialize all static objects / interfaces;
@@ -54,7 +56,7 @@
 public:
     virtual ~BaseGameManager() { shutdown(); }
 
-    void initialize();
+    void initialize(const std::string& configfile = "");
 
     // cyclic executive for loop back server / client
     void mainLoop();
Index: netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp:1.2 
netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp:1.3
--- netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp:1.2   Tue Nov  4 
18:25:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp       Fri Nov 21 
09:47:11 2003
@@ -27,7 +27,6 @@
 #include "Client.hpp"
 #include "ClientConnectDaemon.hpp"
 #include "Exception.hpp"
-#include "XmlParser.hpp"
 
 //-----------------------------------------------------------------
 BotGameManager::BotGameManager(const std::string &serverHost)
@@ -39,14 +38,12 @@
 /**
  * Bot uses name = playername + "-" + rand() % 1000
  */
-void BotGameManager::initializeGameConfig()
+void BotGameManager::initializeGameConfig(const std::string& configfile)
 {
-    gameconfig = new GameConfig("config/netpanzer-bot.xml");
-    std::string::size_type pos =
-        ((std::string)gameconfig->playername).rfind("-");
-    std::string botname(gameconfig->playername, 0, pos);
-    gameconfig->playername = botname + "-"
-        + XmlParser::toString(rand() % 1000);
+    if(configfile == "")
+        gameconfig = new GameConfig("/config/netpanzer-bot.xml");
+    else
+        gameconfig = new GameConfig(configfile);
 }
 //-----------------------------------------------------------------
 void BotGameManager::initializeInputDevices()
Index: netpanzer/src/NetPanzer/Interfaces/BotGameManager.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/BotGameManager.hpp:1.1 
netpanzer/src/NetPanzer/Interfaces/BotGameManager.hpp:1.2
--- netpanzer/src/NetPanzer/Interfaces/BotGameManager.hpp:1.1   Wed Oct 22 
09:19:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/BotGameManager.hpp       Fri Nov 21 
09:47:11 2003
@@ -27,7 +27,7 @@
 private:
     std::string m_serverHost;
 protected:
-    void initializeGameConfig();
+    void initializeGameConfig(const std::string& configfile);
 
     virtual void initializeInputDevices();
     virtual void shutdownInputDevices();
Index: netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp:1.5 
netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp:1.6
--- netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp:1.5     Tue Nov 
11 08:42:05 2003
+++ netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp Fri Nov 21 
09:47:11 2003
@@ -39,9 +39,12 @@
 #include "IRCLobbyView.hpp"
 
 //-----------------------------------------------------------------
-void DedicatedGameManager::initializeGameConfig()
+void DedicatedGameManager::initializeGameConfig(const std::string& configfile)
 {
-    gameconfig = new GameConfig("config/netpanzer-dedicated.xml");
+    if(configfile == "")
+        gameconfig = new GameConfig("/config/netpanzer-dedicated.xml");
+    else
+        gameconfig = new GameConfig(configfile.c_str());
 }
 //-----------------------------------------------------------------
 void DedicatedGameManager::initializeInputDevices()
Index: netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp:1.2 
netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp:1.3
--- netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp:1.2     Wed Oct 
22 13:50:46 2003
+++ netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp Fri Nov 21 
09:47:11 2003
@@ -24,7 +24,7 @@
 {
 protected:
     virtual void initializeInputDevices();
-    virtual void initializeGameConfig();
+    virtual void initializeGameConfig(const std::string& configfile);
 
     virtual void inputLoop();
 public:




reply via email to

[Prev in Thread] Current Thread [Next in Thread]