mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 03:09:13 +00:00
Use std::min and std::max
This commit is contained in:
@ -59,6 +59,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
#include <cctype>
|
||||
#include <cstdarg>
|
||||
#include <cstdint>
|
||||
#include <algorithm>
|
||||
|
||||
//======================================
|
||||
// Winblows Hacks
|
||||
@ -132,8 +133,6 @@ typedef uint32_t hsGSeedValue;
|
||||
|
||||
#define hsLongAlign(n) (((n) + 3) & ~3L)
|
||||
|
||||
#define hsMaximum(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define hsMinimum(a, b) ((a) < (b) ? (a) : (b))
|
||||
#define hsABS(x) ((x) < 0 ? -(x) : (x))
|
||||
#define hsSGN(x) (((x) < 0) ? -1 : ( ((x) > 0) ? 1 : 0 ))
|
||||
|
||||
|
@ -195,9 +195,9 @@ void hsBounds3::MakeSymmetric(const hsPoint3* p)
|
||||
float delUp;
|
||||
|
||||
delUp = fMaxs[i] - (*p)[i];
|
||||
delMax = hsMaximum(delMax, delUp);
|
||||
delMax = std::max(delMax, delUp);
|
||||
delUp = (*p)[i] - fMins[i];
|
||||
delMax = hsMaximum(delMax, delUp);
|
||||
delMax = std::max(delMax, delUp);
|
||||
}
|
||||
const float sqrtTwo = 1.41421f;
|
||||
delMax *= sqrtTwo;
|
||||
|
@ -42,7 +42,7 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
|
||||
#ifndef hsBounds_inc
|
||||
#define hsBounds_inc
|
||||
|
||||
|
||||
#include "hsGeometry3.h"
|
||||
#include "hsPoint2.h"
|
||||
#include "hsMatrix44.h"
|
||||
@ -186,7 +186,7 @@ inline const hsPoint3& hsBounds3::GetCenter() const
|
||||
inline float hsBounds3::GetMaxDim() const
|
||||
{
|
||||
hsAssert(kBoundsNormal == fType, "Invalid type for GetMaxDim");
|
||||
return hsMaximum(hsMaximum(fMaxs.fX-fMins.fX, fMaxs.fY-fMins.fY), fMaxs.fZ-fMins.fZ);
|
||||
return std::max({ fMaxs.fX - fMins.fX, fMaxs.fY - fMins.fY, fMaxs.fZ - fMins.fZ });
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1054,7 +1054,7 @@ uint32_t hsQueueStream::Read(uint32_t byteCount, void * buffer)
|
||||
int32_t limit, length, total;
|
||||
|
||||
limit = fWriteCursor >= fReadCursor ? fWriteCursor : fSize;
|
||||
length = hsMinimum(limit-fReadCursor,byteCount);
|
||||
length = std::min(limit-fReadCursor, byteCount);
|
||||
HSMemory::BlockMove(fQueue+fReadCursor,buffer,length);
|
||||
fReadCursor += length;
|
||||
fReadCursor %= fSize;
|
||||
@ -1063,7 +1063,7 @@ uint32_t hsQueueStream::Read(uint32_t byteCount, void * buffer)
|
||||
if (length < byteCount && limit != fWriteCursor)
|
||||
{
|
||||
limit = fWriteCursor;
|
||||
length = hsMinimum(limit,byteCount-length);
|
||||
length = std::min(limit, static_cast<int32_t>(byteCount)-length);
|
||||
HSMemory::BlockMove(fQueue,static_cast<char*>(buffer)+total,length);
|
||||
fReadCursor = length;
|
||||
total += length;
|
||||
@ -1079,7 +1079,7 @@ uint32_t hsQueueStream::Write(uint32_t byteCount, const void* buffer)
|
||||
|
||||
int32_t length;
|
||||
|
||||
length = hsMinimum(fSize-fWriteCursor,byteCount);
|
||||
length = std::min(fSize-fWriteCursor, byteCount);
|
||||
HSMemory::BlockMove(buffer,fQueue+fWriteCursor,length);
|
||||
if (fReadCursor > fWriteCursor)
|
||||
{
|
||||
@ -1087,7 +1087,7 @@ uint32_t hsQueueStream::Write(uint32_t byteCount, const void* buffer)
|
||||
if (fReadCursor < fWriteCursor+length+1)
|
||||
hsStatusMessage("ReadCursor wrapped\n");
|
||||
#endif
|
||||
fReadCursor = hsMaximum(fReadCursor,fWriteCursor+length+1);
|
||||
fReadCursor = std::min(fReadCursor, fWriteCursor+length+1);
|
||||
fReadCursor %= fSize;
|
||||
}
|
||||
fWriteCursor += length;
|
||||
@ -1106,19 +1106,19 @@ void hsQueueStream::Skip(uint32_t deltaByteCount)
|
||||
int32_t limit, length;
|
||||
|
||||
limit = fWriteCursor >= fReadCursor ? fWriteCursor : fSize;
|
||||
length = hsMinimum(limit-fReadCursor,deltaByteCount);
|
||||
length = std::min(limit-fReadCursor, deltaByteCount);
|
||||
fReadCursor += length;
|
||||
|
||||
if (length < deltaByteCount && limit != fWriteCursor)
|
||||
{
|
||||
limit = fWriteCursor;
|
||||
length = hsMinimum(limit,deltaByteCount-length);
|
||||
length = std::min(limit, static_cast<int32_t>(deltaByteCount)-length);
|
||||
fReadCursor = length;
|
||||
}
|
||||
else
|
||||
{
|
||||
fReadCursor %= fSize;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void hsQueueStream::Rewind()
|
||||
|
@ -238,7 +238,7 @@ void hsDynamicArray<T>::SetCount(int32_t count)
|
||||
{ T* newArray = new T[count];
|
||||
|
||||
if (fArray)
|
||||
{ int copyCount = hsMinimum(count, fCount);
|
||||
{ int copyCount = std::min(count, fCount);
|
||||
|
||||
for (int i = 0; i < copyCount; i++)
|
||||
newArray[i] = fArray[i];
|
||||
|
@ -270,9 +270,9 @@ bool plViewTransform::Intersect(const plViewTransform& view)
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
mins[i] = hsMaximum(fMin[i], view.fMin[i]);
|
||||
mins[i] = std::max(fMin[i], view.fMin[i]);
|
||||
|
||||
maxs[i] = hsMinimum(fMax[i], view.fMax[i]);
|
||||
maxs[i] = std::min(fMax[i], view.fMax[i]);
|
||||
|
||||
if( mins[i] >= maxs[i] )
|
||||
{
|
||||
@ -292,9 +292,9 @@ bool plViewTransform::Union(const plViewTransform& view)
|
||||
int i;
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
mins[i] = hsMinimum(fMin[i], view.fMin[i]);
|
||||
mins[i] = std::min(fMin[i], view.fMin[i]);
|
||||
|
||||
maxs[i] = hsMaximum(fMax[i], view.fMax[i]);
|
||||
maxs[i] = std::max(fMax[i], view.fMax[i]);
|
||||
|
||||
}
|
||||
SetView(mins, maxs);
|
||||
|
@ -133,7 +133,7 @@ void plDispatchLog::DumpMsg(plMessage* msg, int numReceivers, int sendTimeMs, in
|
||||
float sendTime = hsTimer::GetMilliSeconds<float>(hsTimer::GetTicks() - fStartTicks);
|
||||
|
||||
char indentStr[50];
|
||||
indent = hsMinimum(indent, sizeof(indentStr)-1);
|
||||
indent = std::min(indent, static_cast<int32_t>(sizeof(indentStr)-1));
|
||||
memset(indentStr, ' ', indent);
|
||||
indentStr[indent] = '\0';
|
||||
|
||||
|
@ -162,21 +162,20 @@ static bool ICopySourceToTexture16(BITMAPINFO* bmi, plMipmap* b)
|
||||
uint32_t* pix = (uint32_t*)b->GetImage();
|
||||
pix += b->GetWidth() * b->GetHeight();
|
||||
|
||||
int width = bmi->bmiHeader.biWidth;
|
||||
int height = bmi->bmiHeader.biHeight;
|
||||
uint32_t width = bmi->bmiHeader.biWidth;
|
||||
uint32_t height = bmi->bmiHeader.biHeight;
|
||||
|
||||
int useHeight = hsMinimum(height, b->GetHeight());
|
||||
int useWidth = hsMinimum(width, b->GetWidth());
|
||||
int i;
|
||||
for( i = 0; i < useHeight; i++ )
|
||||
uint32_t useHeight = std::min(height, b->GetHeight());
|
||||
uint32_t useWidth = std::min(width, b->GetWidth());
|
||||
|
||||
for (uint32_t i = 0; i < useHeight; i++)
|
||||
{
|
||||
uint16_t* src = pSrc;
|
||||
pSrc += width;
|
||||
|
||||
pix -= b->GetWidth();
|
||||
uint32_t* tPix = pix;
|
||||
int j;
|
||||
for( j = 0; j < useWidth; j++ )
|
||||
for (uint32_t j = 0; j < useWidth; j++)
|
||||
{
|
||||
*tPix = ((*src & 0x001f) << 3) // up 3
|
||||
| ((*src & 0x03e0) << 6) // down 5 up 3 up 8
|
||||
@ -199,22 +198,20 @@ static bool ICopySourceToTexture24(BITMAPINFO* bmi, plMipmap* b)
|
||||
hsRGBAColor32* pix = (hsRGBAColor32*)b->GetImage();
|
||||
pix += b->GetWidth() * b->GetHeight();
|
||||
|
||||
int width = bmi->bmiHeader.biWidth;
|
||||
int height = bmi->bmiHeader.biHeight;
|
||||
uint32_t width = bmi->bmiHeader.biWidth;
|
||||
uint32_t height = bmi->bmiHeader.biHeight;
|
||||
|
||||
int useHeight = hsMinimum(height, b->GetHeight());
|
||||
int useWidth = hsMinimum(width, b->GetWidth());
|
||||
int i;
|
||||
uint32_t useHeight = std::min(height, b->GetHeight());
|
||||
uint32_t useWidth = std::min(width, b->GetWidth());
|
||||
|
||||
for( i = 0; i < useHeight; i++ )
|
||||
for (uint32_t i = 0; i < useHeight; i++)
|
||||
{
|
||||
unsigned char* src = pSrc;
|
||||
pSrc += width * 3;
|
||||
|
||||
pix -= b->GetWidth();
|
||||
hsRGBAColor32* tPix = pix;
|
||||
int j;
|
||||
for( j = 0; j < useWidth; j++ )
|
||||
for (uint32_t j = 0; j < useWidth; j++)
|
||||
{
|
||||
tPix->b = *src++;
|
||||
tPix->g = *src++;
|
||||
|
@ -158,7 +158,7 @@ protected:
|
||||
uint32_t fAvgCount;
|
||||
uint64_t fAvgTotal;
|
||||
uint32_t fLastAvg;
|
||||
uint32_t fMax;
|
||||
uint64_t fMax;
|
||||
bool fActive;
|
||||
bool fRunning;
|
||||
uint8_t fDisplayFlags;
|
||||
|
@ -161,7 +161,7 @@ void plProfileBase::EndFrame()
|
||||
{
|
||||
fAvgCount++;
|
||||
fAvgTotal += fValue;
|
||||
fMax = hsMaximum(fMax, fValue);
|
||||
fMax = std::max(fMax, fValue);
|
||||
}
|
||||
|
||||
void plProfileBase::UpdateAvg()
|
||||
|
@ -402,7 +402,7 @@ void plWalkingStrategy::Apply(float delSecs)
|
||||
// the largest, so we won't launch into the air if we're running uphill.
|
||||
float prevZVel = achievedVelocity.fZ;
|
||||
if (IsOnGround())
|
||||
prevZVel = hsMinimum(prevZVel, 0.0f);
|
||||
prevZVel = std::min(prevZVel, 0.0f);
|
||||
|
||||
velocity.fZ = prevZVel + (kGravity * delSecs);
|
||||
}
|
||||
@ -716,7 +716,7 @@ void plDynamicWalkingStrategy::Apply(float delSecs)
|
||||
// the largest, so we won't launch into the air if we're running uphill.
|
||||
float prevZVel = achievedVelocity.fZ;
|
||||
if (IsOnGround())
|
||||
prevZVel = hsMinimum(prevZVel, 0.f);
|
||||
prevZVel = std::min(prevZVel, 0.f);
|
||||
|
||||
velocity.fZ = prevZVel + (kGravity * delSecs);
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ bool plDynaRippleMgr::IRippleFromShape(const plPrintShape* shape, bool force)
|
||||
plConst(float) kHeightScale = 1.f;
|
||||
pos.fZ += (shape->GetHeight() * fScale.fZ * kHeightScale) * 0.25f;
|
||||
|
||||
float wid = hsMaximum(shape->GetWidth(), shape->GetLength());
|
||||
float wid = std::max(shape->GetWidth(), shape->GetLength());
|
||||
hsVector3 size(wid * fScale.fX, wid * fScale.fY, shape->GetHeight() * fScale.fZ * kHeightScale);
|
||||
fCutter->SetLength(size);
|
||||
fCutter->Set(pos, dir, up);
|
||||
|
@ -212,7 +212,7 @@ bool plDynaRippleVSMgr::IRippleFromShape(const plPrintShape* shape, bool force)
|
||||
hsVector3 dir(fWaveSetBase->GetWindDir());
|
||||
hsVector3 up(0.f, 0.f, 1.f);
|
||||
|
||||
float wid = hsMaximum(shape->GetWidth(), shape->GetLength());
|
||||
float wid = std::max(shape->GetWidth(), shape->GetLength());
|
||||
|
||||
plConst(float) kMaxWaterDepth(1000.f);
|
||||
|
||||
|
@ -591,7 +591,7 @@ int plSpaceTreeMaker::ITreeDepth(plSpacePrepNode* subRoot)
|
||||
int dep0 = ITreeDepth(subRoot->fChildren[0]);
|
||||
int dep1 = ITreeDepth(subRoot->fChildren[1]);
|
||||
|
||||
int dep = hsMaximum(dep0, dep1);
|
||||
int dep = std::max(dep0, dep1);
|
||||
|
||||
return dep+1;
|
||||
}
|
||||
|
@ -301,7 +301,7 @@ uint32_t plEncryptedStream::Read(uint32_t bytes, void* buffer)
|
||||
// Offset into the first buffer (0 if we are aligned on a chunk, which means no extra block read)
|
||||
uint32_t startChunkPos = startPos % kEncryptChunkSize;
|
||||
// Amount of data in the partial first chunk (0 if we're aligned)
|
||||
uint32_t startAmt = (startChunkPos != 0) ? hsMinimum(kEncryptChunkSize - startChunkPos, bytes) : 0;
|
||||
uint32_t startAmt = (startChunkPos != 0) ? std::min(kEncryptChunkSize - startChunkPos, bytes) : 0;
|
||||
|
||||
uint32_t totalNumRead = IRead(bytes, buffer);
|
||||
|
||||
|
@ -434,7 +434,7 @@ uint32_t plSecureStream::Read(uint32_t bytes, void* buffer)
|
||||
// Offset into the first buffer (0 if we are aligned on a chunk, which means no extra block read)
|
||||
uint32_t startChunkPos = startPos % kEncryptChunkSize;
|
||||
// Amount of data in the partial first chunk (0 if we're aligned)
|
||||
uint32_t startAmt = (startChunkPos != 0) ? hsMinimum(kEncryptChunkSize - startChunkPos, bytes) : 0;
|
||||
uint32_t startAmt = (startChunkPos != 0) ? std::min(kEncryptChunkSize - startChunkPos, bytes) : 0;
|
||||
|
||||
uint32_t totalNumRead = IRead(bytes, buffer);
|
||||
|
||||
|
@ -994,9 +994,9 @@ float plMipmap::IGetDetailLevelAlpha( uint8_t level, float dropStart, float drop
|
||||
detailAlpha = ( level - dropStart ) * ( min - max ) / ( dropStop - dropStart ) + max;
|
||||
|
||||
if( min < max )
|
||||
detailAlpha = hsMinimum( max, hsMaximum( min, detailAlpha ) );
|
||||
detailAlpha = std::min(max, std::max(min, detailAlpha));
|
||||
else
|
||||
detailAlpha = hsMinimum( min, hsMaximum( max, detailAlpha ) );
|
||||
detailAlpha = std::min(min, std::max(max, detailAlpha));
|
||||
|
||||
return detailAlpha;
|
||||
}
|
||||
|
@ -951,7 +951,7 @@ void plSpotLightInfo::IRefresh()
|
||||
float yon = GetRadius();
|
||||
if( yon < kMinHither )
|
||||
yon = kMaxYon;
|
||||
float hither = hsMinimum(kMinHither, yon * 0.5f);
|
||||
float hither = std::min(kMinHither, yon * 0.5f);
|
||||
|
||||
float sinFOV, cosFOV;
|
||||
hsFastMath::SinCos(effFOV, sinFOV, cosFOV);
|
||||
|
@ -373,7 +373,7 @@ plShadowSlave* plShadowMaster::ILastChanceToBail(plShadowCastMsg* castMsg, plSha
|
||||
|
||||
float maxDist = fMaxDist > 0
|
||||
? (fGlobalMaxDist > 0
|
||||
? hsMinimum(fMaxDist, fGlobalMaxDist)
|
||||
? std::min(fMaxDist, fGlobalMaxDist)
|
||||
: fMaxDist)
|
||||
: fGlobalMaxDist;
|
||||
|
||||
|
@ -271,7 +271,7 @@ float plAnimPath::GetExtremePoint(hsPoint3 &worldPt) const
|
||||
{
|
||||
float fore = keyTimes[i + 1] - t;
|
||||
float back = t - keyTimes[i - 1];
|
||||
delTime = hsMaximum(fore, back);
|
||||
delTime = std::max(fore, back);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ float plCompoundController::GetLength() const
|
||||
for(i=0; i<3; i++)
|
||||
{
|
||||
if (GetController(i))
|
||||
len = hsMaximum(len, GetController(i)->GetLength());
|
||||
len = std::max(len, GetController(i)->GetLength());
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ void TimeBasedAvgRing<T>::AddItem(T value, double time)
|
||||
}
|
||||
|
||||
// update the max avg
|
||||
fMaxAvg = hsMaximum( fMaxAvg, fAvg );
|
||||
fMaxAvg = std::max(fMaxAvg, fAvg);
|
||||
|
||||
}
|
||||
|
||||
|
@ -234,7 +234,7 @@ void plNetClientMgr::IShowRelevanceRegions()
|
||||
uint32_t maxPlayerName = 0;
|
||||
|
||||
txt.DrawString(x, y, GetPlayerName().c_str());
|
||||
maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(GetPlayerName().c_str()));
|
||||
maxPlayerName = std::max(maxPlayerName, txt.CalcStringWidth(GetPlayerName().c_str()));
|
||||
y += yOff;
|
||||
|
||||
int i;
|
||||
@ -247,7 +247,7 @@ void plNetClientMgr::IShowRelevanceRegions()
|
||||
|
||||
const plString& name = mbr->GetPlayerName();
|
||||
txt.DrawString(x, y, name.c_str());
|
||||
maxPlayerName = hsMaximum(maxPlayerName, txt.CalcStringWidth(name.c_str()));
|
||||
maxPlayerName = std::max(maxPlayerName, txt.CalcStringWidth(name.c_str()));
|
||||
y += yOff;
|
||||
}
|
||||
|
||||
|
@ -681,12 +681,11 @@ plParticleFlockEffect::~plParticleFlockEffect()
|
||||
|
||||
void plParticleFlockEffect::IUpdateDistances(const plEffectTargetInfo& target)
|
||||
{
|
||||
int i, j;
|
||||
int numParticles = hsMinimum(fMaxParticles, target.fNumValidParticles);
|
||||
uint32_t numParticles = std::min(static_cast<uint32_t>(fMaxParticles), target.fNumValidParticles);
|
||||
|
||||
for (i = 0; i < numParticles; i++)
|
||||
for (uint32_t i = 0; i < numParticles; i++)
|
||||
{
|
||||
for (j = i + 1; j < numParticles; j++)
|
||||
for (uint32_t j = i + 1; j < numParticles; j++)
|
||||
{
|
||||
hsVector3 diff((hsPoint3*)(target.fPos + i * target.fPosStride), (hsPoint3*)(target.fPos + j * target.fPosStride));
|
||||
fDistSq[i * fMaxParticles + j] = fDistSq[j * fMaxParticles + i] = diff.MagnitudeSquared();
|
||||
@ -696,17 +695,16 @@ void plParticleFlockEffect::IUpdateDistances(const plEffectTargetInfo& target)
|
||||
|
||||
void plParticleFlockEffect::IUpdateInfluences(const plEffectTargetInfo &target)
|
||||
{
|
||||
int i, j;
|
||||
int numParticles = hsMinimum(fMaxParticles, target.fNumValidParticles);
|
||||
uint32_t numParticles = std::min(static_cast<uint32_t>(fMaxParticles), target.fNumValidParticles);
|
||||
|
||||
for (i = 0; i < numParticles; i++)
|
||||
for (uint32_t i = 0; i < numParticles; i++)
|
||||
{
|
||||
int numAvg = 0;
|
||||
int numRep = 0;
|
||||
fInfluences[i].fAvgVel.Set(0.f, 0.f, 0.f);
|
||||
fInfluences[i].fRepDir.Set(0.f, 0.f, 0.f);
|
||||
|
||||
for (j = 0; j < numParticles; j++)
|
||||
for (uint32_t j = 0; j < numParticles; j++)
|
||||
{
|
||||
if (i == j)
|
||||
continue;
|
||||
|
@ -261,7 +261,7 @@ void plParticleEmitter::UpdateGenerator(uint32_t paramID, float paramValue)
|
||||
uint16_t plParticleEmitter::StealParticlesFrom(plParticleEmitter *victim, uint16_t num)
|
||||
{
|
||||
uint16_t spaceAvail = (uint16_t)(fMaxParticles - fNumValidParticles);
|
||||
uint16_t numToCopy = (uint16_t)(hsMinimum(num, (victim ? victim->fNumValidParticles : 0)));
|
||||
uint16_t numToCopy = std::min(num, static_cast<uint16_t>(victim ? victim->fNumValidParticles : 0));
|
||||
if (spaceAvail < numToCopy)
|
||||
numToCopy = spaceAvail;
|
||||
|
||||
|
@ -701,7 +701,7 @@ void plSimulationMgr::ConsiderSynch(plPXPhysical* physical, plPXPhysical* other)
|
||||
// If both objects are capable of syncing, we want to do it at the same
|
||||
// time, so no interpenetration issues pop up on other clients
|
||||
if (syncOther)
|
||||
timeElapsed = hsMaximum(timeElapsed, timeNow - other->GetLastSyncTime());
|
||||
timeElapsed = std::max(timeElapsed, timeNow - other->GetLastSyncTime());
|
||||
|
||||
// Set the sync time to 1 second from the last sync
|
||||
double syncTime = 0.0;
|
||||
|
@ -6421,7 +6421,7 @@ plLayerInterface* plDXPipeline::IPopOverAllLayer(plLayerInterface* li)
|
||||
// Calculate the number of active piggy backs.
|
||||
int plDXPipeline::ISetNumActivePiggyBacks()
|
||||
{
|
||||
return fActivePiggyBacks = hsMinimum(fSettings.fMaxPiggyBacks, fPiggyBackStack.GetCount());
|
||||
return fActivePiggyBacks = std::min(static_cast<int>(fSettings.fMaxPiggyBacks), fPiggyBackStack.GetCount());
|
||||
}
|
||||
|
||||
// IPushProjPiggyBack //////////////////////////////////////////////////
|
||||
|
@ -41,11 +41,10 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
||||
*==LICENSE==*/
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#define NOMINMAX
|
||||
#include <d3d9.h>
|
||||
#include <d3dx9core.h>
|
||||
|
||||
#include "HeadSpin.h"
|
||||
|
||||
#include "plDXShader.h"
|
||||
|
||||
#include "plSurface/plShader.h"
|
||||
|
@ -62,7 +62,7 @@ void plStatusLogDrawer::IDrawLogNames(plStatusLog* curLog, plStatusLog* firstLog
|
||||
plStatusLog* iLog = firstLog;
|
||||
while (iLog)
|
||||
{
|
||||
width = hsMaximum(drawText.CalcStringWidth_TEMP(iLog->GetFileName().AsString()) + 4, width);
|
||||
width = std::max(drawText.CalcStringWidth_TEMP(iLog->GetFileName().AsString()) + 4, width);
|
||||
iLog = iLog->fNext;
|
||||
numLogs++;
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ static void PrintColumn(ProfileGroup& group, const char* groupName, int column,
|
||||
height = 0;
|
||||
width = 0;
|
||||
|
||||
width = hsMaximum(width, txt.CalcStringWidth(groupName) + 1);
|
||||
width = std::max(width, static_cast<int>(txt.CalcStringWidth(groupName) + 1));
|
||||
txt.DrawString(x, y+height, groupName, 255, 255, 255, 255, plDebugText::kStyleBold);
|
||||
height += yInc;
|
||||
|
||||
@ -209,7 +209,7 @@ static void PrintColumn(ProfileGroup& group, const char* groupName, int column,
|
||||
// 1 sample the width of the column will jump around. So we calculate the
|
||||
// width based on the stat name plus the width of the widest sample we should
|
||||
// get
|
||||
width = hsMaximum(width, txt.CalcStringWidth(str) + samplesWidth + 1);
|
||||
width = std::max(width, static_cast<int>(txt.CalcStringWidth(str) + samplesWidth + 1));
|
||||
|
||||
// Now add on the samples text, if we have any
|
||||
if (group[i]->GetTimerSamples())
|
||||
@ -235,12 +235,12 @@ static void PrintColumn(ProfileGroup& group, const char* groupName, int column,
|
||||
|
||||
txt.DrawString(x, y+height, str);
|
||||
if (column != kColName)
|
||||
width = hsMaximum(width, txt.CalcStringWidth(str) + 1);
|
||||
width = std::max(width, static_cast<int>(txt.CalcStringWidth(str) + 1));
|
||||
height += yInc;
|
||||
}
|
||||
|
||||
// So the columns don't jump around as much as values change, pad them out to a certain width
|
||||
width = hsMaximum(width, txt.CalcStringWidth("000.0 ms") + 1);
|
||||
width = std::max(width, static_cast<int>(txt.CalcStringWidth("000.0 ms") + 1));
|
||||
}
|
||||
|
||||
static void PrintGroup(ProfileGroup& group, const char* groupName, int& x, int& y)
|
||||
@ -315,7 +315,7 @@ void plProfileManagerFull::Update()
|
||||
int x = 10;
|
||||
PrintGroup(group, groupName.c_str(), x, y);
|
||||
|
||||
maxX = hsMaximum(maxX, x);
|
||||
maxX = std::max(maxX, x);
|
||||
y += 10;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user