diff --git a/Minecraft.Client/Build/Common/App_structs.h b/Minecraft.Client/Build/Common/App_structs.h index e4465dad8..47cc5167c 100644 --- a/Minecraft.Client/Build/Common/App_structs.h +++ b/Minecraft.Client/Build/Common/App_structs.h @@ -224,4 +224,4 @@ typedef struct _TMSPPRequest } TMSPPRequest; -typedef pair SceneStackPair; +typedef std::pair SceneStackPair; diff --git a/Minecraft.Client/Build/Common/DLC/DLCManager.h b/Minecraft.Client/Build/Common/DLC/DLCManager.h index 99854fd49..41ffb3646 100644 --- a/Minecraft.Client/Build/Common/DLC/DLCManager.h +++ b/Minecraft.Client/Build/Common/DLC/DLCManager.h @@ -89,8 +89,8 @@ public: DWORD checkForCorruptDLCAndAlert(bool showMessage = true); bool readDLCDataFile(DWORD &dwFilesProcessed, const std::wstring &path, DLCPack *pack, bool fromArchive = false); - bool readDLCDataFile(DWORD &dwFilesProcessed, const string &path, DLCPack *pack, bool fromArchive = false); - DWORD retrievePackIDFromDLCDataFile(const string &path, DLCPack *pack); + bool readDLCDataFile(DWORD &dwFilesProcessed, const std::string &path, DLCPack *pack, bool fromArchive = false); + DWORD retrievePackIDFromDLCDataFile(const std::string &path, DLCPack *pack); private: bool processDLCDataFile(DWORD &dwFilesProcessed, PBYTE pbData, DWORD dwLength, DLCPack *pack); diff --git a/Minecraft.Client/Level/ServerLevel.h b/Minecraft.Client/Level/ServerLevel.h index 91b190530..3605eb195 100644 --- a/Minecraft.Client/Level/ServerLevel.h +++ b/Minecraft.Client/Level/ServerLevel.h @@ -18,7 +18,7 @@ private: PlayerChunkMap *chunkMap; CRITICAL_SECTION m_tickNextTickCS; // 4J added - set tickNextTickList; // 4J Was TreeSet + std::set tickNextTickList; // 4J Was TreeSet std::unordered_set tickNextTickSet; // 4J Was HashSet std::vector m_queuedSendTileUpdates; // 4J added diff --git a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.inl b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.inl index 1e6990083..42e337657 100644 --- a/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.inl +++ b/Minecraft.Client/Platform/Linux/Stubs/DirectXMath/DirectXCollision.inl @@ -1767,9 +1767,9 @@ inline bool XM_CALLCONV BoundingBox::Intersects(FXMVECTOR Origin, FXMVECTOR Dire // t_min.x = maximum( t_min.x, t_min.y, t_min.z ); // t_max.x = minimum( t_max.x, t_max.y, t_max.z ); t_min = XMVectorMax(t_min, XMVectorSplatY(t_min)); // x = max(x,y) - t_min = XMVectorMax(t_min, XMVectorSplatZ(t_min)); // x = max(max(x,y),z) + t_min = XMVectorMax(t_min, XMVectorSplatZ(t_min)); // x = max(std::max(x,y),z) t_max = XMVectorMin(t_max, XMVectorSplatY(t_max)); // x = min(x,y) - t_max = XMVectorMin(t_max, XMVectorSplatZ(t_max)); // x = min(min(x,y),z) + t_max = XMVectorMin(t_max, XMVectorSplatZ(t_max)); // x = min(std::min(x,y),z) // if ( t_min > t_max ) return false; XMVECTOR NoIntersection = XMVectorGreater(XMVectorSplatX(t_min), XMVectorSplatX(t_max)); @@ -2596,9 +2596,9 @@ inline bool XM_CALLCONV BoundingOrientedBox::Intersects(FXMVECTOR Origin, FXMVEC // t_min.x = maximum( t_min.x, t_min.y, t_min.z ); // t_max.x = minimum( t_max.x, t_max.y, t_max.z ); t_min = XMVectorMax(t_min, XMVectorSplatY(t_min)); // x = max(x,y) - t_min = XMVectorMax(t_min, XMVectorSplatZ(t_min)); // x = max(max(x,y),z) + t_min = XMVectorMax(t_min, XMVectorSplatZ(t_min)); // x = max(std::max(x,y),z) t_max = XMVectorMin(t_max, XMVectorSplatY(t_max)); // x = min(x,y) - t_max = XMVectorMin(t_max, XMVectorSplatZ(t_max)); // x = min(min(x,y),z) + t_max = XMVectorMin(t_max, XMVectorSplatZ(t_max)); // x = min(std::min(x,y),z) // if ( t_min > t_max ) return false; XMVECTOR NoIntersection = XMVectorGreater(XMVectorSplatX(t_min), XMVectorSplatX(t_max)); diff --git a/Minecraft.Client/Platform/PS3/PS3Extras/DirectX/DirectXCollision.inl b/Minecraft.Client/Platform/PS3/PS3Extras/DirectX/DirectXCollision.inl index 34d443829..b8c2c6107 100644 --- a/Minecraft.Client/Platform/PS3/PS3Extras/DirectX/DirectXCollision.inl +++ b/Minecraft.Client/Platform/PS3/PS3Extras/DirectX/DirectXCollision.inl @@ -1761,9 +1761,9 @@ inline bool BoundingBox::Intersects( FXMVECTOR Origin, FXMVECTOR Direction, floa // t_min.x = maximum( t_min.x, t_min.y, t_min.z ); // t_max.x = minimum( t_max.x, t_max.y, t_max.z ); t_min = XMVectorMax( t_min, XMVectorSplatY( t_min ) ); // x = max(x,y) - t_min = XMVectorMax( t_min, XMVectorSplatZ( t_min ) ); // x = max(max(x,y),z) + t_min = XMVectorMax( t_min, XMVectorSplatZ( t_min ) ); // x = max(std::max(x,y),z) t_max = XMVectorMin( t_max, XMVectorSplatY( t_max ) ); // x = min(x,y) - t_max = XMVectorMin( t_max, XMVectorSplatZ( t_max ) ); // x = min(min(x,y),z) + t_max = XMVectorMin( t_max, XMVectorSplatZ( t_max ) ); // x = min(std::min(x,y),z) // if ( t_min > t_max ) return false; XMVECTOR NoIntersection = XMVectorGreater( XMVectorSplatX( t_min ), XMVectorSplatX( t_max ) ); @@ -2589,9 +2589,9 @@ inline bool BoundingOrientedBox::Intersects( FXMVECTOR Origin, FXMVECTOR Directi // t_min.x = maximum( t_min.x, t_min.y, t_min.z ); // t_max.x = minimum( t_max.x, t_max.y, t_max.z ); t_min = XMVectorMax( t_min, XMVectorSplatY( t_min ) ); // x = max(x,y) - t_min = XMVectorMax( t_min, XMVectorSplatZ( t_min ) ); // x = max(max(x,y),z) + t_min = XMVectorMax( t_min, XMVectorSplatZ( t_min ) ); // x = max(std::max(x,y),z) t_max = XMVectorMin( t_max, XMVectorSplatY( t_max ) ); // x = min(x,y) - t_max = XMVectorMin( t_max, XMVectorSplatZ( t_max ) ); // x = min(min(x,y),z) + t_max = XMVectorMin( t_max, XMVectorSplatZ( t_max ) ); // x = min(std::min(x,y),z) // if ( t_min > t_max ) return false; XMVECTOR NoIntersection = XMVectorGreater( XMVectorSplatX( t_min ), XMVectorSplatX( t_max ) ); diff --git a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp index e9813f1e4..b2a52ff73 100644 --- a/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp +++ b/Minecraft.Client/Platform/Xbox/Network/PlatformNetworkManagerXbox.cpp @@ -1298,7 +1298,7 @@ void CPlatformNetworkManagerXbox::SearchForGames() return; } - DWORD sessionIDCount = min( XSESSION_SEARCH_MAX_IDS, friendsSessions[m_lastSearchPad].size() ); + DWORD sessionIDCount = std::min( XSESSION_SEARCH_MAX_IDS, friendsSessions[m_lastSearchPad].size() ); SessionID *sessionIDList = new SessionID[sessionIDCount]; for(DWORD i = 0; i < sessionIDCount; ++i) diff --git a/Minecraft.Client/Player/ServerPlayer.cpp b/Minecraft.Client/Player/ServerPlayer.cpp index 35e3e94a4..e459ebd9c 100644 --- a/Minecraft.Client/Player/ServerPlayer.cpp +++ b/Minecraft.Client/Player/ServerPlayer.cpp @@ -253,7 +253,7 @@ void ServerPlayer::flushEntitiesToRemove() if (!entitiesToRemove.empty()) { int sz = entitiesToRemove.size(); - int amount = min(sz, RemoveEntitiesPacket::MAX_PER_PACKET); + int amount = std::min(sz, RemoveEntitiesPacket::MAX_PER_PACKET); intArray ids(amount); int pos = 0; diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index f620c8331..5544ff787 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -983,7 +983,7 @@ float GameRenderer::getNightVisionScale(std::shared_ptr player, float a) } else { - float flash = max(0.0f, (float)duration - a); + float flash = std::max(0.0f, (float)duration - a); return .7f + Mth::sin(flash * PI * .05f) * .3f; // was: .7 + sin(flash*pi*0.2) * .3 } } @@ -2144,7 +2144,7 @@ void GameRenderer::setupFog(int i, float alpha) if (mc->level->dimension->isFoggyAt((int) player->x, (int) player->z)) { glFogf(GL_FOG_START, distance * 0.05f); - glFogf(GL_FOG_END, min(distance, 16 * 16 * .75f) * .5f); + glFogf(GL_FOG_END, std::min(distance, 16 * 16 * .75f) * .5f); } } diff --git a/Minecraft.Client/Rendering/Tesselator.cpp b/Minecraft.Client/Rendering/Tesselator.cpp index 9122c26c7..5f1231ff4 100644 --- a/Minecraft.Client/Rendering/Tesselator.cpp +++ b/Minecraft.Client/Rendering/Tesselator.cpp @@ -1022,9 +1022,9 @@ uint32_t _ConvertF32toX11Y11Z10N(float x, float y, float z) if (z<-1.0f || z>1.0f) { printf("Value (%5.3f) should be in range [-1..1]. Conversion will clamp to X11Y11Z10N.\n", z); } #endif - const uint32_t uX = ((int32_t(max(min(((x)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_X_MASK >> X11Y11Z10N_X_SHIFT)) << X11Y11Z10N_X_SHIFT); - const uint32_t uY = ((int32_t(max(min(((y)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_Y_MASK >> X11Y11Z10N_Y_SHIFT)) << X11Y11Z10N_Y_SHIFT); - const uint32_t uZ = ((int32_t(max(min(((z)*1023.f - 1.f)*0.5f, 511.f), -512.f )) & (X11Y11Z10N_Z_MASK >> X11Y11Z10N_Z_SHIFT)) << X11Y11Z10N_Z_SHIFT); + const uint32_t uX = ((int32_t(std::max(std::min(((x)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_X_MASK >> X11Y11Z10N_X_SHIFT)) << X11Y11Z10N_X_SHIFT); + const uint32_t uY = ((int32_t(std::max(std::min(((y)*2047.f - 1.f)*0.5f, 1023.f), -1024.f)) & (X11Y11Z10N_Y_MASK >> X11Y11Z10N_Y_SHIFT)) << X11Y11Z10N_Y_SHIFT); + const uint32_t uZ = ((int32_t(std::max(std::min(((z)*1023.f - 1.f)*0.5f, 511.f), -512.f )) & (X11Y11Z10N_Z_MASK >> X11Y11Z10N_Z_SHIFT)) << X11Y11Z10N_Z_SHIFT); const uint32_t xyz = uX | uY | uZ; return xyz; } diff --git a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp index 1a30bca3f..7f7d99b9d 100644 --- a/Minecraft.Client/Textures/Stitching/StitchSlot.cpp +++ b/Minecraft.Client/Textures/Stitching/StitchSlot.cpp @@ -76,8 +76,8 @@ bool StitchSlot::add(TextureHolder *textureHolder) // (In the case of this ASCII drawing, it's the 'right hand side' that should win) // The 'fattest' area should be used (or when tied, the right hand one) - int right = max(height, spareWidth); - int bottom = max(width, spareHeight); + int right = std::max(height, spareWidth); + int bottom = std::max(width, spareHeight); if (right >= bottom) { subSlots->push_back(new StitchSlot(originX, originY + textureHeight, textureWidth, spareHeight)); diff --git a/Minecraft.Client/Textures/Stitching/Stitcher.cpp b/Minecraft.Client/Textures/Stitching/Stitcher.cpp index 6b76bc216..4d8be3f12 100644 --- a/Minecraft.Client/Textures/Stitching/Stitcher.cpp +++ b/Minecraft.Client/Textures/Stitching/Stitcher.cpp @@ -154,7 +154,7 @@ bool Stitcher::addToStorage(TextureHolder *textureHolder) */ bool Stitcher::expand(TextureHolder *textureHolder) { - int minDistance = min(textureHolder->getHeight(), textureHolder->getWidth()); + int minDistance = std::min(textureHolder->getHeight(), textureHolder->getWidth()); bool firstAddition = storageX == 0 && storageY == 0; // It couldn't fit, decide which direction to grow to @@ -175,7 +175,7 @@ bool Stitcher::expand(TextureHolder *textureHolder) } // Even if the smallest side fits the larger might not >.> - int maxDistance = max(textureHolder->getHeight(), textureHolder->getWidth()); + int maxDistance = std::max(textureHolder->getHeight(), textureHolder->getWidth()); // TODO: This seems wrong ... if (firstAddition && !xCanGrow && !(smallestEncompassingPowerOfTwo(storageY + maxDistance) <= maxHeight)) { diff --git a/Minecraft.Client/Textures/TextureHolder.cpp b/Minecraft.Client/Textures/TextureHolder.cpp index 085e413c0..4ea7d3d9f 100644 --- a/Minecraft.Client/Textures/TextureHolder.cpp +++ b/Minecraft.Client/Textures/TextureHolder.cpp @@ -52,7 +52,7 @@ void TextureHolder::setForcedScale(int targetSize) return; } - scale = (float) targetSize / min(width, height); + scale = (float) targetSize / std::min(width, height); } //@Override diff --git a/Minecraft.Client/UI/Rect2i.cpp b/Minecraft.Client/UI/Rect2i.cpp index b56bfd7eb..70a07e8ca 100644 --- a/Minecraft.Client/UI/Rect2i.cpp +++ b/Minecraft.Client/UI/Rect2i.cpp @@ -21,10 +21,10 @@ Rect2i *Rect2i::intersect(const Rect2i *other) int x3 = x2 + other->getWidth(); int y3 = y2 + other->getHeight(); - xPos = max(x0, x2); - yPos = max(y0, y2); - width = max(0, min(x1, x3) - xPos); - height = max(0, min(y1, y3) - yPos); + xPos = std::max(x0, x2); + yPos = std::max(y0, y2); + width = std::max(0, std::min(x1, x3) - xPos); + height = std::max(0, std::min(y1, y3) - yPos); return this; } diff --git a/Minecraft.World/AI/Control/BodyControl.cpp b/Minecraft.World/AI/Control/BodyControl.cpp index c9291df34..ee7a6b64a 100644 --- a/Minecraft.World/AI/Control/BodyControl.cpp +++ b/Minecraft.World/AI/Control/BodyControl.cpp @@ -39,7 +39,7 @@ void BodyControl::clientTick() { ++timeStill; static const int timeStillBeforeTurn = 10; - if (timeStill > timeStillBeforeTurn) clampAngle = max(1 - (timeStill - timeStillBeforeTurn) / 10.f, 0.0f) * maxClampAngle; + if (timeStill > timeStillBeforeTurn) clampAngle = std::max(1 - (timeStill - timeStillBeforeTurn) / 10.f, 0.0f) * maxClampAngle; } mob->yBodyRot = clamp(mob->yHeadRot, mob->yBodyRot, clampAngle); diff --git a/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp b/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp index 358366279..8917d87b0 100644 --- a/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp +++ b/Minecraft.World/AI/Goals/ArrowAttackGoal.cpp @@ -60,7 +60,7 @@ void ArrowAttackGoal::tick() mob->getLookControl()->setLookAt(tar, 30, 30); - attackTime = max(attackTime - 1, 0); + attackTime = std::max(attackTime - 1, 0); if (attackTime > 0) return; if (targetDistSqr > attackRadiusSqr || !canSee) return; fireAtTarget(); diff --git a/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp b/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp index 7c437ac08..9c9d666ac 100644 --- a/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp +++ b/Minecraft.World/AI/Goals/ControlledByPlayerGoal.cpp @@ -80,7 +80,7 @@ void ControlledByPlayerGoal::tick() float sin = Mth::sin(pig->yRot * PI / 180); float cos = Mth::cos(pig->yRot * PI / 180); float aproxSpeed = pig->getSpeed() * friction2; - float dist = max((int)moveSpeed, 1); + float dist = std::max((int)moveSpeed, 1); dist = aproxSpeed / dist; float normMoveSpeed = moveSpeed * dist; float xa = -(normMoveSpeed * sin); diff --git a/Minecraft.World/AI/Goals/DoorInteractGoal.cpp b/Minecraft.World/AI/Goals/DoorInteractGoal.cpp index 2b3e0f10d..c441a3fcf 100644 --- a/Minecraft.World/AI/Goals/DoorInteractGoal.cpp +++ b/Minecraft.World/AI/Goals/DoorInteractGoal.cpp @@ -23,7 +23,7 @@ bool DoorInteractGoal::canUse() Path *path = pathNav->getPath(); if (path == NULL || path->isDone() || !pathNav->canOpenDoors()) return false; - for (int i = 0; i < min(path->getIndex() + 2, path->getSize()); ++i) + for (int i = 0; i < std::min(path->getIndex() + 2, path->getSize()); ++i) { Node *n = path->get(i); doorX = n->x; diff --git a/Minecraft.World/AI/Goals/EatTileGoal.cpp b/Minecraft.World/AI/Goals/EatTileGoal.cpp index 3cd4dd389..679e6f24f 100644 --- a/Minecraft.World/AI/Goals/EatTileGoal.cpp +++ b/Minecraft.World/AI/Goals/EatTileGoal.cpp @@ -51,7 +51,7 @@ int EatTileGoal::getEatAnimationTick() void EatTileGoal::tick() { - eatAnimationTick = max(0, eatAnimationTick - 1); + eatAnimationTick = std::max(0, eatAnimationTick - 1); if (eatAnimationTick != 4) return; int xx = Mth::floor(mob->x); diff --git a/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp b/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp index 72738fb41..8d107c6ae 100644 --- a/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp +++ b/Minecraft.World/AI/Goals/MeleeAttackGoal.cpp @@ -86,7 +86,7 @@ void MeleeAttackGoal::tick() } } - attackTime = max(attackTime - 1, 0); + attackTime = std::max(attackTime - 1, 0); double meleeRadiusSqr = (mob->bbWidth * 2) * (mob->bbWidth * 2); if (mob->distanceToSqr(target.lock()->x, target.lock()->bb->y0, target.lock()->z) > meleeRadiusSqr) return; diff --git a/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp b/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp index 6accd7bbd..9d59f233f 100644 --- a/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp +++ b/Minecraft.World/AI/Goals/OcelotAttackGoal.cpp @@ -52,7 +52,7 @@ void OzelotAttackGoal::tick() mob->getNavigation()->moveTo(target.lock(), speed); - attackTime = max(attackTime - 1, 0); + attackTime = std::max(attackTime - 1, 0); if (distSqr > meleeRadiusSqr) return; if (attackTime > 0) return; diff --git a/Minecraft.World/Blocks/FallingTile.cpp b/Minecraft.World/Blocks/FallingTile.cpp index a683ea9b8..bf38adac2 100644 --- a/Minecraft.World/Blocks/FallingTile.cpp +++ b/Minecraft.World/Blocks/FallingTile.cpp @@ -159,7 +159,7 @@ void FallingTile::causeFallDamage(float distance) //for (Entity entity : entities) for(AUTO_VAR(it,entities->begin()); it != entities->end(); ++it) { - (*it)->hurt(source, min(Mth::floor(dmg * fallDamageAmount), fallDamageMax)); + (*it)->hurt(source, std::min(Mth::floor(dmg * fallDamageAmount), fallDamageMax)); } if (tile == Tile::anvil_Id && random->nextFloat() < 0.05f + (dmg * 0.05)) { diff --git a/Minecraft.World/Containers/FurnaceResultSlot.cpp b/Minecraft.World/Containers/FurnaceResultSlot.cpp index 5a7bbe3ae..87b77277a 100644 --- a/Minecraft.World/Containers/FurnaceResultSlot.cpp +++ b/Minecraft.World/Containers/FurnaceResultSlot.cpp @@ -24,7 +24,7 @@ std::shared_ptr FurnaceResultSlot::remove(int c) { if (hasItem()) { - removeCount += min(c, getItem()->count); + removeCount += std::min(c, getItem()->count); } return Slot::remove(c); } diff --git a/Minecraft.World/Containers/MerchantResultSlot.cpp b/Minecraft.World/Containers/MerchantResultSlot.cpp index 9b02fe459..0a1d08aeb 100644 --- a/Minecraft.World/Containers/MerchantResultSlot.cpp +++ b/Minecraft.World/Containers/MerchantResultSlot.cpp @@ -20,7 +20,7 @@ std::shared_ptr MerchantResultSlot::remove(int c) { if (hasItem()) { - removeCount += min(c, getItem()->count); + removeCount += std::min(c, getItem()->count); } return Slot::remove(c); } diff --git a/Minecraft.World/Containers/RepairMenu.cpp b/Minecraft.World/Containers/RepairMenu.cpp index 65c6432bf..d88319b7b 100644 --- a/Minecraft.World/Containers/RepairMenu.cpp +++ b/Minecraft.World/Containers/RepairMenu.cpp @@ -82,7 +82,7 @@ void RepairMenu::createResult() if (result->isDamageableItem() && Item::items[result->id]->isValidRepairItem(input, addition)) { - int repairAmount = min(result->getDamageValue(), result->getMaxDamage() / 4); + int repairAmount = std::min(result->getDamageValue(), result->getMaxDamage() / 4); if (repairAmount <= 0) { resultSlots->setItem(0, nullptr); @@ -96,9 +96,9 @@ void RepairMenu::createResult() { int resultDamage = result->getDamageValue() - repairAmount; result->setAuxValue(resultDamage); - price += max(1, repairAmount / 100) + enchantments->size(); + price += std::max(1, repairAmount / 100) + enchantments->size(); - repairAmount = min(result->getDamageValue(), result->getMaxDamage() / 4); + repairAmount = std::min(result->getDamageValue(), result->getMaxDamage() / 4); count++; } repairItemCountCost = count; @@ -124,10 +124,10 @@ void RepairMenu::createResult() if (resultDamage < result->getAuxValue()) { result->setAuxValue(resultDamage); - price += max(1, additional / 100); + price += std::max(1, additional / 100); if (DEBUG_COST) { - app.DebugPrintf("Repairing; price is now %d (went up by %d)\n", price, max(1, additional / 100) ); + app.DebugPrintf("Repairing; price is now %d (went up by %d)\n", price, std::max(1, additional / 100) ); } } } @@ -141,7 +141,7 @@ void RepairMenu::createResult() AUTO_VAR(localIt, enchantments->find(id)); int current = localIt != enchantments->end() ? localIt->second : 0; int level = it->second; - level = (current == level) ? level += 1 : max(level, current); + level = (current == level) ? level += 1 : std::max(level, current); int extra = level - current; bool compatible = enchantment->canEnchant(input); @@ -183,7 +183,7 @@ void RepairMenu::createResult() break; } - if (usingBook) fee = max(1, fee / 2); + if (usingBook) fee = std::max(1, fee / 2); price += fee * extra; if (DEBUG_COST) @@ -244,7 +244,7 @@ void RepairMenu::createResult() break; } - if (usingBook) fee = max(1, fee / 2); + if (usingBook) fee = std::max(1, fee / 2); tax += count + level * fee; if (DEBUG_COST) @@ -253,7 +253,7 @@ void RepairMenu::createResult() } } - if (usingBook) tax = max(1, tax / 2); + if (usingBook) tax = std::max(1, tax / 2); cost = tax + price; if (price <= 0) diff --git a/Minecraft.World/Containers/ResultSlot.cpp b/Minecraft.World/Containers/ResultSlot.cpp index a3d5e3104..40696e333 100644 --- a/Minecraft.World/Containers/ResultSlot.cpp +++ b/Minecraft.World/Containers/ResultSlot.cpp @@ -22,7 +22,7 @@ std::shared_ptr ResultSlot::remove(int c) { if (hasItem()) { - removeCount += min(c, getItem()->count); + removeCount += std::min(c, getItem()->count); } return Slot::remove(c); } diff --git a/Minecraft.World/Enchantments/EnchantmentHelper.cpp b/Minecraft.World/Enchantments/EnchantmentHelper.cpp index 98bb2b3c6..2cce4907e 100644 --- a/Minecraft.World/Enchantments/EnchantmentHelper.cpp +++ b/Minecraft.World/Enchantments/EnchantmentHelper.cpp @@ -288,11 +288,11 @@ int EnchantmentHelper::getEnchantmentCost(Random *random, int slot, int bookcase int selected = random->nextInt(8) + 1 + (bookcases >> 1) + random->nextInt(bookcases + 1); if (slot == 0) { - return max((selected / 3), 1); + return std::max((selected / 3), 1); } if (slot == 1) { - return max(selected, bookcases * 2); + return std::max(selected, bookcases * 2); } return selected; } diff --git a/Minecraft.World/Entities/HangingEntity.cpp b/Minecraft.World/Entities/HangingEntity.cpp index bd94c4da0..a996c756f 100644 --- a/Minecraft.World/Entities/HangingEntity.cpp +++ b/Minecraft.World/Entities/HangingEntity.cpp @@ -86,7 +86,7 @@ void HangingEntity::setDir(int dir) float y1 = y + h + ss; float z0 = z - d - ss; float z1 = z + d + ss; - bb->set(min(x0,x1), min(y0,y1), min(z0,z1), max(x0,x1), max(y0,y1), max(z0,z1)); + bb->set(std::min(x0,x1), std::min(y0,y1), std::min(z0,z1), std::max(x0,x1), std::max(y0,y1), std::max(z0,z1)); } float HangingEntity::offs(int w) @@ -117,8 +117,8 @@ bool HangingEntity::survives() } else { - int ws = max(1, getWidth() / 16); - int hs = max(1, getHeight() / 16); + int ws = std::max(1, getWidth() / 16); + int hs = std::max(1, getHeight() / 16); int xt = xTile; int yt = yTile; diff --git a/Minecraft.World/Entities/ItemEntity.cpp b/Minecraft.World/Entities/ItemEntity.cpp index e29abb518..7a5a03d74 100644 --- a/Minecraft.World/Entities/ItemEntity.cpp +++ b/Minecraft.World/Entities/ItemEntity.cpp @@ -158,8 +158,8 @@ bool ItemEntity::merge(std::shared_ptr target) if (targetItem->count + myItem->count > targetItem->getMaxStackSize()) return false; targetItem->count += myItem->count; - target->throwTime = max(target->throwTime, this->throwTime); - target->age = min(target->age, this->age); + target->throwTime = std::max(target->throwTime, this->throwTime); + target->age = std::min(target->age, this->age); target->setItem(targetItem); remove(); diff --git a/Minecraft.World/Entities/Mobs/EnderDragon.cpp b/Minecraft.World/Entities/Mobs/EnderDragon.cpp index 099c58b52..99a11462c 100644 --- a/Minecraft.World/Entities/Mobs/EnderDragon.cpp +++ b/Minecraft.World/Entities/Mobs/EnderDragon.cpp @@ -879,7 +879,7 @@ void EnderDragon::findNewTarget() if(!newTarget && m_currentPath != NULL && m_currentPath->isDone()) { // Distance is 64, which is the radius of the circle - int eggHeight = max(level->seaLevel + 5, level->getTopSolidBlock(PODIUM_X_POS,PODIUM_Z_POS)); //level->getHeightmap(4,4); + int eggHeight = std::max(level->seaLevel + 5, level->getTopSolidBlock(PODIUM_X_POS,PODIUM_Z_POS)); //level->getHeightmap(4,4); playerNearestToEgg = level->getNearestPlayer(PODIUM_X_POS, eggHeight, PODIUM_Z_POS, 64.0); double dist = 64.0f; if(playerNearestToEgg != NULL) @@ -950,7 +950,7 @@ void EnderDragon::findNewTarget() int currentNodeIndex = findClosestNode(); // To get the angle to the player correct when landing, head to a node diametrically opposite the player, then swoop in to 4,4 - int eggHeight = max( level->seaLevel + 5, level->getTopSolidBlock(PODIUM_X_POS,PODIUM_Z_POS) ); //level->getHeightmap(4,4); + int eggHeight = std::max( level->seaLevel + 5, level->getTopSolidBlock(PODIUM_X_POS,PODIUM_Z_POS) ); //level->getHeightmap(4,4); playerNearestToEgg = level->getNearestPlayer(PODIUM_X_POS, eggHeight, PODIUM_Z_POS, 128.0); int targetNodeIndex = 0 ; @@ -1568,7 +1568,7 @@ int EnderDragon::findClosestNode() } // Fix for #77202 - TU9: Content: Gameplay: The Ender Dragon sometimes flies through terrain // Add minimum height - nodeY = max( (level->seaLevel + 10), level->getTopSolidBlock(nodeX, nodeZ) + yAdjustment ); + nodeY = std::max( (level->seaLevel + 10), level->getTopSolidBlock(nodeX, nodeZ) + yAdjustment ); app.DebugPrintf("Node %d is at (%d,%d,%d)\n", i, nodeX, nodeY, nodeZ); diff --git a/Minecraft.World/Entities/Mobs/Sheep.cpp b/Minecraft.World/Entities/Mobs/Sheep.cpp index 18beaab97..9b75c0b80 100644 --- a/Minecraft.World/Entities/Mobs/Sheep.cpp +++ b/Minecraft.World/Entities/Mobs/Sheep.cpp @@ -86,7 +86,7 @@ void Sheep::newServerAiStep() void Sheep::aiStep() { - if (level->isClientSide) eatAnimationTick = max(0, eatAnimationTick - 1); + if (level->isClientSide) eatAnimationTick = std::max(0, eatAnimationTick - 1); Animal::aiStep(); } diff --git a/Minecraft.World/Entities/Mobs/Zombie.cpp b/Minecraft.World/Entities/Mobs/Zombie.cpp index 276b0a194..854fb4aaf 100644 --- a/Minecraft.World/Entities/Mobs/Zombie.cpp +++ b/Minecraft.World/Entities/Mobs/Zombie.cpp @@ -295,7 +295,7 @@ void Zombie::startConverting(int time) getEntityData()->set(DATA_CONVERTING_ID, (uint8_t) 1); removeEffect(MobEffect::weakness->id); - addEffect(new MobEffectInstance(MobEffect::damageBoost->id, time, min(level->difficulty - 1, 0))); + addEffect(new MobEffectInstance(MobEffect::damageBoost->id, time, std::min(level->difficulty - 1, 0))); level->broadcastEntityEvent(shared_from_this(), EntityEvent::ZOMBIE_CONVERTING); } diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp index a41af925d..b64dcb922 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileOriginal.cpp @@ -60,7 +60,7 @@ ConsoleSaveFileOriginal::ConsoleSaveFileOriginal(const std::wstring &fileName, L if( forceCleanSave ) fileSize = 0; - DWORD heapSize = max( fileSize, (DWORD)(1024 * 1024 * 2)); // 4J Stu - Our files are going to be bigger than 2MB so allocate high to start with + DWORD heapSize = std::max( fileSize, (DWORD)(1024 * 1024 * 2)); // 4J Stu - Our files are going to be bigger than 2MB so allocate high to start with // Initially committ enough room to store headSize bytes (using CSF_PAGE_SIZE pages, so rounding up here). We should only ever have one save file at a time, // and the pages should be decommitted in the dtor, so pages committed should always be zero at this point. diff --git a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp index 63f58bee4..7c319a4c8 100644 --- a/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp +++ b/Minecraft.World/IO/Files/ConsoleSaveFileSplit.cpp @@ -478,7 +478,7 @@ void ConsoleSaveFileSplit::_init(const std::wstring &fileName, LPVOID pvSaveData regionFiles[regionIndex] = regionFileRef; } - DWORD heapSize = max( fileSize, (DWORD)(1024 * 1024 * 2)); // 4J Stu - Our files are going to be bigger than 2MB so allocate high to start with + DWORD heapSize = std::max( fileSize, (DWORD)(1024 * 1024 * 2)); // 4J Stu - Our files are going to be bigger than 2MB so allocate high to start with // Initially committ enough room to store headSize bytes (using CSF_PAGE_SIZE pages, so rounding up here). We should only ever have one save file at a time, // and the pages should be decommitted in the dtor, so pages committed should always be zero at this point. diff --git a/Minecraft.World/IO/Files/FileHeader.cpp b/Minecraft.World/IO/Files/FileHeader.cpp index d08d25279..f0d8ee88c 100644 --- a/Minecraft.World/IO/Files/FileHeader.cpp +++ b/Minecraft.World/IO/Files/FileHeader.cpp @@ -30,7 +30,7 @@ FileEntry *FileHeader::AddFile( const std::wstring &name, unsigned int length /* wchar_t filename[64]; memset( &filename, 0, sizeof( wchar_t ) * 64 ); - memcpy( &filename, name.c_str(), min( sizeof( wchar_t ) * 64, sizeof( wchar_t ) * name.length() ) ); + memcpy( &filename, name.c_str(), std::min( sizeof( wchar_t ) * 64, sizeof( wchar_t ) * name.length() ) ); // Would a map be more efficient? Our file tables probably won't be very big so better to avoid hashing all the time? // Does the file exist? diff --git a/Minecraft.World/IO/Streams/ByteArrayInputStream.cpp b/Minecraft.World/IO/Streams/ByteArrayInputStream.cpp index e936c57bd..191287faa 100644 --- a/Minecraft.World/IO/Streams/ByteArrayInputStream.cpp +++ b/Minecraft.World/IO/Streams/ByteArrayInputStream.cpp @@ -10,7 +10,7 @@ //offset - the offset in the buffer of the first byte to read. //length - the maximum number of bytes to read from the buffer. ByteArrayInputStream::ByteArrayInputStream(byteArray buf, unsigned int offset, unsigned int length) - : pos( offset ), count( min( offset+length, buf.length ) ), mark( offset ) + : pos( offset ), count( std::min( offset+length, buf.length ) ), mark( offset ) { this->buf = buf; } @@ -77,7 +77,7 @@ int ByteArrayInputStream::read(byteArray b, unsigned int offset, unsigned int le if( pos == count ) return -1; - int k = min( length, count-pos ); + int k = std::min( length, count-pos ); XMemCpy( &b[offset], &buf[pos], k ); //std::copy( buf->data+pos, buf->data+pos+k, b->data + offset ); // Or this instead? diff --git a/Minecraft.World/IO/Streams/ByteArrayOutputStream.cpp b/Minecraft.World/IO/Streams/ByteArrayOutputStream.cpp index ef46f8977..09546aa97 100644 --- a/Minecraft.World/IO/Streams/ByteArrayOutputStream.cpp +++ b/Minecraft.World/IO/Streams/ByteArrayOutputStream.cpp @@ -55,7 +55,7 @@ void ByteArrayOutputStream::write(byteArray b, unsigned int offset, unsigned int // If we will fill the buffer we need to make it bigger if( count + length >= buf.length ) - buf.resize( max( count + length + 1, buf.length * 2 ) ); + buf.resize( std::max( count + length + 1, buf.length * 2 ) ); XMemCpy( &buf[count], &b[offset], length ); //std::copy( b->data+offset, b->data+offset+length, buf->data + count ); // Or this instead? diff --git a/Minecraft.World/Level/LevelChunk.cpp b/Minecraft.World/Level/LevelChunk.cpp index 879fd6b86..b83b2e08a 100644 --- a/Minecraft.World/Level/LevelChunk.cpp +++ b/Minecraft.World/Level/LevelChunk.cpp @@ -1696,21 +1696,21 @@ int LevelChunk::getBlocksAndData(byteArray *data, int x0, int y0, int z0, int x1 int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; // 4J - replaced block storage as now using CompressedTileStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlocks->getDataRegion( *data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlocks->getDataRegion( *data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlocks->getDataRegion( *data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlocks->getDataRegion( *data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); // 4J - replaced data storage as now using SparseDataStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->getDataRegion( *data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->getDataRegion( *data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->getDataRegion( *data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->getDataRegion( *data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); if( includeLighting ) { // 4J - replaced block and skylight storage as these now use our SparseLightStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlockLight->getDataRegion( *data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlockLight->getDataRegion( *data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlockLight->getDataRegion( *data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlockLight->getDataRegion( *data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerSkyLight->getDataRegion( *data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperSkyLight->getDataRegion( *data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerSkyLight->getDataRegion( *data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperSkyLight->getDataRegion( *data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); } /* @@ -1744,8 +1744,8 @@ bool LevelChunk::testSetBlocksAndData(byteArray data, int x0, int y0, int z0, in // 4J Stu - Added this because some "min" functions don't let us use our constants :( int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) changed = lowerBlocks->testSetDataRegion(data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) changed = changed || upperBlocks->testSetDataRegion(data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) changed = lowerBlocks->testSetDataRegion(data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) changed = changed || upperBlocks->testSetDataRegion(data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p); return changed; } @@ -1788,8 +1788,8 @@ int LevelChunk::setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; // 4J - replaced block storage as now uses CompressedTileStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlocks->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? NULL : tileUpdatedCallback, this, 0 ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlocks->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? NULL : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlocks->setDataRegion( data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p, includeLighting ? NULL : tileUpdatedCallback, this, 0 ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlocks->setDataRegion( data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? NULL : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); /* for (int x = x0; x < x1; x++) for (int z = z0; z < z1; z++) @@ -1803,17 +1803,17 @@ int LevelChunk::setBlocksAndData(byteArray data, int x0, int y0, int z0, int x1, recalcHeightmapOnly(); // 4J - replaced data storage as now uses SparseDataStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p, includeLighting ? NULL : tileUpdatedCallback, this, 0 ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? NULL : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->setDataRegion( data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p, includeLighting ? NULL : tileUpdatedCallback, this, 0 ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->setDataRegion( data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p, includeLighting ? NULL : tileUpdatedCallback, this, Level::COMPRESSED_CHUNK_SECTION_HEIGHT ); if( includeLighting ) { // 4J - replaced block and skylight storage as these now use our SparseLightStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlockLight->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlockLight->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlockLight->setDataRegion( data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlockLight->setDataRegion( data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerSkyLight->setDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperSkyLight->setDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerSkyLight->setDataRegion( data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperSkyLight->setDataRegion( data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); memcpy(biomes.data, &data.data[p],biomes.length); p += biomes.length; @@ -2324,7 +2324,7 @@ byteArray LevelChunk::getReorderedBlocksAndData(int x0, int y0, int z0, int xs, { int highestNonEmpty = getHighestNonEmptyY(); - ys = min(highestNonEmpty - y0, ys); + ys = std::min(highestNonEmpty - y0, ys); if(ys < 0 ) ys = 0; int x1 = x0 + xs; @@ -2354,15 +2354,15 @@ byteArray LevelChunk::getReorderedBlocksAndData(int x0, int y0, int z0, int xs, int compressedHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; // 4J - replaced data storage as now using SparseDataStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->getDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->getDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerData->getDataRegion( data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperData->getDataRegion( data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); // 4J - replaced block and skylight storage as these now use our SparseLightStorage - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlockLight->getDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlockLight->getDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerBlockLight->getDataRegion( data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperBlockLight->getDataRegion( data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); - if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerSkyLight->getDataRegion( data, x0, y0, z0, x1, min(compressedHeight, y1), z1, p ); - if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperSkyLight->getDataRegion( data, x0, max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); + if(y0 < Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += lowerSkyLight->getDataRegion( data, x0, y0, z0, x1, std::min(compressedHeight, y1), z1, p ); + if(y1 > Level::COMPRESSED_CHUNK_SECTION_HEIGHT) p += upperSkyLight->getDataRegion( data, x0, std::max(y0-compressedHeight,0), z0, x1, y1-Level::COMPRESSED_CHUNK_SECTION_HEIGHT, z1, p ); memcpy(&data.data[p],biomes.data,biomes.length); @@ -2402,7 +2402,7 @@ void LevelChunk::reorderBlocksAndDataToXZY(int y0, int xs, int ys, int zs, byteA unsigned int halfTileCount = tileCount/2; int sectionHeight = Level::COMPRESSED_CHUNK_SECTION_HEIGHT; - int lowerYSpan = min(y1, sectionHeight) - y0; + int lowerYSpan = std::min(y1, sectionHeight) - y0; int upperYSpan = ys - lowerYSpan; int upperSlotOffset = xs * zs * lowerYSpan; diff --git a/Minecraft.World/Level/LevelData.cpp b/Minecraft.World/Level/LevelData.cpp index d38a623ac..556c53c48 100644 --- a/Minecraft.World/Level/LevelData.cpp +++ b/Minecraft.World/Level/LevelData.cpp @@ -112,11 +112,11 @@ LevelData::LevelData(CompoundTag *tag) m_xzSize = tag->getInt(L"XZSize"); m_hellScale = tag->getInt(L"HellScale"); - m_xzSize = min(m_xzSize,LEVEL_MAX_WIDTH); - m_xzSize = max(m_xzSize,LEVEL_MIN_WIDTH); + m_xzSize = std::min(m_xzSize,LEVEL_MAX_WIDTH); + m_xzSize = std::max(m_xzSize,LEVEL_MIN_WIDTH); - m_hellScale = min(m_hellScale,HELL_LEVEL_MAX_SCALE); - m_hellScale = max(m_hellScale,HELL_LEVEL_MIN_SCALE); + m_hellScale = std::min(m_hellScale,HELL_LEVEL_MAX_SCALE); + m_hellScale = std::max(m_hellScale,HELL_LEVEL_MIN_SCALE); int hellXZSize = m_xzSize / m_hellScale; while(hellXZSize > HELL_LEVEL_MAX_WIDTH && m_hellScale < HELL_LEVEL_MAX_SCALE) @@ -180,11 +180,11 @@ LevelData::LevelData(LevelSettings *levelSettings, const std::wstring& levelName m_xzSize = levelSettings->getXZSize(); m_hellScale = levelSettings->getHellScale(); - m_xzSize = min(m_xzSize,LEVEL_MAX_WIDTH); - m_xzSize = max(m_xzSize,LEVEL_MIN_WIDTH); + m_xzSize = std::min(m_xzSize,LEVEL_MAX_WIDTH); + m_xzSize = std::max(m_xzSize,LEVEL_MIN_WIDTH); - m_hellScale = min(m_hellScale,HELL_LEVEL_MAX_SCALE); - m_hellScale = max(m_hellScale,HELL_LEVEL_MIN_SCALE); + m_hellScale = std::min(m_hellScale,HELL_LEVEL_MAX_SCALE); + m_hellScale = std::max(m_hellScale,HELL_LEVEL_MIN_SCALE); int hellXZSize = m_xzSize / m_hellScale; while(hellXZSize > HELL_LEVEL_MAX_WIDTH && m_hellScale < HELL_LEVEL_MAX_SCALE) diff --git a/Minecraft.World/Player/FoodData.cpp b/Minecraft.World/Player/FoodData.cpp index ff430c1f5..b2a23ae45 100644 --- a/Minecraft.World/Player/FoodData.cpp +++ b/Minecraft.World/Player/FoodData.cpp @@ -20,8 +20,8 @@ FoodData::FoodData() void FoodData::eat(int food, float saturationModifier) { - foodLevel = min(food + foodLevel, FoodConstants::MAX_FOOD); - saturationLevel = min(saturationLevel + (float) food * saturationModifier * 2.0f, (float)foodLevel); + foodLevel = std::min(food + foodLevel, FoodConstants::MAX_FOOD); + saturationLevel = std::min(saturationLevel + (float) food * saturationModifier * 2.0f, (float)foodLevel); } void FoodData::eat(FoodItem *item) @@ -42,11 +42,11 @@ void FoodData::tick(std::shared_ptr player) if (saturationLevel > 0) { - saturationLevel = max(saturationLevel - 1, 0.0f); + saturationLevel = std::max(saturationLevel - 1, 0.0f); } else if (difficulty > Difficulty::PEACEFUL) { - foodLevel = max(foodLevel - 1, 0); + foodLevel = std::max(foodLevel - 1, 0); } } @@ -130,7 +130,7 @@ bool FoodData::needsFood() void FoodData::addExhaustion(float amount) { - exhaustionLevel = min(exhaustionLevel + amount, FoodConstants::MAX_SATURATION * 2); + exhaustionLevel = std::min(exhaustionLevel + amount, FoodConstants::MAX_SATURATION * 2); } float FoodData::getExhaustionLevel() diff --git a/Minecraft.World/Recipes/ArmorDyeRecipe.cpp b/Minecraft.World/Recipes/ArmorDyeRecipe.cpp index f6f7e52c5..8eb11c805 100644 --- a/Minecraft.World/Recipes/ArmorDyeRecipe.cpp +++ b/Minecraft.World/Recipes/ArmorDyeRecipe.cpp @@ -72,7 +72,7 @@ std::shared_ptr ArmorDyeRecipe::assembleDyedArmor(std::shared_ptr< float green = (float) ((color >> 8) & 0xFF) / 0xFF; float blue = (float) (color & 0xFF) / 0xFF; - intensityTotal += max(red, max(green, blue)) * 0xFF; + intensityTotal += std::max(red, std::max(green, blue)) * 0xFF; colorTotals[0] += red * 0xFF; colorTotals[1] += green * 0xFF; @@ -92,7 +92,7 @@ std::shared_ptr ArmorDyeRecipe::assembleDyedArmor(std::shared_ptr< int green = (int) (Sheep::COLOR[tileData][1] * 0xFF); int blue = (int) (Sheep::COLOR[tileData][2] * 0xFF); - intensityTotal += max(red, max(green, blue)); + intensityTotal += std::max(red, std::max(green, blue)); colorTotals[0] += red; colorTotals[1] += green; @@ -113,7 +113,7 @@ std::shared_ptr ArmorDyeRecipe::assembleDyedArmor(std::shared_ptr< int blue = (colorTotals[2] / colourCounts); float averageIntensity = (float) intensityTotal / colourCounts; - float resultIntensity = (float) max(red, max(green, blue)); + float resultIntensity = (float) std::max(red, std::max(green, blue)); // System.out.println(averageIntensity + ", " + resultIntensity); red = (int) ((float) red * averageIntensity / resultIntensity); diff --git a/Minecraft.World/Recipes/ArmorRecipes.h b/Minecraft.World/Recipes/ArmorRecipes.h index 0ab9321bb..88a7bb5cd 100644 --- a/Minecraft.World/Recipes/ArmorRecipes.h +++ b/Minecraft.World/Recipes/ArmorRecipes.h @@ -26,7 +26,7 @@ private: static std::wstring shapes[][4]; private: - vector *map; + std::vector *map; public: void addRecipes(Recipes *r); diff --git a/Minecraft.World/Recipes/OreRecipes.h b/Minecraft.World/Recipes/OreRecipes.h index fa226a8a0..ef4082c5e 100644 --- a/Minecraft.World/Recipes/OreRecipes.h +++ b/Minecraft.World/Recipes/OreRecipes.h @@ -10,7 +10,7 @@ public: OreRecipies() {_init();} private: - vector *map; + std::vector *map; public: void addRecipes(Recipes *r); diff --git a/Minecraft.World/Recipes/Recipes.cpp b/Minecraft.World/Recipes/Recipes.cpp index a5f38f49b..7c0fef842 100644 --- a/Minecraft.World/Recipes/Recipes.cpp +++ b/Minecraft.World/Recipes/Recipes.cpp @@ -1083,7 +1083,7 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... ) Item *pItem; Recipy::_eGroupType group = Recipy::eGroupType_Decoration; wchar_t wchFrom; - vector *ingredients = new std::vector(); + std::vector *ingredients = new std::vector(); va_start(vl,result); // 4J-PB - second argument is a list of the types diff --git a/Minecraft.World/Recipes/Recipes.h b/Minecraft.World/Recipes/Recipes.h index 49c1449fa..4a538962d 100644 --- a/Minecraft.World/Recipes/Recipes.h +++ b/Minecraft.World/Recipes/Recipes.h @@ -70,7 +70,7 @@ public: private: static Recipes *instance; - vector *recipies; + std::vector *recipies; public: static void staticCtor(); @@ -90,7 +90,7 @@ public: void addShapelessRecipy(ItemInstance *result,... ); std::shared_ptr getItemFor(std::shared_ptr craftSlots, Level *level); - vector *getRecipies(); + std::vector *getRecipies(); // 4J-PB - Added all below for new Xbox 'crafting' std::shared_ptr getItemForRecipe(Recipy *r); diff --git a/Minecraft.World/Recipes/ShapelessRecipy.cpp b/Minecraft.World/Recipes/ShapelessRecipy.cpp index 84595b5ad..b40f2a480 100644 --- a/Minecraft.World/Recipes/ShapelessRecipy.cpp +++ b/Minecraft.World/Recipes/ShapelessRecipy.cpp @@ -31,7 +31,7 @@ const ItemInstance *ShapelessRecipy::getResultItem() bool ShapelessRecipy::matches(std::shared_ptr craftSlots, Level *level) { - vector tempList = *ingredients; + std::vector tempList = *ingredients; for (int y = 0; y < 3; y++) { @@ -80,7 +80,7 @@ int ShapelessRecipy::size() // 4J-PB bool ShapelessRecipy::requires(int iRecipe) { - vector *tempList = new std::vector; + std::vector *tempList = new std::vector; *tempList=*ingredients; diff --git a/Minecraft.World/Recipes/ToolRecipes.h b/Minecraft.World/Recipes/ToolRecipes.h index 5b3ddfdb0..f04130901 100644 --- a/Minecraft.World/Recipes/ToolRecipes.h +++ b/Minecraft.World/Recipes/ToolRecipes.h @@ -17,7 +17,7 @@ public: private: static std::wstring shapes[][4]; - vector *map; + std::vector *map; public: void addRecipes(Recipes *r); diff --git a/Minecraft.World/Recipes/WeaponRecipes.h b/Minecraft.World/Recipes/WeaponRecipes.h index d8793a917..9e4d7275e 100644 --- a/Minecraft.World/Recipes/WeaponRecipes.h +++ b/Minecraft.World/Recipes/WeaponRecipes.h @@ -15,7 +15,7 @@ public: private: static std::wstring shapes[][4]; - vector *map; + std::vector *map; public: void addRecipes(Recipes *r); diff --git a/Minecraft.World/WorldGen/Features/BasicTreeFeature.cpp b/Minecraft.World/WorldGen/Features/BasicTreeFeature.cpp index 4de3ec869..8f50a59e8 100644 --- a/Minecraft.World/WorldGen/Features/BasicTreeFeature.cpp +++ b/Minecraft.World/WorldGen/Features/BasicTreeFeature.cpp @@ -286,7 +286,7 @@ void BasicTree::limb(int *start, int *end, int material) int dir = TreeTile::FACING_Y; int xdiff = abs(coordinate[0] - start[0]); int zdiff = abs(coordinate[2] - start[2]); - int maxdiff = max(xdiff, zdiff); + int maxdiff = std::max(xdiff, zdiff); if (maxdiff > 0) { diff --git a/Minecraft.World/WorldGen/Features/MineShaftFeature.cpp b/Minecraft.World/WorldGen/Features/MineShaftFeature.cpp index da2ee9533..8e8eb36d9 100644 --- a/Minecraft.World/WorldGen/Features/MineShaftFeature.cpp +++ b/Minecraft.World/WorldGen/Features/MineShaftFeature.cpp @@ -11,7 +11,7 @@ bool MineShaftFeature::isFeatureChunk(int x, int z, bool bIsSuperflat) forcePlacement = levelGenOptions->isFeatureChunk(x,z,eFeature_Mineshaft); } - return forcePlacement || (random->nextInt(100) == 0 && random->nextInt(80) < max(abs(x), abs(z))); + return forcePlacement || (random->nextInt(100) == 0 && random->nextInt(80) < std::max(abs(x), abs(z))); } StructureStart *MineShaftFeature::createStructureStart(int x, int z) diff --git a/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.cpp b/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.cpp index b46a12afb..8823fb79f 100644 --- a/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.cpp +++ b/Minecraft.World/WorldGen/Sources/HellRandomLevelSource.cpp @@ -228,7 +228,7 @@ void HellRandomLevelSource::buildSurfaces(int xOffs, int zOffs, byteArray blocks // Place the nether wart on top of the soul sand y += 1; int genDepthMinusOne = Level::genDepthMinusOne; // Take into local int for PS4 as min takes a reference to the const int there and then needs the value to exist for the linker - y = min(y, genDepthMinusOne); + y = std::min(y, genDepthMinusOne); runDepth += 1; offs = (z * 16 + x) * Level::genDepth + y; } diff --git a/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp b/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp index 9fa63a011..6b82919c4 100644 --- a/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp +++ b/Minecraft.World/WorldGen/Structures/MineShaftPieces.cpp @@ -188,7 +188,7 @@ bool MineShaftPieces::MineShaftRoom::postProcess(Level *level, Random *random, B generateBox(level, chunkBB, boundingBox->x0, boundingBox->y0, boundingBox->z0, boundingBox->x1, boundingBox->y0, boundingBox->z1, Tile::dirt_Id, 0, true); // room air - generateBox(level, chunkBB, boundingBox->x0, boundingBox->y0 + 1, boundingBox->z0, boundingBox->x1, min(boundingBox->y0 + 3, boundingBox->y1), boundingBox->z1, 0, 0, false); + generateBox(level, chunkBB, boundingBox->x0, boundingBox->y0 + 1, boundingBox->z0, boundingBox->x1, std::min(boundingBox->y0 + 3, boundingBox->y1), boundingBox->z1, 0, 0, false); for(AUTO_VAR(it, childEntranceBoxes.begin()); it != childEntranceBoxes.end(); ++it) { BoundingBox *entranceBox = *it; diff --git a/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp b/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp index 128aaf986..9011a824c 100644 --- a/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp +++ b/Minecraft.World/WorldGen/Structures/NetherBridgePieces.cpp @@ -1333,8 +1333,8 @@ bool NetherBridgePieces::CastleCorridorStairsPiece::postProcess(Level *level, Ra int stairsData = getOrientationData(Tile::stairs_netherBricks_Id, 2); for (int step = 0; step <= 9; step++) { - int floor = max(1, 7 - step); - int roof = min(max(floor + 5, 14 - step), 13); + int floor = std::max(1, 7 - step); + int roof = std::min(std::max(floor + 5, 14 - step), 13); int z = step; // floor diff --git a/Minecraft.World/WorldGen/Structures/ScatteredFeaturePieces.cpp b/Minecraft.World/WorldGen/Structures/ScatteredFeaturePieces.cpp index e75e1fd64..6ce4f1f8d 100644 --- a/Minecraft.World/WorldGen/Structures/ScatteredFeaturePieces.cpp +++ b/Minecraft.World/WorldGen/Structures/ScatteredFeaturePieces.cpp @@ -43,7 +43,7 @@ bool ScatteredFeaturePieces::ScatteredFeaturePiece::updateAverageGroundHeight(Le { if (chunkBB->isInside(x, 64, z)) { - total += max(level->getTopSolidBlock(x, z), level->dimension->getSpawnYPosition()); + total += std::max(level->getTopSolidBlock(x, z), level->dimension->getSpawnYPosition()); count++; } } diff --git a/Minecraft.World/WorldGen/Structures/Village.cpp b/Minecraft.World/WorldGen/Structures/Village.cpp index 10d8a5cf0..d3029c828 100644 --- a/Minecraft.World/WorldGen/Structures/Village.cpp +++ b/Minecraft.World/WorldGen/Structures/Village.cpp @@ -374,10 +374,10 @@ void Village::calcInfo() for(AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it) { std::shared_ptr dm = *it; - maxRadiusSqr = max(dm->distanceToSqr(center->x, center->y, center->z), maxRadiusSqr); + maxRadiusSqr = std::max(dm->distanceToSqr(center->x, center->y, center->z), maxRadiusSqr); } int doorDist= Villages::MaxDoorDist; // Take into local int for PS4 as max takes a reference to the const int there and then needs the value to exist for the linker - radius = max(doorDist, (int) sqrt((float)maxRadiusSqr) + 1); + radius = std::max(doorDist, (int) sqrt((float)maxRadiusSqr) + 1); } int Village::getStanding(const std::wstring &playerName)