summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-10-24 20:03:33 +0000
committerrubidium <rubidium@openttd.org>2010-10-24 20:03:33 +0000
commit2cd67a51acc71b08e52c94fefa44fe665977396f (patch)
tree837c257316c331c6bcc3c390a3bd0828649c3a18 /src/network/core
parentfc15063838e6d802af0ae0de178d218dbf786c17 (diff)
downloadopenttd-2cd67a51acc71b08e52c94fefa44fe665977396f.tar.xz
(svn r21029) -Codechange: split the map downloading packet + 3-state enum into 3 separate packets
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/tcp_game.cpp8
-rw-r--r--src/network/core/tcp_game.h29
2 files changed, 24 insertions, 13 deletions
diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp
index dc3be15fe..4f4baeb6b 100644
--- a/src/network/core/tcp_game.cpp
+++ b/src/network/core/tcp_game.cpp
@@ -85,7 +85,9 @@ NetworkRecvStatus NetworkGameSocketHandler::HandlePacket(Packet *p)
GAME_COMMAND(PACKET_SERVER_WELCOME)
GAME_COMMAND(PACKET_CLIENT_GETMAP)
GAME_COMMAND(PACKET_SERVER_WAIT)
- GAME_COMMAND(PACKET_SERVER_MAP)
+ GAME_COMMAND(PACKET_SERVER_MAP_BEGIN)
+ GAME_COMMAND(PACKET_SERVER_MAP_DATA)
+ GAME_COMMAND(PACKET_SERVER_MAP_DONE)
GAME_COMMAND(PACKET_CLIENT_MAP_OK)
GAME_COMMAND(PACKET_SERVER_JOIN)
GAME_COMMAND(PACKET_SERVER_FRAME)
@@ -170,7 +172,9 @@ DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_COMPANY_PASSWORD)
DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_SERVER_WELCOME)
DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_GETMAP)
DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_SERVER_WAIT)
-DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MAP)
+DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MAP_BEGIN)
+DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MAP_DATA)
+DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MAP_DONE)
DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_CLIENT_MAP_OK)
DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_SERVER_JOIN)
DEFINE_UNAVAILABLE_GAME_RECEIVE_COMMAND(PACKET_SERVER_FRAME)
diff --git a/src/network/core/tcp_game.h b/src/network/core/tcp_game.h
index b312a447c..6fd5649c1 100644
--- a/src/network/core/tcp_game.h
+++ b/src/network/core/tcp_game.h
@@ -72,7 +72,9 @@ enum PacketGameType {
/* Getting the savegame/map. */
PACKET_CLIENT_GETMAP, ///< Client requests the actual map.
PACKET_SERVER_WAIT, ///< Server tells the client there are some people waiting for the map as well.
- PACKET_SERVER_MAP, ///< Server sends bits of the map to the client.
+ PACKET_SERVER_MAP_BEGIN, ///< Server tells the client that it is beginning to send the map.
+ PACKET_SERVER_MAP_DATA, ///< Server sends bits of the map to the client.
+ PACKET_SERVER_MAP_DONE, ///< Server tells it has just sent the last bits of the map to the client.
PACKET_CLIENT_MAP_OK, ///< Client tells the server that it received the whole map.
PACKET_SERVER_JOIN, ///< Tells clients that a new client has joined.
@@ -283,17 +285,22 @@ protected:
DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_WAIT);
/**
- * Sends parts of the map to the client:
- * uint8 packet type (MAP_PACKET_START, MAP_PACKET_NORMAL, MAP_PACKET_END).
- * If MAP_PACKET_START:
- * uint32 Current frame.
- * uint32 Size of the map (in bytes).
- * If MAP_PACKET_NORMAL:
- * Part of the map (until max size of packet).
- * If MAP_PACKET_END:
- * No further data sent.
+ * Sends that the server will begin with sending the map to the client:
+ * uint32 Current frame.
+ * uint32 Size of the map (in bytes).
*/
- DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MAP);
+ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MAP_BEGIN);
+
+ /**
+ * Sends the data of the map to the client:
+ * Contains a part of the map (until max size of packet).
+ */
+ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MAP_DATA);
+
+ /**
+ * Sends that all data of the map are sent to the client:
+ */
+ DECLARE_GAME_RECEIVE_COMMAND(PACKET_SERVER_MAP_DONE);
/**
* Tell the server that we are done receiving/loading the map.