(svn r10369) -Codechange: Add the IndustryType parameter to the GetIndustryCallback function.
authorbelugas
Thu, 28 Jun 2007 02:14:40 +0000
changeset 7102 fe01c264132b
parent 7101 d70ab00ad9f5
child 7103 e10badf500c8
(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
src/newgrf_industries.h
--- a/src/newgrf_industries.cpp	Wed Jun 27 23:40:21 2007 +0000
+++ b/src/newgrf_industries.cpp	Thu Jun 28 02:14:40 2007 +0000
@@ -248,7 +248,7 @@
 	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 @@
 	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;
--- a/src/newgrf_industries.h	Wed Jun 27 23:40:21 2007 +0000
+++ b/src/newgrf_industries.h	Thu Jun 28 02:14:40 2007 +0000
@@ -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*/