fix: unglob std::{min, max}, manual stuff

This commit is contained in:
Tropical 2026-03-06 20:47:11 -06:00
parent 967ffbb2a6
commit 04ff82ba70
54 changed files with 126 additions and 126 deletions

View file

@ -224,4 +224,4 @@ typedef struct _TMSPPRequest
}
TMSPPRequest;
typedef pair<EUIScene, HXUIOBJ> SceneStackPair;
typedef std::pair<EUIScene, HXUIOBJ> SceneStackPair;

View file

@ -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);

View file

@ -18,7 +18,7 @@ private:
PlayerChunkMap *chunkMap;
CRITICAL_SECTION m_tickNextTickCS; // 4J added
set<TickNextTickData, TickNextTickDataKeyCompare> tickNextTickList; // 4J Was TreeSet
std::set<TickNextTickData, TickNextTickDataKeyCompare> tickNextTickList; // 4J Was TreeSet
std::unordered_set<TickNextTickData, TickNextTickDataKeyHash, TickNextTickDataKeyEq> tickNextTickSet; // 4J Was HashSet
std::vector<Pos *> m_queuedSendTileUpdates; // 4J added

View file

@ -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));

View file

@ -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 ) );

View file

@ -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)

View file

@ -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;

View file

@ -983,7 +983,7 @@ float GameRenderer::getNightVisionScale(std::shared_ptr<Player> 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);
}
}

View file

@ -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;
}

View file

@ -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));

View file

@ -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))
{

View file

@ -52,7 +52,7 @@ void TextureHolder::setForcedScale(int targetSize)
return;
}
scale = (float) targetSize / min(width, height);
scale = (float) targetSize / std::min(width, height);
}
//@Override

View file

@ -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;
}

View file

@ -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);

View file

@ -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();

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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))
{

View file

@ -24,7 +24,7 @@ std::shared_ptr<ItemInstance> FurnaceResultSlot::remove(int c)
{
if (hasItem())
{
removeCount += min(c, getItem()->count);
removeCount += std::min(c, getItem()->count);
}
return Slot::remove(c);
}

View file

@ -20,7 +20,7 @@ std::shared_ptr<ItemInstance> MerchantResultSlot::remove(int c)
{
if (hasItem())
{
removeCount += min(c, getItem()->count);
removeCount += std::min(c, getItem()->count);
}
return Slot::remove(c);
}

View file

@ -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)

View file

@ -22,7 +22,7 @@ std::shared_ptr<ItemInstance> ResultSlot::remove(int c)
{
if (hasItem())
{
removeCount += min(c, getItem()->count);
removeCount += std::min(c, getItem()->count);
}
return Slot::remove(c);
}

View file

@ -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;
}

View file

@ -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;

View file

@ -158,8 +158,8 @@ bool ItemEntity::merge(std::shared_ptr<ItemEntity> 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();

View file

@ -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);

View file

@ -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();
}

View file

@ -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);
}

View file

@ -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.

View file

@ -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.

View file

@ -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?

View file

@ -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?

View file

@ -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?

View file

@ -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;

View file

@ -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)

View file

@ -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> 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()

View file

@ -72,7 +72,7 @@ std::shared_ptr<ItemInstance> 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<ItemInstance> 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<ItemInstance> 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);

View file

@ -26,7 +26,7 @@ private:
static std::wstring shapes[][4];
private:
vector <Object *> *map;
std::vector <Object *> *map;
public:
void addRecipes(Recipes *r);

View file

@ -10,7 +10,7 @@ public:
OreRecipies() {_init();}
private:
vector <Object *> *map;
std::vector <Object *> *map;
public:
void addRecipes(Recipes *r);

View file

@ -1083,7 +1083,7 @@ void Recipes::addShapelessRecipy(ItemInstance *result,... )
Item *pItem;
Recipy::_eGroupType group = Recipy::eGroupType_Decoration;
wchar_t wchFrom;
vector <ItemInstance *> *ingredients = new std::vector<ItemInstance *>();
std::vector <ItemInstance *> *ingredients = new std::vector<ItemInstance *>();
va_start(vl,result);
// 4J-PB - second argument is a list of the types

View file

@ -70,7 +70,7 @@ public:
private:
static Recipes *instance;
vector <Recipy *> *recipies;
std::vector <Recipy *> *recipies;
public:
static void staticCtor();
@ -90,7 +90,7 @@ public:
void addShapelessRecipy(ItemInstance *result,... );
std::shared_ptr<ItemInstance> getItemFor(std::shared_ptr<CraftingContainer> craftSlots, Level *level);
vector <Recipy *> *getRecipies();
std::vector <Recipy *> *getRecipies();
// 4J-PB - Added all below for new Xbox 'crafting'
std::shared_ptr<ItemInstance> getItemForRecipe(Recipy *r);

View file

@ -31,7 +31,7 @@ const ItemInstance *ShapelessRecipy::getResultItem()
bool ShapelessRecipy::matches(std::shared_ptr<CraftingContainer> craftSlots, Level *level)
{
vector <ItemInstance *> tempList = *ingredients;
std::vector <ItemInstance *> tempList = *ingredients;
for (int y = 0; y < 3; y++)
{
@ -80,7 +80,7 @@ int ShapelessRecipy::size()
// 4J-PB
bool ShapelessRecipy::requires(int iRecipe)
{
vector <ItemInstance *> *tempList = new std::vector<ItemInstance *>;
std::vector <ItemInstance *> *tempList = new std::vector<ItemInstance *>;
*tempList=*ingredients;

View file

@ -17,7 +17,7 @@ public:
private:
static std::wstring shapes[][4];
vector <Object *> *map;
std::vector <Object *> *map;
public:
void addRecipes(Recipes *r);

View file

@ -15,7 +15,7 @@ public:
private:
static std::wstring shapes[][4];
vector <Object *> *map;
std::vector <Object *> *map;
public:
void addRecipes(Recipes *r);

View file

@ -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)
{

View file

@ -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)

View file

@ -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;
}

View file

@ -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;

View file

@ -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

View file

@ -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++;
}
}

View file

@ -374,10 +374,10 @@ void Village::calcInfo()
for(AUTO_VAR(it, doorInfos.begin()); it != doorInfos.end(); ++it)
{
std::shared_ptr<DoorInfo> 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)