diff options
-rw-r--r-- | src/network/core/tcp_admin.cpp | 4 | ||||
-rw-r--r-- | src/network/core/tcp_game.cpp | 8 | ||||
-rw-r--r-- | src/network/core/tcp_game.h | 2 | ||||
-rw-r--r-- | src/network/network_content.cpp | 3 | ||||
-rw-r--r-- | src/network/network_internal.h | 2 | ||||
-rw-r--r-- | src/tgp.cpp | 3 |
6 files changed, 13 insertions, 9 deletions
diff --git a/src/network/core/tcp_admin.cpp b/src/network/core/tcp_admin.cpp index 0a3153319..636696e2c 100644 --- a/src/network/core/tcp_admin.cpp +++ b/src/network/core/tcp_admin.cpp @@ -29,9 +29,11 @@ assert_compile((int)CRR_END == (int)ADMIN_CRR_END); * Create the admin handler for the given socket. * @param s The socket to communicate over. */ -NetworkAdminSocketHandler::NetworkAdminSocketHandler(SOCKET s) +NetworkAdminSocketHandler::NetworkAdminSocketHandler(SOCKET s) : status(ADMIN_STATUS_INACTIVE) { this->sock = s; + this->admin_name[0] = '\0'; + this->admin_version[0] = '\0'; } NetworkAdminSocketHandler::~NetworkAdminSocketHandler() diff --git a/src/network/core/tcp_game.cpp b/src/network/core/tcp_game.cpp index 711d6a2b7..54d222495 100644 --- a/src/network/core/tcp_game.cpp +++ b/src/network/core/tcp_game.cpp @@ -26,12 +26,10 @@ * Create a new socket for the game connection. * @param s The socket to connect with. */ -NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s) +NetworkGameSocketHandler::NetworkGameSocketHandler(SOCKET s) : info(NULL), + last_frame(_frame_counter), last_frame_server(_frame_counter), last_packet(_realtime_tick) { - this->sock = s; - this->last_frame = _frame_counter; - this->last_frame_server = _frame_counter; - this->last_packet = _realtime_tick; + this->sock = s; } /** diff --git a/src/network/core/tcp_game.h b/src/network/core/tcp_game.h index 761399639..5c6cb5c34 100644 --- a/src/network/core/tcp_game.h +++ b/src/network/core/tcp_game.h @@ -137,7 +137,7 @@ class CommandQueue { public: /** Initialise the command queue. */ - CommandQueue() : first(NULL), last(NULL) {} + CommandQueue() : first(NULL), last(NULL), count(0) {} /** Clear the command queue. */ ~CommandQueue() { this->Free(); } void Append(CommandPacket *p); diff --git a/src/network/network_content.cpp b/src/network/network_content.cpp index 047269969..8677a8104 100644 --- a/src/network/network_content.cpp +++ b/src/network/network_content.cpp @@ -705,7 +705,8 @@ ClientNetworkContentSocketHandler::ClientNetworkContentSocketHandler() : http_response_index(-2), curFile(NULL), curInfo(NULL), - isConnecting(false) + isConnecting(false), + lastActivity(_realtime_tick) { } diff --git a/src/network/network_internal.h b/src/network/network_internal.h index 938682981..e46f20792 100644 --- a/src/network/network_internal.h +++ b/src/network/network_internal.h @@ -154,6 +154,8 @@ bool IsNetworkCompatibleVersion(const char *version); * Everything we need to know about a command to be able to execute it. */ struct CommandPacket : CommandContainer { + /** Make sure the pointer is NULL. */ + CommandPacket() : next(NULL) {} CommandPacket *next; ///< the next command packet (if in queue) CompanyByte company; ///< company that is executing the command uint32 frame; ///< the frame in which this packet is executed diff --git a/src/tgp.cpp b/src/tgp.cpp index 4cbde2d82..1fb3485ec 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -560,11 +560,12 @@ static const control_point_list_t _curve_maps[] = { static void HeightMapCurves(uint level) { height_t ht[lengthof(_curve_maps)]; + MemSetT(ht, 0, lengthof(ht)); /* Set up a grid to choose curve maps based on location */ uint sx = Clamp(1 << level, 2, 32); uint sy = Clamp(1 << level, 2, 32); - byte *c = (byte *)alloca(sx * sy); + byte *c = AllocaM(byte, sx * sy); for (uint i = 0; i < sx * sy; i++) { c[i] = Random() % lengthof(_curve_maps); |