summaryrefslogtreecommitdiff
path: root/src/network/core
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-08 14:40:18 +0000
committerrubidium <rubidium@openttd.org>2009-01-08 14:40:18 +0000
commit0e1127e8b5b94d5966333662d0cd13e306b39cbb (patch)
treeaaad012b34556fa555a78f97f1b9ff51be515025 /src/network/core
parentda7da4c1c8b76f56696fdf89416c84f32e70d6f3 (diff)
downloadopenttd-0e1127e8b5b94d5966333662d0cd13e306b39cbb.tar.xz
(svn r14915) -Codechange: unify the receiving and sending of commands, and thus unifying most of the validity checking too.
Diffstat (limited to 'src/network/core')
-rw-r--r--src/network/core/tcp.h17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/network/core/tcp.h b/src/network/core/tcp.h
index 1f5be946e..a124337a0 100644
--- a/src/network/core/tcp.h
+++ b/src/network/core/tcp.h
@@ -12,7 +12,6 @@
#include "os_abstraction.h"
#include "core.h"
#include "packet.h"
-#include "../../tile_type.h"
/**
* Enum with all types of UDP packets.
@@ -59,18 +58,7 @@ enum {
};
/** Packet that wraps a command */
-struct CommandPacket {
- CommandPacket *next; ///< the next command packet (if in queue)
- CompanyByte company; ///< company that is executing the command
- uint32 cmd; ///< command being executed
- uint32 p1; ///< parameter p1
- uint32 p2; ///< parameter p2
- TileIndex tile; ///< tile command being executed on
- char text[80]; ///< possible text sent for name changes etc
- uint32 frame; ///< the frame in which this packet is executed
- byte callback; ///< any callback function executed upon successful completion of the command
- bool my_cmd; ///< did the command originate from "me"
-};
+struct CommandPacket;
/** Status of a client */
enum ClientStatus {
@@ -120,6 +108,9 @@ public:
inline bool IsValid() const { return this->IsConnected(); }
inline void SetInfo(NetworkClientInfo *info) { assert(info != NULL && this->info == NULL); this->info = info; }
inline NetworkClientInfo *GetInfo() const { return this->info; }
+
+ const char *Recv_Command(Packet *p, CommandPacket *cp);
+ void Send_Command(Packet *p, const CommandPacket *cp);
};
static inline bool IsValidNetworkClientSocketIndex(ClientIndex index)