From 6e761a18d6fd0a8bf3039bdaeaecac58397e0366 Mon Sep 17 00:00:00 2001 From: belugas Date: Sat, 2 Feb 2008 03:23:26 +0000 Subject: (svn r12041) -Codechange: Add the loader and the property for action 00 industries, prop 24, nearby station name. No assignation yet, no real work either. --- src/industry.h | 1 + src/newgrf.cpp | 12 ++++++++++++ src/table/build_industry.h | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/industry.h b/src/industry.h index 95d6da3cb..c2fed658c 100644 --- a/src/industry.h +++ b/src/industry.h @@ -179,6 +179,7 @@ struct IndustrySpec { GRFMappedStringID closure_text; ///< Message appearing when the industry closes GRFMappedStringID production_up_text; ///< Message appearing when the industry's production is increasing GRFMappedStringID production_down_text; ///< Message appearing when the industry's production is decreasing + GRFMappedStringID station_name; ///< Default name for nearby station byte appear_ingame[NUM_LANDSCAPE]; ///< Probability of appearance in game byte appear_creation[NUM_LANDSCAPE]; ///< Probability of appearance during map creation uint8 number_of_sounds; ///< Number of sounds available in the sounds array diff --git a/src/newgrf.cpp b/src/newgrf.cpp index d5fdb161b..99aad12b7 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -2126,6 +2126,10 @@ static bool IndustriesChangeInfo(uint indid, int numinfo, int prop, byte **bufp, indsp->removal_cost_multiplier = grf_load_dword(&buf); break; + case 0x24: // name for nearby station + indsp->station_name = GRFMappedStringID(grf_load_dword(&buf), _cur_grffile->grfid); + break; + default: ret = true; break; @@ -5421,6 +5425,14 @@ static void FinaliseIndustriesArray() strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->new_industry_text); if (strid != STR_UNDEFINED) indsp->new_industry_text = strid; + indsp->station_name.MapString(); + if (indsp->station_name != STR_NULL) { + /* STR_NULL (0) can be set by grf. It has a meaning regarding assignation of the + * station's name. Don't wont to loose the value, therefor, do not process. */ + strid = GetGRFStringID(indsp->grf_prop.grffile->grfid, indsp->station_name); + if (strid != STR_UNDEFINED) indsp->station_name = strid; + } + _industry_mngr.SetEntitySpec(indsp); _loaded_newgrf_features.has_newindustries = true; } diff --git a/src/table/build_industry.h b/src/table/build_industry.h index c21e12d56..58b2b78c9 100644 --- a/src/table/build_industry.h +++ b/src/table/build_industry.h @@ -1176,7 +1176,7 @@ enum { #define MI(tbl, sndc, snd, d, pc, ai1, ai2, ai3, ai4, ag1, ag2, ag3, ag4, col, \ c1, c2, c3, proc, p1, r1, p2, r2, m, a1, im1, a2, im2, a3, im3, pr, clim, bev, in, intx, s1, s2, s3) \ {tbl, lengthof(tbl), min(255, d), 0, d, pc, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m, \ - {a1, a2, a3}, {{im1, 0}, {im2, 0}, {im3, 0}}, pr, clim, bev, col, GRFMappedStringID(in, 0), GRFMappedStringID(intx, 0), GRFMappedStringID(s1, 0), GRFMappedStringID(s2, 0), GRFMappedStringID(s3, 0), {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, \ + {a1, a2, a3}, {{im1, 0}, {im2, 0}, {im3, 0}}, pr, clim, bev, col, GRFMappedStringID(in, 0), GRFMappedStringID(intx, 0), GRFMappedStringID(s1, 0), GRFMappedStringID(s2, 0), GRFMappedStringID(s3, 0), GRFMappedStringID(STR_UNDEFINED, 0), {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, \ sndc, snd, 0, 0, true, {INVALID_INDUSTRYTYPE, 0, NULL, NULL, INVALID_INDUSTRYTYPE}} /* Format: tile table count and sounds table -- cgit v1.2.3-70-g09d2