src/ai/core/object/commands.cpp
branchnoai
changeset 9406 3500f836dc21
parent 9370 839d87adee8e
child 9414 a7f7bbec08da
--- a/src/ai/core/object/commands.cpp	Thu Mar 15 13:50:58 2007 +0000
+++ b/src/ai/core/object/commands.cpp	Thu Mar 15 14:06:59 2007 +0000
@@ -27,16 +27,18 @@
 	if (flags & DC_AUTO)     procc |= CMD_AUTO;
 	if (flags & DC_NO_WATER) procc |= CMD_NO_WATER;
 
-	/* NetworkSend_Command needs _local_player to be set correctly, so
-	 * adjust it, and put it back right after the function */
-	old_lp = _local_player;
-	_local_player = _current_player;
-
 #ifdef ENABLE_NETWORK
 	/* Send the command */
 	if (_networking) {
-		/* Network is easy, send it to his handler */
+		/* NetworkSend_Command needs _local_player to be set correctly, so
+		 * adjust it, and put it back right after the function */
+		old_lp = _local_player;
+		_local_player = _current_player;
+
 		::NetworkSend_Command(tile, p1, p2, procc, callback);
+
+		/* Set _local_player back */
+		_local_player = old_lp;
 	} else {
 #else
 	{
@@ -45,8 +47,5 @@
 		::DoCommandP(tile, p1, p2, callback, procc);
 	}
 
-	/* Set _local_player back */
-	_local_player = old_lp;
-
 	return res;
 }