[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer/src/NetPanzer Classes/Network/ClientC...
From: |
Ivo Danihelka |
Subject: |
[netPanzer-CVS] netpanzer/src/NetPanzer Classes/Network/ClientC... |
Date: |
Wed, 22 Oct 2003 13:50:47 -0400 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Ivo Danihelka <address@hidden> 03/10/22 13:50:47
Modified files:
src/NetPanzer/Classes/Network: ClientConnectDaemon.cpp
src/NetPanzer/Interfaces: ConfigVariable.hpp
DedicatedGameManager.cpp
DedicatedGameManager.hpp
PlayerGameManager.cpp
src/NetPanzer/Views/MainMenu/Multi: PlayerNameView.cpp
Log message:
Added c_str() method for ConfigString
Patches:
Index: netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp
diff -u netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp:1.9
netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp:1.10
--- netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp:1.9 Wed Oct
22 09:19:28 2003
+++ netpanzer/src/NetPanzer/Classes/Network/ClientConnectDaemon.cpp Wed Oct
22 13:50:46 2003
@@ -284,8 +284,7 @@
ConnectClientSettings client_setting;
client_setting.set(
- ((const std::string&)
- (gameconfig->playername)).c_str(),
+ gameconfig->playername.c_str(),
gameconfig->getUnitColor(),
gameconfig->playerflag );
Index: netpanzer/src/NetPanzer/Interfaces/ConfigVariable.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/ConfigVariable.hpp:1.1
netpanzer/src/NetPanzer/Interfaces/ConfigVariable.hpp:1.2
--- netpanzer/src/NetPanzer/Interfaces/ConfigVariable.hpp:1.1 Sat Oct 4
10:46:28 2003
+++ netpanzer/src/NetPanzer/Interfaces/ConfigVariable.hpp Wed Oct 22
13:50:46 2003
@@ -80,6 +80,9 @@
ConfigString(const std::string& name, const std::string& value="");
~ConfigString();
+ const char *c_str()
+ { return value.c_str(); }
+
operator const std::string& () const
{ return value; }
Index: netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp:1.1
netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp:1.2
--- netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp:1.1 Wed Oct
22 09:19:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.cpp Wed Oct 22
13:50:46 2003
@@ -39,7 +39,7 @@
//-----------------------------------------------------------------
void DedicatedGameManager::initializeGameConfig()
{
- gameconfig = new GameConfig("config/netpanzer-dedicated.cfg");
+ gameconfig = new GameConfig("config/netpanzer-dedicated.xml");
}
//-----------------------------------------------------------------
void DedicatedGameManager::initializeInputDevices()
@@ -49,8 +49,6 @@
//-----------------------------------------------------------------
void DedicatedGameManager::inputLoop()
{
- //TODO: slow down for happy CPU
-
// XXX we need new code here (someone wanna write a readline version of
this
// stuff?
#ifdef WIN32
@@ -114,23 +112,6 @@
#endif
}
//-----------------------------------------------------------------
-void DedicatedGameManager::dedicatedLoadGameMap(const char *map_name)
-{
- std::string map_path("maps/");
- map_path.append(map_name);
-
- MapInterface::startMapLoad(map_path.c_str(), false, 0);
-
- map_path.append(".opt");
- ObjectiveInterface::loadObjectiveList(map_path.c_str());
-
- ParticleInterface::initParticleSystems();
- Particle2D::setCreateParticles(false);
-
- ParticleInterface::addCloudParticle(gameconfig->cloudcoverage);
- Physics::wind.setVelocity(gameconfig->windspeed, 107);
-}
-//-----------------------------------------------------------------
// custom version of readString that doesn't return the trailing \n
static inline void readString(char* buffer, size_t buffersize, FILE* file)
{
@@ -147,7 +128,7 @@
MapsManager::getCurrentMap( input_str );
gameconfig->map = input_str;
- const char* mapname = ((const std::string&)(gameconfig->map)).c_str();
+ const char* mapname = gameconfig->map.c_str();
printf( "Map Name <%s> : ", mapname);
fflush(stdout);
readString(input_str, 256, stdin);
@@ -229,16 +210,19 @@
} // ** switch
- printf( "PowerUps <NO> (Y/N) : " );
+ printf( "PowerUps <%s> (Y/N) : ",
+ (bool) gameconfig->powerups ? "Y" : "N" );
fflush(stdout);
readString(input_str, 256, stdin);
- if ( strcasecmp( "y", input_str ) == 0 ) {
- gameconfig->powerups = true;
- } else {
- gameconfig->powerups = false;
+ if ( strlen(input_str) > 0 ) {
+ if ( strcasecmp( "y", input_str ) == 0 ) {
+ gameconfig->powerups = true;
+ } else {
+ gameconfig->powerups = false;
+ }
}
- printf( "Server Name <Dedicated Server> :" );
+ printf( "Server Name <%s> :", gameconfig->playername.c_str() );
fflush(stdout);
readString(input_str, 256, stdin);
if ( strlen(input_str) > 0 ) {
@@ -247,9 +231,9 @@
gameconfig->playername = "Dedicated Server";
}
- mapname = ((const std::string&)(gameconfig->map)).c_str();
+ mapname = gameconfig->map.c_str();
MapsManager::setCycleStartMap(mapname);
- dedicatedLoadGameMap(mapname);
+ GameManager::dedicatedLoadGameMap(mapname);
GameManager::reinitializeGameLogic();
Index: netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp
diff -u netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp:1.1
netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp:1.2
--- netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp:1.1 Wed Oct
22 09:19:30 2003
+++ netpanzer/src/NetPanzer/Interfaces/DedicatedGameManager.hpp Wed Oct 22
13:50:46 2003
@@ -27,8 +27,6 @@
virtual void initializeGameConfig();
virtual void inputLoop();
-
- void dedicatedLoadGameMap(const char *map_name);
public:
virtual bool launchNetPanzerGame();
};
Index: netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp:1.1
netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp:1.2
--- netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp:1.1 Wed Oct
22 09:19:31 2003
+++ netpanzer/src/NetPanzer/Interfaces/PlayerGameManager.cpp Wed Oct 22
13:50:46 2003
@@ -285,7 +285,7 @@
progressView->scrollAndUpdateDirect( "Loading Game Data ..." );
- const char* mapname = ((const std::string&)(gameconfig->map)).c_str();
+ const char* mapname = gameconfig->map.c_str();
MapsManager::setCycleStartMap(mapname);
int result_code;
@@ -323,8 +323,7 @@
progressView->scrollAndUpdateDirect( "Spawning Player ..." );
player_state = PlayerInterface::allocateLoopBackPlayer();
- const char* playername = ((const
- std::string&)(gameconfig->playername)).c_str();
+ const char* playername = gameconfig->playername.c_str();
player_state->setName(playername);
player_state->setFlag( (unsigned char) gameconfig->playerflag );
player = PlayerInterface::getLocalPlayerID();
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp:1.7
netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp:1.8
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp:1.7 Wed Oct
15 17:16:33 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/PlayerNameView.cpp Wed Oct
22 13:50:47 2003
@@ -50,7 +50,7 @@
//---------------------------------------------------------------------------
void PlayerNameView::init()
{
- playerName.init(std::string(gameconfig->playername).c_str(),
INPUT_FIELD_CHARACTERS);
+ playerName.init(gameconfig->playername.c_str(), INPUT_FIELD_CHARACTERS);
addInputField(iXY(BORDER_SPACE, BORDER_SPACE), &playerName, "", true);
} // end PlayerNameView::init
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer/src/NetPanzer Classes/Network/ClientC...,
Ivo Danihelka <=