Added community server

Added community server

diff --git a/CMakeLists.txt b/CMakeLists.txt
index d16ac11..a2f5608 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -79,6 +79,7 @@ option( BUILD_SERVER                   "Build dedicated server"                 
 option( BUILD_AUTOUPDATE_SERVER        "Build AutoUpdate server"                  ON )
 option( BUILD_MASTER_SERVER            "Build master server"                      ON )
 option( BUILD_AUTH_SERVER              "Build authorization server"               ON )
+option( BUILD_COMMUNITY_SERVER         "Build community server"                   ON )
 
 # Package info
 set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Application client" )
@@ -192,6 +193,7 @@ set( SERVERLIST_HEADERS
 	${MOUNT_DIR}/server/server.h
 	${MOUNT_DIR}/server/serverCcmds.h
 	${MOUNT_DIR}/server/serverClient.h
+	${MOUNT_DIR}/server/serverCommunity.h
 	${MOUNT_DIR}/server/serverGame.h
 	${MOUNT_DIR}/server/serverWorld.h
 	${MOUNT_DIR}/server/serverSnapshot.h
@@ -216,6 +218,7 @@ set( SERVERLIST_HEADERS
 set( SERVERLIST_SOURCES
 	${MOUNT_DIR}/server/serverCcmds.cpp
 	${MOUNT_DIR}/server/serverClient.cpp
+	${MOUNT_DIR}/server/serverCommunity.cpp
 	${MOUNT_DIR}/server/serverGame.cpp
 	${MOUNT_DIR}/server/serverWorld.cpp
 	${MOUNT_DIR}/server/serverSnapshot.cpp
@@ -293,6 +296,7 @@ set( FRAMEWORKS_HEADERS
 
 set( FRAMEWORKS_SOURCES
 	${MOUNT_DIR}/framework/FileSystem.cpp
+	${MOUNT_DIR}/framework/hash_table.cpp
 	${MOUNT_DIR}/framework/CVarSystem.cpp
 	${MOUNT_DIR}/framework/CmdSystem.cpp
 	${MOUNT_DIR}/framework/CmdBuffer.cpp
@@ -302,6 +306,7 @@ set( FRAMEWORKS_SOURCES
 	${MOUNT_DIR}/framework/MD4.cpp
 	${MOUNT_DIR}/framework/MD5.cpp
 	${MOUNT_DIR}/framework/Puff.cpp
+	${MOUNT_DIR}/framework/tiger_hash.cpp
 	${MOUNT_DIR}/framework/Unzip.cpp
 	${MOUNT_DIR}/framework/Network.cpp
 	${MOUNT_DIR}/framework/NetworkChain.cpp
@@ -456,6 +461,19 @@ set( OWAUTHSERVERLIST_SOURCES
 	${TOOLS_DIR}/authserver/dpmaster.cpp
 )
 
+set( OWCOMMUNITYSERVERLIST_HEADERS
+	${TOOLS_DIR}/communityserver/communityserver.hpp
+	${TOOLS_DIR}/communityserver/json.hpp
+)
+
+set( OWCOMMUNITYSERVERLIST_SOURCES
+	${TOOLS_DIR}/communityserver/communityserver.cpp
+	${TOOLS_DIR}/communityserver/mySQLDatabase.cpp
+	${TOOLS_DIR}/communityserver/net.cpp
+	${TOOLS_DIR}/communityserver/parser.cpp
+	${TOOLS_DIR}/communityserver/json.cpp
+)
+
 set( CLIENT_SOURCES
 	${MOUNT_DIR}/platform/systemLauncher.cpp
 )
@@ -723,7 +741,7 @@ if( BUILD_MASTER_SERVER )
 	if(WIN32)
 		target_link_libraries( OWMaster wsock32 ws2_32 ${GEOIP_LIBRARIES} )
 	elseif( UNIX )
-		target_link_libraries( OWMaster -ltdb -lm ${GEOIP_LIBRARIES} )
+		target_link_libraries( OWMaster -lm ${GEOIP_LIBRARIES} )
 	endif() 
 
 	set_target_properties( OWMaster PROPERTIES OUTPUT_NAME "OWMaster.${BUILD_ARCH}" PREFIX "" )
@@ -755,9 +773,44 @@ if( BUILD_AUTH_SERVER )
 	if(WIN32)
 		target_link_libraries( OWAuthServer wsock32 ws2_32 )
 	elseif( UNIX )
-		target_link_libraries( OWAuthServer -ltdb -lm )
+		target_link_libraries( OWAuthServer -lm )
 	endif() 
 
 	set_target_properties( OWAuthServer PROPERTIES OUTPUT_NAME "OWAuthServer.${BUILD_ARCH}" PREFIX "" )
 
 endif()
+
+###########################
+# Build OWCommunityServer #
+###########################
+
+if( BUILD_COMMUNITY_SERVER )
+	# Dushan - This is how visual studio directories (or filters) are generated
+	if( MSVC )
+		SOURCE_GROUP( Header\ Files\\OWCommunityServer                        FILES ${OWCOMMUNITYSERVERLIST_HEADERS} )
+		SOURCE_GROUP( Source\ Files\\OWCommunityServer                        FILES ${OWCOMMUNITYSERVERLIST_SOURCES} )
+	endif( MSVC )
+
+	# Setup OWCommunityServer target
+	add_executable( OWCommunityServer ${OWCOMMUNITYSERVERLIST_SOURCES} ${OWCOMMUNITYSERVERLIST_HEADERS} )
+	if(WIN32)
+		target_compile_options( OWCommunityServer PRIVATE "/MP" )
+		set_property( TARGET OWCommunityServer APPEND PROPERTY COMPILE_DEFINITIONS _AMD64_ NDEBUG _WIN32 WIN32 _AMD64 _WIN64 __WIN64__  )
+	elseif( UNIX )
+		set_property( TARGET OWCommunityServer APPEND PROPERTY COMPILE_DEFINITIONS __LINUX__ _LINUX_ LINUX )
+	endif() 
+
+    find_package( MySQL REQUIRED )
+
+	TARGET_INCLUDE_DIRECTORIES( OWCommunityServer PRIVATE ${TOOLS_DIR}/communityserver ${MYSQL_INCLUDE_DIR} )
+    
+	target_link_libraries( OWCommunityServer ${MYSQL_LIBRARIES} )
+	
+	if(WIN32)
+		target_link_libraries( OWCommunityServer wsock32 ws2_32 )
+	elseif( UNIX )
+		target_link_libraries( OWCommunityServer -lm )
+	endif() 
+
+	set_target_properties( OWCommunityServer PROPERTIES OUTPUT_NAME "OWCommunityServer.${BUILD_ARCH}" PREFIX "" )
+endif()
diff --git a/src/engine/API/FileSystem_api.h b/src/engine/API/FileSystem_api.h
index 9ab8b4f..493b486 100644
--- a/src/engine/API/FileSystem_api.h
+++ b/src/engine/API/FileSystem_api.h
@@ -160,6 +160,7 @@ public:
     virtual void FilenameCompletion( pointer dir, pointer ext, bool stripExt, void( *callback )( pointer s ) ) = 0;
     virtual pointer GetGameDir( void ) = 0;
     virtual bool IsFileEmpty( valueType* filename ) = 0;
+    virtual valueType* GetFullGamePath( valueType* filename ) = 0;
 };
 
 extern idFileSystem* fileSystem;
diff --git a/src/engine/API/Network_api.h b/src/engine/API/Network_api.h
index 13f7e1d..bd07ab8 100644
--- a/src/engine/API/Network_api.h
+++ b/src/engine/API/Network_api.h
@@ -59,6 +59,7 @@ public:
     virtual void Shutdown( void ) = 0;
     virtual void Sleep( sint msec ) = 0;
     virtual void Restart_f( void ) = 0;
+    virtual sint ConnectTCP( valueType* s_host_port ) = 0;
 };
 
 extern idNetworkSystem* networkSystem;
diff --git a/src/engine/API/serverGame_api.h b/src/engine/API/serverGame_api.h
index 8b24df0..8be8137 100644
--- a/src/engine/API/serverGame_api.h
+++ b/src/engine/API/serverGame_api.h
@@ -97,12 +97,12 @@ typedef struct svEntity_s
     struct svEntity_s* nextEntityInWorldSector;
     
     entityState_t   baseline;	// for delta compression of initial sighting
-    sint             numClusters;	// if -1, use headnode instead
-    sint             clusternums[MAX_ENT_CLUSTERS];
-    sint             lastCluster;	// if all the clusters don't fit in clusternums
-    sint             areanum, areanum2;
-    sint             snapshotCounter;	// used to prevent double adding from portal views
-    sint             originCluster;	// Gordon: calced upon linking, for origin only bmodel vis checks
+    sint            numClusters;	// if -1, use headnode instead
+    sint            clusternums[MAX_ENT_CLUSTERS];
+    sint            lastCluster;	// if all the clusters don't fit in clusternums
+    sint            areanum, areanum2;
+    sint            snapshotCounter;	// used to prevent double adding from portal views
+    sint            originCluster;	// Gordon: calced upon linking, for origin only bmodel vis checks
 } svEntity_t;
 
 //
diff --git a/src/engine/GPURenderer/r_light.cpp b/src/engine/GPURenderer/r_light.cpp
index 6f69655..8274eac 100644
--- a/src/engine/GPURenderer/r_light.cpp
+++ b/src/engine/GPURenderer/r_light.cpp
@@ -374,7 +374,7 @@ effect a entity.
 =================
 */
 
-void R_AddLightToEntity( trRefEntity_t* ent, dlight_t* light, float dist )
+void R_AddLightToEntity( trRefEntity_t* ent, dlight_t* light, float32 dist )
 {
     // Fill all the light slots first.
     for( sint i = 0; i < MAX_ENTITY_LIGHTS; i++ )
diff --git a/src/engine/audio/s_codec_ogg.cpp b/src/engine/audio/s_codec_ogg.cpp
index 91365a2..273fc29 100644
--- a/src/engine/audio/s_codec_ogg.cpp
+++ b/src/engine/audio/s_codec_ogg.cpp
@@ -194,7 +194,7 @@ sint S_OGG_Callback_close( void* datasource )
 }
 
 // ftell() replacement
-long S_OGG_Callback_tell( void* datasource )
+sint32 S_OGG_Callback_tell( void* datasource )
 {
     // check if input is valid
     if( !datasource )
diff --git a/src/engine/client/cl_main.cpp b/src/engine/client/cl_main.cpp
index 703cf5e..ff93198 100644
--- a/src/engine/client/cl_main.cpp
+++ b/src/engine/client/cl_main.cpp
@@ -1561,7 +1561,7 @@ void CL_Disconnect_f( void )
     {
         if( cmdSystem->Argc() > 1 )
         {

[... diff too long, it was truncated ...]

GitHub
sha: a0b6cdb0