1
0
Commit Graph

111 Commits

Author SHA1 Message Date
madmaxoft@gmail.com
0b24efeb00 Split chunk data into separate arrays; decoupled most sources from cChunk.h dependency
git-svn-id: http://mc-server.googlecode.com/svn/trunk@411 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-14 20:56:09 +00:00
madmaxoft@gmail.com
af44154ff5 Not sending chunks to the client twice
git-svn-id: http://mc-server.googlecode.com/svn/trunk@399 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-11 10:48:20 +00:00
madmaxoft@gmail.com
219be8186c Fixed a few obsoleted functions
git-svn-id: http://mc-server.googlecode.com/svn/trunk@397 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-10 22:27:24 +00:00
madmaxoft@gmail.com
e7731242c1 Using references instead of pointers for sending packets
git-svn-id: http://mc-server.googlecode.com/svn/trunk@394 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-10 21:34:47 +00:00
faketruth
f43b65cf53 cClientHandles have a unique ID now to distinguish them
cAuthenticator uses unique client ID for authentication
Changed the kick function used by cAuthenticator to take a client ID instead of name, so the correct user is kicked
Using callback reference instead of pointer in GetChunkData and affiliates
GetChunkData returns false when failed, and true when succeeded
Renamed entity type enums to something prettier
Exposed some functions to Lua

git-svn-id: http://mc-server.googlecode.com/svn/trunk@388 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-09 13:42:28 +00:00
faketruth
787382caf8 Fixed bug where cPlayer's cClientHandle was used after cPlayer was destroyed http://forum.mc-server.org/showthread.php?tid=380
Also removed the SetClientHandle() function from cPlayer
Added a Destroyed() function to cEntity that is called ONLY ONCE after an entity has been 'destroyed'
Cleaned up some code, using enums for GameMode and Weather and replaced some 'const char *' with 'const AString &'
Exposed some more functions to Lua

git-svn-id: http://mc-server.googlecode.com/svn/trunk@382 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-07 13:36:30 +00:00
madmaxoft@gmail.com
8cdd63f06c Fixed rev368's ChunkSender, now sends properly even chunks that are loaded. Fixed a deadlock in cClientHandle vs TickThread over cClientHandle::m_CSChunkLists
git-svn-id: http://mc-server.googlecode.com/svn/trunk@371 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-06 14:52:44 +00:00
madmaxoft@gmail.com
4d65ffffc0 ChunkSender: Chunks are now compressed and sent to clients from a separate threads, proper passive waiting between threads. Not much tested, just appears to work :)
git-svn-id: http://mc-server.googlecode.com/svn/trunk@365 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-05 16:41:57 +00:00
faketruth
fb7c60ec11 Changed signed char to unsigned char in block packets, so we can receive height up to 255
Blocks placed above 128 limit don't become obsidian anymore. This was due to the cChunk::MakeIndex() function return 0 when outside of bounds, it now returns an 'error constant'

git-svn-id: http://mc-server.googlecode.com/svn/trunk@356 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-04 13:54:33 +00:00
faketruth
ad89cf88ba Got rid of some hardcoded numbers, now using hardcoded variables! woo
git-svn-id: http://mc-server.googlecode.com/svn/trunk@355 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-03 20:55:16 +00:00
faketruth
f7b29dc727 That should not have been committed...
git-svn-id: http://mc-server.googlecode.com/svn/trunk@354 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-02 14:09:52 +00:00
faketruth
957ef3b297 Started carefully moving to 1.2.2
Clients can get up to the login packet, after which the server tries to send chunks but in the wrong format and the client disconnects

git-svn-id: http://mc-server.googlecode.com/svn/trunk@347 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-03-01 17:07:41 +00:00
madmaxoft@gmail.com
93d73ac520 Fixed the authenticator bug
git-svn-id: http://mc-server.googlecode.com/svn/trunk@344 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-29 20:25:11 +00:00
faketruth
bba824a1c6 Making sure cClientHandle::m_Player was NULL after authentication completed
git-svn-id: http://mc-server.googlecode.com/svn/trunk@343 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-29 13:40:40 +00:00
madmaxoft@gmail.com
a4503ddb77 Setting the m_bDestroyed flag only after the cClienthandle is truly destroyed; cClientHandle's destructor now locks loaded chunk lists
git-svn-id: http://mc-server.googlecode.com/svn/trunk@340 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-28 14:58:07 +00:00
madmaxoft@gmail.com
7268a70902 Attempt at fixing crashes with disconnecting players
git-svn-id: http://mc-server.googlecode.com/svn/trunk@329 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-26 12:55:42 +00:00
madmaxoft@gmail.com
0e33c919dd Using cSocketThreads for client outgoing packets. Unfortunately had to put in one intermediate thread (cServer::cNotifyWriteThread) to avoid deadlocks. Still, seems we have a proper multithreading for clients and no more per-client threads, yay :)
git-svn-id: http://mc-server.googlecode.com/svn/trunk@328 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-26 00:36:51 +00:00
madmaxoft@gmail.com
a14e015354 Extended SocketThreads for writing support (unusable in cClientHandle due to too many deadlock possibilities)
Extended the range of ignored packets in pre-game client states (fixes connection issues with some mods installed)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@327 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-25 23:48:28 +00:00
madmaxoft@gmail.com
bf19f7ae9c Made the viewdistance settable by users and default in settings.ini. The default is 9.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@326 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-23 22:51:03 +00:00
faketruth
6015b59f13 Fixed a bug that no chunks were unloaded on the client. Now chunks are properly unloaded on the clients.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@318 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-22 19:31:30 +00:00
madmaxoft@gmail.com
b653e6a012 Removed cChunkPtrs from everywhere but internal cChunkMap usage. Now we should finally be threadsafe :)
Also fixed a threading issue when a player connecting might have gotten stuck in "Downloading world" forever

