Chunks are now generated before the player is able to see them. This is done because after a chunks is done generating, some blocks might still need to be set (parts of trees from neighboring chunk), causing more bandwidth to be used (each changed block needs to be sent to clients again) and (fps) lagging the clients when changing a lot of blocks. Calculating ahead fixes these issues. Separated the placing of foliage (trees and stuff) when generated chunks into a new function GenerateFoliage() Cleaned up the VS2010 project, now using some VS2010 specific functions like dependencies on projects (no need for setting library dependencies manually). VS2010 project now compiles way faster in Release by using multi threading. git-svn-id: http://mc-server.googlecode.com/svn/trunk@103 0a769ca7-a7f5-676a-18bf-c427514a06d6
57 lines
1.4 KiB
C++
57 lines
1.4 KiB
C++
#include "cBlockToPickup.h"
|
|
#include "BlockID.h"
|
|
#include "stdlib.h"
|
|
|
|
ENUM_ITEM_ID cBlockToPickup::ToPickup( unsigned char a_BlockID, ENUM_ITEM_ID a_UsedItemID )
|
|
{
|
|
(void)a_UsedItemID;
|
|
|
|
switch( a_BlockID )
|
|
{
|
|
case E_BLOCK_AIR:
|
|
return E_ITEM_EMPTY;
|
|
case E_BLOCK_STONE:
|
|
return E_ITEM_COBBLESTONE;
|
|
case E_BLOCK_GRASS:
|
|
return E_ITEM_DIRT;
|
|
case E_BLOCK_GLASS:
|
|
return E_ITEM_EMPTY;
|
|
case E_BLOCK_DIRT:
|
|
return E_ITEM_DIRT;
|
|
case E_BLOCK_LOG:
|
|
return E_ITEM_LOG;
|
|
case E_BLOCK_LEAVES:
|
|
if( a_UsedItemID == E_ITEM_SHEARS )
|
|
return E_ITEM_LEAVES;
|
|
else
|
|
if(rand() % 5 == 0) return E_ITEM_SAPLING;
|
|
return E_ITEM_EMPTY;
|
|
case E_BLOCK_COAL_ORE:
|
|
return E_ITEM_COAL;
|
|
case E_BLOCK_LAPIS_ORE:
|
|
return E_ITEM_DYE;
|
|
case E_BLOCK_REDSTONE_ORE_GLOWING:
|
|
case E_BLOCK_REDSTONE_ORE:
|
|
return E_ITEM_REDSTONE_DUST;
|
|
case E_BLOCK_DIAMOND_ORE:
|
|
return E_ITEM_DIAMOND;
|
|
case E_BLOCK_IRON_BLOCK:
|
|
return E_ITEM_IRON_BLOCK;
|
|
case E_BLOCK_DIAMOND_BLOCK:
|
|
return E_ITEM_DIAMOND_BLOCK;
|
|
case E_BLOCK_GOLD_BLOCK:
|
|
return E_ITEM_GOLD_BLOCK;
|
|
case E_BLOCK_SIGN_POST:
|
|
case E_BLOCK_WALLSIGN:
|
|
return E_ITEM_SIGN;
|
|
case E_BLOCK_REDSTONE_WIRE:
|
|
return E_ITEM_REDSTONE_DUST;
|
|
case E_BLOCK_REDSTONE_TORCH_OFF:
|
|
return E_ITEM_REDSTONE_TORCH_ON;
|
|
case E_BLOCK_MELON:
|
|
return E_ITEM_MELON_SLICE;
|
|
default:
|
|
return (ENUM_ITEM_ID)a_BlockID;
|
|
}
|
|
}
|