Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 7, 2016, 4:00:25 PM (8 years ago)
Author:
bberabi
Message:

bots are finally added; controller has to be implemented

Location:
code/branches/SpaceRace_HS16/src/modules/gametypes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.cc

    r11260 r11272  
    3636#include "items/Engine.h"
    3737#include "controllers/HumanController.h"
    38 #include "SpaceRaceBot.h"
    3938
    4039#include "core/CoreIncludes.h"
     
    4342#include "worldentities/pawns/Pawn.h"
    4443#include "core/config/ConfigValueIncludes.h"
     44#include "infos/Bot.h"
     45#include "SpaceRaceBot.h"
    4546
    4647
     
    5657       
    5758        //this->botclass_ = Class();
     59        this->botclass_ = Class(SpaceRaceBot);//ClassByString("")
    5860
    5961        this->checkpointsReached_ = 0;
     
    168170    }
    169171
     172        /*void playerEntered(PlayerInfo* player) {
     173
     174
     175                  Gametype::playerEntered(player);
     176
     177        const std::string& message = player->getName() + " entered the game";
     178        ChatManager::message(message);
     179           
     180        }*/
     181
     182
     183
     184
     185 void OldSpaceRace::addBots(unsigned int amount)
     186    {
     187        for (unsigned int i = 0; i < amount; ++i)
     188            this->botclass_.fabricate(this->getContext());
     189    }
     190
     191
     192
     193
    170194
    171195}
  • code/branches/SpaceRace_HS16/src/modules/gametypes/OldSpaceRace.h

    r11256 r11272  
    3838
    3939#include "gametypes/Gametype.h"
     40#include "SpaceRaceManager.h"
    4041
    4142#include "OldRaceCheckPoint.h"
     
    6364            virtual void playerEntered(PlayerInfo* player) override;
    6465            virtual void newCheckpointReached();
    65             virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command.
     66            virtual void addBots(unsigned int amount) override; //<! overwrite function in order to bypass the addbots command.
    6667                                          //<! This is only a temporary solution. Better: create racingBots.
    6768
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.cc

    r11256 r11272  
    2323 *      Author: purgham
    2424 */
     25#include <vector>
    2526
    2627#include "SpaceRaceBot.h"
     28#include "core/GameMode.h"
    2729#include "core/CoreIncludes.h"
     30#include "core/config/ConfigValueIncludes.h"
     31#include "gametypes/Gametype.h"
     32#include "controllers/AIController.h"
     33#include "gametypes/SpaceRaceController.h"
     34
     35
    2836
    2937namespace orxonox
     
    3341    SpaceRaceBot::SpaceRaceBot(Context* context) : Bot(context){
    3442        RegisterObject(SpaceRaceBot);
    35         this->defaultController_ = Class(SpaceRaceController);// ClassByString("")
    36         this->createController();
    37     }
     43        this->defaultController_ = Class(AIController);// ClassByString("")
     44       
    3845
    3946
     
    4148
    4249
     50        this->createController();
     51
     52    }
     53
     54SpaceRaceBot::~SpaceRaceBot(){
     55
     56}
     57
     58void SpaceRaceBot::setConfigValues()
     59    {
     60        static const std::string names[] =
     61        {
     62            "Dr. Julius No",
     63            "Berkay Berabi",
     64            "Louis Meile"
     65           
     66            "Dominic Greene"
     67        };
     68        static std::vector<std::string> defaultnames(names, names + sizeof(names) / sizeof(std::string));
     69
     70        SetConfigValue(names_, defaultnames);
     71    }
     72
    4373
    4474
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceBot.h

    r11239 r11272  
    3030#include "gametypes/GametypesPrereqs.h"
    3131#include "gametypes/SpaceRaceController.h"
     32#include <vector>
    3233
    3334
     
    3536{
    3637
    37     /**
    38 /sdaasdasdasdasdas     
    39     */
    4038    class _GametypesExport SpaceRaceBot: public Bot
    4139    {
    4240        public:
    43         SpaceRaceBot(Context* context);
    44             virtual ~SpaceRaceBot() {}
     41                SpaceRaceBot(Context* context);
     42            virtual ~SpaceRaceBot();
     43   
     44            void setConfigValues();
     45
     46
     47
     48 virtual inline bool isInitialized() const override
     49                { return true; }
     50            virtual inline float getPing() const override
     51                { return 0; }
     52            virtual inline float getPacketLossRatio() const override
     53                { return 0; }
     54
     55
     56  private:
     57            std::vector<std::string> names_;
     58
     59
    4560    };
    4661}
  • code/branches/SpaceRace_HS16/src/modules/gametypes/SpaceRaceManager.cc

    r11071 r11272  
    4747        RegisterObject(SpaceRaceManager);
    4848        this->race_ = orxonox_cast<SpaceRace*>(this->getGametype());
    49         assert(race_);
     49        //assert(race_);
    5050        //amountOfPlayers=(race_->getPlayers()).size();
    5151        this->firstcheckpointvisible_ = false;
Note: See TracChangeset for help on using the changeset viewer.