From 66f4c9e0c08762fb4668792999c6200e9fd78c89 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 27 Aug 2012 17:31:16 +0000 Subject: Cut out all packet handling to a separate cProtocol descendant git-svn-id: http://mc-server.googlecode.com/svn/trunk@796 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunk.cpp | 109 ------------------------------------------------------ 1 file changed, 109 deletions(-) (limited to 'source/cChunk.cpp') diff --git a/source/cChunk.cpp b/source/cChunk.cpp index aec75cd41..351f456af 100644 --- a/source/cChunk.cpp +++ b/source/cChunk.cpp @@ -1619,115 +1619,6 @@ void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_ -/* -// _X 2012_02_23: Loading in old format not supported anymore -/// Loads the chunk from the old-format disk file, erases the file afterwards. Returns true if successful -bool cChunk::LoadFromDisk() -{ - AString SourceFile; - Printf(SourceFile, "world/X%i_Y%i_Z%i.bin", m_PosX, m_PosY, m_PosZ ); - - cFile f; - if (!f.Open(SourceFile, cFile::fmRead)) - { - return false; - } - - if (f.Read(m_BlockData, sizeof(m_BlockData)) != sizeof(m_BlockData)) - { - LOGERROR("ERROR READING FROM FILE %s", SourceFile.c_str()); - return false; - } - - // Now load Block Entities: - ENUM_BLOCK_ID BlockType; - while (f.Read(&BlockType, sizeof(ENUM_BLOCK_ID)) == sizeof(ENUM_BLOCK_ID)) - { - switch (BlockType) - { - case E_BLOCK_CHEST: - { - cChestEntity * ChestEntity = new cChestEntity( 0, 0, 0, m_World ); - if (!ChestEntity->LoadFromFile(f)) - { - LOGERROR("ERROR READING CHEST FROM FILE %s", SourceFile.c_str()); - delete ChestEntity; - return false; - } - m_BlockEntities.push_back( ChestEntity ); - break; - } - - case E_BLOCK_FURNACE: - { - cFurnaceEntity* FurnaceEntity = new cFurnaceEntity( 0, 0, 0, m_World ); - if (!FurnaceEntity->LoadFromFile(f)) - { - LOGERROR("ERROR READING FURNACE FROM FILE %s", SourceFile.c_str()); - delete FurnaceEntity; - return false; - } - m_BlockEntities.push_back( FurnaceEntity ); - break; - } - - case E_BLOCK_SIGN_POST: - case E_BLOCK_WALLSIGN: - { - cSignEntity * SignEntity = new cSignEntity(BlockType, 0, 0, 0, m_World ); - if (!SignEntity->LoadFromFile( f ) ) - { - LOGERROR("ERROR READING SIGN FROM FILE %s", SourceFile.c_str()); - delete SignEntity; - return false; - } - m_BlockEntities.push_back( SignEntity ); - break; - } - - default: - { - ASSERT(!"Unhandled block entity in file"); - break; - } - } - } - f.Close(); - - // Delete old format file - if (std::remove(SourceFile.c_str()) != 0) - { - LOGERROR("Could not delete file %s", SourceFile.c_str()); - } - else - { - LOGINFO("Successfully deleted old format file \"%s\"", SourceFile.c_str()); - } - m_IsDirty = false; - return true; -} -*/ - - - - - -void cChunk::Broadcast( const cPacket * a_Packet, cClientHandle* a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->Send(*a_Packet); - } // for itr - LoadedByClient[] -} - - - - - void cChunk::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) { for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) -- cgit v1.2.3