summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-21 23:25:29 +0200
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-10-21 23:25:29 +0200
commitc7b4b9f819e0c1335ece87695599474fc14fcdcf (patch)
treed640af246fec0ea63c408a57a28c61ee4f5961dd
parentSetting files (diff)
downloadcuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.gz
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.bz2
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.lz
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.xz
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.tar.zst
cuberite-c7b4b9f819e0c1335ece87695599474fc14fcdcf.zip
Diffstat (limited to '')
-rw-r--r--VC2010/clean.bat7
-rw-r--r--WebServer/Socket.h6
-rw-r--r--makefile247
-rw-r--r--source/MCSocket.h12
-rw-r--r--source/cBlockingTCPLink.cpp3
-rw-r--r--source/cChunk.cpp15
-rw-r--r--source/cChunk.h3
-rw-r--r--source/cChunkMap.cpp3
-rw-r--r--source/cClientHandle.cpp10
-rw-r--r--source/cHeartBeat.cpp4
-rw-r--r--source/cPlayer.cpp1
-rw-r--r--source/cPlayer.h1
-rw-r--r--source/cPluginManager.h1
-rw-r--r--source/cServer.cpp1
-rw-r--r--source/cSocket.cpp14
-rw-r--r--source/cSocket.h4
-rw-r--r--source/cTCPLink.cpp3
-rw-r--r--source/main.cpp4
-rw-r--r--source/packets/cPacket.cpp4
-rw-r--r--source/packets/cPacket.h4
20 files changed, 269 insertions, 78 deletions
diff --git a/VC2010/clean.bat b/VC2010/clean.bat
index 8d7da78b9..c481e1d03 100644
--- a/VC2010/clean.bat
+++ b/VC2010/clean.bat
@@ -6,11 +6,10 @@ del *.map
del *.pdb
del *.bsc
del *.sdf
-del *.opensdf
+del *.opensdf /AH
del *.insprc
del *.aps
del applog.txt
-del tmpl83.00c.vcproj.LAPTOPF.Kevin.user
del *.suo /AH
del debug\*.* /Q
del release\*.* /Q
@@ -22,4 +21,6 @@ rd debug /Q
rd ipch /Q
rd x64 /Q
rd "My Inspector Results" /Q
-rd ipch /Q \ No newline at end of file
+rd ipch /Q
+
+pause \ No newline at end of file
diff --git a/WebServer/Socket.h b/WebServer/Socket.h
index 777f696ce..c26822e34 100644
--- a/WebServer/Socket.h
+++ b/WebServer/Socket.h
@@ -33,9 +33,9 @@
#define SOCKET_H
#include "../source/MCSocket.h"
-#ifdef _WIN32
-#include <winsock2.h>
-#endif
+// #ifdef _WIN32
+// #include <winsock2.h>
+// #endif
#include <string>
diff --git a/makefile b/makefile
index 793221a62..41b32d433 100644
--- a/makefile
+++ b/makefile
@@ -46,12 +46,8 @@ MCServer : \
build/cGenSettings.o\
build/cCuboid.o\
build/cNoise.o\
- build/cPacket_WindowClick.o\
- build/cPacket_Login.o\
- build/cPacket_Chat.o\
build/cTimer.o\
build/cSleep.o\
- build/cPacket_Metadata.o\
build/cMonsterConfig.o\
build/cSpider.o\
build/cThread.o\
@@ -99,7 +95,6 @@ MCServer : \
build/main.o\
build/ManualBindings.o\
build/Matrix4f.o\
- build/PacketHeader.o\
build/Vector3d.o\
build/Vector3f.o\
build/Vector3i.o\
@@ -107,16 +102,48 @@ MCServer : \
build/cTCPLink.o\
build/cMCLogger.o\
build/cTracer.o\
+ build/cPacket_13.o\
+ build/cPacket_AddToInventory.o\
+ build/cPacket_ArmAnim.o\
+ build/cPacket_BlockChange.o\
+ build/cPacket_BlockDig.o\
+ build/cPacket_BlockPlace.o\
+ build/cPacket_Chat.o\
+ build/cPacket_CollectItem.o\
build/cPacket_DestroyEntity.o\
+ build/cPacket_Disconnect.o\
+ build/cPacket_EntityEquipment.o\
build/cPacket_EntityLook.o\
+ build/cPacket_EntityStatus.o\
+ build/cPacket_Flying.o\
+ build/cPacket_Handshake.o\
+ build/cPacket_InventoryProgressBar.o\
+ build/cPacket_InventorySlot.o\
+ build/cPacket_ItemSwitch.o\
+ build/cPacket_KeepAlive.o\
+ build/cPacket_Login.o\
+ build/cPacket_MapChunk.o\
+ build/cPacket_Metadata.o\
+ build/cPacket_MultiBlock.o\
build/cPacket_NamedEntitySpawn.o\
+ build/cPacket_PickupSpawn.o\
+ build/cPacket_PlayerLook.o\
+ build/cPacket_PlayerMoveLook.o\
build/cPacket_PlayerPosition.o\
+ build/cPacket_PreChunk.o\
build/cPacket_RelativeEntityMove.o\
build/cPacket_RelativeEntityMoveLook.o\
build/cPacket_Respawn.o\
build/cPacket_SpawnMob.o\
build/cPacket_TeleportEntity.o\
+ build/cPacket_TimeUpdate.o\
build/cPacket_UpdateHealth.o\
+ build/cPacket_UpdateSign.o\
+ build/cPacket_UseEntity.o\
+ build/cPacket_WholeInventory.o\
+ build/cPacket_WindowClick.o\
+ build/cPacket_WindowClose.o\
+ build/cPacket_WindowOpen.o\
build/cPacket.o\
build/base64.o\
build/Socket.o\
@@ -174,7 +201,9 @@ MCServer : \
build/trees.o\
build/uncompr.o\
build/zutil.o\
- build/iniFile.o
+ build/iniFile.o\
+ build/cSocket.o\
+ build/cWaterSimulator.o
$(CC) $(LNK_OPTIONS) \
build/json_reader.o\
build/json_value.o\
@@ -183,12 +212,8 @@ MCServer : \
build/cGenSettings.o\
build/cCuboid.o\
build/cNoise.o\
- build/cPacket_WindowClick.o\
- build/cPacket_Login.o\
- build/cPacket_Chat.o\
build/cTimer.o\
build/cSleep.o\
- build/cPacket_Metadata.o\
build/cMonsterConfig.o\
build/cSpider.o\
build/cThread.o\
@@ -236,7 +261,6 @@ MCServer : \
build/main.o\
build/ManualBindings.o\
build/Matrix4f.o\
- build/PacketHeader.o\
build/Vector3d.o\
build/Vector3f.o\
build/Vector3i.o\
@@ -244,16 +268,48 @@ MCServer : \
build/cTCPLink.o\
build/cMCLogger.o\
build/cTracer.o\
+ build/cPacket_13.o\
+ build/cPacket_AddToInventory.o\
+ build/cPacket_ArmAnim.o\
+ build/cPacket_BlockChange.o\
+ build/cPacket_BlockDig.o\
+ build/cPacket_BlockPlace.o\
+ build/cPacket_Chat.o\
+ build/cPacket_CollectItem.o\
build/cPacket_DestroyEntity.o\
+ build/cPacket_Disconnect.o\
+ build/cPacket_EntityEquipment.o\
build/cPacket_EntityLook.o\
+ build/cPacket_EntityStatus.o\
+ build/cPacket_Flying.o\
+ build/cPacket_Handshake.o\
+ build/cPacket_InventoryProgressBar.o\
+ build/cPacket_InventorySlot.o\
+ build/cPacket_ItemSwitch.o\
+ build/cPacket_KeepAlive.o\
+ build/cPacket_Login.o\
+ build/cPacket_MapChunk.o\
+ build/cPacket_Metadata.o\
+ build/cPacket_MultiBlock.o\
build/cPacket_NamedEntitySpawn.o\
+ build/cPacket_PickupSpawn.o\
+ build/cPacket_PlayerLook.o\
+ build/cPacket_PlayerMoveLook.o\
build/cPacket_PlayerPosition.o\
+ build/cPacket_PreChunk.o\
build/cPacket_RelativeEntityMove.o\
build/cPacket_RelativeEntityMoveLook.o\
build/cPacket_Respawn.o\
build/cPacket_SpawnMob.o\
build/cPacket_TeleportEntity.o\
+ build/cPacket_TimeUpdate.o\
build/cPacket_UpdateHealth.o\
+ build/cPacket_UpdateSign.o\
+ build/cPacket_UseEntity.o\
+ build/cPacket_WholeInventory.o\
+ build/cPacket_WindowClick.o\
+ build/cPacket_WindowClose.o\
+ build/cPacket_WindowOpen.o\
build/cPacket.o\
build/base64.o\
build/Socket.o\
@@ -312,6 +368,8 @@ MCServer : \
build/uncompr.o\
build/zutil.o\
build/iniFile.o\
+ build/cSocket.o\
+ build/cWaterSimulator.o\
-o MCServer
clean :
@@ -323,12 +381,8 @@ clean :
build/cGenSettings.o\
build/cCuboid.o\
build/cNoise.o\
- build/cPacket_WindowClick.o\
- build/cPacket_Login.o\
- build/cPacket_Chat.o\
build/cTimer.o\
build/cSleep.o\
- build/cPacket_Metadata.o\
build/cMonsterConfig.o\
build/cSpider.o\
build/cThread.o\
@@ -376,7 +430,6 @@ clean :
build/main.o\
build/ManualBindings.o\
build/Matrix4f.o\
- build/PacketHeader.o\
build/Vector3d.o\
build/Vector3f.o\
build/Vector3i.o\
@@ -384,16 +437,48 @@ clean :
build/cTCPLink.o\
build/cMCLogger.o\
build/cTracer.o\
+ build/cPacket_13.o\
+ build/cPacket_AddToInventory.o\
+ build/cPacket_ArmAnim.o\
+ build/cPacket_BlockChange.o\
+ build/cPacket_BlockDig.o\
+ build/cPacket_BlockPlace.o\
+ build/cPacket_Chat.o\
+ build/cPacket_CollectItem.o\
build/cPacket_DestroyEntity.o\
+ build/cPacket_Disconnect.o\
+ build/cPacket_EntityEquipment.o\
build/cPacket_EntityLook.o\
+ build/cPacket_EntityStatus.o\
+ build/cPacket_Flying.o\
+ build/cPacket_Handshake.o\
+ build/cPacket_InventoryProgressBar.o\
+ build/cPacket_InventorySlot.o\
+ build/cPacket_ItemSwitch.o\
+ build/cPacket_KeepAlive.o\
+ build/cPacket_Login.o\
+ build/cPacket_MapChunk.o\
+ build/cPacket_Metadata.o\
+ build/cPacket_MultiBlock.o\
build/cPacket_NamedEntitySpawn.o\
+ build/cPacket_PickupSpawn.o\
+ build/cPacket_PlayerLook.o\
+ build/cPacket_PlayerMoveLook.o\
build/cPacket_PlayerPosition.o\
+ build/cPacket_PreChunk.o\
build/cPacket_RelativeEntityMove.o\
build/cPacket_RelativeEntityMoveLook.o\
build/cPacket_Respawn.o\
build/cPacket_SpawnMob.o\
build/cPacket_TeleportEntity.o\
+ build/cPacket_TimeUpdate.o\
build/cPacket_UpdateHealth.o\
+ build/cPacket_UpdateSign.o\
+ build/cPacket_UseEntity.o\
+ build/cPacket_WholeInventory.o\
+ build/cPacket_WindowClick.o\
+ build/cPacket_WindowClose.o\
+ build/cPacket_WindowOpen.o\
build/cPacket.o\
build/base64.o\
build/Socket.o\
@@ -452,6 +537,8 @@ clean :
build/uncompr.o\
build/zutil.o\
build/iniFile.o\
+ build/cSocket.o\
+ build/cWaterSimulator.o\
MCServer
install : MCServer
@@ -671,12 +758,6 @@ build/ManualBindings.o : source/ManualBindings.cpp
build/Matrix4f.o : source/Matrix4f.cpp
$(CC) $(CC_OPTIONS) source/Matrix4f.cpp -c $(INCLUDE) -o build/Matrix4f.o
-
-# Item # 44 -- PacketHeader --
-build/PacketHeader.o : source/PacketHeader.cpp
- $(CC) $(CC_OPTIONS) source/PacketHeader.cpp -c $(INCLUDE) -o build/PacketHeader.o
-
-
# Item # 45 -- Vector3d --
build/Vector3d.o : source/Vector3d.cpp
$(CC) $(CC_OPTIONS) source/Vector3d.cpp -c $(INCLUDE) -o build/Vector3d.o
@@ -711,56 +792,131 @@ build/cMCLogger.o : source/cMCLogger.cpp
build/cTracer.o : source/cTracer.cpp
$(CC) $(CC_OPTIONS) source/cTracer.cpp -c $(INCLUDE) -o build/cTracer.o
+build/cPacket_13.o : source/packets/cPacket_13.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_13.cpp -c $(INCLUDE) -o build/cPacket_13.o
+
+build/cPacket_AddToInventory.o : source/packets/cPacket_AddToInventory.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_AddToInventory.cpp -c $(INCLUDE) -o build/cPacket_AddToInventory.o
+
+build/cPacket_ArmAnim.o : source/packets/cPacket_ArmAnim.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_ArmAnim.cpp -c $(INCLUDE) -o build/cPacket_ArmAnim.o
+
+build/cPacket_BlockChange.o : source/packets/cPacket_BlockChange.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_BlockChange.cpp -c $(INCLUDE) -o build/cPacket_BlockChange.o
+
+build/cPacket_BlockDig.o : source/packets/cPacket_BlockDig.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_BlockDig.cpp -c $(INCLUDE) -o build/cPacket_BlockDig.o
+
+build/cPacket_BlockPlace.o : source/packets/cPacket_BlockPlace.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_BlockPlace.cpp -c $(INCLUDE) -o build/cPacket_BlockPlace.o
+
+build/cPacket_Chat.o : source/packets/cPacket_Chat.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_Chat.cpp -c $(INCLUDE) -o build/cPacket_Chat.o
+
+build/cPacket_CollectItem.o : source/packets/cPacket_CollectItem.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_CollectItem.cpp -c $(INCLUDE) -o build/cPacket_CollectItem.o
-# Item # 52 -- cPacket_DestroyEntity --
build/cPacket_DestroyEntity.o : source/packets/cPacket_DestroyEntity.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_DestroyEntity.cpp -c $(INCLUDE) -o build/cPacket_DestroyEntity.o
+build/cPacket_Disconnect.o : source/packets/cPacket_Disconnect.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_Disconnect.cpp -c $(INCLUDE) -o build/cPacket_Disconnect.o
+
+build/cPacket_EntityEquipment.o : source/packets/cPacket_EntityEquipment.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_EntityEquipment.cpp -c $(INCLUDE) -o build/cPacket_EntityEquipment.o
-# Item # 53 -- cPacket_EntityLook --
build/cPacket_EntityLook.o : source/packets/cPacket_EntityLook.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_EntityLook.cpp -c $(INCLUDE) -o build/cPacket_EntityLook.o
+build/cPacket_EntityStatus.o : source/packets/cPacket_EntityStatus.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_EntityStatus.cpp -c $(INCLUDE) -o build/cPacket_EntityStatus.o
+
+build/cPacket_Flying.o : source/packets/cPacket_Flying.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_Flying.cpp -c $(INCLUDE) -o build/cPacket_Flying.o
+
+build/cPacket_Handshake.o : source/packets/cPacket_Handshake.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_Handshake.cpp -c $(INCLUDE) -o build/cPacket_Handshake.o
+
+build/cPacket_InventoryProgressBar.o : source/packets/cPacket_InventoryProgressBar.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_InventoryProgressBar.cpp -c $(INCLUDE) -o build/cPacket_InventoryProgressBar.o
+
+build/cPacket_InventorySlot.o : source/packets/cPacket_InventorySlot.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_InventorySlot.cpp -c $(INCLUDE) -o build/cPacket_InventorySlot.o
+
+build/cPacket_ItemSwitch.o : source/packets/cPacket_ItemSwitch.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_ItemSwitch.cpp -c $(INCLUDE) -o build/cPacket_ItemSwitch.o
+
+build/cPacket_KeepAlive.o : source/packets/cPacket_KeepAlive.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_KeepAlive.cpp -c $(INCLUDE) -o build/cPacket_KeepAlive.o
+
+build/cPacket_Login.o : source/packets/cPacket_Login.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_Login.cpp -c $(INCLUDE) -o build/cPacket_Login.o
+
+build/cPacket_MapChunk.o : source/packets/cPacket_MapChunk.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_MapChunk.cpp -c $(INCLUDE) -o build/cPacket_MapChunk.o
+
+build/cPacket_Metadata.o : source/packets/cPacket_Metadata.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_Metadata.cpp -c $(INCLUDE) -o build/cPacket_Metadata.o
+
+build/cPacket_MultiBlock.o : source/packets/cPacket_MultiBlock.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_MultiBlock.cpp -c $(INCLUDE) -o build/cPacket_MultiBlock.o
-# Item # 54 -- cPacket_NamedEntitySpawn --
build/cPacket_NamedEntitySpawn.o : source/packets/cPacket_NamedEntitySpawn.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_NamedEntitySpawn.cpp -c $(INCLUDE) -o build/cPacket_NamedEntitySpawn.o
+build/cPacket_PickupSpawn.o : source/packets/cPacket_PickupSpawn.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_PickupSpawn.cpp -c $(INCLUDE) -o build/cPacket_PickupSpawn.o
+
+build/cPacket_PlayerLook.o : source/packets/cPacket_PlayerLook.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_PlayerLook.cpp -c $(INCLUDE) -o build/cPacket_PlayerLook.o
+
+build/cPacket_PlayerMoveLook.o : source/packets/cPacket_PlayerMoveLook.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_PlayerMoveLook.cpp -c $(INCLUDE) -o build/cPacket_PlayerMoveLook.o
-# Item # 55 -- cPacket_PlayerPosition --
build/cPacket_PlayerPosition.o : source/packets/cPacket_PlayerPosition.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_PlayerPosition.cpp -c $(INCLUDE) -o build/cPacket_PlayerPosition.o
+build/cPacket_PreChunk.o : source/packets/cPacket_PreChunk.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_PreChunk.cpp -c $(INCLUDE) -o build/cPacket_PreChunk.o
-# Item # 56 -- cPacket_RelativeEntityMove --
build/cPacket_RelativeEntityMove.o : source/packets/cPacket_RelativeEntityMove.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_RelativeEntityMove.cpp -c $(INCLUDE) -o build/cPacket_RelativeEntityMove.o
-
-# Item # 57 -- cPacket_RelativeEntityMoveLook --
build/cPacket_RelativeEntityMoveLook.o : source/packets/cPacket_RelativeEntityMoveLook.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_RelativeEntityMoveLook.cpp -c $(INCLUDE) -o build/cPacket_RelativeEntityMoveLook.o
-
-# Item # 58 -- cPacket_Respawn --
build/cPacket_Respawn.o : source/packets/cPacket_Respawn.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_Respawn.cpp -c $(INCLUDE) -o build/cPacket_Respawn.o
-
-# Item # 59 -- cPacket_SpawnMob --
build/cPacket_SpawnMob.o : source/packets/cPacket_SpawnMob.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_SpawnMob.cpp -c $(INCLUDE) -o build/cPacket_SpawnMob.o
-
-# Item # 60 -- cPacket_TeleportEntity --
build/cPacket_TeleportEntity.o : source/packets/cPacket_TeleportEntity.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_TeleportEntity.cpp -c $(INCLUDE) -o build/cPacket_TeleportEntity.o
+build/cPacket_TimeUpdate.o : source/packets/cPacket_TimeUpdate.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_TimeUpdate.cpp -c $(INCLUDE) -o build/cPacket_TimeUpdate.o
-# Item # 61 -- cPacket_UpdateHealth --
build/cPacket_UpdateHealth.o : source/packets/cPacket_UpdateHealth.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_UpdateHealth.cpp -c $(INCLUDE) -o build/cPacket_UpdateHealth.o
+build/cPacket_UpdateSign.o : source/packets/cPacket_UpdateSign.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_UpdateSign.cpp -c $(INCLUDE) -o build/cPacket_UpdateSign.o
+
+build/cPacket_UseEntity.o : source/packets/cPacket_UseEntity.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_UseEntity.cpp -c $(INCLUDE) -o build/cPacket_UseEntity.o
+
+build/cPacket_WholeInventory.o : source/packets/cPacket_WholeInventory.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_WholeInventory.cpp -c $(INCLUDE) -o build/cPacket_WholeInventory.o
+
+build/cPacket_WindowClick.o : source/packets/cPacket_WindowClick.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_WindowClick.cpp -c $(INCLUDE) -o build/cPacket_WindowClick.o
+
+build/cPacket_WindowClose.o : source/packets/cPacket_WindowClose.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_WindowClose.cpp -c $(INCLUDE) -o build/cPacket_WindowClose.o
+
+build/cPacket_WindowOpen.o : source/packets/cPacket_WindowOpen.cpp
+ $(CC) $(CC_OPTIONS) source/packets/cPacket_WindowOpen.cpp -c $(INCLUDE) -o build/cPacket_WindowOpen.o
# Item # 62 -- cPacket --
build/cPacket.o : source/packets/cPacket.cpp
@@ -1067,24 +1223,12 @@ build/cSpider.o: source/cSpider.cpp
build/cMonsterConfig.o: source/cMonsterConfig.cpp
$(CC) $(CC_OPTIONS) source/cMonsterConfig.cpp -c $(INCLUDE) -o build/cMonsterConfig.o
-build/cPacket_Metadata.o: source/packets/cPacket_Metadata.cpp
- $(CC) $(CC_OPTIONS) source/packets/cPacket_Metadata.cpp -c $(INCLUDE) -o build/cPacket_Metadata.o
-
build/cSleep.o: source/cSleep.cpp
$(CC) $(CC_OPTIONS) source/cSleep.cpp -c $(INCLUDE) -o build/cSleep.o
build/cTimer.o: source/cTimer.cpp
$(CC) $(CC_OPTIONS) source/cTimer.cpp -c $(INCLUDE) -o build/cTimer.o
-build/cPacket_Chat.o : source/packets/cPacket_Chat.cpp
- $(CC) $(CC_OPTIONS) source/packets/cPacket_Chat.cpp -c $(INCLUDE) -o build/cPacket_Chat.o
-
-build/cPacket_Login.o : source/packets/cPacket_Login.cpp
- $(CC) $(CC_OPTIONS) source/packets/cPacket_Login.cpp -c $(INCLUDE) -o build/cPacket_Login.o
-
-build/cPacket_WindowClick.o : source/packets/cPacket_WindowClick.cpp
- $(CC) $(CC_OPTIONS) source/packets/cPacket_WindowClick.cpp -c $(INCLUDE) -o build/cPacket_WindowClick.o
-
build/cNoise.o : source/cNoise.cpp
$(CC) $(CC_OPTIONS) source/cNoise.cpp -c $(INCLUDE) -o build/cNoise.o
@@ -1105,4 +1249,11 @@ build/json_writer.o : jsoncpp-src-0.5.0/src/lib_json/json_writer.cpp
build/cMakeDir.o : source/cMakeDir.cpp
$(CC) $(CC_OPTIONS) source/cMakeDir.cpp -c $(INCLUDE) -o build/cMakeDir.o
+
+build/cSocket.o : source/cSocket.cpp
+ $(CC) $(CC_OPTIONS) source/cSocket.cpp -c $(INCLUDE) -o build/cSocket.o
+
+build/cWaterSimulator.o : source/cWaterSimulator.cpp
+ $(CC) $(CC_OPTIONS) source/cWaterSimulator.cpp -c $(INCLUDE) -o build/cWaterSimulator.o
+
##### END RUN ####
diff --git a/source/MCSocket.h b/source/MCSocket.h
index 554a5f35b..6fcbb069b 100644
--- a/source/MCSocket.h
+++ b/source/MCSocket.h
@@ -1,12 +1,12 @@
#pragma once
#ifdef _WIN32
-
-#include <winsock2.h>
-#define socklen_t int
-#ifdef SendMessage
-#undef SendMessage
-#endif
+#include <Windows.h>
+#include <WinSock.h>
+// #define socklen_t int
+// #ifdef SendMessage
+// #undef SendMessage
+// #endif
#else
// Linux threads http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html
diff --git a/source/cBlockingTCPLink.cpp b/source/cBlockingTCPLink.cpp
index a87809857..6a2208084 100644
--- a/source/cBlockingTCPLink.cpp
+++ b/source/cBlockingTCPLink.cpp
@@ -1,5 +1,6 @@
#include "cBlockingTCPLink.h"
#include "packets/cPacket.h"
+#include "MCSocket.h"
#include <string>
#include "cMCLogger.h"
@@ -30,7 +31,7 @@ void cBlockingTCPLink::CloseSocket()
{
if( m_Socket )
{
- closesocket( m_Socket );
+ m_Socket.CloseSocket();
m_Socket = 0;
}
}
diff --git a/source/cChunk.cpp b/source/cChunk.cpp
index c6d0fb3b3..a8e8938a0 100644
--- a/source/cChunk.cpp
+++ b/source/cChunk.cpp
@@ -22,6 +22,7 @@
#include "cItem.h"
#include "cNoise.h"
#include "cRoot.h"
+#include "cCriticalSection.h"
#include "cGenSettings.h"
@@ -37,6 +38,10 @@
#include <vector>
#include <map>
+#ifndef _WIN32
+#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
+#endif
+
extern bool g_bWaterPhysics;
@@ -77,8 +82,7 @@ cChunk::~cChunk()
if( m_EntitiesCriticalSection )
{
- DeleteCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection );
- delete (CRITICAL_SECTION*)m_EntitiesCriticalSection;
+ delete m_EntitiesCriticalSection;
m_EntitiesCriticalSection = 0;
}
delete m_pState;
@@ -102,8 +106,7 @@ cChunk::cChunk(int a_X, int a_Y, int a_Z)
, m_EntitiesCriticalSection( 0 )
{
//LOG("cChunk::cChunk(%i, %i, %i)", a_X, a_Y, a_Z);
- m_EntitiesCriticalSection = new CRITICAL_SECTION;
- InitializeCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection );
+ m_EntitiesCriticalSection = new cCriticalSection();
}
void cChunk::Initialize()
@@ -1064,12 +1067,12 @@ bool cChunk::RemoveEntity( cEntity & a_Entity, cChunk* a_CalledFrom /* = 0 */ )
void cChunk::LockEntities()
{
- EnterCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection );
+ m_EntitiesCriticalSection->Lock();
}
void cChunk::UnlockEntities()
{
- LeaveCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection );
+ m_EntitiesCriticalSection->Unlock();
}
char cChunk::GetBlock( int a_X, int a_Y, int a_Z )
diff --git a/source/cChunk.h b/source/cChunk.h
index 83c14dcfa..d90e817cf 100644
--- a/source/cChunk.h
+++ b/source/cChunk.h
@@ -7,6 +7,7 @@ namespace Json
class Value;
};
+class cCriticalSection;
class cFurnaceEntity;
class cPacket;
class cBlockEntity;
@@ -123,5 +124,5 @@ private:
unsigned int m_BlockTickNum;
unsigned int m_BlockTickX, m_BlockTickY, m_BlockTickZ;
- void* m_EntitiesCriticalSection;
+ cCriticalSection* m_EntitiesCriticalSection;
}; \ No newline at end of file
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp
index 5e0e39a9c..119af2c76 100644
--- a/source/cChunkMap.cpp
+++ b/source/cChunkMap.cpp
@@ -4,9 +4,12 @@
#include "cWorld.h"
#include "cRoot.h"
#include "cMakeDir.h"
+
#ifndef _WIN32
#include <cstring> // memcpy
#include <cstdlib> // abs
+#include <math.h> // floorf
+#include <stdio.h> // sprintf and stuff
#endif
#include "zlib.h"
diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp
index f274795c1..68a70715e 100644
--- a/source/cClientHandle.cpp
+++ b/source/cClientHandle.cpp
@@ -4,6 +4,8 @@
#include <errno.h>
#endif
+#include "MCSocket.h"
+
#include "cClientHandle.h"
#include "cServer.h"
#include "cWorld.h"
@@ -68,6 +70,10 @@
#include "packets/cPacket_Ping.h"
+#ifndef _WIN32
+#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
+#endif
+
#define MAX_SEMAPHORES (2000)
typedef std::list<cPacket*> PacketList;
@@ -176,7 +182,7 @@ cClientHandle::~cClientHandle()
Disconnect.m_Reason = "Server shut down? Kthnxbai";
Disconnect.Send( m_pState->Socket );
- closesocket( m_pState->Socket );
+ m_pState->Socket.CloseSocket();
m_pState->Socket = 0;
}
m_pState->SocketCriticalSection.Unlock();
@@ -218,7 +224,7 @@ void cClientHandle::Destroy()
m_pState->SocketCriticalSection.Lock();
if( m_pState->Socket )
{
- closesocket( m_pState->Socket );
+ m_pState->Socket.CloseSocket();
m_pState->Socket = 0;
}
m_pState->SocketCriticalSection.Unlock();
diff --git a/source/cHeartBeat.cpp b/source/cHeartBeat.cpp
index b518a753a..3661b9376 100644
--- a/source/cHeartBeat.cpp
+++ b/source/cHeartBeat.cpp
@@ -8,6 +8,10 @@
#include "cServer.h"
#include "cSleep.h"
+#ifndef _WIN32
+#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
+#endif
+
cHeartBeat::cHeartBeat()
{
m_State = 0;
diff --git a/source/cPlayer.cpp b/source/cPlayer.cpp
index 8552abd3e..71fa41d27 100644
--- a/source/cPlayer.cpp
+++ b/source/cPlayer.cpp
@@ -36,6 +36,7 @@
#ifndef _WIN32 // for mkdir
#include <sys/stat.h>
#include <sys/types.h>
+#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#endif
extern std::vector< std::string > StringSplit( std::string str, std::string delim);
diff --git a/source/cPlayer.h b/source/cPlayer.h
index 6f05b824d..d5ad6abac 100644
--- a/source/cPlayer.h
+++ b/source/cPlayer.h
@@ -2,6 +2,7 @@
#include "cPawn.h"
#include <list>
+#include <string> // TODO - use const char*
class cGroup;
class cWindow;
diff --git a/source/cPluginManager.h b/source/cPluginManager.h
index 32c7b9d3a..6a94060e0 100644
--- a/source/cPluginManager.h
+++ b/source/cPluginManager.h
@@ -1,6 +1,7 @@
#pragma once
#include <list>
+#include <string> // TODO - use const char*
struct lua_State;
class cLuaCommandBinder;
diff --git a/source/cServer.cpp b/source/cServer.cpp
index 966444a25..a5e06d3ec 100644
--- a/source/cServer.cpp
+++ b/source/cServer.cpp
@@ -32,6 +32,7 @@
#include <cstring>
#include <errno.h>
#include <semaphore.h>
+#include "MCSocket.h"
#endif
#include <string>
diff --git a/source/cSocket.cpp b/source/cSocket.cpp
index d2489d48e..edc57c1ce 100644
--- a/source/cSocket.cpp
+++ b/source/cSocket.cpp
@@ -1,5 +1,10 @@
#include "cSocket.h"
+#ifndef _WIN32
+#include <netdb.h>
+#include <unistd.h>
+#endif
+
cSocket::cSocket( xSocket a_Socket )
: m_Socket( a_Socket )
{
@@ -28,3 +33,12 @@ bool cSocket::IsValid()
#endif
}
+void cSocket::CloseSocket()
+{
+#ifdef _WIN32
+ closesocket(m_Socket);
+#else
+ shutdown(m_Socket, SHUT_RDWR);//SD_BOTH);
+ close(m_Socket);
+#endif
+} \ No newline at end of file
diff --git a/source/cSocket.h b/source/cSocket.h
index 4a58ff2c9..cfbc2959f 100644
--- a/source/cSocket.h
+++ b/source/cSocket.h
@@ -6,7 +6,8 @@
#ifdef SendMessage
#undef SendMessage
#endif
-#endif
+#endif // _WIN32
+
class cSocket
{
@@ -23,6 +24,7 @@ public:
~cSocket();
bool IsValid();
+ void CloseSocket();
operator const xSocket() const;
xSocket GetSocket() const;
diff --git a/source/cTCPLink.cpp b/source/cTCPLink.cpp
index 13eb593ef..0efc0254f 100644
--- a/source/cTCPLink.cpp
+++ b/source/cTCPLink.cpp
@@ -2,6 +2,7 @@
#include "cSocket.h"
#include "cEvent.h"
#include "cThread.h"
+#include "MCSocket.h"
#include "cMCLogger.h"
@@ -37,7 +38,7 @@ void cTCPLink::CloseSocket()
{
if( m_Socket )
{
- closesocket( m_Socket );
+ m_Socket.CloseSocket();
m_Socket = 0;
}
}
diff --git a/source/main.cpp b/source/main.cpp
index 393db121e..d17456af1 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -4,9 +4,9 @@
#include "cRoot.h"
#include "cMCLogger.h"
-#ifdef _WIN32
+//#ifdef _WIN32
#include <exception>
-#endif
+//#endif
int main( int argc, char **argv )
{
diff --git a/source/packets/cPacket.cpp b/source/packets/cPacket.cpp
index e49c3e016..7775ede73 100644
--- a/source/packets/cPacket.cpp
+++ b/source/packets/cPacket.cpp
@@ -13,7 +13,7 @@
//*****************************************************************************
// Blocking receive all function
//*****************************************************************************
-int cPacket::RecvAll( SOCKET a_Socket, char* a_Data, unsigned int a_Size, int a_Options )
+int cPacket::RecvAll( cSocket & a_Socket, char* a_Data, unsigned int a_Size, int a_Options )
{
unsigned int RequestSize = a_Size;
while(a_Size != 0)
@@ -30,7 +30,7 @@ int cPacket::RecvAll( SOCKET a_Socket, char* a_Data, unsigned int a_Size, int a_
//*****************************************************************************
// Own implementation of send()
//*****************************************************************************
-int cPacket::SendData( SOCKET a_Socket, const char* a_Message, unsigned int a_Size, int a_Options )
+int cPacket::SendData( cSocket & a_Socket, const char* a_Message, unsigned int a_Size, int a_Options )
{
return send(a_Socket, a_Message, a_Size, a_Options | MSG_NOSIGNAL );
}
diff --git a/source/packets/cPacket.h b/source/packets/cPacket.h
index 3cab5f222..304d6b8d3 100644
--- a/source/packets/cPacket.h
+++ b/source/packets/cPacket.h
@@ -51,6 +51,6 @@ protected:
void AppendData ( char* a_Data, unsigned int a_Size, char* a_Dst, unsigned int & a_Iterator );
public:
- static int SendData( SOCKET a_Socket, const char* a_Message, unsigned int a_Size, int a_Options );
- static int RecvAll( SOCKET a_Socket, char* a_Data, unsigned int a_Size, int a_Options );
+ static int SendData( cSocket & a_Socket, const char* a_Message, unsigned int a_Size, int a_Options );
+ static int RecvAll( cSocket & a_Socket, char* a_Data, unsigned int a_Size, int a_Options );
};