Update of /cvsroot/timewarp/source/newships In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5054/source/newships Modified Files: shpaktgu.cpp shpalabc.cpp shpalckr.cpp shpalhdr.cpp shpalhha.cpp shparkpi.cpp shpastba.cpp shpayrbs.cpp shpbahbu.cpp shpbatde.cpp shpbogce.cpp shpbubbo.cpp shpchoex.cpp shpclofl.cpp shpconca.cpp shpcrapl.cpp shpcrore.cpp shpdajem.cpp shpdeees.cpp shpdjila.cpp shpdragr.cpp shpducla.cpp shpdyzha.cpp shpearc2.cpp shpearc3.cpp shpfiear.cpp shpfopsl.cpp shpforsh.cpp shpgahmo.cpp shpgarty.cpp shpgerhe.cpp shpgeror.cpp shpglads.cpp shphotsp.cpp shphubde.cpp shphydcr.cpp shpilwsp.cpp shpimpka.cpp shpjnkla.cpp shpjurcu.cpp shpjygst.cpp shpkabwe.cpp shpkatpo.cpp shpklidr.cpp shpkolfl.cpp shpkorsi.cpp shplyrwa.cpp shpmoisp.cpp shpmontr.cpp shpnarlu.cpp shpoliha.cpp shpplane.cpp shpqlore.cpp shpraame.cpp shprogsq.cpp shpsamat.cpp shpsclfr.cpp shpsefn2.cpp shpstaba.cpp shptauar.cpp shptaubo.cpp shptauem.cpp shptaule.cpp shptaumc.cpp shptautu.cpp shpterbi.cpp shptrige.cpp shptulra.cpp shpulzin.cpp shpvelcr.cpp shpvenke.cpp shpvezba.cpp shpvirli.cpp shpwassu.cpp shpxilcr.cpp shpyevme.cpp shpyurpa.cpp Log Message: debugging Index: shphotsp.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shphotsp.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shphotsp.cpp 23 Aug 2005 22:18:11 -0000 1.14 --- shphotsp.cpp 28 Aug 2005 20:34:08 -0000 1.15 *************** *** 442,446 **** Query q; ! for (q.begin(this, layers, passiveRange); q.current; q.next()) { SpaceObject *o = q.currento; --- 442,446 ---- Query q; ! for (q.begin(this, layers, passiveRange, QUERY_OBJECT); q.current; q.next()) { SpaceObject *o = q.currento; Index: shpglads.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpglads.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shpglads.cpp 14 Aug 2005 16:14:32 -0000 1.12 --- shpglads.cpp 28 Aug 2005 20:34:08 -0000 1.13 *************** *** 132,136 **** double a; Query q; ! for (q.begin(this, bit(LAYER_SHIPS),(laser_range *.80)); q.current; q.next()) { o = q.currento; a = normalize(trajectory_angle(o)-angle,360); --- 132,136 ---- double a; Query q; ! for (q.begin(this, bit(LAYER_SHIPS),(laser_range *.80), QUERY_OBJECT); q.current; q.next()) { o = q.currento; a = normalize(trajectory_angle(o)-angle,360); Index: shptautu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptautu.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shptautu.cpp 14 Aug 2005 16:14:32 -0000 1.11 --- shptautu.cpp 28 Aug 2005 20:34:08 -0000 1.12 *************** *** 282,286 **** Query q; double aa, bb; ! for (q.begin(this, bit(LAYER_SHOTS), 30); q.currento; q.next()) if (q.currento->getID() == id) { aa = (trajectory_angle(q.currento)+PI); --- 282,286 ---- Query q; double aa, bb; ! for (q.begin(this, bit(LAYER_SHOTS), 30, QUERY_OBJECT); q.currento; q.next()) if (q.currento->getID() == id) { aa = (trajectory_angle(q.currento)+PI); Index: shprogsq.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shprogsq.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shprogsq.cpp 16 Aug 2005 23:21:02 -0000 1.18 --- shprogsq.cpp 28 Aug 2005 20:34:08 -0000 1.19 *************** *** 232,236 **** fighter[i]->pos = fighter[i]->idealpos; fighter[i]->angle = player_angle; ! fighter[i]->vel = 0; } --- 232,236 ---- fighter[i]->pos = fighter[i]->idealpos; fighter[i]->angle = player_angle; ! fighter[i]->set_vel ( 0 ); } *************** *** 411,415 **** SpaceObject *o; Query a; ! for (a.begin(this, bit(LAYER_SHIPS), 999999.0); a.current; a.next()) { o = a.currento; --- 411,415 ---- SpaceObject *o; Query a; ! for (a.begin(this, bit(LAYER_SHIPS), 999999.0, QUERY_OBJECT); a.current; a.next()) { o = a.currento; Index: shpdjila.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdjila.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpdjila.cpp 11 Jul 2005 00:25:30 -0000 1.10 --- shpdjila.cpp 28 Aug 2005 20:34:07 -0000 1.11 *************** *** 241,245 **** Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { --- 241,245 ---- Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange, QUERY_OBJECT); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { Index: shpdajem.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdajem.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpdajem.cpp 26 Aug 2005 21:55:19 -0000 1.16 --- shpdajem.cpp 28 Aug 2005 20:34:07 -0000 1.17 *************** *** 41,45 **** DajielkaTendril* tendril[30]; DajielkaSanctuary(DajielkaCruiser* ocreator); ! ~DajielkaSanctuary(void); DajielkaTendril* RecreateTendril(DajielkaTendril* DT); virtual void calculate(); --- 41,45 ---- DajielkaTendril* tendril[30]; DajielkaSanctuary(DajielkaCruiser* ocreator); ! virtual void death(); DajielkaTendril* RecreateTendril(DajielkaTendril* DT); virtual void calculate(); *************** *** 92,99 **** DajielkaTendril(DajielkaSanctuary* osanctuary, int odamage, int orange, double ostartingAngle, double orotation); ! ~DajielkaTendril(void); virtual void animate(Frame* space); virtual void calculate(void); virtual void inflict_damage(SpaceObject *other); }; --- 92,101 ---- DajielkaTendril(DajielkaSanctuary* osanctuary, int odamage, int orange, double ostartingAngle, double orotation); ! virtual ~DajielkaTendril(void); virtual void animate(Frame* space); virtual void calculate(void); virtual void inflict_damage(SpaceObject *other); + virtual int handle_damage(SpaceLocation *source, double normal, double direct); + virtual bool DajielkaTendril::die(); }; *************** *** 163,167 **** public: DajielkaCruiser(Vector2 opos, double angle, ShipData *data, unsigned int code); ! ~DajielkaCruiser(void); DajielkaSanctuary* sanctuary; protected: --- 165,169 ---- public: DajielkaCruiser(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual void death(); DajielkaSanctuary* sanctuary; protected: *************** *** 236,241 **** } ! DajielkaCruiser::~DajielkaCruiser(void) { ! STACKTRACE if(sanctuary!=NULL) { sanctuary->state = 0; --- 238,247 ---- } ! void DajielkaCruiser::death() ! { ! STACKTRACE; ! ! Ship::death(); ! if(sanctuary!=NULL) { sanctuary->state = 0; *************** *** 266,296 **** } ! void DajielkaCruiser::calculate(void) { ! STACKTRACE ! if(!fire_special) redeployTime=0; ! if(accumulatedCharge>shipChargeThreshhold) { ! if(batt<batt_max) { ! batt++; ! update_panel = TRUE; ! accumulatedCharge -= shipChargeThreshhold; ! if(batt>batt_max) ! batt=batt_max; ! } ! else ! accumulatedCharge = shipChargeThreshhold; ! } ! if(accumulatedRegeneration>shipRegenerationThreshhold) { ! if(crew<crew_max) { ! crew++; ! update_panel = TRUE; ! accumulatedRegeneration -= shipRegenerationThreshhold; ! if(crew>crew_max) ! crew=crew_max; ! } ! else ! accumulatedRegeneration = shipRegenerationThreshhold; ! } - Ship::calculate(); } --- 272,312 ---- } ! void DajielkaCruiser::calculate(void) ! { ! STACKTRACE; ! ! Ship::calculate(); ! ! if (sanctuary && !sanctuary->exists()) ! sanctuary = 0; ! ! if(!fire_special) ! redeployTime=0; ! ! if(accumulatedCharge>shipChargeThreshhold) ! { ! if(batt<batt_max) { ! batt++; ! update_panel = TRUE; ! accumulatedCharge -= shipChargeThreshhold; ! if(batt>batt_max) ! batt=batt_max; ! } ! else ! accumulatedCharge = shipChargeThreshhold; ! } ! if(accumulatedRegeneration>shipRegenerationThreshhold) ! { ! if(crew<crew_max) { ! crew++; ! update_panel = TRUE; ! accumulatedRegeneration -= shipRegenerationThreshhold; ! if(crew>crew_max) ! crew=crew_max; ! } ! else ! accumulatedRegeneration = shipRegenerationThreshhold; ! } } *************** *** 344,348 **** void DajielkaCrTorpedo::calculate() { ! STACKTRACE AnimatedShot::calculate(); } --- 360,368 ---- void DajielkaCrTorpedo::calculate() { ! STACKTRACE; ! ! if (creator && !creator->exists()) ! creator = 0; ! AnimatedShot::calculate(); } *************** *** 432,437 **** } ! DajielkaSanctuary::~DajielkaSanctuary(void) { ! STACKTRACE int i; for(i=0; i<30; i++) { --- 452,460 ---- } ! void DajielkaSanctuary::death() ! { ! STACKTRACE; ! SpaceObject::death(); ! int i; for(i=0; i<30; i++) { *************** *** 443,449 **** } ! void DajielkaSanctuary::calculate(void) { STACKTRACE; if (creator && !creator->exists()) { --- 466,475 ---- } ! void DajielkaSanctuary::calculate(void) ! { STACKTRACE; + SpaceObject::calculate(); + if (creator && !creator->exists()) { *************** *** 455,466 **** int regenMultiplier; DajielkaSanctuary::addEnergy( iround(energyPerFrame*frame_time/25.0) ); //corrected for click-dependant regeneration. Tau. ! for(i=0;i<30;i++) ! if(tendril[i]!=NULL) ! if(tendril[i]->recreateMe == TRUE) { //tw_error("Want to recreate!"); //tendril[i] = this->RecreateTendril(tendril[i]); } vel = 0; ! SpaceObject::calculate(); regenMultiplier=1; for(j=0;j<regenerationExponent;j++) --- 481,505 ---- int regenMultiplier; DajielkaSanctuary::addEnergy( iround(energyPerFrame*frame_time/25.0) ); //corrected for click-dependant regeneration. Tau. ! ! for ( i = 0; i < 30; i++) ! { ! if (tendril[i]) ! { ! if (!tendril[i]->exists()) ! { ! tw_error("a dead tendril? this should not happen"); ! tendril[i] = 0; ! } ! ! ! if(tendril[i]->recreateMe == TRUE) { //tw_error("Want to recreate!"); //tendril[i] = this->RecreateTendril(tendril[i]); } + } + } + vel = 0; ! regenMultiplier=1; for(j=0;j<regenerationExponent;j++) *************** *** 505,539 **** ! void DajielkaSanctuary::addEnergy(int energy) { ! STACKTRACE ! int i, j; ! int damageBefore, damageAfter; ! for(j=1;j<10 && energy>0;j++) ! { ! for(i=0;i<30 && energy>0;i++) { ! if (tendril[i]->energyLevelPerDamagePoint) ! damageBefore = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageBefore = 0; ! ! if(tendril[i]!=NULL && tendril[i]->state !=0) ! if(tendril[i]->energyLevelPerDamagePoint * j > tendril[i]->energyLevel ! && tendril[i]->energyLevel < tendril[i]->energyLevelMax) { ! tendril[i]->energyLevel += energy; ! energy = 0; ! } ! ! if (tendril[i]->energyLevelPerDamagePoint) ! damageAfter = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageAfter = 0; ! ! if(damageBefore!=damageAfter && tendril[i]->get_length()==0) { ! //tendril[i]=this->RecreateTendril(tendril[i]); ! tendril[i]->isActive = TRUE; ! } ! } ! } } --- 544,586 ---- ! void DajielkaSanctuary::addEnergy(int energy) ! { ! STACKTRACE; ! int i, j; ! int damageBefore, damageAfter; ! for(j=1;j<10 && energy>0;j++) { ! for(i=0;i<30 && energy>0;i++) ! { ! if (tendril[i]) ! { ! if (tendril[i]->energyLevelPerDamagePoint) ! damageBefore = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageBefore = 0; ! ! if (tendril[i]->state !=0) ! { ! if(tendril[i]->energyLevelPerDamagePoint * j > tendril[i]->energyLevel ! && tendril[i]->energyLevel < tendril[i]->energyLevelMax) ! { ! tendril[i]->energyLevel += energy; ! energy = 0; ! } ! } ! ! if (tendril[i]->energyLevelPerDamagePoint) ! damageAfter = (int)(tendril[i]->energyLevel/tendril[i]->energyLevelPerDamagePoint); ! else ! damageAfter = 0; ! ! if(damageBefore!=damageAfter && tendril[i]->get_length()==0) ! { ! //tendril[i]=this->RecreateTendril(tendril[i]); ! tendril[i]->isActive = TRUE; ! } ! } ! } ! } } *************** *** 586,624 **** } ! void DajielkaTendril::calculate(void) { STACKTRACE; - if(energyLevel<energyLevelPerDamagePoint) { - isActive = FALSE; - length = 0; - damage_factor = 0; - collide_flag_anyone = 0; - collide_flag_sameteam = 0; - collide_flag_sameship = 0; - } - else { - isActive = TRUE; - length = originalLength; - damage_factor = 1; - collide_flag_anyone = ALL_LAYERS; - collide_flag_sameteam = bit(LAYER_SHIPS)|bit(LAYER_SHOTS); - collide_flag_sameship = bit(LAYER_SHIPS)|bit(LAYER_SHOTS); - } - angle = angle + frame_time / 1000.0 * rotation; - while(angle<0) angle+=PI2; - while(angle>PI2) angle-=PI2; ! if (creator && !creator->exists()) ! { ! creator = 0; ! state = 0; ! } ! ! SpaceLine::calculate(); ! color=palette_color[(int)(energyLevel/energyLevelPerDamagePoint)+7]; ! if(creator!=NULL) ! if(isActive) ! if(regenerationIsTendrilBased==1) ! sanctuary->regenerationCount += frame_time; } --- 633,685 ---- } ! void DajielkaTendril::calculate(void) ! { STACKTRACE; ! SpaceLine::calculate(); ! ! if (creator && !creator->exists()) ! { ! creator = 0; ! //state = 0; ! } ! if (sanctuary && !sanctuary->exists()) ! { ! sanctuary = 0; ! state = 0; ! } ! ! ! if(energyLevel<energyLevelPerDamagePoint) { ! isActive = FALSE; ! length = 0; ! damage_factor = 0; ! collide_flag_anyone = 0; ! collide_flag_sameteam = 0; ! collide_flag_sameship = 0; ! } ! else { ! isActive = TRUE; ! length = originalLength; ! damage_factor = 1; ! collide_flag_anyone = ALL_LAYERS; ! collide_flag_sameteam = bit(LAYER_SHIPS)|bit(LAYER_SHOTS); ! collide_flag_sameship = bit(LAYER_SHIPS)|bit(LAYER_SHOTS); ! } ! angle = angle + frame_time / 1000.0 * rotation; ! while(angle<0) angle+=PI2; ! while(angle>PI2) angle-=PI2; ! ! ! color=palette_color[(int)(energyLevel/energyLevelPerDamagePoint)+7]; ! if (creator && sanctuary) ! { ! if(isActive) ! { ! if(regenerationIsTendrilBased==1) ! sanctuary->regenerationCount += frame_time; ! } ! } } *************** *** 630,633 **** --- 691,701 ---- } + int DajielkaTendril::handle_damage(SpaceLocation *source, double normal, double direct) + { + // don't die. + return 0; + } + + void DajielkaTendril::inflict_damage(SpaceObject *other) { STACKTRACE *************** *** 692,699 **** } ! DajielkaTendril::~DajielkaTendril(void) { ! if(sanctuary!=NULL) ! if(creator!=NULL) *pointerToMe = NULL; } --- 760,777 ---- } ! DajielkaTendril::~DajielkaTendril(void) ! { ! /* //xxx I don't think this is necessary - geo. ! if(sanctuary!=NULL && creator!=NULL) ! { *pointerToMe = NULL; + tw_error("what is this ??"); + } + */ + } + + bool DajielkaTendril::die() + { + return false; // this is not allowed to die !! } Index: shphydcr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shphydcr.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shphydcr.cpp 26 Aug 2005 21:55:19 -0000 1.16 --- shphydcr.cpp 28 Aug 2005 20:34:08 -0000 1.17 *************** *** 147,151 **** SpaceSprite *osprite, SpaceObject* oTarget); ! ~HydrovarEsFighter(void); virtual void calculate(); --- 147,151 ---- SpaceSprite *osprite, SpaceObject* oTarget); ! virtual ~HydrovarEsFighter(void); virtual void calculate(); *************** *** 558,562 **** if(this->targetsShots) searchLayers += bit(LAYER_SHOTS); if(this->targetsSpecial) searchLayers += bit(LAYER_SPECIAL); ! for (a.begin(this, searchLayers, trackingRange); a.current; a.next()) { // if(a.currento==NULL) // tw_error("Null object during search loop."); --- 558,562 ---- if(this->targetsShots) searchLayers += bit(LAYER_SHOTS); if(this->targetsSpecial) searchLayers += bit(LAYER_SPECIAL); ! for (a.begin(this, searchLayers, trackingRange, QUERY_OBJECT); a.current; a.next()) { // if(a.currento==NULL) // tw_error("Null object during search loop."); Index: shpvenke.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpvenke.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpvenke.cpp 14 Aug 2005 16:14:32 -0000 1.15 --- shpvenke.cpp 28 Aug 2005 20:34:08 -0000 1.16 *************** *** 78,82 **** VenKekThrust* Thrust; VenKekFrigate(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual ~VenKekFrigate(void); protected: void createThrust(); --- 78,82 ---- VenKekThrust* Thrust; VenKekFrigate(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual void death(); protected: void createThrust(); *************** *** 124,128 **** virtual void inflict_damage(SpaceObject* other); virtual int handle_damage(SpaceLocation* source, double normal, double direct = 0); ! virtual ~VenKekThrust(void); }; --- 124,128 ---- virtual void inflict_damage(SpaceObject* other); virtual int handle_damage(SpaceLocation* source, double normal, double direct = 0); ! virtual void death(); }; *************** *** 193,198 **** ! VenKekFrigate::~VenKekFrigate(void) { ! STACKTRACE if(Thrust!=NULL && Thrust->exists()) Thrust->state = 0; // possible crash problem. } --- 193,200 ---- ! void VenKekFrigate::death() ! { ! STACKTRACE; ! Ship::death(); if(Thrust!=NULL && Thrust->exists()) Thrust->state = 0; // possible crash problem. } *************** *** 348,352 **** 0, 1, -1, 1, this, data->spriteSpecial, 0); Thrust->creator = this; ! Thrust->vel = this->vel; Thrust->pos = this->pos; Thrust->damage_factor = 1; --- 350,354 ---- 0, 1, -1, 1, this, data->spriteSpecial, 0); Thrust->creator = this; ! Thrust->set_vel( this->vel ); Thrust->pos = this->pos; Thrust->damage_factor = 1; *************** *** 439,443 **** this->changeDirection(creator->angle); this->v = creator->vel.magnitude(); ! this->vel = creator->vel; } Missile::calculate(); --- 441,445 ---- this->changeDirection(creator->angle); this->v = creator->vel.magnitude(); ! set_vel( creator->vel ); } Missile::calculate(); *************** *** 483,487 **** } ! VenKekThrust::~VenKekThrust(void) { if(!creator) return; if(!creator->exists()) return; --- 485,491 ---- } ! void VenKekThrust::death() ! { ! Missile::death(); if(!creator) return; if(!creator->exists()) return; Index: shptulra.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptulra.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shptulra.cpp 14 Aug 2005 16:14:32 -0000 1.17 --- shptulra.cpp 28 Aug 2005 20:34:08 -0000 1.18 *************** *** 326,331 **** } if( pos != P ) ship->translate( pos - P ); ! if( vel != PV ){ ! ship->vel = PV; } } --- 326,331 ---- } if( pos != P ) ship->translate( pos - P ); ! if( ship && vel != PV ){ ! ship->set_vel( PV ); } } *************** *** 431,435 **** Query q; ! for( q.begin( this, OBJECT_LAYERS, srange ); q.currento; q.next() ){ if( q.currento->isObject() && !q.currento->sameShip(this) ){ damage(this, armour); --- 431,435 ---- Query q; ! for( q.begin( this, OBJECT_LAYERS, srange, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->isObject() && !q.currento->sameShip(this) ){ damage(this, armour); *************** *** 460,464 **** if( s && !exists() ){ Query q; ! for( q.begin( this, OBJECT_LAYERS, drange ); q.currento; q.next() ){ // we could use a distance dependant damage factor // int dmg = (int)ceil((drange - distance(q.currento)) / drange * damage_factor); --- 460,464 ---- if( s && !exists() ){ Query q; ! for( q.begin( this, OBJECT_LAYERS, drange, QUERY_OBJECT ); q.currento; q.next() ){ // we could use a distance dependant damage factor // int dmg = (int)ceil((drange - distance(q.currento)) / drange * damage_factor); Index: shptaumc.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaumc.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shptaumc.cpp 11 Jul 2005 00:25:32 -0000 1.10 --- shptaumc.cpp 28 Aug 2005 20:34:08 -0000 1.11 *************** *** 412,416 **** Query q; double a_a, a0 = -1e20; ! for (q.begin(this, OBJECT_LAYERS, range - d); q.currento; q.next()) if ( (!q.currento->sameTeam(this)) && (q.currento->collide_flag_anyone&bit(layer)) && !q.currento->isPlanet() ) { --- 412,416 ---- Query q; double a_a, a0 = -1e20; ! for (q.begin(this, OBJECT_LAYERS, range - d, QUERY_OBJECT); q.currento; q.next()) if ( (!q.currento->sameTeam(this)) && (q.currento->collide_flag_anyone&bit(layer)) && !q.currento->isPlanet() ) { *************** *** 500,504 **** Query q; double r, d; ! for (q.begin(this, OBJECT_LAYERS, blast_range); q.currento; q.next()) { r = distance(q.currento) / blast_range; if (r > 1) --- 500,504 ---- Query q; double r, d; ! for (q.begin(this, OBJECT_LAYERS, blast_range, QUERY_OBJECT); q.currento; q.next()) { r = distance(q.currento) / blast_range; if (r > 1) Index: shpbogce.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpbogce.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpbogce.cpp 14 Aug 2005 16:14:32 -0000 1.9 --- shpbogce.cpp 28 Aug 2005 20:34:07 -0000 1.10 *************** *** 260,264 **** links_num = 0; BoggCenturion* bro; ! for (q.begin(this, bit(LAYER_SHIPS), share_range); q.currento; q.next()) { if (q.currento->getID() == BOGEI_CENTURION_ID) --- 260,264 ---- links_num = 0; BoggCenturion* bro; ! for (q.begin(this, bit(LAYER_SHIPS), share_range, QUERY_OBJECT); q.currento; q.next()) { if (q.currento->getID() == BOGEI_CENTURION_ID) *************** *** 377,381 **** int ln = 0; BoggCenturion* bro; ! for (q.begin(this, bit(LAYER_SHIPS), share_range); q.currento; q.next()) if (q.currento->getID() == BOGEI_CENTURION_ID) { bro = (BoggCenturion*)q.currento; --- 377,381 ---- int ln = 0; BoggCenturion* bro; ! for (q.begin(this, bit(LAYER_SHIPS), share_range, QUERY_OBJECT); q.currento; q.next()) if (q.currento->getID() == BOGEI_CENTURION_ID) { bro = (BoggCenturion*)q.currento; Index: shpkatpo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkatpo.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpkatpo.cpp 23 Jul 2005 14:08:08 -0000 1.19 --- shpkatpo.cpp 28 Aug 2005 20:34:08 -0000 1.20 *************** *** 251,255 **** morph->crew = crew; // set it's attributes morph->batt = batt - special_drain; // [battery has to be decreased now] ! morph->vel = vel; update_panel = true; // maybe the colors changed --- 251,255 ---- morph->crew = crew; // set it's attributes morph->batt = batt - special_drain; // [battery has to be decreased now] ! morph->set_vel ( vel ); update_panel = true; // maybe the colors changed Index: shpnarlu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpnarlu.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** shpnarlu.cpp 14 Aug 2005 16:14:32 -0000 1.18 --- shpnarlu.cpp 28 Aug 2005 20:34:08 -0000 1.19 *************** *** 36,40 **** BITMAP *lightningbmp; ! ~NaroolLurker(); --- 36,40 ---- BITMAP *lightningbmp; ! virtual ~NaroolLurker(); Index: shpalhdr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpalhdr.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpalhdr.cpp 2 Aug 2005 00:23:40 -0000 1.15 --- shpalhdr.cpp 28 Aug 2005 20:34:07 -0000 1.16 *************** *** 56,60 **** public: AlhordianDreadnought(Vector2 opos, double angle, ShipData *data, unsigned int code); - virtual ~AlhordianDreadnought(void); protected: virtual int activate_weapon(); --- 56,59 ---- *************** *** 169,175 **** } ! AlhordianDreadnought::~AlhordianDreadnought(void) { ! ; ! } void AlhordianDreadnought::calculate() --- 168,172 ---- } ! void AlhordianDreadnought::calculate() *************** *** 372,376 **** armour = (1 - fractionDone) * startArmour + fractionDone * endArmour; this->v *= (1 - this->friction * frame_time); ! this->vel = unit_vector(this->angle) * this->v; } --- 369,373 ---- armour = (1 - fractionDone) * startArmour + fractionDone * endArmour; this->v *= (1 - this->friction * frame_time); ! this->set_vel ( unit_vector(this->angle) * this->v ); } Index: shpcrore.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpcrore.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpcrore.cpp 2 Aug 2005 00:23:44 -0000 1.9 --- shpcrore.cpp 28 Aug 2005 20:34:07 -0000 1.10 *************** *** 144,148 **** Vector2 nvel, ovel; ! for (q.begin(this, OBJECT_LAYERS, specialRange); q.currento; q.next()) { if (((q.currento->mass <= 0) && !q.currento->isShot()) ) continue; xt = 0; xp = 0; --- 144,148 ---- Vector2 nvel, ovel; ! for (q.begin(this, OBJECT_LAYERS, specialRange, QUERY_OBJECT); q.currento; q.next()) { if (((q.currento->mass <= 0) && !q.currento->isShot()) ) continue; xt = 0; xp = 0; *************** *** 203,207 **** // q.currento->vx = ovx; // q.currento->vy = ovy; ! q.currento->vel = ovel; } } --- 203,207 ---- // q.currento->vx = ovx; // q.currento->vy = ovy; ! q.currento->set_vel ( ovel ); } } *************** *** 267,271 **** ! for (q.begin(this, OBJECT_LAYERS, blast_range); q.currento; q.next()) { if (q.currento != direct_hit) --- 267,271 ---- ! for (q.begin(this, OBJECT_LAYERS, blast_range, QUERY_OBJECT); q.currento; q.next()) { if (q.currento != direct_hit) Index: shpfiear.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpfiear.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** shpfiear.cpp 21 Aug 2005 12:44:01 -0000 1.16 --- shpfiear.cpp 28 Aug 2005 20:34:08 -0000 1.17 *************** *** 180,184 **** Query q; ! for (q.begin(this, OBJECT_LAYERS, repulsor_radius); q.currento; q.next()) { o = q.currento; if (!o->sameShip(this)){ --- 180,184 ---- Query q; ! for (q.begin(this, OBJECT_LAYERS, repulsor_radius, QUERY_OBJECT); q.currento; q.next()) { o = q.currento; if (!o->sameShip(this)){ Index: shpkabwe.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkabwe.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shpkabwe.cpp 26 Aug 2005 21:55:19 -0000 1.19 --- shpkabwe.cpp 28 Aug 2005 20:34:08 -0000 1.20 *************** *** 47,51 **** virtual void collide(SpaceObject *other); //virtual void death(); ! ~KaboHaze(); }; --- 47,51 ---- virtual void collide(SpaceObject *other); //virtual void death(); ! virtual ~KaboHaze(); }; Index: shptaule.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptaule.cpp,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** shptaule.cpp 23 Aug 2005 22:18:11 -0000 1.22 --- shptaule.cpp 28 Aug 2005 20:34:08 -0000 1.23 *************** *** 323,327 **** Query q; ! for (q.begin(this, bit(LAYER_SHOTS), size.y*4.0); q.currento; q.next()) if (q.currento->getID() == LEVIATHAN_SLIME_FOOD) { --- 323,327 ---- Query q; ! for (q.begin(this, bit(LAYER_SHOTS), size.y*4.0, QUERY_OBJECT); q.currento; q.next()) if (q.currento->getID() == LEVIATHAN_SLIME_FOOD) { Index: shpklidr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpklidr.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** shpklidr.cpp 2 Aug 2005 00:23:46 -0000 1.11 --- shpklidr.cpp 28 Aug 2005 20:34:08 -0000 1.12 *************** *** 171,175 **** Query a; a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), this->specialRange); for (;a.current;a.next()) { o = a.currento; --- 171,175 ---- Query a; a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), this->specialRange, QUERY_OBJECT); for (;a.current;a.next()) { o = a.currento; *************** *** 269,273 **** this->v *= (1 - this->friction * frame_time); ! this->vel = unit_vector(this->angle) * this->v; } --- 269,273 ---- this->v *= (1 - this->friction * frame_time); ! set_vel( unit_vector(this->angle) * this->v ); } Index: shpdyzha.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpdyzha.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpdyzha.cpp 2 Aug 2005 00:23:45 -0000 1.14 --- shpdyzha.cpp 28 Aug 2005 20:34:07 -0000 1.15 *************** *** 320,324 **** // check if anything is in range ... which should be maxed speeded ... Query a; ! for (a.begin(this, OBJECT_LAYERS, range); a.currento; a.next()) { SpaceObject *o = a.currento; --- 320,324 ---- // check if anything is in range ... which should be maxed speeded ... Query a; ! for (a.begin(this, OBJECT_LAYERS, range, QUERY_OBJECT); a.currento; a.next()) { SpaceObject *o = a.currento; Index: shpgarty.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpgarty.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpgarty.cpp 2 Aug 2005 13:04:08 -0000 1.17 --- shpgarty.cpp 28 Aug 2005 20:34:08 -0000 1.18 *************** *** 191,195 **** Query q; ! for (q.begin(this, OBJECT_LAYERS, specialRange); q.currento; q.next()) { // bugfix Geo --- 191,195 ---- Query q; ! for (q.begin(this, OBJECT_LAYERS, specialRange, QUERY_OBJECT); q.currento; q.next()) { // bugfix Geo *************** *** 241,245 **** game->add(GRS); GRS->pos = other->pos; ! GRS->vel = other->vel; } } --- 241,245 ---- game->add(GRS); GRS->pos = other->pos; ! GRS->set_vel ( other->vel ); } } *************** *** 346,350 **** { this->pos = targetship->pos; ! this->vel = targetship->vel; } --- 346,350 ---- { this->pos = targetship->pos; ! this->set_vel ( targetship->vel ); } Index: shpraame.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpraame.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpraame.cpp 23 Aug 2005 22:18:11 -0000 1.20 --- shpraame.cpp 28 Aug 2005 20:34:08 -0000 1.21 *************** *** 306,310 **** collide_flag_anyone = 0; Query q; ! for (q.begin(oship, bit(LAYER_HOTSPOTS), 10); q.current; q.next()) { if ((q.current->getID() == getID()) && (((RaalrithPoison*)q.current)->oship == oship)) { ((RaalrithPoison*)q.current)->duration = duration; --- 306,310 ---- collide_flag_anyone = 0; Query q; ! for (q.begin(oship, bit(LAYER_HOTSPOTS), 10, QUERY_OBJECT); q.current; q.next()) { if ((q.current->getID() == getID()) && (((RaalrithPoison*)q.current)->oship == oship)) { ((RaalrithPoison*)q.current)->duration = duration; Index: shpstaba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpstaba.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpstaba.cpp 14 Aug 2005 16:14:32 -0000 1.10 --- shpstaba.cpp 28 Aug 2005 20:34:08 -0000 1.11 *************** *** 90,94 **** Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { --- 90,94 ---- Query a; for (a.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange, QUERY_OBJECT); a.current; a.next()) { o = a.currento; if( (!o->isInvisible()) && !o->sameTeam(this) && (o->collide_flag_anyone & bit(LAYER_LINES))) { *************** *** 113,117 **** Query a; ! for (a.begin(this, bit(LAYER_SHIPS), HealRange); a.current; a.next()) { o = (Ship *)a.currento; if((!o->isInvisible()) && o->sameTeam(this)) --- 113,120 ---- Query a; ! for (a.begin(this, bit(LAYER_SHIPS), HealRange, QUERY_OBJECT); a.current; a.next()) { ! if (!o->isShip()) ! continue; ! o = (Ship *)a.currento; if((!o->isInvisible()) && o->sameTeam(this)) Index: shpterbi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpterbi.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpterbi.cpp 26 Aug 2005 21:55:19 -0000 1.10 --- shpterbi.cpp 28 Aug 2005 20:34:08 -0000 1.11 *************** *** 535,539 **** }else{ Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange ); q.currento; q.next() ){ if( sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ if( current_option == option_order_assist_building ){ --- 535,539 ---- }else{ Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ if( current_option == option_order_assist_building ){ *************** *** 555,559 **** if( select_all ){ Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange ); q.currento; q.next() ){ if( sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ data->TERON_SELECTION_SPRITE->animate( --- 555,559 ---- if( select_all ){ Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ data->TERON_SELECTION_SPRITE->animate( *************** *** 585,589 **** if( collect_step <= 0 && collectRange ){ Query q; ! for( q.begin( this, bit(LAYER_CBODIES), collectRange ); q.currento; q.next() ){ if( q.currento->isAsteroid() ){ collecting = q.currento; --- 585,589 ---- if( collect_step <= 0 && collectRange ){ Query q; ! for( q.begin( this, bit(LAYER_CBODIES), collectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->isAsteroid() ){ collecting = q.currento; *************** *** 647,651 **** TeronDrone* next_drone = NULL; Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange ); q.currento; q.next() ){ if( !next_drone && sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ next_drone = (TeronDrone*)q.currento; --- 647,651 ---- TeronDrone* next_drone = NULL; Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( !next_drone && sameShip( q.currento ) && q.currento->get_sprite() == data->TERON_DRONE_SPRITE ){ next_drone = (TeronDrone*)q.currento; *************** *** 665,669 **** TeronDrone* prev_drone = NULL; Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange ); q.currento; q.next() ){ if( q.currento == current_drone ){ if( prev_drone ) break; --- 665,669 ---- TeronDrone* prev_drone = NULL; Query q; ! for( q.begin( this, bit(LAYER_SHIPS), selectRange, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento == current_drone ){ if( prev_drone ) break; *************** *** 792,796 **** c->temporary = true; ((ControlWussie*)c)->option_velocity[0][0] = scale_velocity( 999 ); ! ((ControlWussie*)c)->option_range[0][0] = weaponRange; if (control->ship != this || control != c) --- 792,796 ---- c->temporary = true; ((ControlWussie*)c)->option_velocity[0][0] = scale_velocity( 999 ); ! ((ControlWussie*)c)->option_range[0][0] = 0.8 * weaponRange; if (control->ship != this || control != c) *************** *** 821,825 **** void TeronDrone::assist_building(){ Query q; ! for( q.begin( this, bit(LAYER_SPECIAL), TERON_DRONE_SIGHT_RANGE ); q.currento; q.next() ){ if( sameShip( q.currento )){ TeronBuildPlatform* platform = ((TeronBuildPlatform*)q.currento); --- 821,825 ---- void TeronDrone::assist_building(){ Query q; ! for( q.begin( this, bit(LAYER_SPECIAL), TERON_DRONE_SIGHT_RANGE, QUERY_OBJECT ); q.currento; q.next() ){ if( sameShip( q.currento )){ TeronBuildPlatform* platform = ((TeronBuildPlatform*)q.currento); *************** *** 843,847 **** double d = TERON_DRONE_SIGHT_RANGE; Query q; ! for( q.begin( this, bit(LAYER_CBODIES), TERON_DRONE_SIGHT_RANGE ); q.currento; q.next() ){ if( q.currento->isAsteroid() ){ double i = distance( q.currento ); --- 843,847 ---- double d = TERON_DRONE_SIGHT_RANGE; Query q; ! for( q.begin( this, bit(LAYER_CBODIES), TERON_DRONE_SIGHT_RANGE, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->isAsteroid() ){ double i = distance( q.currento ); *************** *** 900,903 **** --- 900,904 ---- game->add( new TeronDroneLaser( this, angle, pallete_color[TERON_DRONE_BEAM_COLOR], weaponRange, 0, time_ratio, this, Vector2(size)*Vector2(0,0.5)/*0.0, 0.5 * h*/, true )); + //xxx 0 instead of -1 ? //vx = -vx; //vy = -vy; *************** *** 1236,1240 **** vel = 0; //base->vx = base->vy = 0; ! base->vel = 0; //base->x = x; //base->y = y; --- 1237,1241 ---- vel = 0; //base->vx = base->vy = 0; ! base->set_vel ( 0 ); //base->x = x; //base->y = y; *************** *** 1331,1334 **** --- 1332,1337 ---- mass = creator->mass; layer = LAYER_SHIPS; + + attributes &= ~ATTRIB_STANDARD_INDEX; } *************** *** 1385,1388 **** --- 1388,1399 ---- collide_flag_anyone = collide_flag_sameteam = collide_flag_sameship = ALL_LAYERS; layer = LAYER_SPECIAL; + + int n = sprite->frames(); + if (sprite_index >= n) + { + tw_error("error in sprite index!"); + } + + attributes &= ~ATTRIB_STANDARD_INDEX; } *************** *** 1395,1399 **** tot = normal + direct; ! if( tot > 0 ){ sprite_index--; if( sprite_index < index_zero ){ --- 1406,1411 ---- tot = normal + direct; ! if( tot > 0 ) ! { sprite_index--; if( sprite_index < index_zero ){ *************** *** 1414,1418 **** state = 0; new_ship->pos = pos; ! new_ship->vel = 0; game->add( new_ship ); new_ship->materialize(); --- 1426,1430 ---- state = 0; new_ship->pos = pos; ! new_ship->set_vel( 0 ); game->add( new_ship ); new_ship->materialize(); Index: shpkolfl.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkolfl.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpkolfl.cpp 16 Aug 2005 23:21:02 -0000 1.15 --- shpkolfl.cpp 28 Aug 2005 20:34:08 -0000 1.16 *************** *** 165,169 **** Query a; ! for (a.begin(this, layers, passiveRange); a.current; a.next()) { SpaceObject *o = a.currento; --- 165,169 ---- Query a; ! for (a.begin(this, layers, passiveRange, QUERY_OBJECT); a.current; a.next()) { SpaceObject *o = a.currento; Index: shpearc2.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpearc2.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpearc2.cpp 2 Aug 2005 00:23:45 -0000 1.10 --- shpearc2.cpp 28 Aug 2005 20:34:07 -0000 1.11 *************** *** 84,88 **** Query q; for (q.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange); q.current; q.next()) { o = q.currento; if (!o->isInvisible() && !o->sameTeam(this) && (o->collide_flag_anyone&bit(LAYER_LINES))) { --- 84,88 ---- Query q; for (q.begin(this, bit(LAYER_SHIPS) + bit(LAYER_SHOTS) + bit(LAYER_SPECIAL) + ! bit(LAYER_CBODIES), specialRange, QUERY_OBJECT); q.current; q.next()) { o = q.currento; if (!o->isInvisible() && !o->sameTeam(this) && (o->collide_flag_anyone&bit(LAYER_LINES))) { Index: shpsclfr.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpsclfr.cpp,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** shpsclfr.cpp 23 Aug 2005 22:18:11 -0000 1.14 --- shpsclfr.cpp 28 Aug 2005 20:34:08 -0000 1.15 *************** *** 35,39 **** ScloreSting* Sting; ScloreFrigate(Vector2 opos, double angle, ShipData *data, unsigned int code); ! ~ScloreFrigate(void); protected: void fireSting(); --- 35,39 ---- ScloreSting* Sting; ScloreFrigate(Vector2 opos, double angle, ShipData *data, unsigned int code); ! virtual void death(); protected: void fireSting(); *************** *** 76,80 **** virtual void inflict_damage(SpaceObject* other); virtual int handle_damage(SpaceLocation* source, double normal, double direct = 0); ! ~ScloreSting(void); }; --- 76,80 ---- virtual void inflict_damage(SpaceObject* other); virtual int handle_damage(SpaceLocation* source, double normal, double direct = 0); ! virtual void death(); }; *************** *** 122,126 **** } vr = this->vel * specialRelativity; ! Sting->vel = v + vr; Sting->v = (v + vr).magnitude(); Sting=NULL; //sting is released. --- 122,126 ---- } vr = this->vel * specialRelativity; ! Sting->set_vel( v + vr ); Sting->v = (v + vr).magnitude(); Sting=NULL; //sting is released. *************** *** 146,151 **** } ! ScloreFrigate::~ScloreFrigate(void) { ! STACKTRACE if(Sting!=NULL && Sting->exists()) Sting->state = 0; // possible crash problem. } --- 146,153 ---- } ! void ScloreFrigate::death() ! { ! STACKTRACE; ! Ship::death(); if(Sting!=NULL && Sting->exists()) Sting->state = 0; // possible crash problem. } *************** *** 258,262 **** this->changeDirection(creator->angle); this->v = creator->vel.magnitude(); ! this->vel = creator->vel; } --- 260,264 ---- this->changeDirection(creator->angle); this->v = creator->vel.magnitude(); ! set_vel( creator->vel ); } *************** *** 313,318 **** } ! ScloreSting::~ScloreSting(void) { ! STACKTRACE if(!creator) return; if(!creator->exists()) return; --- 315,324 ---- } ! void ScloreSting::death() ! { ! STACKTRACE; ! ! Missile::death(); ! if(!creator) return; if(!creator->exists()) return; Index: shpoliha.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpoliha.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** shpoliha.cpp 23 Aug 2005 22:18:11 -0000 1.13 --- shpoliha.cpp 28 Aug 2005 20:34:08 -0000 1.14 *************** *** 188,192 **** collide_flag_sameship = 0; ! collide_flag_sameship = bit(LAYER_SPECIAL); relangle = 0; --- 188,192 ---- collide_flag_sameship = 0; ! collide_flag_sameship = 0; relangle = 0; *************** *** 311,315 **** Query a; ! for (a.begin(this, OBJECT_LAYERS, mother->laserRange); a.current; a.next()) { if ((distance(a.current) < r) && !a.current->isInvisible() --- 311,315 ---- Query a; ! for (a.begin(this, OBJECT_LAYERS, mother->laserRange, QUERY_OBJECT); a.current; a.next()) { if ((distance(a.current) < r) && !a.current->isInvisible() Index: shpyurpa.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpyurpa.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** shpyurpa.cpp 11 Jul 2005 00:25:32 -0000 1.15 --- shpyurpa.cpp 28 Aug 2005 20:34:08 -0000 1.16 *************** *** 53,57 **** double oangle, double angleOffset, double ov, double odamage, double orange, double oarmour); ! ~YuryulRam(); virtual void calculate(void); }; --- 53,57 ---- double oangle, double angleOffset, double ov, double odamage, double orange, double oarmour); ! virtual void death(); virtual void calculate(void); }; *************** *** 94,98 **** protected: - ~YuryulPatriot(); virtual void calculate(); virtual int activate_weapon(); --- 94,97 ---- *************** *** 138,152 **** } ! YuryulPatriot::~YuryulPatriot(void) { ! if(Ram1!=NULL) ! Ram1->creator = NULL; ! if(Ram2!=NULL) ! Ram2->creator = NULL; ! } void YuryulPatriot::death(void) { STACKTRACE ! Ship::death(); } --- 137,151 ---- } ! void YuryulPatriot::death(void) { STACKTRACE ! Ship::death(); ! ! if(Ram1!=NULL) ! Ram1->creator = NULL; ! if(Ram2!=NULL) ! Ram2->creator = NULL; } *************** *** 239,243 **** } ! YuryulRam::~YuryulRam(void) { if(creator!=NULL) { if(RamNumber == 1) --- 238,245 ---- } ! void YuryulRam::death() ! { ! Missile::death(); ! if(creator!=NULL) { if(RamNumber == 1) *************** *** 249,252 **** --- 251,255 ---- + void YuryulRam::calculate(void) { STACKTRACE *************** *** 260,264 **** this->changeDirection(creator->angle + this->angleOffset); this->pos = creator->pos; ! this->vel = creator->vel; pos = normalize(pos + rotate(relativePosition, -PI/2+creator->get_angle())); Missile::calculate(); --- 263,267 ---- this->changeDirection(creator->angle + this->angleOffset); this->pos = creator->pos; ! set_vel(creator->vel); pos = normalize(pos + rotate(relativePosition, -PI/2+creator->get_angle())); Missile::calculate(); Index: shpimpka.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpimpka.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** shpimpka.cpp 17 Aug 2005 23:52:28 -0000 1.17 --- shpimpka.cpp 28 Aug 2005 20:34:08 -0000 1.18 *************** *** 144,148 **** bool found = false; Query q; ! for( q.begin( this, OBJECT_LAYERS, size.x ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == this ){ q.currento->state = 0; --- 144,148 ---- bool found = false; Query q; ! for( q.begin( this, OBJECT_LAYERS, size.x, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == this ){ q.currento->state = 0; *************** *** 234,238 **** bool raded = false; Query q; ! for( q.begin( this, OBJECT_LAYERS, size.x ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == this ){ raded = true; --- 234,238 ---- bool raded = false; Query q; ! for( q.begin( this, OBJECT_LAYERS, size.x, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == this ){ raded = true; *************** *** 354,358 **** Query q; ! for( q.begin( other, OBJECT_LAYERS, size.x ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == other ){ q.end(); --- 354,358 ---- Query q; ! for( q.begin( other, OBJECT_LAYERS, size.x, QUERY_OBJECT ); q.currento; q.next() ){ if( q.currento->get_sprite() == data->spriteSpecialExplosion && q.currento->ship == other ){ q.end(); Index: shpastba.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpastba.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpastba.cpp 26 Aug 2005 21:55:19 -0000 1.9 --- shpastba.cpp 28 Aug 2005 20:34:07 -0000 1.10 *************** *** 849,854 **** vfinal = 0; ! first->vel += (vfinal - v1) * L; ! second->vel += (vfinal - v2) * L; --- 849,854 ---- vfinal = 0; ! first->change_vel ( (vfinal - v1) * L ); ! second->change_vel ( (vfinal - v2) * L ); *************** *** 881,885 **** // apply these accelerations: ! second->vel += 1E-3 * accel * frame_time; --- 881,885 ---- // apply these accelerations: ! second->change_vel ( 1E-3 * accel * frame_time ); *************** *** 887,891 **** // including drag in the rotation direction. ! second->vel -= 0.5 * frame_time*1E-3 * (second->vel - L*second->vel.dot(L)); } --- 887,891 ---- // including drag in the rotation direction. ! second->change_vel (-0.5 * frame_time*1E-3 * (second->vel - L*second->vel.dot(L)) ); } Index: shpgahmo.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpgahmo.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** shpgahmo.cpp 2 Aug 2005 00:23:45 -0000 1.10 --- shpgahmo.cpp 28 Aug 2005 20:34:08 -0000 1.11 *************** *** 607,611 **** if(tractorTarget->isShot()) { tractorTarget->pos = pos + unit_vector(tractorAngle) * tractorLength; ! tractorTarget->vel = vel; return; } --- 607,611 ---- if(tractorTarget->isShot()) { tractorTarget->pos = pos + unit_vector(tractorAngle) * tractorLength; ! tractorTarget->set_vel ( vel ); return; } *************** *** 621,625 **** vtransfer = (specialVelocityCouplingFactor * frame_time) / (1+(specialVelocityCouplingFactor * frame_time)); vel = vel * (1-vtransfer) + TM * vtransfer; ! tractorTarget->vel = tractorTarget->vel * (1-vtransfer) + TM * vtransfer; return; } --- 621,625 ---- vtransfer = (specialVelocityCouplingFactor * frame_time) / (1+(specialVelocityCouplingFactor * frame_time)); vel = vel * (1-vtransfer) + TM * vtransfer; ! tractorTarget->set_vel(tractorTarget->vel * (1-vtransfer) + TM * vtransfer); return; } Index: shpducla.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpducla.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpducla.cpp 26 Aug 2005 21:55:19 -0000 1.20 --- shpducla.cpp 28 Aug 2005 20:34:07 -0000 1.21 *************** *** 83,86 **** --- 83,87 ---- double llength, int lcolor); + virtual void calculate(); void set_props(Vector2 opos, double oangle, double olength); virtual int handle_damage(SpaceLocation *source, double normal, double direct = 0); *************** *** 103,107 **** LaserArc(DuclyLanternjaws *creator, Vector2 lpos, int lcolor, int N); ! ~LaserArc(); virtual void calculate(); --- 104,108 ---- LaserArc(DuclyLanternjaws *creator, Vector2 lpos, int lcolor, int N); ! virtual ~LaserArc(); virtual void calculate(); *************** *** 260,264 **** { mother->pos = oldpos + partlist[i]->change_pos; ! mother->vel = oldvel + partlist[i]->change_vel; } --- 261,265 ---- { mother->pos = oldpos + partlist[i]->change_pos; ! mother->set_vel ( oldvel + partlist[i]->change_vel ); } *************** *** 488,492 **** vel += _dp * tmp / mass; if (other->mass > 1) ! other->vel -= _dp * tmp / other->mass; } --- 489,493 ---- vel += _dp * tmp / mass; if (other->mass > 1) ! other->change_vel (- _dp * tmp / other->mass ); } *************** *** 810,813 **** --- 811,816 ---- LaserArc::~LaserArc() { + /* should not be here! Cause in a physics-delete operation, the objects that we refer to here, + could already be dead! - geo [and gosh, I wrote this myself..] int i; for ( i = 0; i < Nseg; ++i ) *************** *** 816,819 **** --- 819,823 ---- laser_o[i]->state = 0; } + */ delete[] laser_o; *************** *** 831,834 **** --- 835,846 ---- for ( i = 0; i < Nseg; ++i ) { + if ( laser_o[i] && !laser_o[i]->exists() ) + laser_o[i] = 0; + + if (!laser_o[i]) + { + tw_error("LaserArc: laser segment has died."); + } + double a, a1, a2, L; a1 = mother->angle + angle_min + i * angle_step; *************** *** 894,897 **** --- 906,920 ---- } + void SpaceLineArc::calculate() + { + SpaceLine::calculate(); + + if (mother && !mother->exists()) + mother = 0; + + if (!mother) + state = 0; + } + void SpaceLineArc::set_props(Vector2 opos, double oangle, double olength) { *************** *** 909,914 **** void SpaceLineArc::inflict_damage(SpaceObject *other) { ! STACKTRACE ! // copied from space_line: --- 932,936 ---- void SpaceLineArc::inflict_damage(SpaceObject *other) { ! STACKTRACE; // copied from space_line: Index: shptrige.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shptrige.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** shptrige.cpp 2 Aug 2005 00:23:47 -0000 1.12 --- shptrige.cpp 28 Aug 2005 20:34:08 -0000 1.13 *************** *** 205,209 **** // turret->vx=vx=vfx; // turret->vy=vy=vfy; ! turret->vel = vel = vf; turn_left=FALSE; //Ensure that ship_calculate_turn_xxxx() --- 205,210 ---- // turret->vx=vx=vfx; // turret->vy=vy=vfy; ! turret->set_vel(vf); ! set_vel( vf ); turn_left=FALSE; //Ensure that ship_calculate_turn_xxxx() Index: shpkorsi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpkorsi.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** shpkorsi.cpp 21 Jul 2005 14:55:08 -0000 1.2 --- shpkorsi.cpp 28 Aug 2005 20:34:08 -0000 1.3 *************** *** 141,145 **** if(tugger == NULL) { for (a.begin(this, bit(LAYER_SHIPS) | bit(LAYER_SHOTS) | bit(LAYER_SPECIAL) | bit(LAYER_CBODIES), ! tuggerDistance); a.current; a.next()) { o = a.currento; --- 141,145 ---- if(tugger == NULL) { for (a.begin(this, bit(LAYER_SHIPS) | bit(LAYER_SHOTS) | bit(LAYER_SPECIAL) | bit(LAYER_CBODIES), ! tuggerDistance, QUERY_OBJECT); a.current; a.next()) { o = a.currento; Index: shpbatde.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpbatde.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** shpbatde.cpp 2 Aug 2005 00:23:44 -0000 1.20 --- shpbatde.cpp 28 Aug 2005 20:34:07 -0000 1.21 *************** *** 49,53 **** SpriteDrawList(SpaceObject *creator, int N, SpaceSprite **osprites, double odelaytime); ! ~SpriteDrawList(); void calculate(); --- 49,53 ---- SpriteDrawList(SpaceObject *creator, int N, SpaceSprite **osprites, double odelaytime); ! virtual ~SpriteDrawList(); void calculate(); *************** *** 250,254 **** Query a; ! for (a.begin(this, layers, gravRange); a.current; a.next()) { SpaceObject *o = a.currento; --- 250,254 ---- Query a; ! for (a.begin(this, layers, gravRange, QUERY_OBJECT); a.current; a.next()) { SpaceObject *o = a.currento; *************** *** 293,301 **** if (!o->isPlanet()) ! o->vel += Vacc; else ! vel -= Vacc; ! vel -= Vacc; if (vel.length() > speed_max) vel *= speed_max / vel.length(); --- 293,301 ---- if (!o->isPlanet()) ! o->change_vel ( Vacc ); else ! change_vel ( -Vacc ); ! change_vel (-Vacc); if (vel.length() > speed_max) vel *= speed_max / vel.length(); *************** *** 569,573 **** Query a; ! for (a.begin(this, layers, passiveRange); a.current; a.next()) { SpaceObject *o = a.currento; --- 569,573 ---- Query a; ! for (a.begin(this, layers, passiveRange, QUERY_OBJECT); a.current; a.next()) { SpaceObject *o = a.currento; Index: shpaktgu.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shpaktgu.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** shpaktgu.cpp 2 Aug 2005 00:23:40 -0000 1.9 --- shpaktgu.cpp 28 Aug 2005 20:34:07 -0000 1.10 *************** *** 233,237 **** Query q; ! for (q.begin(this, OBJECT_LAYERS &~ bit(LAYER_CBODIES), lRange); q.currento; q.next()) { if (!q.currento->isInvisible() && !q.currento->sameTeam(this)) { SpaceLocation *l; --- 233,237 ---- Query q; ! for (q.begin(this, OBJECT_LAYERS &~ bit(LAYER_CBODIES), lRange, QUERY_OBJECT); q.currento; q.next()) { if (!q.currento->isInvisible() && !q.currento->sameTeam(this)) { SpaceLocation *l; Index: shparkpi.cpp =================================================================== RCS file: /cvsroot/timewarp/source/newships/shparkpi.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** shparkpi.cpp 23 Aug 2005 22:18:11 -0000 1.19 --- shparkpi.cpp 28 Aug 2005 20:34:07 -0000 1.20 *************** *** 26,30 **** ArkanoidPincer(ArkanoidPincerShip* ocreator, Vector2 opos, double oangle, SpaceSprite *osprite); - virtual ~ArkanoidPincer(void); virtual void calculate(); virtual void collide(SpaceObject *other); --- 26,29 ---- *************** *** 97,101 **** public: ArkanoidPincerShip(Vector2 opos, double angl... [truncated message content] |