Remove AUTO_VAR macro and _toString function (#592)

This commit is contained in:
void_17
2026-03-06 02:11:18 +07:00
committed by GitHub
parent 7d6658fe5b
commit 55231bb8d3
294 changed files with 5067 additions and 5773 deletions

View File

@@ -79,7 +79,7 @@
//#define DEBUG_RENDER_SHOWS_PACKETS 1
//#define SPLITSCREEN_TEST
// If not disabled, this creates an event queue on a seperate thread so that the Level::tick calls can be offloaded
// If not disabled, this creates an event queue on a seperate thread so that the Level::tick calls can be offloaded
// from the main thread, and have longer to run, since it's called at 20Hz instead of 60
#define DISABLE_LEVELTICK_THREAD
@@ -96,7 +96,7 @@ TOUCHSCREENRECT QuickSelectRect[3]=
{
{ 560, 890, 1360, 980 },
{ 450, 840, 1449, 960 },
{ 320, 840, 1600, 970 },
{ 320, 840, 1600, 970 },
};
int QuickSelectBoxWidth[3]=
@@ -741,7 +741,7 @@ void Minecraft::run()
while (System::currentTimeMillis() >= lastTime + 1000)
{
fpsString = _toString<int>(frames) + L" fps, " + _toString<int>(Chunk::updates) + L" chunk updates";
fpsString = std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates";
Chunk::updates = 0;
lastTime += 1000;
frames = 0;
@@ -1286,7 +1286,7 @@ void Minecraft::run_middle()
if( pDLCPack )
{
if(!pDLCPack->hasPurchasedFile( DLCManager::e_DLCType_Texture, L"" ))
{
{
bTrialTexturepack=true;
}
}
@@ -1408,7 +1408,7 @@ void Minecraft::run_middle()
{
delete m_pPsPlusUpsell;
m_pPsPlusUpsell = NULL;
if ( ProfileManager.HasPlayStationPlus(i) )
{
app.DebugPrintf("<Minecraft.cpp> Player_%i is now authorised for PsPlus.\n", i);
@@ -2034,7 +2034,7 @@ void Minecraft::run_middle()
while (System::nanoTime() >= lastTime + 1000000000)
{
MemSect(31);
fpsString = _toString<int>(frames) + L" fps, " + _toString<int>(Chunk::updates) + L" chunk updates";
fpsString = std::to_wstring(frames) + L" fps, " + std::to_wstring(Chunk::updates) + L" chunk updates";
MemSect(0);
Chunk::updates = 0;
lastTime += 1000000000;
@@ -2231,7 +2231,7 @@ void Minecraft::levelTickThreadInitFunc()
{
AABB::CreateNewThreadStorage();
Vec3::CreateNewThreadStorage();
IntCache::CreateNewThreadStorage();
IntCache::CreateNewThreadStorage();
Compression::UseDefaultThreadStorage();
}
@@ -2861,10 +2861,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
shared_ptr<ItemInstance> heldItem = nullptr;
if (player->inventory->IsHeldItem())
{
heldItem = player->inventory->getSelected();
heldItem = player->inventory->getSelected();
}
int heldItemId = heldItem != NULL ? heldItem->getItem()->id : -1;
switch(entityType)
{
case eTYPE_CHICKEN:
@@ -2906,7 +2906,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
case eTYPE_COW:
{
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
shared_ptr<Animal> animal = dynamic_pointer_cast<Animal>(hitResult->entity);
if (animal->isLeashed() && animal->getLeashHolder() == player)
@@ -2970,7 +2970,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
*piUse=IDS_TOOLTIPS_MILK;
break;
case Item::shears_Id:
{
{
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
if(!animal->isBaby()) *piUse=IDS_TOOLTIPS_SHEAR;
}
@@ -2998,10 +2998,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
*piAction = IDS_TOOLTIPS_MINE;
*piUse = IDS_TOOLTIPS_RIDE; // are we in the minecart already? - 4J-JEV: Doesn't matter anymore.
break;
case eTYPE_MINECART_FURNACE:
*piAction = IDS_TOOLTIPS_MINE;
// if you have coal, it'll go. Is there an object in hand?
if (heldItemId == Item::coal_Id) *piUse=IDS_TOOLTIPS_USE;
break;
@@ -3082,7 +3082,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
shared_ptr<Pig> pig = dynamic_pointer_cast<Pig>(hitResult->entity);
if (pig->isLeashed() && pig->getLeashHolder() == player)
{
*piUse=IDS_TOOLTIPS_UNLEASH;
@@ -3225,7 +3225,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
shared_ptr<Ocelot> ocelot = dynamic_pointer_cast<Ocelot>(hitResult->entity);
if(player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
if (ocelot->isLeashed() && ocelot->getLeashHolder() == player)
{
*piUse = IDS_TOOLTIPS_UNLEASH;
@@ -3254,7 +3254,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
}
else
{
*piUse=IDS_TOOLTIPS_FEED;
*piUse=IDS_TOOLTIPS_FEED;
}
}
@@ -3277,7 +3277,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
}
}
break;
case eTYPE_PLAYER:
{
// Fix for #58576 - TU6: Content: Gameplay: Hit button prompt is available when attacking a host who has "Invisible" option turned on
@@ -3343,9 +3343,9 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
case eTYPE_HORSE:
{
shared_ptr<EntityHorse> horse = dynamic_pointer_cast<EntityHorse>(hitResult->entity);
bool heldItemIsFood = false, heldItemIsLove = false, heldItemIsArmour = false;
switch( heldItemId )
{
case Item::wheat_Id:
@@ -3400,7 +3400,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
*piUse = IDS_TOOLTIPS_FEED;
}
}
else if ( player->isSneaking()
else if ( player->isSneaking()
|| (heldItemId == Item::saddle_Id)
|| (horse->canWearArmor() && heldItemIsArmour)
)
@@ -3409,7 +3409,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
if (*piUse == -1) *piUse = IDS_TOOLTIPS_OPEN;
}
else if ( horse->canWearBags()
&& !horse->isChestedHorse()
&& !horse->isChestedHorse()
&& (heldItemId == Tile::chest_Id) )
{
// 4j - Attach saddle-bags (chest) to donkey or mule.
@@ -3431,7 +3431,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
// 4j - Ride tamed horse.
*piUse = IDS_TOOLTIPS_MOUNT;
}
if (player->isAllowedToAttackAnimals()) *piAction=IDS_TOOLTIPS_HIT;
}
break;
@@ -3471,7 +3471,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
}
}
*piAction=IDS_TOOLTIPS_HIT;
break;
break;
}
break;
}
@@ -3666,7 +3666,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
player->abilities.debugflying = !player->abilities.debugflying;
player->abilities.flying = !player->abilities.flying;
}
#endif // PSVITA
#endif // PSVITA
}
#endif
@@ -3743,7 +3743,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
}
__uint64 ullButtonsPressed=player->ullButtonsPressed;
bool selected = false;
#ifdef __PSVITA__
// 4J-PB - use the touchscreen for quickselect
@@ -3768,7 +3768,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
shared_ptr<ItemInstance> selectedItem = player->getSelectedItem();
// Dropping items happens over network, so if we only have one then assume that we dropped it and should hide the item
int iCount=0;
if(selectedItem != NULL) iCount=selectedItem->GetCount();
if(selectedItem != NULL && !( (player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_DROP)) && selectedItem->GetCount() == 1))
{
@@ -4077,7 +4077,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
}
#ifdef __PS3__
// while(!g_tickLevelQueue.empty())
// while(!g_tickLevelQueue.empty())
// {
// Level* pLevel = g_tickLevelQueue.front();
// g_tickLevelQueue.pop();
@@ -4305,7 +4305,7 @@ void Minecraft::setLevel(MultiPlayerLevel *level, int message /*=-1*/, shared_pt
player->resetPos();
gameMode->initPlayer(player);
player->SetXboxPad(iPrimaryPlayer);
for(int i=0;i<XUSER_MAX_COUNT;i++)
@@ -4432,7 +4432,7 @@ void Minecraft::prepareLevel(int title)
wstring Minecraft::gatherStats1()
{
//return levelRenderer->gatherStats1();
return L"Time to autosave: " + _toString<unsigned int>( app.SecondsToAutosave() ) + L"s";
return L"Time to autosave: " + std::to_wstring( app.SecondsToAutosave() ) + L"s";
}
wstring Minecraft::gatherStats2()
@@ -4610,7 +4610,7 @@ void Minecraft::startAndConnectTo(const wstring& name, const wstring& sid, const
}
else
{
minecraft->user = new User(L"Player" + _toString<int>(System::currentTimeMillis() % 1000), L"");
minecraft->user = new User(L"Player" + std::to_wstring(System::currentTimeMillis() % 1000), L"");
}
}
//else
@@ -4691,7 +4691,7 @@ void Minecraft::main()
}
app.DebugPrintf("\n\n\n\n\n");
for(unsigned int i = 0; i < 256; ++i)
{
if(Tile::tiles[i] != NULL)
@@ -4705,7 +4705,7 @@ void Minecraft::main()
// 4J-PB - Can't call this for the first 5 seconds of a game - MS rule
//if (ProfileManager.IsFullVersion())
{
name = L"Player" + _toString<__int64>(System::currentTimeMillis() % 1000);
name = L"Player" + std::to_wstring(System::currentTimeMillis() % 1000);
sessionId = L"-";
/* 4J - TODO - get a session ID from somewhere?
if (args.length > 0) name = args[0];
@@ -5106,8 +5106,8 @@ void Minecraft::tickAllConnections()
bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
{
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName));
if( it == m_pendingTextureRequests.end() )
auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
if( it == m_pendingTextureRequests.end() )
{
m_pendingTextureRequests.push_back(textureName);
return true;
@@ -5117,8 +5117,8 @@ bool Minecraft::addPendingClientTextureRequest(const wstring &textureName)
void Minecraft::handleClientTextureReceived(const wstring &textureName)
{
AUTO_VAR(it, find( m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName));
if( it != m_pendingTextureRequests.end() )
auto it = find(m_pendingTextureRequests.begin(), m_pendingTextureRequests.end(), textureName);
if( it != m_pendingTextureRequests.end() )
{
m_pendingTextureRequests.erase(it);
}
@@ -5148,8 +5148,8 @@ int Minecraft::MustSignInReturnedPSN(void *pParam, int iPad, C4JStorage::EMessag
{
Minecraft* pMinecraft = (Minecraft *)pParam;
if(result == C4JStorage::EMessage_ResultAccept)
{
if(result == C4JStorage::EMessage_ResultAccept)
{
SQRNetworkManager_Orbis::AttemptPSNSignIn(&Minecraft::InGame_SignInReturned, pMinecraft, false, iPad);
}