Skip to content

Commit 1b49451

Browse files
committed
Refactor: Keep old behavior changed by previous commit
The following usages across the code base were changed `flt_min` -> `flt_lowest` `flt_zero` -> `flt_min` `dbl_zero` -> `dbl_min`
1 parent 33d2be6 commit 1b49451

25 files changed

+34
-34
lines changed

src/Layers/xrRenderPC_R1/LightProjector.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ void CLightProjector::calculate()
243243
v.sub(v_Cs, v_C);
244244
;
245245
#ifdef DEBUG
246-
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_zero)
246+
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_min)
247247
{
248248
IGameObject* OO = dynamic_cast<IGameObject*>(R.O);
249249
Msg("Object[%s] Visual[%s] has invalid position. ", *OO->cName(), *OO->cNameVisual());
@@ -274,7 +274,7 @@ void CLightProjector::calculate()
274274
}
275275
#endif
276276
// handle invalid object-bug
277-
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_zero)
277+
if ((v.x * v.x + v.y * v.y + v.z * v.z) <= flt_min)
278278
{
279279
// invalidate record, so that object will be unshadowed, but doesn't crash
280280
R.dwTimeValid = Device.dwTimeGlobal;

src/utils/xrAI/space_restrictor_wrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ void CSpaceRestrictorWrapper::fill_shape(const CShapeData::shape_def& shape)
147147
Fvector().set(-.5f, +.5f, -.5f), Fvector().set(-.5f, +.5f, +.5f), Fvector().set(+.5f, -.5f, -.5f),
148148
Fvector().set(+.5f, -.5f, +.5f), Fvector().set(+.5f, +.5f, -.5f), Fvector().set(+.5f, +.5f, +.5f)};
149149
start = Fvector().set(flt_max, flt_max, flt_max);
150-
dest = Fvector().set(flt_min, flt_min, flt_min);
150+
dest = Fvector().set(flt_lowest, flt_lowest, flt_lowest);
151151
Fmatrix Q;
152152
Q.mul_43(m_xform, shape.data.box);
153153
Fvector temp;

