Compiles for linux

git-svn-id: http://mc-server.googlecode.com/svn/trunk@6 0a769ca7-a7f5-676a-18bf-c427514a06d6
master
faketruth 2011-10-21 21:25:29 +00:00
parent 7e010e7f8f
commit c7b4b9f819
20 changed files with 399 additions and 208 deletions

View File

@ -6,11 +6,10 @@ del *.map
del *.pdb del *.pdb
del *.bsc del *.bsc
del *.sdf del *.sdf
del *.opensdf del *.opensdf /AH
del *.insprc del *.insprc
del *.aps del *.aps
del applog.txt del applog.txt
del tmpl83.00c.vcproj.LAPTOPF.Kevin.user
del *.suo /AH del *.suo /AH
del debug\*.* /Q del debug\*.* /Q
del release\*.* /Q del release\*.* /Q
@ -23,3 +22,5 @@ rd ipch /Q
rd x64 /Q rd x64 /Q
rd "My Inspector Results" /Q rd "My Inspector Results" /Q
rd ipch /Q rd ipch /Q
pause

View File

@ -33,9 +33,9 @@
#define SOCKET_H #define SOCKET_H
#include "../source/MCSocket.h" #include "../source/MCSocket.h"
#ifdef _WIN32 // #ifdef _WIN32
#include <winsock2.h> // #include <winsock2.h>
#endif // #endif
#include <string> #include <string>

507
makefile
View File

