(svn r23355) -Codechange: rename all AI* to Script* (Rubidium)
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file script_sign.cpp Implementation of AISign. */
|
||||
/** @file script_sign.cpp Implementation of ScriptSign. */
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "script_sign.hpp"
|
||||
@@ -21,22 +21,22 @@
|
||||
#include "../../tile_map.h"
|
||||
#include "../../company_func.h"
|
||||
|
||||
/* static */ bool AISign::IsValidSign(SignID sign_id)
|
||||
/* static */ bool ScriptSign::IsValidSign(SignID sign_id)
|
||||
{
|
||||
const Sign *si = ::Sign::GetIfValid(sign_id);
|
||||
return si != NULL && si->owner == _current_company;
|
||||
}
|
||||
|
||||
/* static */ bool AISign::SetName(SignID sign_id, const char *name)
|
||||
/* static */ bool ScriptSign::SetName(SignID sign_id, const char *name)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidSign(sign_id));
|
||||
EnforcePrecondition(false, !::StrEmpty(name));
|
||||
EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_SIGN_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
|
||||
EnforcePreconditionCustomError(false, ::Utf8StringLength(name) < MAX_LENGTH_SIGN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
|
||||
|
||||
return AIObject::DoCommand(0, sign_id, 0, CMD_RENAME_SIGN, name);
|
||||
return ScriptObject::DoCommand(0, sign_id, 0, CMD_RENAME_SIGN, name);
|
||||
}
|
||||
|
||||
/* static */ char *AISign::GetName(SignID sign_id)
|
||||
/* static */ char *ScriptSign::GetName(SignID sign_id)
|
||||
{
|
||||
if (!IsValidSign(sign_id)) return NULL;
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
return sign_name;
|
||||
}
|
||||
|
||||
/* static */ TileIndex AISign::GetLocation(SignID sign_id)
|
||||
/* static */ TileIndex ScriptSign::GetLocation(SignID sign_id)
|
||||
{
|
||||
if (!IsValidSign(sign_id)) return INVALID_TILE;
|
||||
|
||||
@@ -57,19 +57,19 @@
|
||||
return ::TileVirtXY(sign->x, sign->y);
|
||||
}
|
||||
|
||||
/* static */ bool AISign::RemoveSign(SignID sign_id)
|
||||
/* static */ bool ScriptSign::RemoveSign(SignID sign_id)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidSign(sign_id));
|
||||
return AIObject::DoCommand(0, sign_id, 0, CMD_RENAME_SIGN, "");
|
||||
return ScriptObject::DoCommand(0, sign_id, 0, CMD_RENAME_SIGN, "");
|
||||
}
|
||||
|
||||
/* static */ SignID AISign::BuildSign(TileIndex location, const char *text)
|
||||
/* static */ SignID ScriptSign::BuildSign(TileIndex location, const char *text)
|
||||
{
|
||||
EnforcePrecondition(INVALID_SIGN, ::IsValidTile(location));
|
||||
EnforcePrecondition(INVALID_SIGN, !::StrEmpty(text));
|
||||
EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_SIGN_NAME_CHARS, AIError::ERR_PRECONDITION_STRING_TOO_LONG);
|
||||
EnforcePreconditionCustomError(false, ::Utf8StringLength(text) < MAX_LENGTH_SIGN_NAME_CHARS, ScriptError::ERR_PRECONDITION_STRING_TOO_LONG);
|
||||
|
||||
if (!AIObject::DoCommand(location, 0, 0, CMD_PLACE_SIGN, text, &AIInstance::DoCommandReturnSignID)) return INVALID_SIGN;
|
||||
if (!ScriptObject::DoCommand(location, 0, 0, CMD_PLACE_SIGN, text, &AIInstance::DoCommandReturnSignID)) return INVALID_SIGN;
|
||||
|
||||
/* In case of test-mode, we return SignID 0 */
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user