Changeset - r15954:be63e4d3dfa6
[Not reviewed]
master
0 2 0
rubidium - 14 years ago 2010-08-28 17:38:07
rubidium@openttd.org
(svn r20652) -Codechange: implement a function to get the index of a spec.
2 files changed with 11 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/newgrf_object.cpp
Show inline comments
 
@@ -46,6 +46,11 @@ bool ObjectSpec::IsAvailable() const
 
			(flags & (_game_mode != GM_EDITOR ? OBJECT_FLAG_ONLY_IN_SCENEDIT : OBJECT_FLAG_ONLY_IN_GAME)) == 0;
 
}
 

	
 
uint ObjectSpec::Index() const
 
{
 
	return this - _object_specs;
 
}
 

	
 
/** This function initialize the spec arrays of objects. */
 
void ResetObjects()
 
{
src/newgrf_object.h
Show inline comments
 
@@ -88,6 +88,12 @@ struct ObjectSpec {
 
	Money GetClearCost() const { return (_price[PR_CLEAR_OBJECT] * this->clear_cost_multiplier); }
 

	
 
	/**
 
	 * Gets the index of this spec.
 
	 * @return The index.
 
	 */
 
	uint Index() const;
 

	
 
	/**
 
	 * Get the specification associated with a specific ObjectType.
 
	 * @param index The object type to fetch.
 
	 * @return The specification.
0 comments (0 inline, 0 general)