00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include "zSelector.h"
00029 #include "tRandom.h"
00030
00031
00032
00033
00034
00035
00036 std::vector <ePlayerNetID *>
00037 zSelector::getAllValid(std::vector <ePlayerNetID *> &results, std::vector <ePlayerNetID *> const &sources, LivingStatus living)
00038 {
00039 unsigned short int max = sources.size();
00040 for(unsigned short int i=0;i<max;i++)
00041 {
00042 ePlayerNetID *p=sources[i];
00043 switch (living) {
00044 case _either:
00045 results.push_back(p);
00046 break;
00047 case _alive:
00048 if ( p->Object() && p->Object()->Alive() )
00049 {
00050 results.push_back(p);
00051 }
00052 break;
00053 case _dead:
00054 if( !(p->Object()) || !(p->Object()->Alive()) )
00055 {
00056 results.push_back(p);
00057 }
00058 break;
00059 }
00060 }
00061 return results;
00062 }
00063
00064 zSelector::zSelector()
00065 { }
00066
00067 zSelector::zSelector(zSelector const &other)
00068 { }
00069
00070 void zSelector::operator=(zSelector const &other)
00071 {
00072 if(this != &other) {
00073 }
00074 }
00075
00076 zSelector * zSelector::copy(void) const
00077 {
00078 return new zSelector(*this);
00079 }
00080
00081 gVectorExtra<ePlayerNetID *> zSelector::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00082 {
00083 gVectorExtra<ePlayerNetID *> empty;
00084 return empty;
00085 }
00086
00087 void
00088 zSelector::apply(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00089 {
00090 if (count == -1 || count > 0)
00091 {
00092 gVectorExtra<ePlayerNetID *> d_calculatedTargets = select(owners, teamOwners, triggerer);
00093 zEffectorPtrs::const_iterator iter;
00094 for(iter=effectors.begin();
00095 iter!=effectors.end();
00096 ++iter)
00097 {
00098 (*iter)->apply(d_calculatedTargets);
00099 }
00100 if (count > 0)
00101 count --;
00102 }
00103 }
00104
00105
00106
00107
00108 zSelector* zSelectorSelf::create()
00109 {
00110 return new zSelectorSelf();
00111 }
00112
00113 zSelectorSelf::zSelectorSelf():
00114 zSelector()
00115 { }
00116
00117 zSelectorSelf::zSelectorSelf(zSelectorSelf const &other):
00118 zSelector(other)
00119 { }
00120
00121 void zSelectorSelf::operator=(zSelectorSelf const &other)
00122 {
00123 this->zSelector::operator=(other);
00124 }
00125
00126 zSelectorSelf * zSelectorSelf::copy(void) const
00127 {
00128 return new zSelectorSelf(*this);
00129 }
00130
00131 gVectorExtra<ePlayerNetID *> zSelectorSelf::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00132 {
00133 gVectorExtra<ePlayerNetID *> self;
00134 ePlayerNetID* triggererPlayer = triggerer->Player();
00135 if (triggererPlayer != 0)
00136 self.push_back( triggererPlayer );
00137
00138 return self;
00139 }
00140
00141
00142
00143
00144
00145 zSelector* zSelectorTeammate::create()
00146 {
00147 return new zSelectorTeammate();
00148 }
00149
00150 zSelectorTeammate::zSelectorTeammate():
00151 zSelector()
00152 { }
00153
00154 zSelectorTeammate::zSelectorTeammate(zSelectorTeammate const &other):
00155 zSelector(other)
00156 { }
00157
00158 void zSelectorTeammate::operator=(zSelectorTeammate const &other)
00159 {
00160 this->zSelector::operator=(other);
00161 }
00162
00163 zSelectorTeammate * zSelectorTeammate::copy(void) const
00164 {
00165 return new zSelectorTeammate(*this);
00166 }
00167
00168 gVectorExtra<ePlayerNetID *> zSelectorTeammate::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00169 {
00170
00171
00172
00173 gVectorExtra <ePlayerNetID *> teammates;
00174 gVectorExtra <ePlayerNetID *> singleTeammate;
00175
00176 ePlayerNetID* triggererPlayer = triggerer->Player();
00177 if (triggererPlayer != 0) {
00178 getAllValid(teammates, triggererPlayer->CurrentTeam()->GetAllMembers(), _alive);
00179
00180
00181 teammates.remove(triggererPlayer);
00182
00183
00184 if(teammates.size() != 0)
00185 singleTeammate.push_back(pickOne(teammates));
00186 }
00187 return singleTeammate;
00188 }
00189
00190
00191
00192
00193 zSelector* zSelectorTeam::create()
00194 {
00195 return new zSelectorTeam();
00196 }
00197
00198 zSelectorTeam::zSelectorTeam():
00199 zSelector()
00200 { }
00201
00202 zSelectorTeam::zSelectorTeam(zSelectorTeam const &other):
00203 zSelector(other)
00204 { }
00205
00206 void zSelectorTeam::operator=(zSelectorTeam const &other)
00207 {
00208 this->zSelector::operator=(other);
00209 }
00210
00211 zSelectorTeam * zSelectorTeam::copy(void) const
00212 {
00213 return new zSelectorTeam(*this);
00214 }
00215
00216 gVectorExtra<ePlayerNetID *> zSelectorTeam::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00217 {
00218
00219
00220
00221 gVectorExtra <ePlayerNetID *> allMemberOfTeam;
00222
00223 ePlayerNetID* triggererPlayer = triggerer->Player();
00224 if (triggererPlayer != 0) {
00225 getAllValid(allMemberOfTeam, triggererPlayer->CurrentTeam()->GetAllMembers(), _alive);
00226 }
00227
00228 return allMemberOfTeam;
00229 }
00230
00231
00232
00233
00234 zSelector* zSelectorAll::create()
00235 {
00236 return new zSelectorAll();
00237 }
00238
00239 zSelectorAll::zSelectorAll():
00240 zSelector()
00241 { }
00242
00243 zSelectorAll::zSelectorAll(zSelectorAll const &other):
00244 zSelector(other)
00245 { }
00246
00247 void zSelectorAll::operator=(zSelectorAll const &other)
00248 {
00249 this->zSelector::operator=(other);
00250 }
00251
00252 zSelectorAll * zSelectorAll::copy(void) const
00253 {
00254 return new zSelectorAll(*this);
00255 }
00256
00257 gVectorExtra<ePlayerNetID *> zSelectorAll::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00258 {
00259
00260 gVectorExtra<ePlayerNetID *> everybody;
00261 for (int i=0; i<se_PlayerNetIDs.Len(); i++) {
00262 everybody.push_back( se_PlayerNetIDs(i) );
00263 }
00264
00265 gVectorExtra<ePlayerNetID *> everybodyValid;
00266 getAllValid(everybodyValid, everybody, _alive);
00267
00268 return everybodyValid;
00269 }
00270
00271
00272
00273
00274 zSelector* zSelectorAllButSelf::create()
00275 {
00276 return new zSelectorAllButSelf();
00277 }
00278
00279 zSelectorAllButSelf::zSelectorAllButSelf():
00280 zSelector()
00281 { }
00282
00283 zSelectorAllButSelf::zSelectorAllButSelf(zSelectorAllButSelf const &other):
00284 zSelector(other)
00285 { }
00286
00287 void zSelectorAllButSelf::operator=(zSelectorAllButSelf const &other)
00288 {
00289 this->zSelector::operator=(other);
00290 }
00291
00292 zSelectorAllButSelf * zSelectorAllButSelf::copy(void) const
00293 {
00294 return new zSelectorAllButSelf(*this);
00295 }
00296
00297 gVectorExtra<ePlayerNetID *> zSelectorAllButSelf::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00298 {
00299
00300
00301
00302
00303 gVectorExtra<ePlayerNetID *> everybody;
00304 for (int i=0; i<se_PlayerNetIDs.Len(); i++) {
00305 everybody.push_back( se_PlayerNetIDs(i) );
00306 }
00307
00308 gVectorExtra<ePlayerNetID *> everybodyValid;
00309 getAllValid(everybodyValid, everybody, _alive);
00310
00311
00312 ePlayerNetID* triggererPlayer = triggerer->Player();
00313 if (triggererPlayer != 0) {
00314 everybodyValid.remove(triggererPlayer);
00315 }
00316
00317 return everybodyValid;
00318 }
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374 zSelector* zSelectorAnother::create()
00375 {
00376 return new zSelectorAnother();
00377 }
00378
00379 zSelectorAnother::zSelectorAnother():
00380 zSelector()
00381 { }
00382
00383 zSelectorAnother::zSelectorAnother(zSelectorAnother const &other):
00384 zSelector(other)
00385 { }
00386
00387 void zSelectorAnother::operator=(zSelectorAnother const &other)
00388 {
00389 this->zSelector::operator=(other);
00390 }
00391
00392 zSelectorAnother * zSelectorAnother::copy(void) const
00393 {
00394 return new zSelectorAnother(*this);
00395 }
00396
00397 gVectorExtra<ePlayerNetID *> zSelectorAnother::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00398 {
00399
00400
00401
00402
00403 gVectorExtra <ePlayerNetID *> allValidPlayer;
00404 gVectorExtra <ePlayerNetID *> anotherPlayer;
00405
00406 gVectorExtra <ePlayerNetID *> allPlayer;
00407 for (int i=0; i<se_PlayerNetIDs.Len(); i++) {
00408 allPlayer.push_back( se_PlayerNetIDs(i) );
00409 }
00410
00411 getAllValid(allValidPlayer, allPlayer, _alive);
00412
00413 ePlayerNetID* triggererPlayer = triggerer->Player();
00414 if (triggererPlayer != 0) {
00415 allValidPlayer.remove(triggererPlayer);
00416 }
00417
00418 if(allValidPlayer.size() != 0)
00419 anotherPlayer.push_back(pickOne(allValidPlayer));
00420
00421 return anotherPlayer;
00422 }
00423
00424
00425
00426
00427
00428 zSelector* zSelectorOwner::create()
00429 {
00430 return new zSelectorOwner();
00431 }
00432
00433 zSelectorOwner::zSelectorOwner():
00434 zSelector()
00435 { }
00436
00437 zSelectorOwner::zSelectorOwner(zSelectorOwner const &other):
00438 zSelector(other)
00439 { }
00440
00441 void zSelectorOwner::operator=(zSelectorOwner const &other)
00442 {
00443 this->zSelector::operator=(other);
00444 }
00445
00446 zSelectorOwner * zSelectorOwner::copy(void) const
00447 {
00448 return new zSelectorOwner(*this);
00449 }
00450
00451 gVectorExtra<ePlayerNetID *> zSelectorOwner::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00452 {
00453
00454
00455 gVectorExtra<ePlayerNetID *> owningPlayers;
00456
00457 for(gVectorExtra< nNetObjectID >::const_iterator iter=owners.begin();
00458 iter!=owners.end();
00459 ++iter) {
00460
00461 if(bool(sn_netObjects[(*iter)]))
00462 {
00463 ePlayerNetID * anOwner = static_cast< ePlayerNetID* >( static_cast< nNetObject* >( sn_netObjects[ (*iter) ] ) ) ;
00464 if(anOwner != 0)
00465 owningPlayers.push_back( anOwner );
00466 }
00467 }
00468 return owningPlayers;
00469 }
00470
00471
00472
00473
00474
00475 zSelector* zSelectorOwnerTeam::create()
00476 {
00477 return new zSelectorOwnerTeam();
00478 }
00479
00480 zSelectorOwnerTeam::zSelectorOwnerTeam():
00481 zSelector()
00482 { }
00483
00484 zSelectorOwnerTeam::zSelectorOwnerTeam(zSelectorOwnerTeam const &other):
00485 zSelector(other)
00486 { }
00487
00488 void zSelectorOwnerTeam::operator=(zSelectorOwnerTeam const &other)
00489 {
00490 this->zSelector::operator=(other);
00491 }
00492
00493 zSelectorOwnerTeam * zSelectorOwnerTeam::copy(void) const
00494 {
00495 return new zSelectorOwnerTeam(*this);
00496 }
00497
00498 gVectorExtra<ePlayerNetID *> zSelectorOwnerTeam::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00499 {
00500
00501
00502
00503
00504 gVectorExtra <ePlayerNetID *> allOwnerTeamMembers;
00505 gVectorExtra< nNetObjectID >::const_iterator iter;
00506 for(iter = teamOwners.begin();
00507 iter != teamOwners.end();
00508 ++iter)
00509 {
00510
00511 if(bool(sn_netObjects[(*iter)]))
00512 {
00513 eTeam * aTeam = static_cast< eTeam* >( static_cast< nNetObject* >( sn_netObjects[ (*iter) ] ) ) ;
00514 if(aTeam != 0)
00515 allOwnerTeamMembers.insertAll(aTeam->GetAllMembers());
00516
00517 }
00518 }
00519
00520
00521 gVectorExtra <ePlayerNetID *> OwnerTeamMembers;
00522 getAllValid(OwnerTeamMembers, allOwnerTeamMembers, _alive);
00523
00524 return OwnerTeamMembers;
00525 }
00526
00527
00528
00529
00530
00531 zSelector* zSelectorOwnerTeamTeammate::create()
00532 {
00533 return new zSelectorOwnerTeamTeammate();
00534 }
00535
00536 zSelectorOwnerTeamTeammate::zSelectorOwnerTeamTeammate():
00537 zSelector()
00538 { }
00539
00540 zSelectorOwnerTeamTeammate::zSelectorOwnerTeamTeammate(zSelectorOwnerTeamTeammate const &other):
00541 zSelector(other)
00542 { }
00543
00544 void zSelectorOwnerTeamTeammate::operator=(zSelectorOwnerTeamTeammate const &other)
00545 {
00546 this->zSelector::operator=(other);
00547 }
00548
00549 zSelectorOwnerTeamTeammate * zSelectorOwnerTeamTeammate::copy(void) const
00550 {
00551 return new zSelectorOwnerTeamTeammate(*this);
00552 }
00553
00554 gVectorExtra<ePlayerNetID *> zSelectorOwnerTeamTeammate::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00555 {
00556
00557 gVectorExtra <ePlayerNetID *> allTeammates;
00558 gVectorExtra< nNetObjectID >::const_iterator iter;
00559 for(iter = teamOwners.begin();
00560 iter != teamOwners.end();
00561 ++iter)
00562 {
00563
00564 if(bool(sn_netObjects[(*iter)]))
00565 {
00566 eTeam * aTeam = static_cast< eTeam* >( static_cast< nNetObject* >( sn_netObjects[ (*iter) ] ) ) ;
00567 if(aTeam != 0)
00568 allTeammates.insertAll(aTeam->GetAllMembers());
00569 }
00570 }
00571
00572
00573 gVectorExtra <ePlayerNetID *> teammates;
00574 getAllValid(teammates, allTeammates, _alive);
00575
00576
00577 gVectorExtra<ePlayerNetID *> singleTeammate;
00578 if(teammates.size() != 0)
00579 singleTeammate.push_back(pickOne(teammates));
00580 return singleTeammate;
00581 }
00582
00583
00584
00585
00586 zSelector* zSelectorAnyDead::create()
00587 {
00588 return new zSelectorAnyDead();
00589 }
00590
00591 zSelectorAnyDead::zSelectorAnyDead():
00592 zSelector()
00593 { }
00594
00595 zSelectorAnyDead::zSelectorAnyDead(zSelectorAnyDead const &other):
00596 zSelector(other)
00597 { }
00598
00599 void zSelectorAnyDead::operator=(zSelectorAnyDead const &other)
00600 {
00601 this->zSelector::operator=(other);
00602 }
00603
00604 zSelectorAnyDead * zSelectorAnyDead::copy(void) const
00605 {
00606 return new zSelectorAnyDead(*this);
00607 }
00608
00609 gVectorExtra<ePlayerNetID *> zSelectorAnyDead::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00610 {
00611
00612
00613
00614 gVectorExtra<ePlayerNetID *> everybody;
00615 for (int i=0; i<se_PlayerNetIDs.Len(); i++) {
00616 everybody.push_back( se_PlayerNetIDs(i) );
00617 }
00618
00619 gVectorExtra<ePlayerNetID *> everybodyDead;
00620 getAllValid(everybodyDead, everybody, _dead);
00621
00622 gVectorExtra<ePlayerNetID *> singleDead;
00623 if(everybodyDead.size() != 0)
00624 singleDead.push_back(pickOne(everybodyDead));
00625
00626 return singleDead;
00627 }
00628
00629
00630
00631
00632 zSelector* zSelectorAllDead::create()
00633 {
00634 return new zSelectorAllDead();
00635 }
00636
00637 zSelectorAllDead::zSelectorAllDead():
00638 zSelector()
00639 { }
00640
00641 zSelectorAllDead::zSelectorAllDead(zSelectorAllDead const &other):
00642 zSelector(other)
00643 { }
00644
00645 void zSelectorAllDead::operator=(zSelectorAllDead const &other)
00646 {
00647 this->zSelector::operator=(other);
00648 }
00649
00650 zSelectorAllDead * zSelectorAllDead::copy(void) const
00651 {
00652 return new zSelectorAllDead(*this);
00653 }
00654
00655 gVectorExtra<ePlayerNetID *> zSelectorAllDead::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00656 {
00657
00658
00659 gVectorExtra<ePlayerNetID *> everybody;
00660 for (int i=0; i<se_PlayerNetIDs.Len(); i++) {
00661 everybody.push_back( se_PlayerNetIDs(i) );
00662 }
00663
00664 gVectorExtra<ePlayerNetID *> everybodyDead;
00665 getAllValid(everybodyDead, everybody, _dead);
00666
00667 return everybodyDead;
00668 }
00669
00670
00671
00672
00673 zSelector* zSelectorSingleDeadOwner::create()
00674 {
00675 return new zSelectorSingleDeadOwner();
00676 }
00677
00678 zSelectorSingleDeadOwner::zSelectorSingleDeadOwner():
00679 zSelector()
00680 { }
00681
00682 zSelectorSingleDeadOwner::zSelectorSingleDeadOwner(zSelectorSingleDeadOwner const &other):
00683 zSelector(other)
00684 { }
00685
00686 void zSelectorSingleDeadOwner::operator=(zSelectorSingleDeadOwner const &other)
00687 {
00688 this->zSelector::operator=(other);
00689 }
00690
00691 zSelectorSingleDeadOwner * zSelectorSingleDeadOwner::copy(void) const
00692 {
00693 return new zSelectorSingleDeadOwner(*this);
00694 }
00695
00696 gVectorExtra<ePlayerNetID *> zSelectorSingleDeadOwner::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00697 {
00698
00699
00700
00701
00702 gVectorExtra <ePlayerNetID *> owningPlayers;
00703 gVectorExtra <ePlayerNetID *> deadOwners;
00704 gVectorExtra <ePlayerNetID *> singleDeadOwner;
00705
00706
00707 for(gVectorExtra< nNetObjectID >::const_iterator iter=owners.begin();
00708 iter!=owners.end();
00709 ++iter) {
00710
00711 if(bool(sn_netObjects[(*iter)]))
00712 {
00713 ePlayerNetID * aPlayer = static_cast< ePlayerNetID* >( static_cast< nNetObject* >( sn_netObjects[ (*iter) ] ) ) ;
00714 if(aPlayer != 0)
00715 owningPlayers.push_back( aPlayer );
00716 }
00717 }
00718
00719
00720 getAllValid(deadOwners, owningPlayers, _dead);
00721
00722
00723 if(deadOwners.size() != 0)
00724 singleDeadOwner.push_back(pickOne(deadOwners));
00725
00726 return singleDeadOwner;
00727 }
00728
00729
00730
00731
00732
00733
00734 zSelector* zSelectorAnotherTeammateDead::create()
00735 {
00736 return new zSelectorAnotherTeammateDead();
00737 }
00738
00739 zSelectorAnotherTeammateDead::zSelectorAnotherTeammateDead():
00740 zSelector()
00741 { }
00742
00743 zSelectorAnotherTeammateDead::zSelectorAnotherTeammateDead(zSelectorAnotherTeammateDead const &other):
00744 zSelector(other)
00745 { }
00746
00747 void zSelectorAnotherTeammateDead::operator=(zSelectorAnotherTeammateDead const &other)
00748 {
00749 this->zSelector::operator=(other);
00750 }
00751
00752 zSelectorAnotherTeammateDead * zSelectorAnotherTeammateDead::copy(void) const
00753 {
00754 return new zSelectorAnotherTeammateDead(*this);
00755 }
00756
00757 gVectorExtra<ePlayerNetID *> zSelectorAnotherTeammateDead::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00758 {
00759
00760
00761
00762
00763 gVectorExtra <ePlayerNetID *> deadTeammates;
00764 gVectorExtra <ePlayerNetID *> singleDeadTeammate;
00765
00766 ePlayerNetID* triggererPlayer = triggerer->Player();
00767 if (triggererPlayer != 0) {
00768 getAllValid(deadTeammates, triggererPlayer->CurrentTeam()->GetAllMembers(), _dead);
00769
00770
00771 deadTeammates.remove(triggererPlayer);
00772
00773
00774 if(deadTeammates.size() != 0)
00775 singleDeadTeammate.push_back(pickOne(deadTeammates));
00776 }
00777 return singleDeadTeammate;
00778 }
00779
00780
00781
00782
00783
00784 zSelector* zSelectorAnotherNotTeammateDead::create()
00785 {
00786 return new zSelectorAnotherNotTeammateDead();
00787 }
00788
00789 zSelectorAnotherNotTeammateDead::zSelectorAnotherNotTeammateDead():
00790 zSelector()
00791 { }
00792
00793 zSelectorAnotherNotTeammateDead::zSelectorAnotherNotTeammateDead(zSelectorAnotherNotTeammateDead const &other):
00794 zSelector(other)
00795 { }
00796
00797 void zSelectorAnotherNotTeammateDead::operator=(zSelectorAnotherNotTeammateDead const &other)
00798 {
00799 this->zSelector::operator=(other);
00800 }
00801
00802 zSelectorAnotherNotTeammateDead * zSelectorAnotherNotTeammateDead::copy(void) const
00803 {
00804 return new zSelectorAnotherNotTeammateDead(*this);
00805 }
00806
00807 gVectorExtra<ePlayerNetID *> zSelectorAnotherNotTeammateDead::select(gVectorExtra< nNetObjectID > &owners, gVectorExtra< nNetObjectID > &teamOwners, gCycle * triggerer)
00808 {
00809
00810
00811
00812
00813 gVectorExtra<ePlayerNetID *> everybody;
00814 for (int i=0; i<se_PlayerNetIDs.Len(); i++) {
00815 everybody.push_back( se_PlayerNetIDs(i) );
00816 }
00817 gVectorExtra<ePlayerNetID *> everybodyDead;
00818 getAllValid(everybodyDead, everybody, _dead);
00819
00820 gVectorExtra <ePlayerNetID *> singleDeadNotTeammate;
00821 if (everybodyDead.size() != 0)
00822 {
00823 gVectorExtra <ePlayerNetID *> teammates;
00824
00825 ePlayerNetID* triggererPlayer = triggerer->Player();
00826 if (triggererPlayer != 0)
00827 {
00828 getAllValid(teammates, triggererPlayer->CurrentTeam()->GetAllMembers(), _either);
00829
00830
00831 everybodyDead.removeAll(teammates);
00832
00833
00834 if(everybodyDead.size() != 0)
00835 singleDeadNotTeammate.push_back(pickOne(everybodyDead));
00836 }
00837 }
00838 return singleDeadNotTeammate;
00839 }
00840
00841
00842
00843
00844
00845
00846
00847
00848
00849
00850
00851
00852
00853
00854
00855
00856
00857
00858
00859
00860
00861
00862
00863
00864
00865
00866
00867
00868
00869
00870
00871
00872
00873
00874
00875
00876
00877
00878
00879
00880
00881
00882
00883
00884
00885
00886
00887
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900
00901
00902
00903
00904
00905
00906
00907
00908
00909
00910
00911
00912
00913
00914
00915 template <typename T>
00916 T
00917 zSelector::pickOne(std::vector <T> const &sources)
00918 {
00919 int number = sources.size();
00920 tRandomizer & randomizer = tRandomizer::GetInstance();
00921 int ran = randomizer.Get(number);
00922
00923 return sources[ran];
00924 }
00925
00926
00927
00928
00929
00930
00931
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943
00944
00945
00946
00947
00948
00949
00950
00951
00952
00953
00954
00955
00956
00957
00958
00959
00960
00961
00962
00963
00964
00965
00966
00967
00968
00969
00970
00971
00972
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985
00986
00987
00988
00989
00990
00991
00992
00993
00994
00995
00996
00997
00998
00999
01000
01001
01002
01003
01004
01005
01006
01007
01008
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037
01038
01039
01040
01041
01042
01043
01044
01045
01046
01047
01048
01049
01050
01051
01052
01053
01054
01055
01056
01057
01058
01059
01060
01061
01062
01063