Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.cc @ 10888

Last change on this file since 10888 was 10888, checked in by gania, 8 years ago

started working on pickups

File size: 26.7 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Gani Aliguzhinov
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#include "ActionpointController.h"
30
31#include "core/XMLPort.h"
32#include <algorithm>
33#include "worldentities/Actionpoint.h"
34namespace orxonox
35{
36
37    RegisterClass(ActionpointController);
38
39    ActionpointController::ActionpointController(Context* context) : FightingController(context)
40    {
41        this->actionCounter_ = 0;
42        this->bInLoop_ = false;
43        this->bLoop_ = false;
44        this->bEndLoop_ = false;
45        loopActionpoints_.clear();
46        parsedActionpoints_.clear();
47        actionpoints_.clear();
48        healthSpawners_.clear();
49        damageSpawners_.clear();
50        speedSpawners_.clear();
51        this->bTakenOver_ = false;
52        this->action_ = Action::NONE;
53        this->squaredaccuracy_ = 2500;
54        this->bFirstTick_ = true;
55
56        RegisterObject(ActionpointController);
57
58    }
59    void ActionpointController::XMLPort( Element& xmlelement, XMLPort::Mode mode )
60    {
61        SUPER( ActionpointController, XMLPort, xmlelement, mode );
62        XMLPortObject(ActionpointController, WorldEntity, "actionpoints", addActionpoint, getActionpoint,  xmlelement, mode);
63    }
64    ActionpointController::~ActionpointController()
65    {
66        loopActionpoints_.clear();
67        parsedActionpoints_.clear();
68        actionpoints_.clear();
69        healthSpawners_.clear();
70        damageSpawners_.clear();
71        speedSpawners_.clear();
72    }
73    void ActionpointController::tick(float dt)
74    {
75
76        if (this->timeout_ > 0 && this->bFiredRocket_)
77        {
78            this->timeout_ -= dt;
79        }
80        if (timeout_ <= 0)
81            this->bFiredRocket_ = false;
82
83        if (this->bHasTargetPosition_)
84        {
85            this->moveToTargetPosition(dt);
86        }
87        else if (this->bLookAtTarget_)
88        {
89            this->lookAtTarget(dt);
90        }
91        if (this->bShooting_)
92        {
93            this->doFire();
94        }
95        if (this->bFirstTick_)
96        {
97            std::reverse(parsedActionpoints_.begin(), parsedActionpoints_.end());
98            std::reverse(actionpoints_.begin(), actionpoints_.end());
99            if (this->parsedActionpoints_.empty())
100            {
101                this->action_ = Action::FIGHTALL;
102            }
103        }
104        if (this->bFirstTick_)
105        {   
106            setSpawners();
107            // orxout(internal_error) << "health spawners size = " << this->healthSpawners_.size() <<
108            // ", damage spawners size = " << this->damageSpawners_.size() <<
109            // ", speed spawners size = " << this->speedSpawners_.size() << endl;       
110            this->bFirstTick_ = false;
111        }
112
113        SUPER(ActionpointController, tick, dt);
114    }
115    void ActionpointController::action()
116    {
117        if (!this || !this->getControllableEntity())
118            return;
119        if (!this->getControllableEntity() || !orxonox_cast<Pawn*> (this->getControllableEntity()))
120            return;
121
122        this->deltaHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth() - this->previousHp;
123        this->previousHp = orxonox_cast<Pawn*> (this->getControllableEntity())->getHealth();
124        if (this->actionCounter_ % 2 == 0)
125            this->startAttackingEnemiesThatAreClose();
126        //No action -> pop one from stack
127        if (this->action_ == Action::NONE || this->bTakenOver_)
128        {
129            // Point point = closestPickup(PickupType::HEALTH);
130            // if (point.action != Action::NONE)
131            // {
132            //     orxout(internal_error) << "found health" << endl;
133            //     this->parsedActionpoints_.push_back(point);
134            // }
135            if (this->parsedActionpoints_.empty() && this->loopActionpoints_.empty())
136            {
137                Point p = { Action::FIGHTALL, "", Vector3::ZERO, false };
138                this->parsedActionpoints_.push_back (p);
139            }
140            this->executeActionpoint();
141            this->bTakenOver_ = false;
142            this->action();
143        }
144        //Action fightall -> fight till nobody alive
145        if (this->action_ == Action::FIGHTALL)
146        {
147            if (!this->hasTarget())
148            {
149                ControllableEntity* newTarget = this->closestTarget();   
150                if (newTarget)
151                {
152                    this->setAction (Action::FIGHTALL, newTarget);
153                    this->action();
154                }
155                else
156                {
157                    this->nextActionpoint();
158                    if (!(this->parsedActionpoints_.empty() && this->loopActionpoints_.empty()))
159                    {
160                        this->action();
161                    }
162                    else
163                    {
164                    }     
165                }
166            }
167        }
168        //Action fight -> fight as long as enemies in range
169        else if (this->action_ == Action::FIGHT)
170        {
171            if (!this->hasTarget())
172            {
173                //----find a target----
174                ControllableEntity* newTarget = this->closestTarget();   
175                if (newTarget && 
176                        CommonController::distance (this->getControllableEntity(), newTarget) < this->attackRange_)
177                {
178                    this->setAction (Action::FIGHT, newTarget);
179                    this->action();
180                }
181                else
182                {
183                    this->nextActionpoint();
184                    this->action();
185                }
186            }
187            else if (this->hasTarget())
188            {
189                //----fly in formation if far enough----
190                Vector3 diffVector = this->positionOfTarget_ - this->getControllableEntity()->getWorldPosition();         
191                   
192                if (diffVector.length() > this->attackRange_)
193                {
194                    ControllableEntity* newTarget = this->closestTarget();
195                   
196                    if (newTarget && 
197                        CommonController::distance (this->getControllableEntity(), newTarget) < this->attackRange_)
198                    {
199                        this->setAction (Action::FIGHT, newTarget);
200                    }
201                    else
202                    {
203                        this->nextActionpoint();
204                        this->action();
205                    }
206                }
207            }
208        }
209        else if (this->action_ == Action::FLY)
210        {
211            if (this->squaredDistanceToTarget() <= this->squaredaccuracy_)
212            {
213                this->nextActionpoint();   
214                this->action();
215            }
216        }
217        else if (this->action_ == Action::PROTECT)
218        {
219            if (!this->getProtect())
220            {
221                this->nextActionpoint();
222                this->action(); 
223            }
224            this->stayNearProtect();
225        }
226        else if (this->action_ == Action::ATTACK)
227        {   
228            if (!this->hasTarget())
229            {
230                this->nextActionpoint();
231                this->action();
232            }
233        }
234        if (this->hasTarget())
235        {
236            this->maneuver();
237            this->bShooting_ = this->canFire();
238            // Vector3 healthPosition = bestHealthPickup((this->target_->getWorldPosition() - this->getControllableEntity()->getWorldPosition()).length());
239            // if ((this->getControllableEntity()->getWorldPosition() - healthPosition).length() < this->tolerance_)
240            // {
241            //     //----choose where to go----
242            //     this->maneuver();
243            // }
244            // else
245            // {
246            //     this->dodgeTowards(healthPosition);
247            // }
248            // //----fire if you can----
249            // this->bShooting_ = this->canFire(); 
250        }
251        this->actionCounter_ += this->actionCounter_ < 100000 ? 1 : -this->actionCounter_ ;
252
253    }
254    void ActionpointController::setProtect (ControllableEntity* protect)
255    {
256        this->protect_ = protect;
257    }
258    ControllableEntity* ActionpointController::getProtect ()
259    {
260        return this->protect_;
261    }
262    void ActionpointController::addActionpoint(WorldEntity* actionpoint)
263    {
264        std::string actionName;
265        Vector3 position;
266        std::string targetName;
267        bool inLoop = false;
268        Point p;
269        if (actionpoint->getIdentifier()->getName() == "Actionpoint")
270        {
271            Actionpoint* ap = orxonox_cast<Actionpoint*> (actionpoint);
272            actionName = ap->getActionXML();
273            targetName = ap->getName();
274            position = ap->getWorldPosition();
275
276            if (this->bEndLoop_)
277            {
278                this->bInLoop_ = false;
279            }
280            if (!this->bInLoop_ && ap->getLoopStart())
281            {
282                this->bInLoop_ = true;
283            }
284            if (this->bInLoop_ && ap->getLoopEnd())
285            {
286                this->bEndLoop_ = true;
287            }
288            inLoop = this->bInLoop_;
289
290            Action::Value value;
291           
292            if ( actionName == "FIGHT" )
293            { value = Action::FIGHT; }
294            else if ( actionName == "FLY" )
295            { value = Action::FLY; }
296            else if ( actionName == "PROTECT" )
297            { value = Action::PROTECT; }
298            else if ( actionName == "NONE" )
299            { value = Action::NONE; }
300            else if ( actionName == "FIGHTALL" )
301            { value = Action::FIGHTALL; }
302            else if ( actionName == "ATTACK" )
303            { value = Action::ATTACK; }
304            else
305                ThrowException( ParseError, std::string( "Attempting to set an unknown Action: '" )+ actionName + "'." );
306            p.action = value; p.name = targetName; p.position = position; p.inLoop = inLoop;
307        }
308        else
309        {
310            inLoop = true;
311            p.action = Action::FLY; p.name = ""; p.position = actionpoint->getWorldPosition(); p.inLoop = inLoop;
312        }
313            parsedActionpoints_.push_back(p);
314            this->actionpoints_.push_back(actionpoint);
315    }
316    WorldEntity* ActionpointController::getActionpoint(unsigned int index) const
317    {
318        if (index < this->actionpoints_.size())
319            return this->actionpoints_[index];
320        else
321            return 0;
322    }
323
324    Action::Value ActionpointController::getAction ()
325    {
326        return this->action_;
327    }
328    std::string ActionpointController::getActionName()
329    {
330        switch ( this->action_ )
331        {
332            case Action::FIGHT:
333            { return "FIGHT"; break; }
334            case Action::FLY:
335            { return "FLY"; break; }
336            case Action::PROTECT:
337            { return "PROTECT"; break; }
338            case Action::NONE:
339            { return "NONE"; break; }
340            case Action::FIGHTALL:
341            { return "FIGHTALL"; break; }
342            case Action::ATTACK:
343            { return "ATTACK"; break; }
344            default:
345                return "NONE";
346                break;
347        }
348    }
349    void ActionpointController::setAction (Action::Value action)
350    {
351        this->action_ = action;
352    }
353    void ActionpointController::setAction (Action::Value action, ControllableEntity* target)
354    {
355        this->action_ = action;
356        if (action == Action::FIGHT || action == Action::FIGHTALL || action == Action::ATTACK)
357        {   
358            if (target)
359                this->setTarget (target);
360        }
361        else if (action == Action::PROTECT)
362        {
363            if (target)
364                this->setProtect (target);
365        }
366    }
367    void ActionpointController::setAction (Action::Value action, const Vector3& target)
368    {
369        this->action_ = action;
370        if (action == Action::FLY)
371        {
372            this->setTargetPosition (target);
373        }
374    }
375    void ActionpointController::setAction (Action::Value action, const Vector3& target,  const Quaternion& orient )
376    {
377        this->action_ = action;
378        if (action == Action::FLY)
379        {
380            this->setTargetPosition (target);
381            this->setTargetOrientation (orient);
382        } 
383    }
384   
385    //------------------------------------------------------------------------------
386    //------------------------------Actionpoint methods-----------------------------
387    //------------------------------------------------------------------------------
388
389    //POST: this starts doing what was asked by the last element of parsedActionpoints_,
390    //if last element was failed to be parsed, next element will be executed.
391    void ActionpointController::executeActionpoint()
392    {
393        Point p;
394        if (this->bLoop_ && !loopActionpoints_.empty())
395        {
396            p = loopActionpoints_.back();
397        }
398        else if (this->bLoop_)
399        {
400            this->bLoop_ = false;
401            return;
402        }
403        else if (!this->bLoop_ && !parsedActionpoints_.empty())
404        {
405            p = parsedActionpoints_.back();
406        }
407        else
408        {
409            this->setTarget(0);
410            this->setTargetPosition(this->getControllableEntity()->getWorldPosition());
411            this->action_ = Action::NONE;
412            return;
413        }
414        if (!this->bLoop_ && this->parsedActionpoints_.back().inLoop)
415        {
416            //MOVES all points that are in loop to a loop vector
417            this->fillLoop();
418            this->bLoop_ = true;
419            executeActionpoint();
420            return;
421        }
422        this->setAction (p.action);
423        switch (this->action_)
424        {
425            case Action::FIGHT:
426            {
427                std::string targetName = p.name;
428                if (targetName == "")
429                    break;
430                for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
431                {
432                    if (CommonController::getName(*itP) == targetName)
433                    {
434                        this->setTarget (static_cast<ControllableEntity*>(*itP));
435                    }
436                }
437                break;
438            }
439            case Action::FLY:
440            {
441                this->setTargetPosition( p.position );
442                if (this->squaredDistanceToTarget() <= this->squaredaccuracy_)
443                {
444                    this->nextActionpoint();
445                    this->executeActionpoint();
446                }
447                break;
448            }
449            case Action::PROTECT:
450            {
451               
452                std::string protectName = p.name;
453                if (protectName == "reservedKeyword:human")
454                {
455                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
456                    {
457                        if (orxonox_cast<ControllableEntity*>(*itP) && ((*itP)->getController()) && ((*itP)->getController()->getIdentifier()->getName() == "NewHumanController"))
458                        {
459                            this->setProtect (static_cast<ControllableEntity*>(*itP));
460                        }
461                    }
462                }
463                else
464                {
465                    for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
466                    {
467                        if (CommonController::getName(*itP) == protectName)
468                        {
469                            this->setProtect (static_cast<ControllableEntity*>(*itP));
470                        }
471                    }                           
472                }
473                if (!this->getProtect())
474                {
475                    this->nextActionpoint();
476                    this->executeActionpoint();
477                }
478                break;
479            }
480            case Action::NONE:
481            {
482                break;
483            }
484            case Action::FIGHTALL:
485            {
486                break;
487            }
488            case Action::ATTACK:
489            {
490                std::string targetName = p.name;
491
492                for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
493                {
494                    if (CommonController::getName(*itP) == targetName)
495                    {
496                        this->setTarget (static_cast<ControllableEntity*>(*itP));
497                    }
498                }
499                if (!this->hasTarget())
500                {
501                    this->nextActionpoint();
502                    this->executeActionpoint();
503                }
504                break;
505            }
506            default:
507                break;
508        }   
509    }
510
511   
512    void ActionpointController::stayNearProtect()
513    {
514        Vector3 targetRelativePosition(0, 300, 300);
515        if (!this->getProtect())
516        {
517            this->nextActionpoint();
518            return;
519        } 
520        Vector3 targetAbsolutePosition = ((this->getProtect()->getWorldPosition()) + 
521            (this->getProtect()->getWorldOrientation()* (targetRelativePosition)));
522        this->setTargetPosition(targetAbsolutePosition);
523        if (!this->getProtect())
524        {
525            this->nextActionpoint();
526            return;
527        } 
528        if (this->actionCounter_ % 3 == 0)
529            this->setTargetOrientation(this->getProtect()->getWorldOrientation());
530    }
531    void ActionpointController::nextActionpoint()
532    {
533        if (!this || !this->getControllableEntity())
534            return;
535        if (this->bLoop_)
536        {
537            if (!this->loopActionpoints_.empty())
538            {
539                this->moveBackToTop();
540            }
541        }
542        else
543        {
544            if (!this->parsedActionpoints_.empty())
545            {
546                this->parsedActionpoints_.pop_back();
547            }           
548        }
549        this->setAction(Action::NONE);
550        this->bHasTargetPosition_ = false;
551    }
552    void ActionpointController::moveBackToTop()
553    {
554        Point temp = loopActionpoints_.back();
555        loopActionpoints_.pop_back();
556        std::reverse (loopActionpoints_.begin(), loopActionpoints_.end());
557        loopActionpoints_.push_back(temp);
558        std::reverse (loopActionpoints_.begin(), loopActionpoints_.end());
559    }
560    void ActionpointController::fillLoop()
561    {
562        loopActionpoints_.clear();
563        fillLoopReversed();
564        std::reverse (loopActionpoints_.begin(), loopActionpoints_.end());
565    }
566    void ActionpointController::fillLoopReversed()
567    {
568        if (parsedActionpoints_.back().inLoop)
569        {
570            loopActionpoints_.push_back(parsedActionpoints_.back());
571            parsedActionpoints_.pop_back();
572        }
573        if (parsedActionpoints_.back().inLoop)
574        {
575            fillLoopReversed();
576        }
577    }
578   
579    void ActionpointController::takeActionpoints (const std::vector<Point>& vector, const std::vector<Point>& loop, bool b)
580    {
581      this->parsedActionpoints_ = vector;
582      this->loopActionpoints_ = loop;
583      this->bLoop_ = b;
584      this->bTakenOver_ = true;
585    }
586    void ActionpointController::setClosestTarget()
587    {
588        this->setTarget (static_cast<ControllableEntity*>( closestTarget() ) ); 
589    }
590    Pawn* ActionpointController::closestTarget()
591    {
592        if (!this->getControllableEntity())
593            return 0;
594
595        Pawn* closestTarget = 0;
596        float minDistance =  std::numeric_limits<float>::infinity();
597        Gametype* gt = this->getGametype();
598        for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>::begin(); itP; ++itP)
599        {
600            if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) )
601                continue;
602
603            float distance = CommonController::distance (*itP, this->getControllableEntity());
604            if (distance < minDistance)
605            {
606                closestTarget = *itP;
607                minDistance = distance;
608            }
609        }
610        if (closestTarget)
611        {
612           return closestTarget;
613        } 
614        return 0; 
615    }
616    void ActionpointController::startAttackingEnemiesThatAreClose()
617    {
618        if (this->action_ != Action::FIGHT && this->action_ != Action::FIGHTALL)
619        {
620            if (!this->target_ || (this->target_ && CommonController::distance (this->getControllableEntity(), this->target_) > this->attackRange_))
621            {
622                Pawn* newTarget = this->closestTarget();
623                if ( newTarget && 
624                    CommonController::distance (this->getControllableEntity(), static_cast<ControllableEntity*>(newTarget))
625                        <= this->attackRange_ )
626                {
627                    if (this->bLoop_)
628                    {
629                        Point p = { Action::FIGHT, CommonController::getName(newTarget), Vector3::ZERO, true };
630                        this->loopActionpoints_.push_back(p);
631                    }
632                    else
633                    {
634                        Point p = { Action::FIGHT, CommonController::getName(newTarget), Vector3::ZERO, false };
635                        this->parsedActionpoints_.push_back(p);
636                    }
637                    this->executeActionpoint();
638                }
639            }
640        }
641    }
642    Vector3 ActionpointController::bestHealthPickup(float searchRadius)
643    {
644
645        //1000000/distance^2 * 1/index+1
646        float maxUse = 0;
647        float tempUse = -1;
648        int index = 0;
649        float distance = 0;
650        Vector3 bestPosition = this->getControllableEntity()->getWorldPosition();
651
652        for (std::multimap<int, std::pair<PickupSpawner*, bool> >::iterator it=healthSpawners_.begin(); it!=healthSpawners_.end(); ++it)
653        {
654            distance = (this->getControllableEntity()->getWorldPosition() - (*it).second.first->getWorldPosition()).length();
655            if (distance < this->tolerance_ || !(*it).second.second)
656            {
657                (*it).second.second = false;
658                continue;
659            }
660            if (distance > searchRadius)
661                continue;
662            index = (*it).first;
663            tempUse = 1000000*1/(1+distance*distance) * 1/((index/2.0f)+1);
664            if (tempUse > maxUse)
665            {
666                bestPosition = (*it).second.first->getWorldPosition();
667                maxUse = tempUse;
668            }
669        }
670        //std::multimap<int, std::pair<PickupSpawner*, bool> >::iterator it = this->healthSpawners_.find(index);
671        //P.S. check if it == ... .end()
672        //orxout (internal_error) << "best position = " << bestPosition << endl;
673        return  bestPosition;
674    }
675    void ActionpointController::setSpawners()
676    {
677        std::vector<std::string> damagePickups;
678        std::vector<std::string> healthPickups;
679        std::vector<std::string> speedPickups;       
680        int index = 0;
681
682
683        damagePickups.push_back("largedamageboostpickup");
684        damagePickups.push_back("dronepickup");           
685        damagePickups.push_back("mediumdamageboostpickup");
686        damagePickups.push_back("smalldamageboostpickup");
687
688        healthPickups.push_back("triplehealthspeedinvisibilitypickup");           
689        healthPickups.push_back("crazyhealthpickup");
690        healthPickups.push_back("hugehealthpickup");
691        healthPickups.push_back("hugeshieldpickup");
692        healthPickups.push_back("hugeinvisiblepickup");
693        healthPickups.push_back("hugeshrinkpickup");
694        healthPickups.push_back("mediumhealthpickup");
695        healthPickups.push_back("mediumshieldpickup");
696        healthPickups.push_back("mediuminvisiblepickup");
697        healthPickups.push_back("mediumshrinkpickup"); 
698        healthPickups.push_back("smallhealthpickup");                   
699        healthPickups.push_back("smallshieldpickup");
700        healthPickups.push_back("smallinvisiblepickup");
701        healthPickups.push_back("smallshrinkpickup");
702
703        speedPickups.push_back("triplehealthspeedinvisibilitypickup");
704        speedPickups.push_back("hugespeedpickup");
705        speedPickups.push_back("smalljumppickup");
706        speedPickups.push_back("mediumspeedpickup");
707        speedPickups.push_back("smallspeedpickup");
708       
709
710
711        for (ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it; ++it)
712        {
713            if ((*it)->getIdentifier()->getName() != "PickupSpawner")
714                continue;
715            PickupSpawner* spawner = static_cast<PickupSpawner*>(*it);
716            std::string name = spawner->getPickupTemplateName();
717            //float distance = ((*it)->getWorldPosition() - this->getControllableEntity()->getWorldPosition()).length();
718            // if (distance < 50.0f)
719            //     continue;           
720            for (unsigned int i = 0; i < healthPickups.size(); ++i)
721            {
722                if (name == healthPickups.at(i))
723                {
724                    index = i;
725                    this->healthSpawners_.insert(std::make_pair(index, std::make_pair(spawner, true)));
726                    break;
727                }
728            }
729            for (unsigned int i = 0; i < damagePickups.size(); ++i)
730            {
731                if (name == damagePickups.at(i))
732                {
733                    //tempUse = 1000000*1/(1+distance*distance) * 1/((i/2.0f)+1);
734                    index = i;
735                    this->damageSpawners_.insert(std::make_pair(index, std::make_pair(spawner, true)));
736                    break;
737                }
738            }
739            for (unsigned int i = 0; i < speedPickups.size(); ++i)
740            {
741                if (name == speedPickups.at(i))
742                {
743                    //tempUse = 1000000*1/(1+distance*distance) * 1/((i/2.0f)+1);
744                    index = i;
745                    this->speedSpawners_.insert(std::make_pair(index, std::make_pair(spawner, true)));
746                    break;
747                }
748            }
749            // if (tempUse > maxUse)
750            // {
751            //     Point p = { Action::FLY, "", (*it)->getWorldPosition(), false };
752            //     maxUse = tempUse;
753            //     maxPoint = p;
754            // }
755            // else
756            // {
757            //     tempUse = -1;
758            //     continue;
759            // }
760            // orxout(internal_error) << "resp time  = " << static_cast<PickupSpawner*>(*it)->getRespawnTime() << endl;
761        } 
762    }
763}
Note: See TracBrowser for help on using the repository browser.