@ -46,12 +46,8 @@ MCServer : \
build/cGenSettings.o\ build/cGenSettings.o\
build/cCuboid.o\ build/cCuboid.o\
build/cNoise.o\ build/cNoise.o\
build/cPacket_WindowClick.o\
build/cPacket_Login.o\
build/cPacket_Chat.o\
build/cTimer.o\ build/cTimer.o\
build/cSleep.o\ build/cSleep.o\
build/cPacket_Metadata.o\
build/cMonsterConfig.o\ build/cMonsterConfig.o\
build/cSpider.o\ build/cSpider.o\
build/cThread.o\ build/cThread.o\
@ -99,7 +95,6 @@ MCServer : \
build/main.o\ build/main.o\
build/ManualBindings.o\ build/ManualBindings.o\
build/Matrix4f.o\ build/Matrix4f.o\
build/PacketHeader.o\
build/Vector3d.o\ build/Vector3d.o\
build/Vector3f.o\ build/Vector3f.o\
build/Vector3i.o\ build/Vector3i.o\
@ -107,153 +102,48 @@ MCServer : \
build/cTCPLink.o\ build/cTCPLink.o\
build/cMCLogger.o\ build/cMCLogger.o\
build/cTracer.o\ build/cTracer.o\
build/cPacket_DestroyEntity.o\ build/cPacket_13.o\
build/cPacket_EntityLook.o\ build/cPacket_AddToInventory.o\
build/cPacket_NamedEntitySpawn.o\ build/cPacket_ArmAnim.o\
build/cPacket_PlayerPosition.o\ build/cPacket_BlockChange.o\
build/cPacket_RelativeEntityMove.o\ build/cPacket_BlockDig.o\
build/cPacket_RelativeEntityMoveLook.o\ build/cPacket_BlockPlace.o\
build/cPacket_Respawn.o\
build/cPacket_SpawnMob.o\
build/cPacket_TeleportEntity.o\
build/cPacket_UpdateHealth.o\
build/cPacket.o\
build/base64.o\
build/Socket.o\
build/StdHelpers.o\
build/UrlHelper.o\
build/WebServer.o\
build/tolua_event.o\
build/tolua_is.o\
build/tolua_map.o\
build/tolua_push.o\
build/tolua_to.o\
build/lapi.o\
build/lauxlib.o\
build/lbaselib.o\
build/lcode.o\
build/ldblib.o\
build/ldebug.o\
build/ldo.o\
build/ldump.o\
build/lfunc.o\
build/lgc.o\
build/linit.o\
build/liolib.o\
build/llex.o\
build/lmathlib.o\
build/lmem.o\
build/loadlib.o\
build/lobject.o\
build/lopcodes.o\
build/loslib.o\
build/lparser.o\
build/lstate.o\
build/lstring.o\
build/lstrlib.o\
build/ltable.o\
build/ltablib.o\
build/ltm.o\
build/luac.o\
build/lundump.o\
build/lvm.o\
build/lzio.o\
build/print.o\
build/adler32.o\
build/compress.o\
build/crc32.o\
build/deflate.o\
build/gzclose.o\
build/gzlib.o\
build/gzread.o\
build/gzwrite.o\
build/infback.o\
build/inffast.o\
build/inflate.o\
build/inftrees.o\
build/trees.o\
build/uncompr.o\
build/zutil.o\
build/iniFile.o
$(CC) $(LNK_OPTIONS) \
build/json_reader.o\
build/json_value.o\
build/json_writer.o\
build/cMakeDir.o\
build/cGenSettings.o\
build/cCuboid.o\
build/cNoise.o\
build/cPacket_WindowClick.o\
build/cPacket_Login.o\
build/cPacket_Chat.o\ build/cPacket_Chat.o\
build/cTimer.o\ build/cPacket_CollectItem.o\
build/cSleep.o\
build/cPacket_Metadata.o\
build/cMonsterConfig.o\
build/cSpider.o\
build/cThread.o\
build/cBlockingTCPLink.o\
build/cAuthenticator.o\
build/cLuaCommandBinder.o\
build/cChicken.o\
build/md5.o\
build/cReferenceManager.o\
build/Bindings.o\
build/cBlockToPickup.o\
build/cChatColor.o\
build/cChestEntity.o\
build/cChunk.o\
build/cChunkMap.o\
build/cClientHandle.o\
build/cCraftingWindow.o\
build/cCriticalSection.o\
build/cEntity.o\
build/cEvent.o\
build/cFurnaceEntity.o\
build/cFurnaceRecipe.o\
build/cFurnaceWindow.o\
build/cGroup.o\
build/cGroupManager.o\
build/cInventory.o\
build/cLog.o\
build/cMonster.o\
build/cPawn.o\
build/cPickup.o\
build/cPlayer.o\
build/cPlugin_Lua.o\
build/cPlugin.o\
build/cPluginManager.o\
build/cRecipeChecker.o\
build/cRoot.o\
build/cSemaphore.o\
build/cServer.o\
build/cSignEntity.o\
build/cStringMap.o\
build/cWebAdmin.o\
build/cWebPlugin.o\
build/cWindow.o\
build/cWorld.o\
build/main.o\
build/ManualBindings.o\
build/Matrix4f.o\
build/PacketHeader.o\
build/Vector3d.o\
build/Vector3f.o\
build/Vector3i.o\
build/cHeartBeat.o\
build/cTCPLink.o\
build/cMCLogger.o\
build/cTracer.o\
build/cPacket_DestroyEntity.o\ build/cPacket_DestroyEntity.o\
build/cPacket_Disconnect.o\
build/cPacket_EntityEquipment.o\
build/cPacket_EntityLook.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_NamedEntitySpawn.o\
build/cPacket_PickupSpawn.o\
build/cPacket_PlayerLook.o\
build/cPacket_PlayerMoveLook.o\
build/cPacket_PlayerPosition.o\ build/cPacket_PlayerPosition.o\
build/cPacket_PreChunk.o\
build/cPacket_RelativeEntityMove.o\ build/cPacket_RelativeEntityMove.o\
build/cPacket_RelativeEntityMoveLook.o\ build/cPacket_RelativeEntityMoveLook.o\
build/cPacket_Respawn.o\ build/cPacket_Respawn.o\
build/cPacket_SpawnMob.o\ build/cPacket_SpawnMob.o\
build/cPacket_TeleportEntity.o\ build/cPacket_TeleportEntity.o\
build/cPacket_TimeUpdate.o\
build/cPacket_UpdateHealth.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/cPacket.o\
build/base64.o\ build/base64.o\
build/Socket.o\ build/Socket.o\
@ -312,6 +202,174 @@ MCServer : \
build/uncompr.o\ build/uncompr.o\
build/zutil.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\
build/json_writer.o\
build/cMakeDir.o\
build/cGenSettings.o\
build/cCuboid.o\
build/cNoise.o\
build/cTimer.o\
build/cSleep.o\
build/cMonsterConfig.o\
build/cSpider.o\
build/cThread.o\
build/cBlockingTCPLink.o\
build/cAuthenticator.o\
build/cLuaCommandBinder.o\
build/cChicken.o\
build/md5.o\
build/cReferenceManager.o\
build/Bindings.o\
build/cBlockToPickup.o\
build/cChatColor.o\
build/cChestEntity.o\
build/cChunk.o\
build/cChunkMap.o\
build/cClientHandle.o\
build/cCraftingWindow.o\
build/cCriticalSection.o\
build/cEntity.o\
build/cEvent.o\
build/cFurnaceEntity.o\
build/cFurnaceRecipe.o\
build/cFurnaceWindow.o\
build/cGroup.o\
build/cGroupManager.o\
build/cInventory.o\
build/cLog.o\
build/cMonster.o\
build/cPawn.o\
build/cPickup.o\
build/cPlayer.o\
build/cPlugin_Lua.o\
build/cPlugin.o\
build/cPluginManager.o\
build/cRecipeChecker.o\
build/cRoot.o\
build/cSemaphore.o\
build/cServer.o\
build/cSignEntity.o\
build/cStringMap.o\
build/cWebAdmin.o\
build/cWebPlugin.o\
build/cWindow.o\
build/cWorld.o\
build/main.o\
build/ManualBindings.o\
build/Matrix4f.o\
build/Vector3d.o\
build/Vector3f.o\
build/Vector3i.o\
build/cHeartBeat.o\
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\
build/StdHelpers.o\
build/UrlHelper.o\
build/WebServer.o\
build/tolua_event.o\
build/tolua_is.o\
build/tolua_map.o\
build/tolua_push.o\
build/tolua_to.o\
build/lapi.o\
build/lauxlib.o\
build/lbaselib.o\
build/lcode.o\
build/ldblib.o\
build/ldebug.o\
build/ldo.o\
build/ldump.o\
build/lfunc.o\
build/lgc.o\
build/linit.o\
build/liolib.o\
build/llex.o\
build/lmathlib.o\
build/lmem.o\
build/loadlib.o\
build/lobject.o\
build/lopcodes.o\
build/loslib.o\
build/lparser.o\
build/lstate.o\
build/lstring.o\
build/lstrlib.o\
build/ltable.o\
build/ltablib.o\
build/ltm.o\
build/luac.o\
build/lundump.o\
build/lvm.o\
build/lzio.o\
build/print.o\
build/adler32.o\
build/compress.o\
build/crc32.o\
build/deflate.o\
build/gzclose.o\
build/gzlib.o\
build/gzread.o\
build/gzwrite.o\
build/infback.o\
build/inffast.o\
build/inflate.o\
build/inftrees.o\
build/trees.o\
build/uncompr.o\
build/zutil.o\
build/iniFile.o\
build/cSocket.o\
build/cWaterSimulator.o\
-o MCServer -o MCServer
clean : clean :
@ -323,12 +381,8 @@ clean :
build/cGenSettings.o\ build/cGenSettings.o\
build/cCuboid.o\ build/cCuboid.o\
build/cNoise.o\ build/cNoise.o\
build/cPacket_WindowClick.o\
build/cPacket_Login.o\
build/cPacket_Chat.o\
build/cTimer.o\ build/cTimer.o\
build/cSleep.o\ build/cSleep.o\
build/cPacket_Metadata.o\
build/cMonsterConfig.o\ build/cMonsterConfig.o\
build/cSpider.o\ build/cSpider.o\
build/cThread.o\ build/cThread.o\
@ -376,7 +430,6 @@ clean :
build/main.o\ build/main.o\
build/ManualBindings.o\ build/ManualBindings.o\
build/Matrix4f.o\ build/Matrix4f.o\
build/PacketHeader.o\
build/Vector3d.o\ build/Vector3d.o\
build/Vector3f.o\ build/Vector3f.o\
build/Vector3i.o\ build/Vector3i.o\
@ -384,16 +437,48 @@ clean :
build/cTCPLink.o\ build/cTCPLink.o\
build/cMCLogger.o\ build/cMCLogger.o\
build/cTracer.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_DestroyEntity.o\
build/cPacket_Disconnect.o\
build/cPacket_EntityEquipment.o\
build/cPacket_EntityLook.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_NamedEntitySpawn.o\
build/cPacket_PickupSpawn.o\
build/cPacket_PlayerLook.o\
build/cPacket_PlayerMoveLook.o\
build/cPacket_PlayerPosition.o\ build/cPacket_PlayerPosition.o\
build/cPacket_PreChunk.o\
build/cPacket_RelativeEntityMove.o\ build/cPacket_RelativeEntityMove.o\
build/cPacket_RelativeEntityMoveLook.o\ build/cPacket_RelativeEntityMoveLook.o\
build/cPacket_Respawn.o\ build/cPacket_Respawn.o\
build/cPacket_SpawnMob.o\ build/cPacket_SpawnMob.o\
build/cPacket_TeleportEntity.o\ build/cPacket_TeleportEntity.o\
build/cPacket_TimeUpdate.o\
build/cPacket_UpdateHealth.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/cPacket.o\
build/base64.o\ build/base64.o\
build/Socket.o\ build/Socket.o\
@ -452,6 +537,8 @@ clean :
build/uncompr.o\ build/uncompr.o\
build/zutil.o\ build/zutil.o\
build/iniFile.o\ build/iniFile.o\
build/cSocket.o\
build/cWaterSimulator.o\
MCServer MCServer
install : MCServer install : MCServer
@ -671,12 +758,6 @@ build/ManualBindings.o : source/ManualBindings.cpp
build/Matrix4f.o : source/Matrix4f.cpp build/Matrix4f.o : source/Matrix4f.cpp
$(CC) $(CC_OPTIONS) source/Matrix4f.cpp -c $(INCLUDE) -o build/Matrix4f.o $(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 -- # Item # 45 -- Vector3d --
build/Vector3d.o : source/Vector3d.cpp build/Vector3d.o : source/Vector3d.cpp
$(CC) $(CC_OPTIONS) source/Vector3d.cpp -c $(INCLUDE) -o build/Vector3d.o $(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 build/cTracer.o : source/cTracer.cpp
$(CC) $(CC_OPTIONS) source/cTracer.cpp -c $(INCLUDE) -o build/cTracer.o $(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 build/cPacket_DestroyEntity.o : source/packets/cPacket_DestroyEntity.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_DestroyEntity.cpp -c $(INCLUDE) -o build/cPacket_DestroyEntity.o $(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 build/cPacket_EntityLook.o : source/packets/cPacket_EntityLook.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_EntityLook.cpp -c $(INCLUDE) -o build/cPacket_EntityLook.o $(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 build/cPacket_NamedEntitySpawn.o : source/packets/cPacket_NamedEntitySpawn.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_NamedEntitySpawn.cpp -c $(INCLUDE) -o build/cPacket_NamedEntitySpawn.o $(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 build/cPacket_PlayerPosition.o : source/packets/cPacket_PlayerPosition.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_PlayerPosition.cpp -c $(INCLUDE) -o build/cPacket_PlayerPosition.o $(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 build/cPacket_RelativeEntityMove.o : source/packets/cPacket_RelativeEntityMove.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_RelativeEntityMove.cpp -c $(INCLUDE) -o build/cPacket_RelativeEntityMove.o $(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 build/cPacket_RelativeEntityMoveLook.o : source/packets/cPacket_RelativeEntityMoveLook.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_RelativeEntityMoveLook.cpp -c $(INCLUDE) -o build/cPacket_RelativeEntityMoveLook.o $(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 build/cPacket_Respawn.o : source/packets/cPacket_Respawn.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_Respawn.cpp -c $(INCLUDE) -o build/cPacket_Respawn.o $(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 build/cPacket_SpawnMob.o : source/packets/cPacket_SpawnMob.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_SpawnMob.cpp -c $(INCLUDE) -o build/cPacket_SpawnMob.o $(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 build/cPacket_TeleportEntity.o : source/packets/cPacket_TeleportEntity.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_TeleportEntity.cpp -c $(INCLUDE) -o build/cPacket_TeleportEntity.o $(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 build/cPacket_UpdateHealth.o : source/packets/cPacket_UpdateHealth.cpp
$(CC) $(CC_OPTIONS) source/packets/cPacket_UpdateHealth.cpp -c $(INCLUDE) -o build/cPacket_UpdateHealth.o $(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 -- # Item # 62 -- cPacket --
build/cPacket.o : source/packets/cPacket.cpp build/cPacket.o : source/packets/cPacket.cpp
@ -1067,24 +1223,12 @@ build/cSpider.o: source/cSpider.cpp
build/cMonsterConfig.o: source/cMonsterConfig.cpp build/cMonsterConfig.o: source/cMonsterConfig.cpp
$(CC) $(CC_OPTIONS) source/cMonsterConfig.cpp -c $(INCLUDE) -o build/cMonsterConfig.o $(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 build/cSleep.o: source/cSleep.cpp
$(CC) $(CC_OPTIONS) source/cSleep.cpp -c $(INCLUDE) -o build/cSleep.o $(CC) $(CC_OPTIONS) source/cSleep.cpp -c $(INCLUDE) -o build/cSleep.o
build/cTimer.o: source/cTimer.cpp build/cTimer.o: source/cTimer.cpp
$(CC) $(CC_OPTIONS) source/cTimer.cpp -c $(INCLUDE) -o build/cTimer.o $(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 build/cNoise.o : source/cNoise.cpp
$(CC) $(CC_OPTIONS) source/cNoise.cpp -c $(INCLUDE) -o build/cNoise.o $(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 build/cMakeDir.o : source/cMakeDir.cpp
$(CC) $(CC_OPTIONS) source/cMakeDir.cpp -c $(INCLUDE) -o build/cMakeDir.o $(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 #### ##### END RUN ####

View File

@ -1,12 +1,12 @@
#pragma once #pragma once
#ifdef _WIN32 #ifdef _WIN32
#include <Windows.h>
#include <winsock2.h> #include <WinSock.h>
#define socklen_t int // #define socklen_t int
#ifdef SendMessage // #ifdef SendMessage
#undef SendMessage // #undef SendMessage
#endif // #endif
#else #else
// Linux threads http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html // Linux threads http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html

View File

@ -1,5 +1,6 @@
#include "cBlockingTCPLink.h" #include "cBlockingTCPLink.h"
#include "packets/cPacket.h" #include "packets/cPacket.h"
#include "MCSocket.h"
#include <string> #include <string>
#include "cMCLogger.h" #include "cMCLogger.h"
@ -30,7 +31,7 @@ void cBlockingTCPLink::CloseSocket()
{ {
if( m_Socket ) if( m_Socket )
{ {
closesocket( m_Socket ); m_Socket.CloseSocket();
m_Socket = 0; m_Socket = 0;
} }
} }

View File

@ -22,6 +22,7 @@
#include "cItem.h" #include "cItem.h"
#include "cNoise.h" #include "cNoise.h"
#include "cRoot.h" #include "cRoot.h"
#include "cCriticalSection.h"
#include "cGenSettings.h" #include "cGenSettings.h"
@ -37,6 +38,10 @@
#include <vector> #include <vector>
#include <map> #include <map>
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#endif
extern bool g_bWaterPhysics; extern bool g_bWaterPhysics;
@ -77,8 +82,7 @@ cChunk::~cChunk()
if( m_EntitiesCriticalSection ) if( m_EntitiesCriticalSection )
{ {
DeleteCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection ); delete m_EntitiesCriticalSection;
delete (CRITICAL_SECTION*)m_EntitiesCriticalSection;
m_EntitiesCriticalSection = 0; m_EntitiesCriticalSection = 0;
} }
delete m_pState; delete m_pState;
@ -102,8 +106,7 @@ cChunk::cChunk(int a_X, int a_Y, int a_Z)
, m_EntitiesCriticalSection( 0 ) , m_EntitiesCriticalSection( 0 )
{ {
//LOG("cChunk::cChunk(%i, %i, %i)", a_X, a_Y, a_Z); //LOG("cChunk::cChunk(%i, %i, %i)", a_X, a_Y, a_Z);
m_EntitiesCriticalSection = new CRITICAL_SECTION; m_EntitiesCriticalSection = new cCriticalSection();
InitializeCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection );
} }
void cChunk::Initialize() void cChunk::Initialize()
@ -1064,12 +1067,12 @@ bool cChunk::RemoveEntity( cEntity & a_Entity, cChunk* a_CalledFrom /* = 0 */ )
void cChunk::LockEntities() void cChunk::LockEntities()
{ {
EnterCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection ); m_EntitiesCriticalSection->Lock();
} }
void cChunk::UnlockEntities() void cChunk::UnlockEntities()
{ {
LeaveCriticalSection( (CRITICAL_SECTION*)m_EntitiesCriticalSection ); m_EntitiesCriticalSection->Unlock();
} }
char cChunk::GetBlock( int a_X, int a_Y, int a_Z ) char cChunk::GetBlock( int a_X, int a_Y, int a_Z )

View File

@ -7,6 +7,7 @@ namespace Json
class Value; class Value;
}; };
class cCriticalSection;
class cFurnaceEntity; class cFurnaceEntity;
class cPacket; class cPacket;
class cBlockEntity; class cBlockEntity;
@ -123,5 +124,5 @@ private:
unsigned int m_BlockTickNum; unsigned int m_BlockTickNum;
unsigned int m_BlockTickX, m_BlockTickY, m_BlockTickZ; unsigned int m_BlockTickX, m_BlockTickY, m_BlockTickZ;
void* m_EntitiesCriticalSection; cCriticalSection* m_EntitiesCriticalSection;
}; };

View File

@ -4,9 +4,12 @@
#include "cWorld.h" #include "cWorld.h"
#include "cRoot.h" #include "cRoot.h"
#include "cMakeDir.h" #include "cMakeDir.h"
#ifndef _WIN32 #ifndef _WIN32
#include <cstring> // memcpy #include <cstring> // memcpy
#include <cstdlib> // abs #include <cstdlib> // abs
#include <math.h> // floorf
#include <stdio.h> // sprintf and stuff
#endif #endif
#include "zlib.h" #include "zlib.h"

View File

@ -4,6 +4,8 @@
#include <errno.h> #include <errno.h>
#endif #endif
#include "MCSocket.h"
#include "cClientHandle.h" #include "cClientHandle.h"
#include "cServer.h" #include "cServer.h"
#include "cWorld.h" #include "cWorld.h"
@ -68,6 +70,10 @@
#include "packets/cPacket_Ping.h" #include "packets/cPacket_Ping.h"
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#endif
#define MAX_SEMAPHORES (2000) #define MAX_SEMAPHORES (2000)
typedef std::list<cPacket*> PacketList; typedef std::list<cPacket*> PacketList;
@ -176,7 +182,7 @@ cClientHandle::~cClientHandle()
Disconnect.m_Reason = "Server shut down? Kthnxbai"; Disconnect.m_Reason = "Server shut down? Kthnxbai";
Disconnect.Send( m_pState->Socket ); Disconnect.Send( m_pState->Socket );
closesocket( m_pState->Socket ); m_pState->Socket.CloseSocket();
m_pState->Socket = 0; m_pState->Socket = 0;
} }
m_pState->SocketCriticalSection.Unlock(); m_pState->SocketCriticalSection.Unlock();
@ -218,7 +224,7 @@ void cClientHandle::Destroy()
m_pState->SocketCriticalSection.Lock(); m_pState->SocketCriticalSection.Lock();
if( m_pState->Socket ) if( m_pState->Socket )
{ {
closesocket( m_pState->Socket ); m_pState->Socket.CloseSocket();
m_pState->Socket = 0; m_pState->Socket = 0;
} }
m_pState->SocketCriticalSection.Unlock(); m_pState->SocketCriticalSection.Unlock();

View File

@ -8,6 +8,10 @@
#include "cServer.h" #include "cServer.h"
#include "cSleep.h" #include "cSleep.h"
#ifndef _WIN32
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#endif
cHeartBeat::cHeartBeat() cHeartBeat::cHeartBeat()
{ {
m_State = 0; m_State = 0;

View File

@ -36,6 +36,7 @@
#ifndef _WIN32 // for mkdir #ifndef _WIN32 // for mkdir
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#define sprintf_s(dst, size, format, ...) sprintf(dst, format, __VA_ARGS__ )
#endif #endif
extern std::vector< std::string > StringSplit( std::string str, std::string delim); extern std::vector< std::string > StringSplit( std::string str, std::string delim);

View File

@ -2,6 +2,7 @@
#include "cPawn.h" #include "cPawn.h"
#include <list> #include <list>
#include <string> // TODO - use const char*
class cGroup; class cGroup;
class cWindow; class cWindow;

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <list> #include <list>
#include <string> // TODO - use const char*
struct lua_State; struct lua_State;
class cLuaCommandBinder; class cLuaCommandBinder;

View File

@ -32,6 +32,7 @@
#include <cstring> #include <cstring>
#include <errno.h> #include <errno.h>
#include <semaphore.h> #include <semaphore.h>
#include "MCSocket.h"
#endif #endif
#include <string> #include <string>

View File

@ -1,5 +1,10 @@
#include "cSocket.h" #include "cSocket.h"
#ifndef _WIN32
#include <netdb.h>
#include <unistd.h>
#endif
cSocket::cSocket( xSocket a_Socket ) cSocket::cSocket( xSocket a_Socket )
: m_Socket( a_Socket ) : m_Socket( a_Socket )
{ {
@ -28,3 +33,12 @@ bool cSocket::IsValid()
#endif #endif
} }
void cSocket::CloseSocket()
{
#ifdef _WIN32
closesocket(m_Socket);
#else
shutdown(m_Socket, SHUT_RDWR);//SD_BOTH);
close(m_Socket);
#endif
}

View File

@ -6,7 +6,8 @@
#ifdef SendMessage #ifdef SendMessage
#undef SendMessage #undef SendMessage
#endif #endif
#endif #endif // _WIN32
class cSocket class cSocket
{ {
@ -23,6 +24,7 @@ public:
~cSocket(); ~cSocket();
bool IsValid(); bool IsValid();
void CloseSocket();
operator const xSocket() const; operator const xSocket() const;
xSocket GetSocket() const; xSocket GetSocket() const;

View File

@ -2,6 +2,7 @@
#include "cSocket.h" #include "cSocket.h"
#include "cEvent.h" #include "cEvent.h"
#include "cThread.h" #include "cThread.h"
#include "MCSocket.h"
#include "cMCLogger.h" #include "cMCLogger.h"
@ -37,7 +38,7 @@ void cTCPLink::CloseSocket()
{ {
if( m_Socket ) if( m_Socket )
{ {
closesocket( m_Socket ); m_Socket.CloseSocket();
m_Socket = 0; m_Socket = 0;
} }
} }

View File

@ -4,9 +4,9 @@
#include "cRoot.h" #include "cRoot.h"
#include "cMCLogger.h" #include "cMCLogger.h"
#ifdef _WIN32 //#ifdef _WIN32
#include <exception> #include <exception>
#endif //#endif
int main( int argc, char **argv ) int main( int argc, char **argv )
{ {

View File

@ -13,7 +13,7 @@
//***************************************************************************** //*****************************************************************************
// Blocking receive all function // 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; unsigned int RequestSize = a_Size;
while(a_Size != 0) 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() // 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 ); return send(a_Socket, a_Message, a_Size, a_Options | MSG_NOSIGNAL );
} }

View File

@ -51,6 +51,6 @@ protected:
void AppendData ( char* a_Data, unsigned int a_Size, char* a_Dst, unsigned int & a_Iterator ); void AppendData ( char* a_Data, unsigned int a_Size, char* a_Dst, unsigned int & a_Iterator );
public: public:
static int SendData( SOCKET a_Socket, const char* a_Message, 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( SOCKET a_Socket, char* a_Data, unsigned int a_Size, int a_Options ); static int RecvAll( cSocket & a_Socket, char* a_Data, unsigned int a_Size, int a_Options );
}; };