diff --git a/Tools/AnvilStats/Globals.h b/Tools/AnvilStats/Globals.h index db5d3c635..48e1f8492 100644 --- a/Tools/AnvilStats/Globals.h +++ b/Tools/AnvilStats/Globals.h @@ -138,6 +138,7 @@ typedef unsigned short UInt16; // CRT stuff: +#include #include #include #include diff --git a/Tools/AnvilStats/Processor.cpp b/Tools/AnvilStats/Processor.cpp index 8e1cc4c4b..4ecd685ad 100644 --- a/Tools/AnvilStats/Processor.cpp +++ b/Tools/AnvilStats/Processor.cpp @@ -554,8 +554,8 @@ void cProcessor::PopulateFileQueue(const AString & a_WorldFolder) { Path.push_back(cFile::PathSeparator); } - AStringList AllFiles = GetDirectoryContents(Path.c_str()); - for (AStringList::iterator itr = AllFiles.begin(), end = AllFiles.end(); itr != end; ++itr) + AStringVector AllFiles = cFile::GetFolderContents(Path.c_str()); + for (AStringVector::iterator itr = AllFiles.begin(), end = AllFiles.end(); itr != end; ++itr) { if (itr->rfind(".mca") != itr->length() - 4) { diff --git a/Tools/BiomeVisualiser/BiomeColors.cpp b/Tools/BiomeVisualiser/BiomeColors.cpp new file mode 100644 index 000000000..1fd0cb7a0 --- /dev/null +++ b/Tools/BiomeVisualiser/BiomeColors.cpp @@ -0,0 +1,114 @@ + +// BiomeColors.cpp + +// Implements the g_BiomeColors[] array preparation based on a stored biome-to-color map + +#include "Globals.h" +#include "BiomeColors.h" + + + + + +int g_BiomeColors[256]; + + + + + +static struct +{ + EMCSBiome Biome; + int Color; +} g_BiomeColorMap[] = +{ + { biOcean, 0x000070 }, + { biPlains, 0x8db360 }, + { biDesert, 0xfa9418 }, + { biExtremeHills, 0x606060 }, + { biForest, 0x056621 }, + { biTaiga, 0x0b6659 }, + { biSwampland, 0x2fffda }, + { biRiver, 0x3030af }, + { biHell, 0x7f0000 }, + { biSky, 0x007fff }, + { biFrozenOcean, 0xa0a0df }, + { biFrozenRiver, 0xa0a0ff }, + { biIcePlains, 0xffffff }, + { biIceMountains, 0xa0a0a0 }, + { biMushroomIsland, 0xff00ff }, + { biMushroomShore, 0xa000ff }, + { biBeach, 0xfade55 }, + { biDesertHills, 0xd25f12 }, + { biForestHills, 0x22551c }, + { biTaigaHills, 0x163933 }, + { biExtremeHillsEdge, 0x7f8f7f }, + { biJungle, 0x537b09 }, + { biJungleHills, 0x2c4205 }, + + { biJungleEdge, 0x628b17 }, + { biDeepOcean, 0x000030 }, + { biStoneBeach, 0xa2a284 }, + { biColdBeach, 0xfaf0c0 }, + { biBirchForest, 0x307444 }, + { biBirchForestHills, 0x1f5f32 }, + { biRoofedForest, 0x40511a }, + { biColdTaiga, 0x31554a }, + { biColdTaigaHills, 0x597d72 }, + { biMegaTaiga, 0x596651 }, + { biMegaTaigaHills, 0x596659 }, + { biExtremeHillsPlus, 0x507050 }, + { biSavanna, 0xbdb25f }, + { biSavannaPlateau, 0xa79d64 }, + { biMesa, 0xd94515 }, + { biMesaPlateauF, 0xb09765 }, + { biMesaPlateau, 0xca8c65 }, + + // M variants: + { biSunflowerPlains, 0xb5db88 }, + { biDesertM, 0xffbc40 }, + { biExtremeHillsM, 0x888888 }, + { biFlowerForest, 0x2d8e49 }, + { biTaigaM, 0x338e81 }, + { biSwamplandM, 0x07f9b2 }, + { biIcePlainsSpikes, 0xb4dcdc }, + { biJungleM, 0x7ba331 }, + { biJungleEdgeM, 0x628b17 }, + { biBirchForestM, 0x589c6c }, + { biBirchForestHillsM, 0x47875a }, + { biRoofedForestM, 0x687942 }, + { biColdTaigaM, 0x243f36 }, + { biMegaSpruceTaiga, 0x454f3e }, + { biMegaSpruceTaigaHills, 0x454f4e }, + { biExtremeHillsPlusM, 0x789878 }, + { biSavannaM, 0xe5da87 }, + { biSavannaPlateauM, 0xa79d74 }, + { biMesaBryce, 0xff6d3d }, + { biMesaPlateauFM, 0xd8bf8d }, + { biMesaPlateauM, 0xf2b48d }, +} ; + + + + + +static class cBiomeColorsInitializer +{ +public: + cBiomeColorsInitializer(void) + { + // Reset all colors to gray: + for (size_t i = 0; i < ARRAYCOUNT(g_BiomeColors); i++) + { + g_BiomeColors[i] = 0x7f7f7f; + } + for (size_t i = 0; i < ARRAYCOUNT(g_BiomeColorMap); i++) + { + g_BiomeColors[g_BiomeColorMap[i].Biome] = g_BiomeColorMap[i].Color; + } + } +} g_Initializer; + + + + diff --git a/Tools/BiomeVisualiser/BiomeColors.h b/Tools/BiomeVisualiser/BiomeColors.h new file mode 100644 index 000000000..0cb0f578c --- /dev/null +++ b/Tools/BiomeVisualiser/BiomeColors.h @@ -0,0 +1,15 @@ + +// BiomeColors.h + +// Declares the g_BiomeColors[] array used for biome color lookup + + + + + +extern int g_BiomeColors[256]; + + + + + diff --git a/Tools/BiomeVisualiser/BiomeRenderer.cpp b/Tools/BiomeVisualiser/BiomeRenderer.cpp index 98548179c..758eb4b48 100644 --- a/Tools/BiomeVisualiser/BiomeRenderer.cpp +++ b/Tools/BiomeVisualiser/BiomeRenderer.cpp @@ -7,6 +7,7 @@ #include "BiomeRenderer.h" #include "Pixmap.h" #include "Timer.h" +#include "BiomeColors.h" @@ -96,40 +97,11 @@ bool cBiomeRenderer::Render(cPixmap & a_Pixmap) int cBiomeRenderer::GetBiomeColor(EMCSBiome a_Biome) { - if ((a_Biome < 0) || (a_Biome > biMaxBiome)) + if ((a_Biome < 0) || (a_Biome >= ARRAYCOUNT(g_BiomeColors))) { - return 0xcfcfcf; // LtGray for unknown biomes + return 0xff0000; } - - static int BiomeColor[] = - { - // RGB: - 0x0000ff, /* Ocean */ - 0x00cf3f, /* Plains */ - 0xffff00, /* Desert */ - 0x7f7f7f, /* Extreme Hills */ - 0x00cf00, /* Forest */ - 0x007f3f, /* Taiga */ - 0x3f7f00, /* Swampland */ - 0x003fff, /* River */ - 0x7f0000, /* Hell */ - 0x007fff, /* Sky */ - 0x3f3fff, /* Frozen Ocean */ - 0x3f3fff, /* Frozen River */ - 0x7fffcf, /* Ice Plains */ - 0x3fcf7f, /* Ice Mountains */ - 0xcf00cf, /* Mushroom Island */ - 0x7f00ff, /* Mushroom Island Shore */ - 0xffff3f, /* Beach */ - 0xcfcf00, /* Desert Hills */ - 0x00cf3f, /* Forest Hills */ - 0x006f1f, /* Taiga Hills */ - 0x7f8f7f, /* Extreme Hills Edge */ - 0x004f00, /* Jungle */ - 0x003f00, /* Jungle Hills */ - } ; - - return BiomeColor[a_Biome]; + return g_BiomeColors[a_Biome]; } diff --git a/Tools/BiomeVisualiser/BiomeVisualiser.vcproj b/Tools/BiomeVisualiser/BiomeVisualiser.vcproj index 5f840129d..2616313a2 100644 --- a/Tools/BiomeVisualiser/BiomeVisualiser.vcproj +++ b/Tools/BiomeVisualiser/BiomeVisualiser.vcproj @@ -268,6 +268,10 @@ RelativePath=".\BiomeCache.h" > + + @@ -489,6 +493,10 @@ + + diff --git a/src/OSSupport/Socket.cpp b/src/OSSupport/Socket.cpp index c461d38a4..f25f800c2 100644 --- a/src/OSSupport/Socket.cpp +++ b/src/OSSupport/Socket.cpp @@ -210,9 +210,6 @@ bool cSocket::BindToAnyIPv4(unsigned short a_Port) bool cSocket::BindToAnyIPv6(unsigned short a_Port) { - // Cannot use socckaddr_in6, because it is not defined in the default VS2008 SDK - // Must jump through hoops here - sockaddr_in6 local; memset(&local, 0, sizeof(local));