From 303b1a9c45cb74a656c9a099d669c89b92e74098 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 14 Aug 2013 11:44:02 +0100 Subject: Buncha bugfixes [SEE DESC] Fixed generation values not being written Fixed piston being able to push water Fixed ice creating a non-source block (still doesn't update though) Removed problematic piston code --- source/BlockID.cpp | 8 ++++---- source/Blocks/BlockFluid.h | 6 ++++++ source/Blocks/BlockIce.h | 2 +- source/Generating/ComposableGenerator.cpp | 6 +++--- source/Piston.cpp | 8 ++++++++ source/World.cpp | 2 +- 6 files changed, 23 insertions(+), 9 deletions(-) diff --git a/source/BlockID.cpp b/source/BlockID.cpp index ad96cfa72..35668d0b4 100644 --- a/source/BlockID.cpp +++ b/source/BlockID.cpp @@ -655,7 +655,6 @@ public: g_BlockPistonBreakable[E_BLOCK_IRON_DOOR] = true; g_BlockPistonBreakable[E_BLOCK_JACK_O_LANTERN] = true; g_BlockPistonBreakable[E_BLOCK_LADDER] = true; - g_BlockPistonBreakable[E_BLOCK_LAVA] = false; g_BlockPistonBreakable[E_BLOCK_LEVER] = true; g_BlockPistonBreakable[E_BLOCK_MELON] = true; g_BlockPistonBreakable[E_BLOCK_MELON_STEM] = true; @@ -668,14 +667,15 @@ public: g_BlockPistonBreakable[E_BLOCK_RED_ROSE] = true; g_BlockPistonBreakable[E_BLOCK_REEDS] = true; g_BlockPistonBreakable[E_BLOCK_SNOW] = true; - g_BlockPistonBreakable[E_BLOCK_STATIONARY_LAVA] = false; - g_BlockPistonBreakable[E_BLOCK_STATIONARY_WATER] = false; //This gave pistons the ability to drop water :D + g_BlockPistonBreakable[E_BLOCK_STATIONARY_LAVA] = true; + g_BlockPistonBreakable[E_BLOCK_STATIONARY_WATER] = true; + g_BlockPistonBreakable[E_BLOCK_LAVA] = true; + g_BlockPistonBreakable[E_BLOCK_WATER] = true; g_BlockPistonBreakable[E_BLOCK_STONE_BUTTON] = true; g_BlockPistonBreakable[E_BLOCK_STONE_PRESSURE_PLATE] = true; g_BlockPistonBreakable[E_BLOCK_TALL_GRASS] = true; g_BlockPistonBreakable[E_BLOCK_TORCH] = true; g_BlockPistonBreakable[E_BLOCK_VINES] = true; - g_BlockPistonBreakable[E_BLOCK_WATER] = false; g_BlockPistonBreakable[E_BLOCK_WOODEN_DOOR] = true; g_BlockPistonBreakable[E_BLOCK_WOODEN_PRESSURE_PLATE] = true; g_BlockPistonBreakable[E_BLOCK_YELLOW_FLOWER] = true; diff --git a/source/Blocks/BlockFluid.h b/source/Blocks/BlockFluid.h index 696bfb3ce..0db2f60c4 100644 --- a/source/Blocks/BlockFluid.h +++ b/source/Blocks/BlockFluid.h @@ -17,6 +17,12 @@ public: : cBlockHandler(a_BlockType) { + } + + + virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override + { + // No pickups } diff --git a/source/Blocks/BlockIce.h b/source/Blocks/BlockIce.h index 11fe425f3..af4961114 100644 --- a/source/Blocks/BlockIce.h +++ b/source/Blocks/BlockIce.h @@ -27,7 +27,7 @@ public: virtual void OnDestroyed(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override { // TODO: Ice destroyed with air below it should turn into air instead of water - a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_STATIONARY_WATER, 8); + a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_WATER, 0); // This is called later than the real destroying of this ice block } } ; diff --git a/source/Generating/ComposableGenerator.cpp b/source/Generating/ComposableGenerator.cpp index 8763e2809..94f822420 100644 --- a/source/Generating/ComposableGenerator.cpp +++ b/source/Generating/ComposableGenerator.cpp @@ -147,7 +147,7 @@ void cComposableGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile) { - AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", ""); + AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", "MultiStepMap"); if (BiomeGenName.empty()) { LOGWARN("[Generator]::BiomeGen value not found in world.ini, using \"MultiStepMap\"."); @@ -220,7 +220,7 @@ void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile) void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) { - AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", ""); + AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", "Biomal"); if (HeightGenName.empty()) { LOGWARN("[Generator]::HeightGen value not found in world.ini, using \"Biomal\"."); @@ -306,7 +306,7 @@ void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile) { - AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", ""); + AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", "Biomal"); if (CompoGenName.empty()) { LOGWARN("[Generator]::CompositionGen value not found in world.ini, using \"Biomal\"."); diff --git a/source/Piston.cpp b/source/Piston.cpp index 161f2b38c..d75cd4989 100644 --- a/source/Piston.cpp +++ b/source/Piston.cpp @@ -12,11 +12,13 @@ #include "Server.h" #include "Blocks/BlockHandler.h" +/* #ifdef _WIN32 #include #else #include #endif +*/ //Athar from http://www.cplusplus.com/forum/unices/60161/ helped with the sleep code. @@ -128,11 +130,13 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz ) AddDir(extx, exty, extz, pistonMeta & 7, 1) + /* #ifdef _WIN32 Sleep(100); #else usleep(static_cast(100)*1000); #endif + */ m_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, isSticky + pistonMeta & 7); } @@ -178,22 +182,26 @@ void cPiston::RetractPiston( int pistx, int pisty, int pistz ) // These cannot be moved by the sticky piston, bail out return; } + /* #ifdef _WIN32 Sleep(100); #else usleep(static_cast(100)*1000); #endif + */ m_World->SetBlock(pistx, pisty, pistz, tempblock, tempmeta); m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0); } else { + /* #ifdef _WIN32 Sleep(100); #else usleep(static_cast(100)*1000); #endif + */ m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0); } diff --git a/source/World.cpp b/source/World.cpp index 3955b6136..77bfc0e2f 100644 --- a/source/World.cpp +++ b/source/World.cpp @@ -2476,7 +2476,7 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c Printf(SimulatorNameKey, "%sSimulator", a_FluidName); AString SimulatorSectionName; Printf(SimulatorSectionName, "%sSimulator", a_FluidName); - AString SimulatorName = a_IniFile.GetValueSet("Physics", SimulatorNameKey, ""); + AString SimulatorName = a_IniFile.GetValueSet("Physics", SimulatorNameKey, "Floody"); if (SimulatorName.empty()) { LOGWARNING("%s [Physics]:%s not present or empty, using the default of \"Floody\".", GetIniFileName().c_str(), SimulatorNameKey.c_str()); -- cgit v1.2.3 From 4ae1750da200c25ddc95eeb962f2e9626013f5a0 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 14 Aug 2013 11:50:21 +0100 Subject: Alpha sorted PistonBreakable list --- source/BlockID.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/BlockID.cpp b/source/BlockID.cpp index 35668d0b4..05506777c 100644 --- a/source/BlockID.cpp +++ b/source/BlockID.cpp @@ -655,6 +655,7 @@ public: g_BlockPistonBreakable[E_BLOCK_IRON_DOOR] = true; g_BlockPistonBreakable[E_BLOCK_JACK_O_LANTERN] = true; g_BlockPistonBreakable[E_BLOCK_LADDER] = true; + g_BlockPistonBreakable[E_BLOCK_LAVA] = true; g_BlockPistonBreakable[E_BLOCK_LEVER] = true; g_BlockPistonBreakable[E_BLOCK_MELON] = true; g_BlockPistonBreakable[E_BLOCK_MELON_STEM] = true; @@ -669,17 +670,17 @@ public: g_BlockPistonBreakable[E_BLOCK_SNOW] = true; g_BlockPistonBreakable[E_BLOCK_STATIONARY_LAVA] = true; g_BlockPistonBreakable[E_BLOCK_STATIONARY_WATER] = true; - g_BlockPistonBreakable[E_BLOCK_LAVA] = true; - g_BlockPistonBreakable[E_BLOCK_WATER] = true; g_BlockPistonBreakable[E_BLOCK_STONE_BUTTON] = true; g_BlockPistonBreakable[E_BLOCK_STONE_PRESSURE_PLATE] = true; g_BlockPistonBreakable[E_BLOCK_TALL_GRASS] = true; g_BlockPistonBreakable[E_BLOCK_TORCH] = true; g_BlockPistonBreakable[E_BLOCK_VINES] = true; + g_BlockPistonBreakable[E_BLOCK_WATER] = true; g_BlockPistonBreakable[E_BLOCK_WOODEN_DOOR] = true; g_BlockPistonBreakable[E_BLOCK_WOODEN_PRESSURE_PLATE] = true; g_BlockPistonBreakable[E_BLOCK_YELLOW_FLOWER] = true; + // Blocks that can be snowed over: g_BlockIsSnowable[E_BLOCK_AIR] = false; g_BlockIsSnowable[E_BLOCK_BROWN_MUSHROOM] = false; -- cgit v1.2.3 From ad57f1966cef14ea9f52ffbbf3677c8e24c2d5d4 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 14 Aug 2013 12:08:36 +0100 Subject: Okay, changed to xoft's partial fix --- source/Piston.cpp | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/source/Piston.cpp b/source/Piston.cpp index 8729287de..310fcdfd4 100644 --- a/source/Piston.cpp +++ b/source/Piston.cpp @@ -1,4 +1,3 @@ - #include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules #include "Piston.h" @@ -12,13 +11,6 @@ #include "Server.h" #include "Blocks/BlockHandler.h" -/* -#ifdef _WIN32 -#include -#else -#include -#endif -*/ @@ -133,16 +125,11 @@ void cPiston::ExtendPiston( int pistx, int pisty, int pistz ) AddDir(extx, exty, extz, pistonMeta & 7, 1) - /* - #ifdef _WIN32 + // TODO: This code needs replacing // Sleeping here will play the piston animation on the client; however, it will block the entire server // for the 100 ms, effectively dropping 2 game ticks per piston. This is very bad // This needs to be handled using delayed scheduled tasks instead - Sleep(100); - #else - usleep(static_cast(100)*1000); - #endif - */ + cSleep::MilliSleep(100); m_World->SetBlock(extx, exty, extz, E_BLOCK_PISTON_EXTENSION, isSticky + pistonMeta & 7); } @@ -188,33 +175,23 @@ void cPiston::RetractPiston( int pistx, int pisty, int pistz ) // These cannot be moved by the sticky piston, bail out return; } - /* - #ifdef _WIN32 + // TODO: This code needs replacing // Sleeping here will play the piston animation on the client; however, it will block the entire server // for the 100 ms, effectively dropping 2 game ticks per piston. This is very bad // This needs to be handled using delayed scheduled tasks instead - Sleep(100); - #else - usleep(static_cast(100)*1000); - #endif - */ + cSleep::MilliSleep(100); m_World->SetBlock(pistx, pisty, pistz, tempblock, tempmeta); m_World->SetBlock(tempx, tempy, tempz, E_BLOCK_AIR, 0); } else { - /* - #ifdef _WIN32 + // TODO: This code needs replacing // Sleeping here will play the piston animation on the client; however, it will block the entire server // for the 100 ms, effectively dropping 2 game ticks per piston. This is very bad // This needs to be handled using delayed scheduled tasks instead - Sleep(100); - #else - usleep(static_cast(100)*1000); - #endif - */ + cSleep::MilliSleep(100); m_World->SetBlock(pistx, pisty, pistz, E_BLOCK_AIR, 0); } -- cgit v1.2.3 From d4f8a057ddfef83d364f3fd6557b8159f5b38390 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Wed, 14 Aug 2013 22:26:15 +0100 Subject: Generation and simulation defaults ...are no longer set, instead, the server operator is told to set them. --- source/Generating/ComposableGenerator.cpp | 12 ++++++------ source/World.cpp | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/source/Generating/ComposableGenerator.cpp b/source/Generating/ComposableGenerator.cpp index 94f822420..0852f559e 100644 --- a/source/Generating/ComposableGenerator.cpp +++ b/source/Generating/ComposableGenerator.cpp @@ -147,10 +147,10 @@ void cComposableGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile) { - AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", "MultiStepMap"); + AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", ""); if (BiomeGenName.empty()) { - LOGWARN("[Generator]::BiomeGen value not found in world.ini, using \"MultiStepMap\"."); + LOGWARN("[Generator] BiomeGen value not set in world.ini, using \"MultiStepMap\"."); BiomeGenName = "MultiStepMap"; } @@ -220,10 +220,10 @@ void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile) void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) { - AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", "Biomal"); + AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", ""); if (HeightGenName.empty()) { - LOGWARN("[Generator]::HeightGen value not found in world.ini, using \"Biomal\"."); + LOGWARN("[Generator] HeightGen value not set in world.ini, using \"Biomal\"."); HeightGenName = "Biomal"; } @@ -306,10 +306,10 @@ void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile) { - AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", "Biomal"); + AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", ""); if (CompoGenName.empty()) { - LOGWARN("[Generator]::CompositionGen value not found in world.ini, using \"Biomal\"."); + LOGWARN("[Generator] CompositionGen value not set in world.ini, using \"Biomal\"."); CompoGenName = "Biomal"; } if (NoCaseCompare(CompoGenName, "sameblock") == 0) diff --git a/source/World.cpp b/source/World.cpp index 77bfc0e2f..f2b353d32 100644 --- a/source/World.cpp +++ b/source/World.cpp @@ -2476,10 +2476,10 @@ cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const c Printf(SimulatorNameKey, "%sSimulator", a_FluidName); AString SimulatorSectionName; Printf(SimulatorSectionName, "%sSimulator", a_FluidName); - AString SimulatorName = a_IniFile.GetValueSet("Physics", SimulatorNameKey, "Floody"); + AString SimulatorName = a_IniFile.GetValueSet("Physics", SimulatorNameKey, ""); if (SimulatorName.empty()) { - LOGWARNING("%s [Physics]:%s not present or empty, using the default of \"Floody\".", GetIniFileName().c_str(), SimulatorNameKey.c_str()); + LOGWARNING("[Physics] %s not present or empty in %s, using the default of \"Floody\".", SimulatorNameKey.c_str(), GetIniFileName().c_str()); SimulatorName = "Floody"; } -- cgit v1.2.3