Fix crash when compiled with Clang
FossilOrigin-Name: 5e7a0895eb30bb141156e3aaecbc9292d6c2d7ba6399470097f26811a672d2e8
This commit is contained in:
parent
133382170f
commit
f5cd2c4046
4 changed files with 15 additions and 14 deletions
|
@ -36,13 +36,14 @@ renderentities()
|
||||||
{
|
{
|
||||||
entity &e = ents[i];
|
entity &e = ents[i];
|
||||||
if (e.type == MAPMODEL) {
|
if (e.type == MAPMODEL) {
|
||||||
mapmodelinfo &mmi = getmminfo(e.attr2);
|
mapmodelinfo *mmi = getmminfo(e.attr2);
|
||||||
if (!&mmi)
|
if (!mmi)
|
||||||
continue;
|
continue;
|
||||||
rendermodel(mmi.name, 0, 1, e.attr4, (float)mmi.rad,
|
rendermodel(mmi->name, 0, 1, e.attr4, (float)mmi->rad,
|
||||||
e.x, (float)S(e.x, e.y)->floor + mmi.zoff + e.attr3,
|
e.x,
|
||||||
|
(float)S(e.x, e.y)->floor + mmi->zoff + e.attr3,
|
||||||
e.y, (float)((e.attr1 + 7) - (e.attr1 + 7) % 15), 0,
|
e.y, (float)((e.attr1 + 7) - (e.attr1 + 7) % 15), 0,
|
||||||
false, 1.0f, 10.0f, mmi.snap);
|
false, 1.0f, 10.0f, mmi->snap);
|
||||||
} else {
|
} else {
|
||||||
if (OUTBORD(e.x, e.y))
|
if (OUTBORD(e.x, e.y))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -59,18 +59,18 @@ mmcollide(dynent *d, float &hi, float &lo) // collide with a mapmodel
|
||||||
entity &e = ents[i];
|
entity &e = ents[i];
|
||||||
if (e.type != MAPMODEL)
|
if (e.type != MAPMODEL)
|
||||||
continue;
|
continue;
|
||||||
mapmodelinfo &mmi = getmminfo(e.attr2);
|
mapmodelinfo *mmi = getmminfo(e.attr2);
|
||||||
if (!&mmi || !mmi.h)
|
if (!mmi || !mmi->h)
|
||||||
continue;
|
continue;
|
||||||
const float r = mmi.rad + d->radius;
|
const float r = mmi->rad + d->radius;
|
||||||
if (fabs(e.x - d->o.x) < r && fabs(e.y - d->o.y) < r) {
|
if (fabs(e.x - d->o.x) < r && fabs(e.y - d->o.y) < r) {
|
||||||
float mmz =
|
float mmz =
|
||||||
(float)(S(e.x, e.y)->floor + mmi.zoff + e.attr3);
|
(float)(S(e.x, e.y)->floor + mmi->zoff + e.attr3);
|
||||||
if (d->o.z - d->eyeheight < mmz) {
|
if (d->o.z - d->eyeheight < mmz) {
|
||||||
if (mmz < hi)
|
if (mmz < hi)
|
||||||
hi = mmz;
|
hi = mmz;
|
||||||
} else if (mmz + mmi.h > lo)
|
} else if (mmz + mmi->h > lo)
|
||||||
lo = mmz + mmi.h;
|
lo = mmz + mmi->h;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -207,7 +207,7 @@ extern void cleansound();
|
||||||
extern void rendermodel(char *mdl, int frame, int range, int tex, float rad,
|
extern void rendermodel(char *mdl, int frame, int range, int tex, float rad,
|
||||||
float x, float y, float z, float yaw, float pitch, bool teammate,
|
float x, float y, float z, float yaw, float pitch, bool teammate,
|
||||||
float scale, float speed, int snap = 0, int basetime = 0);
|
float scale, float speed, int snap = 0, int basetime = 0);
|
||||||
extern mapmodelinfo &getmminfo(int i);
|
extern mapmodelinfo *getmminfo(int i);
|
||||||
|
|
||||||
// server
|
// server
|
||||||
extern void initserver(bool dedicated, int uprate, char *sdesc, char *ip,
|
extern void initserver(bool dedicated, int uprate, char *sdesc, char *ip,
|
||||||
|
|
|
@ -254,10 +254,10 @@ mapmodelreset()
|
||||||
mapmodels.setsize(0);
|
mapmodels.setsize(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
mapmodelinfo &
|
mapmodelinfo *
|
||||||
getmminfo(int i)
|
getmminfo(int i)
|
||||||
{
|
{
|
||||||
return i < mapmodels.length() ? mapmodels[i]->mmi : *(mapmodelinfo *)0;
|
return i < mapmodels.length() ? &mapmodels[i]->mmi : NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
COMMAND(mapmodel, ARG_5STR);
|
COMMAND(mapmodel, ARG_5STR);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue