1 #ifndef __UNIT_JUMP_CPP__
2 #define __UNIT_JUMP_CPP__
23 std::vector< Unit* >myvec;
25 myvec.push_back( primary );
33 template <
class UnitType >
37 if (
pendingjump[kk]->orig == this->activeStarSystem || this->activeStarSystem == NULL) {
43 for (
un_iter iter =
pendingjump[kk]->orig->getUnitList().createIterator(); (unit = *iter); ++iter) {
44 if (unit->
Threat() ==
this)
48 if (unit->
Target() ==
this) {
73 vector< Unit* >possibilities;
78 for (
un_iter iter =
pendingjump[kk]->dest->getUnitList().createIterator(); (primary = *iter); ++iter) {
82 possibilities.insert( possibilities.end(), tmp.begin(), tmp.end() );
85 this->SetCurPosition(
pendingjump[kk]->final_location );
86 if ( !possibilities.empty() ) {
87 static int jumpdest = 235034;
88 Unit *jumpnode = possibilities[jumpdest%possibilities.size()];
91 this->SetCurPosition( pos );
94 QVector Offset( pos.i < 0 ? 1 : -1,
97 Offset *= jumpnode->
rSize()*2+this->rSize()*2;
98 this->SetPosAndCumPos( pos+Offset );
106 for (
unsigned int jjj = 0; jjj < 2; ++jjj)
108 (tester = *
i) != NULL; ++
i)
111 SetCurPosition( this->LocalPosition()+this->cumulative_transformation_matrix.getR()
112 *( 4*( this->rSize()+tester->
rSize() ) ) );
116 AUDPlay( jumparrive, this->LocalPosition(), this->GetVelocity(), 1 );
122 if (this->docked&UnitType::DOCKING_UNITS)
123 for (
unsigned int i = 0;
i < this->pImage->dockedunits.size();
i++) {
125 if ( NULL != ( unut = this->pImage->dockedunits[
i]->uc.GetUnit() ) )
128 if ( this->docked&(UnitType::DOCKED|UnitType::DOCKED_INSIDE) ) {
129 Unit *un = this->pImage->DockedTo.GetUnit();
131 this->docked &= ( ~(UnitType::DOCKED|UnitType::DOCKED_INSIDE) );