summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-03-20 13:47:00 +0000
committermaedhros <maedhros@openttd.org>2007-03-20 13:47:00 +0000
commit48f2bf9bb1bd7b8859d3527c6c205386471cc4e4 (patch)
treea58aa837d70b430e5ab2ea0f71158e3b6032453b /src/newgrf.cpp
parent7812f7fd0ac617a9df41730e6770519154bc5344 (diff)
downloadopenttd-48f2bf9bb1bd7b8859d3527c6c205386471cc4e4.tar.xz
(svn r9371) -Feature: Add support for variable snow lines in the arctic climate, supplied
by newgrf files. When this is enabled forests cannot be built below the highest snow line, and farms can't be built above it. Houses still use the _opt.snow_line so they are all consistent, so to make them respect the snowline you may want to use some newhouses features as well.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 40185e3d7..6fbcf764f 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -27,6 +27,7 @@
#include "fontcache.h"
#include "date.h"
#include "currency.h"
+#include "landscape.h"
#include "sound.h"
#include "newgrf_config.h"
#include "newgrf_house.h"
@@ -1510,6 +1511,22 @@ static bool GlobalVarChangeInfo(uint gvid, int numinfo, int prop, byte **bufp, i
break;
case 0x10: // 12 * 32 * B Snow line height table
+ if (numinfo > 1 || IsSnowLineSet()) {
+ grfmsg(1, "GlobalVarChangeInfo: The snowline can only be set once (%d)", numinfo);
+ } else if (len < SNOW_LINE_MONTHS * SNOW_LINE_DAYS) {
+ grfmsg(1, "GlobalVarChangeInfo: Not enough entries set in the snowline table (%d)", len);
+ } else {
+ byte table[SNOW_LINE_MONTHS][SNOW_LINE_DAYS];
+
+ for (uint i = 0; i < SNOW_LINE_MONTHS; i++) {
+ for (uint j = 0; j < SNOW_LINE_DAYS; j++) {
+ table[i][j] = grf_load_byte(&buf);
+ }
+ }
+ SetSnowLine(table);
+ }
+ break;
+
default:
ret = true;
}
@@ -3973,6 +3990,9 @@ static void ResetNewGRFData()
ResetStationClasses();
ResetCustomStations();
+ /* Reset the snowline table. */
+ ClearSnowLine();
+
/* Reset NewGRF files */
ResetNewGRF();