netpanzer-cvs
[Top][All Lists]
Advanced

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

[netPanzer-CVS] netpanzer/src/NetPanzer/Interfaces BotGameManag...


From: Ivo Danihelka
Subject: [netPanzer-CVS] netpanzer/src/NetPanzer/Interfaces BotGameManag...
Date: Tue, 04 Nov 2003 18:25:30 -0500

CVSROOT:        /cvsroot/netpanzer
Module name:    netpanzer
Branch:         
Changes by:     Ivo Danihelka <address@hidden>  03/11/04 18:25:30

Modified files:
        src/NetPanzer/Interfaces: BotGameManager.cpp 

Log message:
        Bot uses name with random -suffix

Patches:
Index: netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp:1.1 
netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp:1.2
--- netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp:1.1   Wed Oct 22 
09:19:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/BotGameManager.cpp       Tue Nov  4 
18:25:30 2003
@@ -27,6 +27,7 @@
 #include "Client.hpp"
 #include "ClientConnectDaemon.hpp"
 #include "Exception.hpp"
+#include "XmlParser.hpp"
 
 //-----------------------------------------------------------------
 BotGameManager::BotGameManager(const std::string &serverHost)
@@ -35,9 +36,17 @@
     /* empty */
 }
 //-----------------------------------------------------------------
+/**
+ * Bot uses name = playername + "-" + rand() % 1000
+ */
 void BotGameManager::initializeGameConfig()
 {
     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);
 }
 //-----------------------------------------------------------------
 void BotGameManager::initializeInputDevices()




reply via email to

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