1
0
Fork 0

Codechange: Use SQInteger for generic numbers in script_newgrf

pull/10532/head
glx22 2023-03-04 15:52:47 +01:00 committed by Loïc Guilloux
parent ca67075397
commit f22903ab14
2 changed files with 9 additions and 9 deletions

View File

@ -24,9 +24,9 @@ ScriptNewGRFList::ScriptNewGRFList()
} }
} }
/* static */ bool ScriptNewGRF::IsLoaded(uint32 grfid) /* static */ bool ScriptNewGRF::IsLoaded(SQInteger grfid)
{ {
grfid = BSWAP32(grfid); // Match people's expectations. grfid = BSWAP32(GB(grfid, 0, 32)); // Match people's expectations.
for (auto c = _grfconfig; c != nullptr; c = c->next) { for (auto c = _grfconfig; c != nullptr; c = c->next) {
if (!HasBit(c->flags, GCF_STATIC) && c->ident.grfid == grfid) { if (!HasBit(c->flags, GCF_STATIC) && c->ident.grfid == grfid) {
@ -37,9 +37,9 @@ ScriptNewGRFList::ScriptNewGRFList()
return false; return false;
} }
/* static */ uint32 ScriptNewGRF::GetVersion(uint32 grfid) /* static */ SQInteger ScriptNewGRF::GetVersion(SQInteger grfid)
{ {
grfid = BSWAP32(grfid); // Match people's expectations. grfid = BSWAP32(GB(grfid, 0, 32)); // Match people's expectations.
for (auto c = _grfconfig; c != nullptr; c = c->next) { for (auto c = _grfconfig; c != nullptr; c = c->next) {
if (!HasBit(c->flags, GCF_STATIC) && c->ident.grfid == grfid) { if (!HasBit(c->flags, GCF_STATIC) && c->ident.grfid == grfid) {
@ -50,9 +50,9 @@ ScriptNewGRFList::ScriptNewGRFList()
return 0; return 0;
} }
/* static */ char *ScriptNewGRF::GetName(uint32 grfid) /* static */ char *ScriptNewGRF::GetName(SQInteger grfid)
{ {
grfid = BSWAP32(grfid); // Match people's expectations. grfid = BSWAP32(GB(grfid, 0, 32)); // Match people's expectations.
for (auto c = _grfconfig; c != nullptr; c = c->next) { for (auto c = _grfconfig; c != nullptr; c = c->next) {
if (!HasBit(c->flags, GCF_STATIC) && c->ident.grfid == grfid) { if (!HasBit(c->flags, GCF_STATIC) && c->ident.grfid == grfid) {

View File

@ -34,7 +34,7 @@ public:
* @param grfid The grfid to check. * @param grfid The grfid to check.
* @return True if and only if a NewGRF with the given grfid is loaded in the game. * @return True if and only if a NewGRF with the given grfid is loaded in the game.
*/ */
static bool IsLoaded(uint32 grfid); static bool IsLoaded(SQInteger grfid);
/** /**
* Get the version of a loaded NewGRF. * Get the version of a loaded NewGRF.
@ -42,7 +42,7 @@ public:
* @pre ScriptNewGRF::IsLoaded(grfid). * @pre ScriptNewGRF::IsLoaded(grfid).
* @return Version of the NewGRF or 0 if the NewGRF specifies no version. * @return Version of the NewGRF or 0 if the NewGRF specifies no version.
*/ */
static uint32 GetVersion(uint32 grfid); static SQInteger GetVersion(SQInteger grfid);
/** /**
* Get the name of a loaded NewGRF. * Get the name of a loaded NewGRF.
@ -50,7 +50,7 @@ public:
* @pre ScriptNewGRF::IsLoaded(grfid). * @pre ScriptNewGRF::IsLoaded(grfid).
* @return The name of the NewGRF or null if no name is defined. * @return The name of the NewGRF or null if no name is defined.
*/ */
static char *GetName(uint32 grfid); static char *GetName(SQInteger grfid);
}; };
#endif /* SCRIPT_NEWGRF_HPP */ #endif /* SCRIPT_NEWGRF_HPP */