Rename ItemInfo functions newItem and newItemTemporary to new and newTemporary for consistency.

This commit is contained in:
hispidence 2021-08-23 02:07:17 +01:00
parent a1d5deed99
commit dda1d7143b
2 changed files with 21 additions and 21 deletions

View file

@ -49,13 +49,13 @@ GameScriptItemInfo::~GameScriptItemInfo() {
/*** If you create items with this you NEED to give a position, room, /*** If you create items with this you NEED to give a position, room,
and object number, and then call InitialiseItem before it will work. and object number, and then call InitialiseItem before it will work.
@function ItemInfo.newItem @function ItemInfo.new
*/ */
/*** Like above, but the returned variable controls the /*** Like above, but the returned variable controls the
lifetime of the object (it will be destroyed when the variable goes lifetime of the object (it will be destroyed when the variable goes
out of scope). out of scope).
@function ItemInfo.newItemTemporary @function ItemInfo.newTemporary
*/ */
template <bool temp> std::unique_ptr<GameScriptItemInfo> CreateEmpty() template <bool temp> std::unique_ptr<GameScriptItemInfo> CreateEmpty()
{ {
@ -68,7 +68,7 @@ template <bool temp> std::unique_ptr<GameScriptItemInfo> CreateEmpty()
associated getters and setters. If you do not know what to set for these, associated getters and setters. If you do not know what to set for these,
most can just be set to zero (see usage). See also the overload which most can just be set to zero (see usage). See also the overload which
takes no arguments. takes no arguments.
@function ItemInfo.newItem @function ItemInfo.new
@tparam ObjID object ID @tparam ObjID object ID
@tparam string name Lua name of the item @tparam string name Lua name of the item
@tparam Position position position in level @tparam Position position position in level
@ -88,7 +88,7 @@ takes no arguments.
@tparam bool hitStatus hit status of object @tparam bool hitStatus hit status of object
@return reference to new ItemInfo object @return reference to new ItemInfo object
@usage @usage
local item = ItemInfo.newItem( local item = ItemInfo.new(
ObjID.PISTOLS_ITEM, -- object id ObjID.PISTOLS_ITEM, -- object id
"test", -- name "test", -- name
Position.new(18907, 0, 21201), Position.new(18907, 0, 21201),
@ -112,7 +112,7 @@ takes no arguments.
/*** Like the above, but the returned variable controls the /*** Like the above, but the returned variable controls the
lifetime of the object (it will be destroyed when the variable goes lifetime of the object (it will be destroyed when the variable goes
out of scope). out of scope).
@function ItemInfo.newItemTemporary @function ItemInfo.newTemporary
@param see_above same as above function @param see_above same as above function
*/ */
@ -166,8 +166,8 @@ template <bool temp> static std::unique_ptr<GameScriptItemInfo> Create(
void GameScriptItemInfo::Register(sol::state* state) void GameScriptItemInfo::Register(sol::state* state)
{ {
state->new_usertype<GameScriptItemInfo>(LUA_CLASS_NAME, state->new_usertype<GameScriptItemInfo>(LUA_CLASS_NAME,
"newItem", sol::overload(Create<false>, CreateEmpty<false>), "new", sol::overload(Create<false>, CreateEmpty<false>),
"newItemTemporary", sol::overload(Create<true>, CreateEmpty<true>), "newTemporary", sol::overload(Create<true>, CreateEmpty<true>),
sol::meta_function::index, index_error, sol::meta_function::index, index_error,
sol::meta_function::new_index, newindex_error, sol::meta_function::new_index, newindex_error,

View file

@ -153,23 +153,23 @@ pickups, and Lara herself.</p>
<h2><a href="#Functions">Functions</a></h2> <h2><a href="#Functions">Functions</a></h2>
<table class="function_list"> <table class="function_list">
<tr> <tr>
<td class="name" ><a href="#ItemInfo.newItem">ItemInfo.newItem ()</a></td> <td class="name" ><a href="#ItemInfo.new">ItemInfo.new ()</a></td>
<td class="summary">If you create items with this you NEED to give a position, room, <td class="summary">If you create items with this you NEED to give a position, room,
and object number, and then call InitialiseItem before it will work.</td> and object number, and then call InitialiseItem before it will work.</td>
</tr> </tr>
<tr> <tr>
<td class="name" ><a href="#ItemInfo.newItemTemporary">ItemInfo.newItemTemporary ()</a></td> <td class="name" ><a href="#ItemInfo.newTemporary">ItemInfo.newTemporary ()</a></td>
<td class="summary">Like above, but the returned variable controls the <td class="summary">Like above, but the returned variable controls the
lifetime of the object (it will be destroyed when the variable goes lifetime of the object (it will be destroyed when the variable goes
out of scope).</td> out of scope).</td>
</tr> </tr>
<tr> <tr>
<td class="name" ><a href="#ItemInfo.newItem">ItemInfo.newItem (object, name, position, rotation, room, currentAnimState, requiredAnimState, goalAnimState, animNumber, frameNumber, hp, OCB, itemFlags, AIBits, status, active, hitStatus)</a></td> <td class="name" ><a href="#ItemInfo.new">ItemInfo.new (object, name, position, rotation, room, currentAnimState, requiredAnimState, goalAnimState, animNumber, frameNumber, hp, OCB, itemFlags, AIBits, status, active, hitStatus)</a></td>
<td class="summary">For more information on each parameter, see the <td class="summary">For more information on each parameter, see the
associated getters and setters.</td> associated getters and setters.</td>
</tr> </tr>
<tr> <tr>
<td class="name" ><a href="#ItemInfo.newItemTemporary">ItemInfo.newItemTemporary (see_above)</a></td> <td class="name" ><a href="#ItemInfo.newTemporary">ItemInfo.newTemporary (see_above)</a></td>
<td class="summary">Like the above, but the returned variable controls the <td class="summary">Like the above, but the returned variable controls the
lifetime of the object (it will be destroyed when the variable goes lifetime of the object (it will be destroyed when the variable goes
out of scope).</td> out of scope).</td>
@ -454,8 +454,8 @@ the WadTool animation editor.
Methods Methods
<dl class="function"> <dl class="function">
<dt> <dt>
<a name = "ItemInfo.newItem"></a> <a name = "ItemInfo.new"></a>
<strong>ItemInfo.newItem ()</strong> <strong>ItemInfo.new ()</strong>
</dt> </dt>
<dd> <dd>
If you create items with this you NEED to give a position, room, If you create items with this you NEED to give a position, room,
@ -469,8 +469,8 @@ and object number, and then call InitialiseItem before it will work.
</dd> </dd>
<dt> <dt>
<a name = "ItemInfo.newItemTemporary"></a> <a name = "ItemInfo.newTemporary"></a>
<strong>ItemInfo.newItemTemporary ()</strong> <strong>ItemInfo.newTemporary ()</strong>
</dt> </dt>
<dd> <dd>
Like above, but the returned variable controls the Like above, but the returned variable controls the
@ -485,8 +485,8 @@ out of scope).
</dd> </dd>
<dt> <dt>
<a name = "ItemInfo.newItem"></a> <a name = "ItemInfo.new"></a>
<strong>ItemInfo.newItem (object, name, position, rotation, room, currentAnimState, requiredAnimState, goalAnimState, animNumber, frameNumber, hp, OCB, itemFlags, AIBits, status, active, hitStatus)</strong> <strong>ItemInfo.new (object, name, position, rotation, room, currentAnimState, requiredAnimState, goalAnimState, animNumber, frameNumber, hp, OCB, itemFlags, AIBits, status, active, hitStatus)</strong>
</dt> </dt>
<dd> <dd>
For more information on each parameter, see the For more information on each parameter, see the
@ -577,7 +577,7 @@ takes no arguments.
<h3>Usage:</h3> <h3>Usage:</h3>
<ul> <ul>
<pre class="example"><span class="keyword">local</span> item = ItemInfo.newItem( <pre class="example"><span class="keyword">local</span> item = ItemInfo.new(
ObjID.PISTOLS_ITEM, <span class="comment">-- object id ObjID.PISTOLS_ITEM, <span class="comment">-- object id
</span> <span class="string">"test"</span>, <span class="comment">-- name </span> <span class="string">"test"</span>, <span class="comment">-- name
</span> Position.new(<span class="number">18907</span>, <span class="number">0</span>, <span class="number">21201</span>), </span> Position.new(<span class="number">18907</span>, <span class="number">0</span>, <span class="number">21201</span>),
@ -600,8 +600,8 @@ takes no arguments.
</dd> </dd>
<dt> <dt>
<a name = "ItemInfo.newItemTemporary"></a> <a name = "ItemInfo.newTemporary"></a>
<strong>ItemInfo.newItemTemporary (see_above)</strong> <strong>ItemInfo.newTemporary (see_above)</strong>
</dt> </dt>
<dd> <dd>
Like the above, but the returned variable controls the Like the above, but the returned variable controls the
@ -671,7 +671,7 @@ Use this if you called new with no arguments
</div> <!-- id="main" --> </div> <!-- id="main" -->
<div id="about"> <div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i> <i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2021-08-21 00:29:08 </i> <i style="float:right;">Last updated 2021-08-21 00:32:39 </i>
</div> <!-- id="about" --> </div> <!-- id="about" -->
</div> <!-- id="container" --> </div> <!-- id="container" -->
</body> </body>