Added a crude way of disabling redstone. It's necessary though, redstone is completely broken, crashes the server all the time
git-svn-id: http://mc-server.googlecode.com/svn/trunk@312 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
42a3cd60d4
commit
d9c25a161e
@ -16,6 +16,9 @@ ShowPluginNames=1
|
||||
[Physics]
|
||||
Water=0
|
||||
|
||||
[Redstone]
|
||||
SimulateRedstone=1
|
||||
|
||||
[Monsters]
|
||||
AnimalsOn=0
|
||||
AnimalSpawnInterval=10
|
||||
|
@ -12,6 +12,12 @@
|
||||
|
||||
|
||||
|
||||
bool cRedstone::s_UseRedstone = true;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
cRedstone::cRedstone( cWorld* a_World )
|
||||
:m_World ( a_World )
|
||||
,m_Metadata ( 0 )
|
||||
@ -20,92 +26,102 @@ cRedstone::cRedstone( cWorld* a_World )
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cRedstone::ChangeRedstone( int fillx, int filly, int fillz, bool added )
|
||||
{
|
||||
char before;
|
||||
//int tempX;
|
||||
//int tempY;
|
||||
//int tempZ;
|
||||
//int state;
|
||||
//m_Direction
|
||||
// 0 = x+
|
||||
// 1 = x-
|
||||
// 2 = z+
|
||||
// 3 = z-
|
||||
// 4 = y+
|
||||
// 5 = v-
|
||||
if( !s_UseRedstone ) return;
|
||||
|
||||
char before;
|
||||
//int tempX;
|
||||
//int tempY;
|
||||
//int tempZ;
|
||||
//int state;
|
||||
//m_Direction
|
||||
// 0 = x+
|
||||
// 1 = x-
|
||||
// 2 = z+
|
||||
// 3 = z-
|
||||
// 4 = y+
|
||||
// 5 = v-
|
||||
|
||||
|
||||
if (added) {
|
||||
m_Metadata = 15;
|
||||
} else {
|
||||
m_Metadata = 0;
|
||||
}
|
||||
before = m_Metadata;
|
||||
if (added) {
|
||||
m_Metadata = 15;
|
||||
} else {
|
||||
m_Metadata = 0;
|
||||
}
|
||||
before = m_Metadata;
|
||||
|
||||
//printf("etb1\n");
|
||||
CalculatetRedstone( fillx, filly, fillz ); //calculate all item centers.
|
||||
//printf("etb2\n");
|
||||
//printf("etb1\n");
|
||||
CalculateRedstone( fillx, filly, fillz ); //calculate all item centers.
|
||||
//printf("etb2\n");
|
||||
|
||||
int Block = (int)m_World->GetBlock( fillx, filly, fillz );
|
||||
int Block = (int)m_World->GetBlock( fillx, filly, fillz );
|
||||
|
||||
switch (Block)//these blocks won't trigger the normal calculaton because they are affected by the redstone around them. So we check each possible channel around them instead.
|
||||
{
|
||||
case E_BLOCK_REDSTONE_TORCH_ON:
|
||||
case E_BLOCK_REDSTONE_TORCH_OFF:
|
||||
case E_BLOCK_AIR:
|
||||
case E_BLOCK_PISTON_EXTENSION:
|
||||
case E_BLOCK_PISTON:
|
||||
case E_BLOCK_STICKY_PISTON:
|
||||
{
|
||||
m_Metadata = 0;
|
||||
m_Direction = 0;
|
||||
CalculatetRedstone( fillx+1, filly, fillz );
|
||||
m_Metadata = 0;
|
||||
m_Direction = 1;
|
||||
CalculatetRedstone( fillx-1, filly, fillz );
|
||||
m_Metadata = 0;
|
||||
m_Direction = 2;
|
||||
CalculatetRedstone( fillx, filly, fillz+1 );
|
||||
m_Metadata = 0;
|
||||
m_Direction = 3;
|
||||
CalculatetRedstone( fillx, filly, fillz-1 );
|
||||
m_Metadata = 0;
|
||||
CalculatetRedstone( fillx, filly-1, fillz );
|
||||
break;
|
||||
}
|
||||
case E_BLOCK_REDSTONE_WIRE: //special case for redstone wire.
|
||||
{
|
||||
m_Direction = 0;
|
||||
CalculatetRedstone( fillx+1, filly, fillz );
|
||||
m_Direction = 1;
|
||||
CalculatetRedstone( fillx-1, filly, fillz );
|
||||
m_Direction = 2;
|
||||
CalculatetRedstone( fillx, filly, fillz+1 );
|
||||
m_Direction = 3;
|
||||
CalculatetRedstone( fillx, filly, fillz-1 );
|
||||
m_Metadata = 0;
|
||||
CalculatetRedstone( fillx, filly-1, fillz );
|
||||
switch (Block)//these blocks won't trigger the normal calculaton because they are affected by the redstone around them. So we check each possible channel around them instead.
|
||||
{
|
||||
case E_BLOCK_REDSTONE_TORCH_ON:
|
||||
case E_BLOCK_REDSTONE_TORCH_OFF:
|
||||
case E_BLOCK_AIR:
|
||||
case E_BLOCK_PISTON_EXTENSION:
|
||||
case E_BLOCK_PISTON:
|
||||
case E_BLOCK_STICKY_PISTON:
|
||||
{
|
||||
m_Metadata = 0;
|
||||
m_Direction = 0;
|
||||
CalculateRedstone( fillx+1, filly, fillz );
|
||||
m_Metadata = 0;
|
||||
m_Direction = 1;
|
||||
CalculateRedstone( fillx-1, filly, fillz );
|
||||
m_Metadata = 0;
|
||||
m_Direction = 2;
|
||||
CalculateRedstone( fillx, filly, fillz+1 );
|
||||
m_Metadata = 0;
|
||||
m_Direction = 3;
|
||||
CalculateRedstone( fillx, filly, fillz-1 );
|
||||
m_Metadata = 0;
|
||||
CalculateRedstone( fillx, filly-1, fillz );
|
||||
break;
|
||||
}
|
||||
case E_BLOCK_REDSTONE_WIRE: //special case for redstone wire.
|
||||
{
|
||||
m_Direction = 0;
|
||||
CalculateRedstone( fillx+1, filly, fillz );
|
||||
m_Direction = 1;
|
||||
CalculateRedstone( fillx-1, filly, fillz );
|
||||
m_Direction = 2;
|
||||
CalculateRedstone( fillx, filly, fillz+1 );
|
||||
m_Direction = 3;
|
||||
CalculateRedstone( fillx, filly, fillz-1 );
|
||||
m_Metadata = 0;
|
||||
CalculateRedstone( fillx, filly-1, fillz );
|
||||
|
||||
m_Direction = 4;
|
||||
CalculatetRedstone( fillx+1, filly+1, fillz );
|
||||
CalculatetRedstone( fillx-1, filly+1, fillz );
|
||||
CalculatetRedstone( fillx, filly+1, fillz+1 );
|
||||
CalculatetRedstone( fillx, filly+1, fillz-1 );
|
||||
m_Direction = 4;
|
||||
CalculateRedstone( fillx+1, filly+1, fillz );
|
||||
CalculateRedstone( fillx-1, filly+1, fillz );
|
||||
CalculateRedstone( fillx, filly+1, fillz+1 );
|
||||
CalculateRedstone( fillx, filly+1, fillz-1 );
|
||||
|
||||
m_Direction = 5;
|
||||
CalculatetRedstone( fillx+1, filly-1, fillz );
|
||||
CalculatetRedstone( fillx-1, filly-1, fillz );
|
||||
CalculatetRedstone( fillx, filly-1, fillz+1 );
|
||||
CalculatetRedstone( fillx, filly-1, fillz-1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_Direction = 5;
|
||||
CalculateRedstone( fillx+1, filly-1, fillz );
|
||||
CalculateRedstone( fillx-1, filly-1, fillz );
|
||||
CalculateRedstone( fillx, filly-1, fillz+1 );
|
||||
CalculateRedstone( fillx, filly-1, fillz-1 );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//printf("done here\n");
|
||||
}
|
||||
|
||||
void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
|
||||
|
||||
|
||||
|
||||
|
||||
void cRedstone::CalculateRedstone( int fillx, int filly, int fillz)
|
||||
{
|
||||
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_STICKY_PISTON ) || ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_PISTON ) ) {
|
||||
@ -127,29 +143,29 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
|
||||
if ( (int)m_World->GetBlockMeta( fillx, filly, fillz) > 6 ) { //button powered
|
||||
m_Metadata = 15; //change meta to 15 only if redstone power device in on possition is found.
|
||||
if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx-1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx-1,filly,fillz);
|
||||
CalculateRedstone(fillx-1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx+1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx+1,filly,fillz);
|
||||
CalculateRedstone(fillx+1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz-1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz-1);
|
||||
CalculateRedstone(fillx,filly,fillz-1);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz+1);
|
||||
CalculateRedstone(fillx,filly,fillz+1);
|
||||
}
|
||||
} else {
|
||||
if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx-1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx-1,filly,fillz);
|
||||
CalculateRedstone(fillx-1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx+1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx+1,filly,fillz);
|
||||
CalculateRedstone(fillx+1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz-1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz-1);
|
||||
CalculateRedstone(fillx,filly,fillz-1);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz+1);
|
||||
CalculateRedstone(fillx,filly,fillz+1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,31 +174,31 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
|
||||
if ( (int)m_World->GetBlockMeta( fillx, filly, fillz) == 1 ) { //plate powered
|
||||
m_Metadata = 15; //change meta to 15 only if redstone power device in on possition is found.
|
||||
if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx-1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx-1,filly,fillz);
|
||||
CalculateRedstone(fillx-1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx+1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx+1,filly,fillz);
|
||||
CalculateRedstone(fillx+1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz-1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz-1);
|
||||
CalculateRedstone(fillx,filly,fillz-1);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz+1);
|
||||
CalculateRedstone(fillx,filly,fillz+1);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx-1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx-1,filly,fillz);
|
||||
CalculateRedstone(fillx-1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx+1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx+1,filly,fillz);
|
||||
CalculateRedstone(fillx+1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz-1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz-1);
|
||||
CalculateRedstone(fillx,filly,fillz-1);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz+1);
|
||||
CalculateRedstone(fillx,filly,fillz+1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,32 +206,32 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
|
||||
//printf("found torch on\n");
|
||||
m_Metadata = 15; //change meta to 15 only if redstone torch in on possition is found.
|
||||
if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx-1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx-1,filly,fillz);
|
||||
CalculateRedstone(fillx-1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx+1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx+1,filly,fillz);
|
||||
CalculateRedstone(fillx+1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz-1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz-1);
|
||||
CalculateRedstone(fillx,filly,fillz-1);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz+1);
|
||||
CalculateRedstone(fillx,filly,fillz+1);
|
||||
}
|
||||
|
||||
} else if ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_REDSTONE_TORCH_OFF ) { //if the torch is off
|
||||
//printf("found torch off\n");
|
||||
// no need to change meta here.
|
||||
if ( ( (int)m_World->GetBlock( fillx-1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx-1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx-1,filly,fillz);
|
||||
CalculateRedstone(fillx-1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx+1, filly, fillz ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx+1, filly, fillz) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx+1,filly,fillz);
|
||||
CalculateRedstone(fillx+1,filly,fillz);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz-1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz-1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz-1);
|
||||
CalculateRedstone(fillx,filly,fillz-1);
|
||||
}
|
||||
if ( ( (int)m_World->GetBlock( fillx, filly, fillz+1 ) == E_BLOCK_REDSTONE_WIRE) && ( (int)m_World->GetBlockMeta( fillx, filly, fillz+1) != m_Metadata ) ) {
|
||||
CalculatetRedstone(fillx,filly,fillz+1);
|
||||
CalculateRedstone(fillx,filly,fillz+1);
|
||||
}
|
||||
|
||||
} else if ( (int)m_World->GetBlock( fillx, filly, fillz ) == E_BLOCK_REDSTONE_WIRE ) { //simple fill algorithm for redstone wire.
|
||||
@ -223,26 +239,26 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
|
||||
if ( (int)m_World->GetBlockMeta( fillx, filly, fillz) != m_Metadata ) {
|
||||
m_World->FastSetBlock( fillx, filly, fillz, (char)E_BLOCK_REDSTONE_WIRE, m_Metadata );
|
||||
m_Direction = 0;
|
||||
CalculatetRedstone( fillx+1, filly, fillz );
|
||||
CalculateRedstone( fillx+1, filly, fillz );
|
||||
m_Direction = 1;
|
||||
CalculatetRedstone( fillx-1, filly, fillz );
|
||||
CalculateRedstone( fillx-1, filly, fillz );
|
||||
m_Direction = 2;
|
||||
CalculatetRedstone( fillx, filly, fillz+1 );
|
||||
CalculateRedstone( fillx, filly, fillz+1 );
|
||||
m_Direction = 3;
|
||||
CalculatetRedstone( fillx, filly, fillz-1 );
|
||||
CalculatetRedstone( fillx, filly-1, fillz ); //check one block below //similar to same plane
|
||||
CalculateRedstone( fillx, filly, fillz-1 );
|
||||
CalculateRedstone( fillx, filly-1, fillz ); //check one block below //similar to same plane
|
||||
|
||||
m_Direction = 4;
|
||||
CalculatetRedstone( fillx+1, filly+1, fillz );
|
||||
CalculatetRedstone( fillx-1, filly+1, fillz );
|
||||
CalculatetRedstone( fillx, filly+1, fillz+1 );
|
||||
CalculatetRedstone( fillx, filly+1, fillz-1 );
|
||||
CalculateRedstone( fillx+1, filly+1, fillz );
|
||||
CalculateRedstone( fillx-1, filly+1, fillz );
|
||||
CalculateRedstone( fillx, filly+1, fillz+1 );
|
||||
CalculateRedstone( fillx, filly+1, fillz-1 );
|
||||
|
||||
m_Direction = 5;
|
||||
CalculatetRedstone( fillx+1, filly-1, fillz );
|
||||
CalculatetRedstone( fillx-1, filly-1, fillz );
|
||||
CalculatetRedstone( fillx, filly-1, fillz+1 );
|
||||
CalculatetRedstone( fillx, filly-1, fillz-1 );
|
||||
CalculateRedstone( fillx+1, filly-1, fillz );
|
||||
CalculateRedstone( fillx-1, filly-1, fillz );
|
||||
CalculateRedstone( fillx, filly-1, fillz+1 );
|
||||
CalculateRedstone( fillx, filly-1, fillz-1 );
|
||||
}
|
||||
|
||||
} else { //default, check item for torch attached to it. If meta > 0 then turn that torch off, otherwise turn it on. This change needs to be passed to the next world tick.
|
||||
@ -337,6 +353,9 @@ void cRedstone::CalculatetRedstone( int fillx, int filly, int fillz)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cRedstone::IsBlockPowered( int fillx, int filly, int fillz )
|
||||
{
|
||||
|
||||
|
@ -5,30 +5,31 @@ class cRedstone
|
||||
{
|
||||
public:
|
||||
|
||||
cRedstone( cWorld* a_World );
|
||||
cRedstone( cWorld* a_World );
|
||||
|
||||
static char RepeaterRotationToMetaData( float a_Rotation )
|
||||
{
|
||||
a_Rotation += 90 + 45; // So its not aligned with axis
|
||||
if( a_Rotation > 360.f ) a_Rotation -= 360.f;
|
||||
if( a_Rotation >= 0.f && a_Rotation < 90.f )
|
||||
return 0x1;
|
||||
else if( a_Rotation >= 180 && a_Rotation < 270 )
|
||||
return 0x3;
|
||||
else if( a_Rotation >= 90 && a_Rotation < 180 )
|
||||
return 0x2;
|
||||
else
|
||||
return 0x0;
|
||||
}
|
||||
static char RepeaterRotationToMetaData( float a_Rotation )
|
||||
{
|
||||
a_Rotation += 90 + 45; // So its not aligned with axis
|
||||
if( a_Rotation > 360.f ) a_Rotation -= 360.f;
|
||||
if( a_Rotation >= 0.f && a_Rotation < 90.f )
|
||||
return 0x1;
|
||||
else if( a_Rotation >= 180 && a_Rotation < 270 )
|
||||
return 0x3;
|
||||
else if( a_Rotation >= 90 && a_Rotation < 180 )
|
||||
return 0x2;
|
||||
else
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
|
||||
void CalculatetRedstone( int, int, int );
|
||||
void ChangeRedstone( int, int, int, bool );
|
||||
bool IsBlockPowered( int, int, int );
|
||||
void CalculateRedstone( int, int, int );
|
||||
void ChangeRedstone( int, int, int, bool );
|
||||
bool IsBlockPowered( int, int, int );
|
||||
|
||||
cWorld* m_World;
|
||||
cWorld* m_World;
|
||||
|
||||
char m_Metadata;
|
||||
char m_Direction;
|
||||
char m_Metadata;
|
||||
char m_Direction;
|
||||
|
||||
static bool s_UseRedstone;
|
||||
};
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "cSleep.h"
|
||||
#include "cThread.h"
|
||||
#include "cFileFormatUpdater.h"
|
||||
#include "cGenSettings.h"
|
||||
#include "cRedstone.h"
|
||||
|
||||
#include "../iniFile/iniFile.h"
|
||||
|
||||
@ -92,6 +94,8 @@ void cRoot::Start()
|
||||
{
|
||||
m_bRestart = false;
|
||||
|
||||
LoadGlobalSettings();
|
||||
|
||||
cFileFormatUpdater::UpdateFileFormat();
|
||||
|
||||
LOG("Creating new server instance...");
|
||||
@ -182,6 +186,44 @@ void cRoot::Start()
|
||||
|
||||
|
||||
|
||||
void cRoot::LoadGlobalSettings()
|
||||
{
|
||||
cIniFile IniFile("settings.ini");
|
||||
if( IniFile.ReadFile() )
|
||||
{
|
||||
cRedstone::s_UseRedstone = IniFile.GetValueB("Redstone", "SimulateRedstone", true );
|
||||
}
|
||||
|
||||
|
||||
// I think this should be removed? I can't believe anybody is using it anyway
|
||||
cIniFile GenSettings("terrain.ini");
|
||||
if( GenSettings.ReadFile() )
|
||||
{
|
||||
#define READ_INI_TERRAIN_VAL( var, type ) cGenSettings::var = (type)GenSettings.GetValueF("Terrain", #var, cGenSettings::var )
|
||||
READ_INI_TERRAIN_VAL( HeightFreq1, float );
|
||||
READ_INI_TERRAIN_VAL( HeightFreq2, float );
|
||||
READ_INI_TERRAIN_VAL( HeightFreq3, float );
|
||||
READ_INI_TERRAIN_VAL( HeightAmp1, float );
|
||||
READ_INI_TERRAIN_VAL( HeightAmp2, float );
|
||||
READ_INI_TERRAIN_VAL( HeightAmp3, float );
|
||||
}
|
||||
else
|
||||
{
|
||||
#define SET_INI_TERRAIN_VAL( var ) GenSettings.SetValueF("Terrain", #var, cGenSettings::var )
|
||||
SET_INI_TERRAIN_VAL( HeightFreq1 );
|
||||
SET_INI_TERRAIN_VAL( HeightFreq2 );
|
||||
SET_INI_TERRAIN_VAL( HeightFreq3 );
|
||||
SET_INI_TERRAIN_VAL( HeightAmp1 );
|
||||
SET_INI_TERRAIN_VAL( HeightAmp2 );
|
||||
SET_INI_TERRAIN_VAL( HeightAmp3 );
|
||||
GenSettings.WriteFile();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cRoot::LoadWorlds()
|
||||
{
|
||||
cIniFile IniFile("settings.ini"); IniFile.ReadFile();
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
int GetTotalChunkCount(void); // tolua_export
|
||||
|
||||
private:
|
||||
void LoadGlobalSettings();
|
||||
|
||||
void LoadWorlds();
|
||||
void UnloadWorlds();
|
||||
|
@ -223,28 +223,6 @@ cWorld::cWorld( const AString & a_WorldName )
|
||||
|
||||
m_Storage.Start(this, StorageSchema);
|
||||
m_Generator.Start(this, GeneratorName);
|
||||
cIniFile GenSettings("terrain.ini");
|
||||
if( GenSettings.ReadFile() )
|
||||
{
|
||||
#define READ_INI_TERRAIN_VAL( var, type ) cGenSettings::var = (type)GenSettings.GetValueF("Terrain", #var, cGenSettings::var )
|
||||
READ_INI_TERRAIN_VAL( HeightFreq1, float );
|
||||
READ_INI_TERRAIN_VAL( HeightFreq2, float );
|
||||
READ_INI_TERRAIN_VAL( HeightFreq3, float );
|
||||
READ_INI_TERRAIN_VAL( HeightAmp1, float );
|
||||
READ_INI_TERRAIN_VAL( HeightAmp2, float );
|
||||
READ_INI_TERRAIN_VAL( HeightAmp3, float );
|
||||
}
|
||||
else
|
||||
{
|
||||
#define SET_INI_TERRAIN_VAL( var ) GenSettings.SetValueF("Terrain", #var, cGenSettings::var )
|
||||
SET_INI_TERRAIN_VAL( HeightFreq1 );
|
||||
SET_INI_TERRAIN_VAL( HeightFreq2 );
|
||||
SET_INI_TERRAIN_VAL( HeightFreq3 );
|
||||
SET_INI_TERRAIN_VAL( HeightAmp1 );
|
||||
SET_INI_TERRAIN_VAL( HeightAmp2 );
|
||||
SET_INI_TERRAIN_VAL( HeightAmp3 );
|
||||
GenSettings.WriteFile();
|
||||
}
|
||||
|
||||
m_bAnimals = true;
|
||||
m_SpawnMonsterRate = 10;
|
||||
|
Loading…
Reference in New Issue
Block a user