src/utils/xrLC/OGF_Face.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void OGF::Optimize()
210210
// 1. Calc bounds
211211
Fvector2 Tmin,Tmax;
212212
Tmin.set(flt_max,flt_max);
213-
Tmax.set(flt_min,flt_min);
213+
Tmax.set(flt_lowest,flt_lowest);
214214
for (size_t j=0; j<x_vertices.size(); j++) {
215215
x_vertex& V = x_vertices[j];
216216
//Tmin.min (V.UV);
@@ -291,7 +291,7 @@ void OGF::Optimize()
291291
{
292292
Fvector2 Tmin, Tmax;
293293
Tmin.set(flt_max, flt_max);
294-
Tmax.set(flt_min, flt_min);
294+
Tmax.set(flt_lowest, flt_lowest);
295295
for (size_t j = 0; j < selection.size(); j++)
296296
{
297297
OGF_Vertex& V = data.vertices[selection[j]];

src/utils/xrLC_Light/MeshStructure.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ struct MESHSTRUCTURE_API Tface : public DataVertexType::DataFaceType, public vec
198198
t2.sub(v2, v1);
199199
dN.crossproduct(t1, t2);
200200
double mag = dN.magnitude();
201-
if (mag < dbl_zero)
201+
if (mag < dbl_min)
202202
{
203203
Failure();
204204
Dvector Nabs;

src/utils/xrMiscMath/matrix.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ _matrix<T>& _matrix<T>::invert(const _matrix<T>& a) // important: this is 4x3
155155
a._12 * (a._21 * a._33 - a._23 * a._31) +
156156
a._13 * (a._21 * a._32 - a._22 * a._31));
157157

158-
VERIFY(_abs(fDetInv) > flt_zero);
158+
VERIFY(_abs(fDetInv) > flt_min);
159159
fDetInv = 1.0f / fDetInv;
160160

161161
_11 = fDetInv * (a._22 * a._33 - a._23 * a._32);
@@ -188,7 +188,7 @@ bool _matrix<T>::invert_b(const _matrix<T>& a) // important: this is 4x3 inver
188188
a._12 * (a._21 * a._33 - a._23 * a._31) +
189189
a._13 * (a._21 * a._32 - a._22 * a._31));
190190

191-
if (_abs(fDetInv) <= flt_zero) return false;
191+
if (_abs(fDetInv) <= flt_min) return false;
192192
fDetInv = 1.0f / fDetInv;
193193

194194
_11 = fDetInv * (a._22 * a._33 - a._23 * a._32);
@@ -234,7 +234,7 @@ _matrix<T>& _matrix<T>::invert_44(const _matrix<T>& a)
234234
T A14 = -(a21 * mn3 - a22 * mn5 + a23 * mn6);
235235

236236
T detInv = a11 * A11 + a12 * A12 + a13 * A13 + a14 * A14;
237-
VERIFY(_abs(detInv) > flt_zero);
237+
VERIFY(_abs(detInv) > flt_min);
238238

239239
detInv = 1.f / detInv;
240240

src/utils/xrMiscMath/vector.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ _vector3<T>& _vector3<T>::normalize_safe()
315315
template <typename T>
316316
_vector3<T>& _vector3<T>::normalize(const _vector3<T>& v)
317317
{
318-
VERIFY((v.x*v.x + v.y*v.y + v.z*v.z) > flt_zero);
318+
VERIFY((v.x*v.x + v.y*v.y + v.z*v.z) > flt_min);
319319
T mag = _sqrt(1 / (v.x*v.x + v.y*v.y + v.z*v.z));
320320
x = v.x*mag;
321321
y = v.y*mag;

src/xrCDB/Frustum.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void CFrustum::SimplifyPoly_AABB(sPoly* poly, Fplane& plane)
295295
// Project and find extents
296296
Fvector2 min, max;
297297
min.set(flt_max, flt_max);
298-
max.set(flt_min, flt_min);
298+
max.set(flt_lowest, flt_lowest);
299299
for (auto& v : *poly)
300300
{
301301
Fvector2 tmp;

src/xrCore/_fbox.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ struct Fbox3
6767
auto& invalidate()
6868
{
6969
vMin.set(type_max<float>, type_max<float>, type_max<float>);
70-
vMax.set(type_min<float>, type_min<float>, type_min<float>);
70+
vMax.set(type_lowest<float>, type_lowest<float>, type_lowest<float>);
7171
return *this;
7272
}
7373

src/xrCore/_fbox2.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ struct Fbox2
5757
auto& invalidate()
5858
{
5959
min.set(type_max<float>, type_max<float>);
60-
max.set(type_min<float>, type_min<float>);
60+
max.set(type_lowest<float>, type_lowest<float>);
6161
return *this;
6262
}
6363

src/xrCore/_rect.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ struct _rect
7070
{
7171
lt.x = type_max<T>;
7272
lt.y = type_max<T>;
73-
rb.x = type_min<T>;
74-
rb.y = type_min<T>;
73+
rb.x = type_lowest<T>;
74+
rb.y = type_lowest<T>;
7575
return *this;
7676
};
7777
IC bool valide() { return lt.x1 < rb.x && lt.y < rb.y; }

src/xrEngine/FDemoPlay.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void CDemoPlay::stat_Stop()
114114

115115
// min/max/average
116116
rfps_min = flt_max;
117-
rfps_max = flt_min;
117+
rfps_max = flt_lowest;
118118
rfps_middlepoint = 0;
119119

120120
// Filtered FPS

src/xrEngine/xrSASH.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ void xrSASH::ReportNative(pcstr pszTestName)
160160

161161
// min/max/average
162162
float fMinFps = flt_max;
163-
float fMaxFps = flt_min;
163+
float fMaxFps = flt_lowest;
164164

165165
const u32 iWindowSize = 15;
166166

src/xrGame/DynamicHeightMap.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ float CHM_Static::Query(float x, float z)
211211

212212
//
213213
void CHM_Dynamic::Update() {}
214-
float CHM_Dynamic::Query(float x, float z) { return flt_min; }
214+
float CHM_Dynamic::Query(float x, float z) { return flt_lowest; }
215215
//
216216
float CHeightMap::Query(float x, float z)
217217
{

src/xrGame/DynamicHeightMap.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class CHM_Static
3131
{
3232
for (u32 i = 0; i < dhm_precision; ++i)
3333
for (u32 j = 0; j < dhm_precision; ++j)
34-
data[i][j] = flt_min;
34+
data[i][j] = flt_lowest;
3535
}
3636
Slot()
3737
{

src/xrGame/Level_bullet_manager_firetrace.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ void CBulletManager::FireShotmark(SBullet* bullet, const Fvector& vDir, const Fv
237237
if ((ps_name && ShowMark) || (bullet->flags.explosive && bStatic))
238238
{
239239
VERIFY2((particle_dir.x * particle_dir.x + particle_dir.y * particle_dir.y + particle_dir.z * particle_dir.z) >
240-
flt_zero,
240+
flt_min,
241241
make_string("[%f][%f][%f]", VPUSH(particle_dir)));
242242
Fmatrix pos;
243243
pos.k.normalize(particle_dir);

src/xrGame/WeaponBinocularsVision.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ void SBinocVisibleObj::Update()
8989

9090
Fmatrix xform;
9191
xform.mul(Device.mFullTransform, m_object->XFORM());
92-
Fvector2 mn = {flt_max, flt_max}, mx = {flt_min, flt_min};
92+
Fvector2 mn = {flt_max, flt_max}, mx = {flt_lowest, flt_lowest};
9393

9494
for (u32 k = 0; k < 8; ++k)
9595
{

src/xrGame/ai/monsters/basemonster/base_monster.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ float CBaseMonster::get_screen_space_coverage_diagonal()
10371037

10381038
Fmatrix xform;
10391039
xform.mul(Device.mFullTransform, XFORM());
1040-
Fvector2 mn = {flt_max, flt_max}, mx = {flt_min, flt_min};
1040+
Fvector2 mn = {flt_max, flt_max}, mx = {flt_lowest, flt_lowest};
10411041

10421042
for (u32 k = 0; k < 8; ++k)
10431043
{

src/xrGame/ai_obstacle.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void ai_obstacle::compute_matrix(Fmatrix& result, const Fvector& additional)
164164
void ai_obstacle::prepare_inside(Fvector& min, Fvector& max)
165165
{
166166
min = Fvector().set(flt_max, flt_max, flt_max);
167-
max = Fvector().set(flt_min, flt_min, flt_min);
167+
max = Fvector().set(flt_lowest, flt_lowest, flt_lowest);
168168

169169
Fmatrix matrix;
170170
float half_cell_size = (use_additional_radius ? 1.f : 0.f) * ai().level_graph().header().cell_size() * .5f;

src/xrGame/inventory_upgrade_manager.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ LPCSTR Manager::get_upgrade_by_index(CInventoryItem& item, Ivector2 const& index
493493
bool Manager::compute_range(LPCSTR parameter, float& low, float& high)
494494
{
495495
low = flt_max;
496-
high = flt_min;
496+
high = flt_lowest;
497497

498498
Roots_type::iterator ib = m_roots.begin();
499499
Roots_type::iterator ie = m_roots.end();
@@ -509,7 +509,7 @@ bool Manager::compute_range(LPCSTR parameter, float& low, float& high)
509509
compute_range_section(((*uib).second)->section(), parameter, low, high);
510510
}
511511

512-
return (low != flt_max) && (high != flt_min);
512+
return (low != flt_max) && (high != flt_lowest);
513513
}
514514

515515
void Manager::compute_range_section(LPCSTR section, LPCSTR parameter, float& low, float& high)

src/xrGame/smart_cover_detail.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ namespace detail
1919
{
2020
typedef RestrictionSpace::CTimeIntrusiveBase intrusive_base_time;
2121

22-
float parse_float(luabind::adl::object const& table, LPCSTR identifier, float const& min_threshold = flt_min,
22+
float parse_float(luabind::adl::object const& table, LPCSTR identifier, float const& min_threshold = flt_lowest,
2323
float const& max_threshold = flt_max);
2424
bool parse_float(float& output, luabind::adl::object const& table, LPCSTR identifier,
25-
float const& min_threshold = flt_min, float const& max_threshold = flt_max);
25+
float const& min_threshold = flt_lowest, float const& max_threshold = flt_max);
2626
LPCSTR parse_string(luabind::adl::object const& table, LPCSTR identifier);
2727
void parse_table(luabind::adl::object const& table, LPCSTR identifier, luabind::adl::object& result);
2828
bool parse_bool(luabind::adl::object const& table, LPCSTR identifier);

src/xrGame/space_restriction_shape.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void CSpaceRestrictionShape::fill_shape(const CCF_Shape::shape_def& shape)
6161
Fvector().set(-.5f, +.5f, -.5f), Fvector().set(-.5f, +.5f, +.5f), Fvector().set(+.5f, -.5f, -.5f),
6262
Fvector().set(+.5f, -.5f, +.5f), Fvector().set(+.5f, +.5f, -.5f), Fvector().set(+.5f, +.5f, +.5f)};
6363
start = Fvector().set(flt_max, flt_max, flt_max);
64-
dest = Fvector().set(flt_min, flt_min, flt_min);
64+
dest = Fvector().set(flt_lowest, flt_lowest, flt_lowest);
6565
Fmatrix Q;
6666
Q.mul_43(m_restrictor->XFORM(), shape.data.box);
6767
Fvector temp;

src/xrServerEntities/PropertiesListHelper.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ class CPropHelper : public IPropHelper
8484
PropItemVec& items, shared_str key, float* val, float mn = 0.f, float mx = 86400.f);
8585
virtual ShortcutValue* CreateShortcut(PropItemVec& items, shared_str key, xr_shortcut* val);
8686

87-
virtual FloatValue* CreateAngle(PropItemVec& items, shared_str key, float* val, float mn = flt_min,
87+
virtual FloatValue* CreateAngle(PropItemVec& items, shared_str key, float* val, float mn = flt_lowest,
8888
float mx = flt_max, float inc = 0.01f, int decim = 2);
89-
virtual VectorValue* CreateAngle3(PropItemVec& items, shared_str key, Fvector* val, float mn = flt_min,
89+
virtual VectorValue* CreateAngle3(PropItemVec& items, shared_str key, Fvector* val, float mn = flt_lowest,
9090
float mx = flt_max, float inc = 0.01f, int decim = 2);
9191
virtual RTextValue* CreateName(PropItemVec& items, shared_str key, shared_str* val, ListItem* owner);
9292
virtual RTextValue* CreateNameCB(PropItemVec& items, shared_str key, shared_str* val,

src/xrServerEntities/alife_monster_brain.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ void CALifeMonsterBrain::select_task(const bool forced)
107107

108108
m_last_search_time = current_time;
109109

110-
float best_value = flt_min;
110+
float best_value = flt_lowest;
111111
CALifeSmartTerrainRegistry::OBJECTS::const_iterator I = ai().alife().smart_terrains().objects().begin();
112112
CALifeSmartTerrainRegistry::OBJECTS::const_iterator E = ai().alife().smart_terrains().objects().end();
113113
for (; I != E; ++I)

src/xrServerEntities/xrEProps.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,9 @@ class XR_EPROPS_API IPropHelper
138138
PropItemVec& items, shared_str key, float* val, float mn = 0.f, float mx = 86400.f) = 0;
139139
virtual ShortcutValue* CreateShortcut(PropItemVec& items, shared_str key, xr_shortcut* val) = 0;
140140

141-
virtual FloatValue* CreateAngle(PropItemVec& items, shared_str key, float* val, float mn = flt_min,
141+
virtual FloatValue* CreateAngle(PropItemVec& items, shared_str key, float* val, float mn = flt_lowest,
142142
float mx = flt_max, float inc = 0.01f, int decim = 2) = 0;
143-
virtual VectorValue* CreateAngle3(PropItemVec& items, shared_str key, Fvector* val, float mn = flt_min,
143+
virtual VectorValue* CreateAngle3(PropItemVec& items, shared_str key, Fvector* val, float mn = flt_lowest,
144144
float mx = flt_max, float inc = 0.01f, int decim = 2) = 0;
145145
virtual RTextValue* CreateName(PropItemVec& items, shared_str key, shared_str* val, ListItem* owner) = 0;
146146
virtual RTextValue* CreateNameCB(PropItemVec& items, shared_str key, shared_str* val,

src/xrServerEntities/xrServer_Objects_Alife_Smartcovers.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ Fvector parse_fvector(luabind::object const& table, LPCSTR identifier)
194194
return (luabind::object_cast<Fvector>(result));
195195
}
196196

197-
float parse_float(luabind::object const& table, LPCSTR identifier, float const& min_threshold = flt_min,
197+
float parse_float(luabind::object const& table, LPCSTR identifier, float const& min_threshold = flt_lowest,
198198
float const& max_threshold = flt_max)
199199
{
200200
VERIFY2(luabind::type(table) == LUA_TTABLE, "invalid loophole description passed");

0 commit comments

Comments
 (0)