Skip to content

Commit

Permalink
fix exception for particle effect at the begining of network game
Browse files Browse the repository at this point in the history
  • Loading branch information
stalkerg committed Dec 2, 2024
1 parent a3bebd1 commit b9ef5ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions src/units/effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,10 @@ void TargetParticleObject::AddVertex(const Vector& _vR,int _Color,int _Speed1,in
void TargetParticleType::aQuant2(void)
{
int tx,ty;

if (pDist <= 0 && !type) {
return;
}

tx = SPGetDistX(vT.x,vR.x);
ty = vT.y - vR.y;
Expand All @@ -1467,7 +1471,7 @@ void TargetParticleType::aQuant2(void)
// vR.y &= PTrack_mask_y;
pDist--;

if (!pDist && type){
if (pDist <= 0 && type){
pDist = LifeTime;

vT = vD;
Expand Down Expand Up @@ -1502,7 +1506,7 @@ void TargetParticleObject::AddVertex2(const Vector& _vR,const Vector& _vT, int _

p->Color = _Color;
p->type = _type;
p->LifeTime = LifeTime;
p->LifeTime = LifeTime * GAME_TIME_COEFF;

if (_type){
p->vT.x = vCheck.x << 8;
Expand Down Expand Up @@ -1534,7 +1538,7 @@ void TargetParticleObject::AddVertex2(const Vector& _vR,const Vector& _vT, int _
p->vT.y = vCheck.y << 8;
p->vT.z = vCheck.z << 8;
}
p->pDist = LifeTime;
p->pDist = LifeTime * GAME_TIME_COEFF;
if ( _type ) {
p->pDist >>= 1;
p->LifeTime >>= 1;
Expand Down
2 changes: 1 addition & 1 deletion src/units/effect.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ struct TargetParticleType
int Color;
Vector vR,vT,vD;
int s;
short pDist, LifeTime;
int pDist, LifeTime;
void aQuant(void);
void aQuant2(void);

Expand Down

0 comments on commit b9ef5ca

Please sign in to comment.