git-svn-id: http://mc-server.googlecode.com/svn/trunk@304 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-21 16:27:30 +00:00
madmaxoft@gmail.com
f0145ee9fa Fixed heightmap optimization from rev 302; removed a few more cChunkPtrs
git-svn-id: http://mc-server.googlecode.com/svn/trunk@303 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-21 15:18:02 +00:00
madmaxoft@gmail.com
d592882fe0 Removed some more cChunkPtr usage
git-svn-id: http://mc-server.googlecode.com/svn/trunk@298 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-20 16:39:00 +00:00
faketruth
0b616909e3 Using own ASSERT() that logs to file
git-svn-id: http://mc-server.googlecode.com/svn/trunk@297 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-19 23:00:00 +00:00
madmaxoft@gmail.com
510133bd35 Chunk coords mostly "upgraded" to include the Y coord for future compatibility
git-svn-id: http://mc-server.googlecode.com/svn/trunk@285 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-17 17:56:25 +00:00
faketruth
008addf5d7 Got rid of dangerous GetEntity(), not using DoWithEntity()
git-svn-id: http://mc-server.googlecode.com/svn/trunk@278 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-16 17:20:28 +00:00
madmaxoft@gmail.com
1aebcea095 Restored chest and furnace functionality as it was (it's basically working but joined chests show single-chest window)
git-svn-id: http://mc-server.googlecode.com/svn/trunk@263 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-15 14:22:44 +00:00
madmaxoft@gmail.com
4f17362aeb Rewritten most of the code for multithreading; still not 100%, but getting there. If this commit proves to be too problematic, we can always undo it.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@251 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-13 21:47:03 +00:00
madmaxoft@gmail.com
32880153ab MTRand class is not created in each tick, therefore much improving tick-thread time (now uses ~5 % CPU instead of one full core)
git-svn-id: http://mc-server.googlecode.com/svn/trunk@245 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-08 12:36:54 +00:00
madmaxoft@gmail.com
c82c636d8c cSocketThreads plugged in for cClientHandle reading. Sending still kept the old way. Please help me test this commit thoroughly, this is a change that can break on subtleties.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@244 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-08 10:02:46 +00:00
madmaxoft@gmail.com
b7d524423c Rewritten all packets to use buffers instead of direct sockets, for future cSocketThreads compatibility.
Moved data sending from cPacket into cSocket

git-svn-id: http://mc-server.googlecode.com/svn/trunk@240 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-07 20:49:52 +00:00
faketruth
ab95abb6bd Now showing proper error messages when sockets fail :)
Crossplatform GetLastError function in cSocket

git-svn-id: http://mc-server.googlecode.com/svn/trunk@234 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-05 16:24:16 +00:00
madmaxoft@gmail.com
b8be8a4df0 cClientHandle: split packet handling into separate functions for clarity
git-svn-id: http://mc-server.googlecode.com/svn/trunk@229 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-03 14:33:40 +00:00
madmaxoft@gmail.com
f86d796295 cClientHandle: gotten rid of the obnoxious m_pState, now using direct members instead
git-svn-id: http://mc-server.googlecode.com/svn/trunk@228 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-02 21:13:24 +00:00
madmaxoft@gmail.com
48d30d6ab4 Rewritten cAuthenticator to make use of the new cIsThread architecture - now authentication runs in a single separate thread for all clients;
Global player-kicking function (cServer, cRoot);
More char * -> AString conversion

git-svn-id: http://mc-server.googlecode.com/svn/trunk@221 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-01 22:38:03 +00:00
madmaxoft@gmail.com
2568bad3cc sprintf() begone! Replaced with StringUtils' Printf()
git-svn-id: http://mc-server.googlecode.com/svn/trunk@216 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-02-01 13:43:47 +00:00
madmaxoft@gmail.com
59e740035e Slight code cleanup, no big changes
git-svn-id: http://mc-server.googlecode.com/svn/trunk@202 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-31 18:06:24 +00:00
madmaxoft@gmail.com
89afb970d8 VC2008 / VC2010: Enabled precompiled header through Globals.h; the header included in every module in the project. Compilation optimization.
git-svn-id: http://mc-server.googlecode.com/svn/trunk@188 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-29 19:28:19 +00:00
faketruth
ce11c6b2bd Cactus towers can be destroyed by removing the bottom block
Added checks whether flowers/mushrooms/saplings can be placed on surface
Added checks for cactus to see if it's allowed to be placed
Fluids now wash away certain items (flower, sapling, cactus)


