SourceForge has been redesigned. Learn more.
Close

Diff of /trunk/src/core/document.cpp [r2065] .. [r2066]  Maximize  Restore

Switch to side-by-side view

--- a/trunk/src/core/document.cpp
+++ b/trunk/src/core/document.cpp
@@ -91,12 +91,12 @@
 	int port = Options::getInstance()->getPort();
 	int max_players = Options::getInstance()->getMaxNumberPlayers();
 	std::string host = Options::getInstance()->getServerHost();
-	
+
 	if (m_single_player)
 	{
 		max_players = 1;
 	}
-	
+
 	World::createWorld(server,port, true,max_players);
 
 	if (server)
@@ -202,13 +202,17 @@
 		std::stringstream sstream;
 		StdStreamConv cv2(&sstream);
 
-		sleep(10);
-		
+		Timer t;
+		t.start();
+		while (t.getTime() < 200)
+		{
+		}
+
 		m_temp_player->toSavegame(&cv2);
 		DEBUG("sending savegame");
 		World::getWorld()->handleSavegame(&cv2);
 		DEBUGX("sent savegame");
-		
+
 		// read shortkeys from the savegame
 		m_ability_shortkey_map.clear();
 		short key,dest;
@@ -465,7 +469,7 @@
 	Player* pl = static_cast<Player*> (World::getWorld()->getLocalPlayer());
 	if (pl==0)
 		return;
-	
+
 	// Dialog is open, each klick is interpreted as *skip this text*
 	if (pl->getDialogueId() != 0)
 	{
@@ -1226,7 +1230,7 @@
 	// determine action mapped to the key
 	ShortkeyDestination dest;
 	dest = Options::getInstance()->getMappedDestination(key);
-	
+
 	if (m_gui_state.m_shown_windows & SKILLTREE && dest==0)
 	{
 		// Skilltree is displayed
@@ -1235,7 +1239,7 @@
 		Action::ActionType act = getGUIState()->m_hover_ability;
 		if (act != "noaction" && getLocalPlayer()->checkAbility(act))
 		{
-			// Action exists and is available 
+			// Action exists and is available
 			Action::ActionInfo* aci = Action::getActionInfo(act);
 
 			// determine if the shortkey should map the ability for left or right mouse button
@@ -1278,7 +1282,7 @@
 
 	}
 
-	
+
 	// if key was not mapped to a shortkey
 	// check ability shortkeys
 	if (dest == 0)
@@ -1287,7 +1291,7 @@
 		if (it != m_ability_shortkey_map.end())
 			dest = it->second;
 	}
-	
+
 
 	// execute the action, if any mapping was found
 	if (dest != 0)
@@ -1334,7 +1338,7 @@
 			if (player != 0)
 			{
 				std::map<int,LearnableAbility> &ablts = player->getLearnableAbilities();
-	
+
 				if (ablts.count(dest-USE_SKILL_LEFT) >0)
 				{
 					setLeftAction(ablts[dest-USE_SKILL_LEFT].m_type);
@@ -1625,7 +1629,7 @@
 				command.m_button=LEFT_SHIFT_MOUSE_BUTTON;
 			}
 			updateClickedObjectId();
-			
+
 			command.m_goal = m_gui_state.m_clicked;
 			command.m_id = m_gui_state.m_clicked_object_id;
 			command.m_action = player->getLeftAction();
@@ -1672,7 +1676,7 @@
 	Region* reg = player->getRegion();
 	if (reg == 0)
 		return;
-	
+
 	// select new target if the old one is gone or inactive
 	if (m_gui_state.m_clicked_object_id != 0 && m_gui_state.m_cursor_object_id != 0)
 	{
@@ -1699,10 +1703,10 @@
 	CharConv* save;
 
 
-	
+
 	std::stringstream* pstr = new std::stringstream;
 	save = new StdStreamConv(pstr);
-	
+
 	getLocalPlayer()->toSavegame(save);
 
 	// Shortkeys hinzufuegen
@@ -1745,10 +1749,10 @@
 	char* bp=0;
 	int len=0;
 	char bin ='0';
-	
+
 	// binary savegames are not used anymore
-	
-	
+
+
 	// Daten byteweise in Datei schreiben
 	std::ofstream file;
 	if (bin =='1')
@@ -1807,7 +1811,7 @@
     std::string path = PHYSFS_getUserDir();
     path.append("/Library/Application Support/Sumwars/");
     Options::getInstance()->readFromFile(path + "options.xml");
-#else    
+#else
 	Options::getInstance()->readFromFile("options.xml");
 #endif
 }