diff options
author | Alexander Harkness <bearbin@gmail.com> | 2014-06-12 17:50:08 +0200 |
---|---|---|
committer | Alexander Harkness <bearbin@gmail.com> | 2014-06-12 17:50:08 +0200 |
commit | db4d786a843eff72d84a77c9a1334eaba7d30ccd (patch) | |
tree | 1a29f8550614a59b67a786798ca0393187a4c178 /src | |
parent | Merge pull request #1086 from qaisjp/patch-1 (diff) | |
parent | Fixed constness (diff) | |
download | cuberite-db4d786a843eff72d84a77c9a1334eaba7d30ccd.tar cuberite-db4d786a843eff72d84a77c9a1334eaba7d30ccd.tar.gz cuberite-db4d786a843eff72d84a77c9a1334eaba7d30ccd.tar.bz2 cuberite-db4d786a843eff72d84a77c9a1334eaba7d30ccd.tar.lz cuberite-db4d786a843eff72d84a77c9a1334eaba7d30ccd.tar.xz cuberite-db4d786a843eff72d84a77c9a1334eaba7d30ccd.tar.zst cuberite-db4d786a843eff72d84a77c9a1334eaba7d30ccd.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/World.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/World.h b/src/World.h index abdc3120c..0a8dcffc4 100644 --- a/src/World.h +++ b/src/World.h @@ -707,13 +707,41 @@ public: /** Returns the current weather. Instead of comparing values directly to the weather constants, use IsWeatherXXX() functions, if possible */ eWeather GetWeather (void) const { return m_Weather; }; + /** Returns true if the current weather is sun */ bool IsWeatherSunny(void) const { return (m_Weather == wSunny); } - bool IsWeatherRain (void) const { return (m_Weather == wRain); } + + /** Returns true if it is sunny at the specified location. This takes into account biomes. */ + bool IsWeatherSunnyAt(int a_BlockX, int a_BlockZ) + { + return (IsWeatherSunny() || IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ))); + } + + /** Returns true if the current weather is rain */ + bool IsWeatherRain(void) const { return (m_Weather == wRain); } + + /** Returns true if it is raining at the specified location. This takes into account biomes. */ + bool IsWeatherRainAt (int a_BlockX, int a_BlockZ) + { + return (IsWeatherRain() && !IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ))); + } + + /** Returns true if the current weather is stormy */ bool IsWeatherStorm(void) const { return (m_Weather == wStorm); } - /** Returns true if the current weather has any precipitation - rain or storm */ - bool IsWeatherWet (void) const { return (m_Weather != wSunny); } + /** Returns true if the weather is stormy at the specified location. This takes into account biomes. */ + bool IsWeatherStormAt(int a_BlockX, int a_BlockZ) + { + return (IsWeatherStorm() && !IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ))); + } + + /** Returns true if the current weather has any precipitation - rain, storm or snow */ + bool IsWeatherWet(void) const { return !IsWeatherSunny(); } + /** Returns true if it is raining, stormy or snowing at the specified location. This takes into account biomes. */ + bool IsWeatherWetAt(int a_BlockX, int a_BlockZ) + { + return (IsWeatherWet() && !IsBiomeNoDownfall(GetBiomeAt(a_BlockX, a_BlockZ))); + } // tolua_end cChunkGenerator & GetGenerator(void) { return m_Generator; } |