From 890dfe749e5d9b9bb3799025f3f4b64194d8acaf Mon Sep 17 00:00:00 2001 From: belugas Date: Thu, 28 Jun 2007 02:14:40 +0000 Subject: (svn r10369) -Codechange: Add the IndustryType parameter to the GetIndustryCallback function. Sometimes, the industry might not be able to provide its type, since it does not exists at all --- src/newgrf_industries.cpp | 4 ++-- src/newgrf_industries.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 402bccccb..61f3ae224 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -248,7 +248,7 @@ static void NewIndustryResolver(ResolverObject *res, TileIndex tile, Industry *i res->reseed = 0; } -uint16 GetIndustryCallback(uint16 callback, uint32 param1, uint32 param2, Industry *industry, TileIndex tile) +uint16 GetIndustryCallback(uint16 callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile) { ResolverObject object; const SpriteGroup *group; @@ -258,7 +258,7 @@ uint16 GetIndustryCallback(uint16 callback, uint32 param1, uint32 param2, Indust object.callback_param1 = param1; object.callback_param2 = param2; - group = Resolve(GetIndustrySpec(industry->type)->grf_prop.spritegroup, &object); + group = Resolve(GetIndustrySpec(type)->grf_prop.spritegroup, &object); if (group == NULL || group->type != SGT_CALLBACK) return CALLBACK_FAILED; return group->g.callback.result; diff --git a/src/newgrf_industries.h b/src/newgrf_industries.h index 54a54cbf8..5da4cef1a 100644 --- a/src/newgrf_industries.h +++ b/src/newgrf_industries.h @@ -10,7 +10,7 @@ /* in newgrf_industry.cpp */ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available); -uint16 GetIndustryCallback(uint16 callback, uint32 param1, uint32 param2, Industry *industry, TileIndex tile); +uint16 GetIndustryCallback(uint16 callback, uint32 param1, uint32 param2, Industry *industry, IndustryType type, TileIndex tile); uint32 GetIndustryIDAtOffset(TileIndex new_tile, TileIndex old_tile, const Industry *i); /* in newgrf_industrytiles.cpp*/ -- cgit v1.2.3-70-g09d2