git-svn-id: http://mc-server.googlecode.com/svn/trunk@169 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-23 15:11:45 +00:00
faketruth
7b840aa5d8 MCServer is now compatible with Minecraft client 1.1 (as long as the client is not using any mods/plugins I think)
git-svn-id: http://mc-server.googlecode.com/svn/trunk@165 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-20 17:39:16 +00:00
faketruth
50a7722242 Terrain generation is synchronous again, async generation has bugs.
Made some funky smart pointer things for chunks.
Fixed a bug where the client would override the player position on the server and back again, resulting in sending too many chunks to the client which it doesn't even need.
Fixed some compiler warnings in cPickup.cpp


git-svn-id: http://mc-server.googlecode.com/svn/trunk@164 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-19 18:12:39 +00:00
faketruth
f47c852186 Fixed crashing bug in cClientHandle::~cClientHandle
When there are players in the server, and a client connects as far as the handshake and then disconnects, the server crashed.
This is because there is no m_Player yet after the handshake, and the destructor uses m_Player without checking if it exists

git-svn-id: http://mc-server.googlecode.com/svn/trunk@163 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-02 19:03:19 +00:00
faketruth
01398f8424 Fixed the numchunks console command.
Added some form of reference counting to cChunk to make sure it's not referenced when deleting it.
Right now it's only needed due to the generation of chunks in a separate thread and adding it to the spread light list in cWorld

git-svn-id: http://mc-server.googlecode.com/svn/trunk@161 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-01 16:20:52 +00:00
lapayo94@gmail.com
d7068b35a8 - implemented separated inventory for creative mode (cSurvivalInventory and cCreativeInventory)
(Separation is not perfect yet, because maybe there are some mayor changes needed :D)
- implemented CreativeInventoryAction (was mistakenly called CreateInventoryAction)
-> Fixed meta data for creative selected blocks
->->Slabs/Steps are now placed correctly
- slabs can now be build to a double slab
- fixed a bug in the inventory which put items with different meta values in the same slot

git-svn-id: http://mc-server.googlecode.com/svn/trunk@160 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-01 04:55:17 +00:00
faketruth
4f176ee685 Chests, furnaces and dispensers face the correct way now.
http://mc-server.org/support/index.php?do=details&task_id=88

git-svn-id: http://mc-server.googlecode.com/svn/trunk@159 0a769ca7-a7f5-676a-18bf-c427514a06d6
2012-01-01 02:48:26 +00:00
faketruth
9af5ed43fd Made a couple of functions in cChunk inline, this should speed up several block operations on chunks
Players should not spawn in the ground anymore.
When an entity was added to cWorld twice (which shouldn't happen actually), the server would crash when the entity is destroyed, this should be fixed now.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@158 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-12-31 21:08:23 +00:00
mtilden@gmail.com
d7adbba59d - Initial food handling by cedeel
git-svn-id: http://mc-server.googlecode.com/svn/trunk@156 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-12-29 15:31:48 +00:00
mtilden@gmail.com
c4f4ae5c71 - Chests open and close on clients when opened/closed
- Beginnings of "Double Chest". All that's needed is detection when 2 chests get put next to each other, block other chests from then touching them on any side, load/save with the m_JoinedChest seeing each other and adding and making sure the left side is always the top rows.

I'm not sure exactly at this moment how to do all of the detection and saving/loading of the double chest stuff so if you've any ideas feel free to point out some areas in the server code or implement it yourself.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@154 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-12-29 13:16:23 +00:00
lapayo94@gmail.com
2ca40c819e - Pickups should now burn in fire
- The player no longer gets an empty bucket when in creative mode
- improved the simulators again (moved to std::list because this should be faster with so many objects) (But the water simulation still is very slow)

git-svn-id: http://mc-server.googlecode.com/svn/trunk@153 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-12-29 02:44:21 +00:00
lapayo94@gmail.com
c6b4ee8c9f - implemented the fire simulation in native c++ (cFireSimulator)
- Changed the Durationsystem for Items. cPlayer::UseEquippedItem calls cItem::DamageItem this function damages the item if it has a duration. (needed the duration also in another place so this saves code ;))
- added some other burning blocks
- the mobtypes for the settings.ini which i must have forgotten in the last commit

git-svn-id: http://mc-server.googlecode.com/svn/trunk@150 0a769ca7-a7f5-676a-18bf-c427514a06d6
2011-12-28 21:00:35 +00:00