mirror of https://github.com/OpenTTD/OpenTTD
(svn r20652) -Codechange: implement a function to get the index of a spec.
parent
0a86eac2f1
commit
164a923c69
|
@ -46,6 +46,11 @@ bool ObjectSpec::IsAvailable() const
|
||||||
(flags & (_game_mode != GM_EDITOR ? OBJECT_FLAG_ONLY_IN_SCENEDIT : OBJECT_FLAG_ONLY_IN_GAME)) == 0;
|
(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. */
|
/** This function initialize the spec arrays of objects. */
|
||||||
void ResetObjects()
|
void ResetObjects()
|
||||||
{
|
{
|
||||||
|
|
|
@ -87,6 +87,12 @@ struct ObjectSpec {
|
||||||
*/
|
*/
|
||||||
Money GetClearCost() const { return (_price[PR_CLEAR_OBJECT] * this->clear_cost_multiplier); }
|
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.
|
* Get the specification associated with a specific ObjectType.
|
||||||
* @param index The object type to fetch.
|
* @param index The object type to fetch.
|
||||||
|
|
Loading…
Reference in New Issue