mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-24 04:34:16 +01:00
Codechange: replace BSWAP32/BSWAP16 with std::byteswap
This commit is contained in:
@@ -162,6 +162,6 @@
|
||||
{
|
||||
EnforcePrecondition(IT_INVALID, IsInsideBS(grf_local_id, 0x00, NUM_INDUSTRYTYPES_PER_GRF));
|
||||
|
||||
grfid = BSWAP32(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
grfid = std::byteswap(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
return _industry_mngr.GetID(grf_local_id, grfid);
|
||||
}
|
||||
|
||||
@@ -19,14 +19,14 @@ ScriptNewGRFList::ScriptNewGRFList()
|
||||
{
|
||||
for (auto c = _grfconfig; c != nullptr; c = c->next) {
|
||||
if (!HasBit(c->flags, GCF_STATIC)) {
|
||||
this->AddItem(BSWAP32(c->ident.grfid));
|
||||
this->AddItem(std::byteswap(c->ident.grfid));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ bool ScriptNewGRF::IsLoaded(SQInteger grfid)
|
||||
{
|
||||
grfid = BSWAP32(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
grfid = std::byteswap(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
|
||||
for (auto c = _grfconfig; c != nullptr; c = c->next) {
|
||||
if (!HasBit(c->flags, GCF_STATIC) && c->ident.grfid == grfid) {
|
||||
@@ -39,7 +39,7 @@ ScriptNewGRFList::ScriptNewGRFList()
|
||||
|
||||
/* static */ SQInteger ScriptNewGRF::GetVersion(SQInteger grfid)
|
||||
{
|
||||
grfid = BSWAP32(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
grfid = std::byteswap(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
|
||||
for (auto c = _grfconfig; c != nullptr; c = c->next) {
|
||||
if (!HasBit(c->flags, GCF_STATIC) && c->ident.grfid == grfid) {
|
||||
@@ -52,7 +52,7 @@ ScriptNewGRFList::ScriptNewGRFList()
|
||||
|
||||
/* static */ std::optional<std::string> ScriptNewGRF::GetName(SQInteger grfid)
|
||||
{
|
||||
grfid = BSWAP32(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
grfid = std::byteswap(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
|
||||
for (auto c = _grfconfig; c != nullptr; c = c->next) {
|
||||
if (!HasBit(c->flags, GCF_STATIC) && c->ident.grfid == grfid) {
|
||||
|
||||
@@ -51,6 +51,6 @@
|
||||
{
|
||||
EnforcePrecondition(INVALID_OBJECT_TYPE, IsInsideBS(grf_local_id, 0x00, NUM_OBJECTS_PER_GRF));
|
||||
|
||||
grfid = BSWAP32(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
grfid = std::byteswap(GB(grfid, 0, 32)); // Match people's expectations.
|
||||
return _object_mngr.GetID(grf_local_id, grfid);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user