[Orxonox-commit 148] r2831 - in branches/pickups/src/orxonox/objects: pickup worldentities/pawns
danielh at orxonox.net
danielh at orxonox.net
Mon Mar 23 14:39:47 CET 2009
Author: danielh
Date: 2009-03-23 13:39:47 +0000 (Mon, 23 Mar 2009)
New Revision: 2831
Removed:
branches/pickups/src/orxonox/objects/pickup/BaseItem.cc
branches/pickups/src/orxonox/objects/pickup/BaseItem.h
branches/pickups/src/orxonox/objects/pickup/PickupSpawner.cc
branches/pickups/src/orxonox/objects/pickup/PickupSpawner.h
branches/pickups/src/orxonox/objects/pickup/ShipEquipment.cc
branches/pickups/src/orxonox/objects/pickup/ShipEquipment.h
branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.cc
branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.h
branches/pickups/src/orxonox/objects/pickup/ShipItem.cc
branches/pickups/src/orxonox/objects/pickup/ShipItem.h
branches/pickups/src/orxonox/objects/pickup/Turbo.cc
branches/pickups/src/orxonox/objects/pickup/Turbo.h
branches/pickups/src/orxonox/objects/pickup/Usable.h
Modified:
branches/pickups/src/orxonox/objects/pickup/CMakeLists.txt
branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.cc
branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.h
Log:
removed old pickup system
Deleted: branches/pickups/src/orxonox/objects/pickup/BaseItem.cc
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/BaseItem.cc 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/BaseItem.cc 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,78 +0,0 @@
-/* has to be added to player
- multimap<std::string, BaseItem*> Equipment;*/
-
-
-#include "OrxonoxStableHeaders.h"
-#include "BaseItem.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "util/String.h"
-#include "objects/worldentities/pawns/Pawn.h"
-
-
-namespace orxonox
-{
-BaseItem::BaseItem(BaseObject* creator) : BaseObject(creator)
-{
- RegisterObject(BaseItem);
-
- this->playerBaseClass_ = 0;
-}
-
-BaseItem::~BaseItem()
-{
-}
- void BaseItem::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(BaseItem, XMLPort, xmlelement, mode);
-
- XMLPortParam(BaseItem, "playerclass", setPlayerBaseClassName, getPlayerBaseClassName, xmlelement, mode);
- }
-
-bool BaseItem::addTo (Pawn* player)
-{
-
- return player->getPickUp().insert(this);
- /*if(checkSlot(player)==true)
- player->pickUp.Equipment.insert ( std::pair<std::string, BaseItem*>(this->getName(),this) );
- else
- COUT(3) << "swap?" << std::endl;*/
-}
-bool BaseItem::remove(Pawn* player)
-{
- /*if(player->pickUp.Equipment.find(this->getName())!= player->pickUp.Equipment.end())
- {
- std::multimap<std::string,BaseItem*>::iterator it;
- it=player->pickUp.Equipment.find(this->getName());
- player->pickUp.Equipment.erase (it);
- return true;
- }
- else
- return false;*/
- return player->getPickUp().erase(this);
-}
-bool BaseItem::checkSlot(Pawn* player)
-{
- /*std::multimap<std::string,BaseItem*>::iterator it;
- for ( it=player->getPickUp().getEquipment().begin() ; it != player->getPickUp().getEquipment().end(); it++ )
- {
- if((*it).second->playerBaseClass_==this->playerBaseClass_)
- //das isch schmarre...machs mit isExactlyA(...)
- return false;
- }
- return true;*/
- return player->getPickUp().checkSlot(this);
-}
-void BaseItem::setPlayerBaseClassName(const std::string& name)
-{
- this->playerBaseClass_ = ClassByString(name);
-}
-
-const std::string& BaseItem::getPlayerBaseClassName() const
-{
- if (this->playerBaseClass_)
- return this->playerBaseClass_->getName();
- else
- return BLANKSTRING;
-}
-}
Deleted: branches/pickups/src/orxonox/objects/pickup/BaseItem.h
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/BaseItem.h 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/BaseItem.h 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,37 +0,0 @@
-#ifndef _BaseItem_H__
-#define _BaseItem_H__
-
-#include "core/BaseObject.h"
-#include "OrxonoxPrereqs.h"
-
-namespace orxonox
-{
- class ShipEquipment;
-
- class _OrxonoxExport BaseItem : public BaseObject
- {
- public:
- BaseItem( BaseObject* creator);
- virtual ~BaseItem();
- bool checkSlot(Pawn* player);
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual bool pickedUp(Pawn* player) { return true; }
- virtual bool dropped(Pawn* player) { return true; } //erst bei festen Items
- bool remove(Pawn* player);
- bool addTo(Pawn* player);
-
- inline void setPlayerBaseClass(Identifier* identifier)
- { this->playerBaseClass_ = identifier; }
- inline Identifier* getPlayerBaseClass() const
- { return this->playerBaseClass_; }
-
- private:
- void setPlayerBaseClassName(const std::string& name);
- const std::string& getPlayerBaseClassName() const;
-
- Identifier* playerBaseClass_;
- };
-}
-
-#endif /* _BaseItem_H__ */
Modified: branches/pickups/src/orxonox/objects/pickup/CMakeLists.txt
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/CMakeLists.txt 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/CMakeLists.txt 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,6 +1,3 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
- PickupSpawner.cc
- BaseItem.cc
- Turbo.cc
- ShipEquipment.cc
+
)
Deleted: branches/pickups/src/orxonox/objects/pickup/PickupSpawner.cc
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/PickupSpawner.cc 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/PickupSpawner.cc 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,121 +0,0 @@
-#include "OrxonoxStableHeaders.h"
-#include "PickupSpawner.h"
-#include "BaseItem.h"
-#include "objects/worldentities/pawns/Pawn.h"
-#include "objects/worldentities/triggers/DistanceTrigger.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "core/Template.h"
-
-namespace orxonox
-{
-CreateFactory(PickupSpawner);
-
-PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator)
-{
- RegisterObject(PickupSpawner);
-
- this->template_ = 0;
- this->distance_ = 20;
- this->respawntimer_= 0;
-}
-
-PickupSpawner::~PickupSpawner()
-{
-}
-
-void PickupSpawner::XMLPort(Element& xmlelement, XMLPort::Mode mode)
-{
- SUPER(PickupSpawner, XMLPort, xmlelement, mode);
-
- XMLPortParam(PickupSpawner, "item", setItemTemplate, getItemTemplate, xmlelement, mode);
- XMLPortParam(PickupSpawner, "distance", setDistance, getDistance, xmlelement, mode).defaultValues(20.0f);
- XMLPortParam(PickupSpawner, "respawntimer", setRespawnTimer, getRespawnTimer, xmlelement, mode);
-
-}
-
-void PickupSpawner::tick(float dt)
-{
- if (this->isActive())
- {
- for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)
- {
- Vector3 distanceVec = it->getWorldPosition() - this->getWorldPosition();
- if (distanceVec.length() < this->distance_)
- this->triggering(*it);
- }
- }
-}
-
-void PickupSpawner::setItemTemplate(const std::string& itemtemplate)
-{
- this->itemtemplate_ = itemtemplate;
- this->template_ = Template::getTemplate(itemtemplate);
-}
-
-void PickupSpawner::triggering(Pawn* player)
-{
- if (this->isActive() && this->template_ && this->template_->getBaseclassIdentifier())
- {
- COUT(0) << "ITEM PICKED UP" << std::endl;
- //if(player->isA(itemtemplate_->getPlayerBaseClass()))
- {
- BaseObject* newobject = this->template_->getBaseclassIdentifier()->fabricate(this);
- BaseItem* newitem = dynamic_cast<BaseItem*>(newobject);
- if (newitem)
- {
- newitem->addTemplate(this->itemtemplate_);
- if (newitem->pickedUp(player)== true)
- {
- if(respawntimer_!=0)
- this->triggerRespawnTimer();
- this->setActive(false);
- this->fireEvent();
- }
- else
- delete newobject;
- }
- }
- //else
- // delete newobject;
- }
-}
-
-void PickupSpawner::triggerRespawnTimer()
-{
-
- if(respawntimer_!=0)
- {
- ExecutorMember<BaseObject>* executor = createExecutor(createFunctor(&BaseObject::setActive));
- executor->setDefaultValues(true);
- RespawnTimer_.setTimer(this->respawntimer_, false, (BaseObject*)this, executor);
- COUT(0) << "TIMER SET" << std::endl;
- }
-}
-void PickupSpawner::changedActivity()
-{
-/*
- COUT(0) << "Visble?" << std::endl;
- if(isActive())
- {
- setVisible(true);
- COUT(0) << "Visble!" << std::endl;
- }
- if(isActive()==false)
- {
- setVisible(false);
- COUT(0) << "INvisble!" << std::endl;
- }
-
-*/
- SUPER(PickupSpawner, changedActivity);
-
- for (std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); ++it)
- (*it)->setVisible(this->isActive());
-}
-
-
-}
-
-
-
Deleted: branches/pickups/src/orxonox/objects/pickup/PickupSpawner.h
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/PickupSpawner.h 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/PickupSpawner.h 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,67 +0,0 @@
-#ifndef _PickupSpawner_H__
-#define _PickupSpawner_H__
-
-#include "OrxonoxPrereqs.h"
-#include "BaseItem.h"
-#include "tools/Timer.h"
-#include "objects/worldentities/StaticEntity.h"
-#include "objects/Tickable.h"
-
-namespace orxonox
-{
- class _OrxonoxExport PickupSpawner : public StaticEntity, public Tickable
- {
- public:
- PickupSpawner(BaseObject* creator);
- virtual ~PickupSpawner();
- virtual void changedActivity();
- virtual void tick(float dt);
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void triggering(Pawn* trigger); // Wenn ein Spieler in die Naehe kommt
- void triggerRespawnTimer();
-
- /*inline void setVisibility(bool visible)
- { this->setActive(visible); }
- inline float getVisibility() const
- { return this->isActive(); }*/
-
- void setItemTemplate(const std::string& itemtemplate);
- inline const std::string& getItemTemplate() const
- { return this->itemtemplate_; }
-
- inline void setDistance(float distance)
- { this->distance_ = distance; }
- inline float getDistance() const
- { return this->distance_; }
- inline void setRespawnTimer (float respawntimer)
- { this->respawntimer_ = respawntimer; }
- inline float getRespawnTimer() const
- { return this->respawntimer_; }
-
- private:
- std::string itemtemplate_;
- Template* template_;
- float distance_;
- float respawntimer_;
- Timer<BaseObject> RespawnTimer_;
- };
-}
-
-#endif /* _PickupSpawner_H__ */
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Deleted: branches/pickups/src/orxonox/objects/pickup/ShipEquipment.cc
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/ShipEquipment.cc 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/ShipEquipment.cc 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,98 +0,0 @@
-#include "OrxonoxStableHeaders.h"
-#include "BaseItem.h"
-#include "ShipEquipment.h"
-#include "objects/worldentities/pawns/Pawn.h"
-
-
-namespace orxonox
-{
-/**
- at brief
- Insert a permanent Item to the Equipment. Is usually called by the addTo function in Items.
-
- at param item
- pointer to the item which is to be inserted.
-
- at return
- if new item has sucessfully been added it will return true, in any other case the return value is false.
-*/
- bool ShipEquipment::insert(BaseItem* item)
- {
- if(checkSlot(item)==NULL)
- {
- Equipment.insert ( std::pair<std::string, BaseItem*>(item->getName(),item) );
- return true;
- }
- else
- {
- COUT(3) << "SWAP?" << endl;
- //Abfrage- irgendne ifschleife...
- if((checkSlot(item)->dropped(player))==true)
- {
- Equipment.insert ( std::pair<std::string, BaseItem*>(item->getName(),item) );
- COUT(3) << "SWAPPED!" << endl;
- return true;
- }
- return false;
- }
-
- return false;
- };
-
-/**
- at brief
- Erases a permanent Item in the Equipment. Is usually called by the remove/dropped function in Items.
-
- at param item
- pointer to the item which is to be erased.
-
- at return
- if new item has sucessfully been erased it will return true, in any other case the return value is false.
-*/
- bool ShipEquipment::erase (BaseItem* item)
- {
- std::multimap<std::string,BaseItem*>::iterator it = Equipment.find(item->getName());
- if(it != Equipment.end())
- {
- Equipment.erase (it);
- return true;
- }
- return false;
- };
- /*void print(std::multimap<std::string, BaseItem*> eut)
- {
- std::multimap<std::string,BaseItem*>::iterator it;
- COUT(3) << "Liste:" << endl;
- for ( it=eut.begin() ; it != eut.end(); ++it )
- COUT(3) << (*it).first << endl;
-
- }*/
-/**
- at brief
- Erases all permanent Items in the Equipment. Its Triggered by hitting the L button.
-
-*/
- void ShipEquipment::eraseAll()
- {
- //print(Equipment);
- for (std::multimap<std::string,BaseItem*>::iterator it = Equipment.begin(); it != Equipment.end(); )
- {
-
- (it++)->second->dropped(this->getPlayer());
- }
- //print(Equipment);
- }
-
- BaseItem* ShipEquipment::checkSlot(BaseItem* item)
- {
- std::multimap<std::string,BaseItem*>::iterator it;
- for ( it= getPlayer()->getPickUp().getEquipment().begin() ; it != getPlayer()->getPickUp().getEquipment().end(); it++ )
- {
- //if((*it).second->getPlayerBaseClass()==item->getPlayerBaseClass())
- if(item->isExactlyA((*it).second->getIdentifier()))
- return (*it).second;
- }
- return NULL;
- };
-
-}
Deleted: branches/pickups/src/orxonox/objects/pickup/ShipEquipment.h
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/ShipEquipment.h 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/ShipEquipment.h 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,66 +0,0 @@
-#ifndef _ShipEquipment_H__
-#define _ShipEquipment_H__
-#include <string>
-#include <map>
-
-/*
-multimap<std::string, BaseItem*> equipment_;
-equipment_.insert(pair<std::string, BaseItem*>("Weapon", new BaseItem()));*/
-
-
-/* std::map<std::itemtype, BaseItem*> EQClasses;
- EQClasses["jacke"] = 0;
- BaseItem* item = itemMap_["jacke"];
-
- if (itemMap_["jacke"])
- if (itemMap_.find("jacke") != itemMap_.end()) */
-namespace orxonox
-{
- class BaseItem;
-/**
- at brief
- ShipEquipment is the inventory of a player. It's part of the Pawn class.
-
-*/
- class _OrxonoxExport ShipEquipment
- {
- public:
- inline int getSpace()
- {
- return Usable.size()+Trunk.size();
- };
- bool insert(BaseItem* item);
- bool erase (BaseItem* item);
- //void print(std::multimap<std::string, BaseItem*> eut);
- void eraseAll();
- //bool checkSlot(BaseItem* item);
- BaseItem* checkSlot(BaseItem* item);
-// const std::multimap<std::string, BaseItem*>& getEquipment() const { return this->Equipment; }
- inline std::multimap<std::string, BaseItem*>& getEquipment() {return this->Equipment;}
- inline std::multimap<std::string, BaseItem*>& getUsable() {return this->Usable;}
- inline std::multimap<std::string, BaseItem*>& getTrunk() {return this->Trunk;}
- inline Pawn* getPlayer() {return this->player ;}
- inline void setPlayer(Pawn* setplayer)
- {this->player = setplayer;}
- private:
- Pawn* player;//!< Is a pointer to the belonging player
- std::multimap<std::string, BaseItem*> Equipment;//!< the Equipment for permanent Items
- std::multimap<std::string, BaseItem*> Usable;//!< Where Usables are stored
- std::multimap<std::string, BaseItem*> Trunk;//!< Every other Item is stored here
- };
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#endif
Deleted: branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.cc
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.cc 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.cc 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,136 +0,0 @@
-namespace orxonox
-{
- const int maxweapons_ =2; //Weaponslots (provisorisch)
- const int maxslots_= 50; //Inventoryslots (provisorisch)
-
-
- bool ShipEquipment::CheckifSpace()
- {
- if((Usable.size()+Trunk.size())>=maxslots_)
- return false;
- return true;
- }
-
- /* Checks if the Ship can pick an Item up. Permanents will give a "false" back unless the Ship doesnt carry a Item for that Slot (2 Weaponslots) yet.Others will be picked up unless there is no Space in the Trunk.*/
-
- bool ShipEquipment::CheckifValid(Shipitem* toBeChecked)
- {
- switch(toBeChecked.CheckType())
- {
- case Powerups:
- activatePowerUp(); //gibts noch nicht
- return true;
- case Permanent:
- switch (toBeChecked.CheckSubType())
- {
- case Weapon:
- int weaponcheck=0;
- multimap<string, ShipItem*>::iterator it;
- for ( it=Equipment.begin() ; it != Equipment.end(); it++ ){
- if((*it).second->CheckSubType()==Weapon)
- weaponcheck++;
- };
- if (weaponcheck>=maxweapons_){
- weaponcheck=0;
- return false;
- }
- break;
- case Thrusters:
- multimap<string, ShipItem*>::iterator it;
- for ( it=Equipment.begin() ; it != Equipment.end(); it++ ){
- if((*it).second->CheckSubType()==Thrusters)
- return false;
- }
- break;
- case Shields:
- multimap<string, ShipItem*>::iterator it;
- for ( it=Equipment.begin() ; it != Equipment.end(); it++ ){
- if((*it).second->CheckSubType()==Shields)
- return false;
- }
- break;
- case Armor:
- multimap<string, ShipItem*>::iterator it;
- for ( it=Equipment.begin() ; it != Equipment.end(); it++ ){
- if((*it).second->CheckSubType()==Armor)
- return false;
- }
- break;
- }
- case Useable:
- return CheckifSpace();
- }
- return true;
- }
-
- /*Adds the Item to the Ship*/
- void ShipEquipment::AddItem(ShipItem* toAddItem)
- {
- if(CheckifValid(toAddItem)==true)
- {
- switch(toAddItem.CheckType())
- {
- case Permanent:
- Equipment.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,*toAddItem) );
- break;
- case Usable:
- Usable.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,*toAddItem) );
- break;
- case Trunk:
- Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,*toAddItem) );
- break;
- }
- }
- else if(toAddItem.CheckType()==Permanent)
- {
- if(CheckifSpace()==true)
- Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,*toAddItem) );
- }
- }
-
- /*Adds the Item to the Ship*/
- void ShipEquipment::AddItem(Shipitem* toAddItem)
- {
- if(CheckifValid(toAddItem)==true)
- {
- switch(toAddItem.CheckType()){
- case Permanent:
- Equipment.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
- break;
- case Usable:
- Usable.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
- break;
- case Trunk:
- Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
- break;
- }
- }
- else if(toAddItem.CheckType()==Permanent)
- {
- if(CheckifSpace()==true)
- Trunk.insert ( pair<std::string, ShipItem*>(toAddItem.itemname,toAddItem) );
- }
- }
-
- void ShipEquipment::SwitchItem(Permanent* toSwitchItem)
- {
- multimap<string, ShipItem*>::iterator it;
- string equippedname;
- equippedname=GetNameofPermanent(toSwitchItem.CheckSubType());
- it=Equipment.find(equippedname);
- Trunk.insert (find(equippedname));
- Equipment.erase (it);
- Equipment.insert(pair<std::string, ShipItem*>(toSwitchItem.itemname,toSwitchItem)
- }
-
- string ShipEquipment::GetNameofPermanent (subItemTypePermanent NametoGet)
- {
- multimap<string, ShipItem*>::iterator it;
- for ( it=Equipment.begin() ; it != Equipment.end(); it++ ){
- if((*it).second->CheckSubType()==NametoGet){
- return (*it).first.itemname;
- }
- }
- return 0;
- }
-}
Deleted: branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.h
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.h 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/ShipEquipmentClasses.h 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,52 +0,0 @@
-
-#ifndef _ShipEquipment_H__
-#define _ShipEquipment_H__
-#include <string>
-#include "SpaceShip.h"
-#include <map>
-
-
-/*
-multimap<std::string, BaseItem*> equipment_;
-equipment_.insert(pair<std::string, BaseItem*>("Weapon", new BaseItem()));*/
-
-
-/* std::map<std::itemtype, BaseItem*> EQClasses;
- EQClasses["jacke"] = 0;
- BaseItem* item = itemMap_["jacke"];
-
- if (itemMap_["jacke"])
- if (itemMap_.find("jacke") != itemMap_.end()) */
-namespace orxonox
-{
- class _OrxonoxExport ShipEquipment
- {
- public:
- /*void AddItem(Shipitem* toAddItem);
- void RemoveItem(Shipitem* toRemoveItem);
- bool CheckifValid(Shipitem* toBeChecked);
- bool CheckifSpace();
- void SwitchItem(Permanent* toSwitchItem);
- string GetNameofPermanent (subItemTypePermanent NametoGet);*/ //holt den Namen des getragenen Items im jeweiligen Slot.
-
- private:
- multimap<std::string, BaseItem*> Equipment;
- multimap<std::string, BaseItem*> Usable;
- multimap<std::string, BaseItem*> Trunk;
- };
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#endif
Deleted: branches/pickups/src/orxonox/objects/pickup/ShipItem.cc
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/ShipItem.cc 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/ShipItem.cc 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,24 +0,0 @@
-#include "Shipitem.h"
-
-namespace orxonox
-{
- itemtype ShipItem::CheckType()
- {
- return this->type;
- }
-
- subItemTypePermanent CheckSubType()
- {
- return this->subtype_permanent;
- }
-
- subItemTypePowerups CheckSubType()
- {
- return this->subtype_powerups;
- }
- subItemTypeUsable CheckSubType()
- {
- return this->subtype_usables;
- }
-
-}
Deleted: branches/pickups/src/orxonox/objects/pickup/ShipItem.h
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/ShipItem.h 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/ShipItem.h 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,91 +0,0 @@
-#ifndef _ShipItems_H__
-#define _ShipItems_H__
-#include <string>
-#include "SpaceShip.h"
-#include <map>
-#include "ShipEquipmentClasses.h"
-
-
-
-namespace orxonox
-{
- class _OrxonoxExport ShipItem
- {
- enum itemType //Diffrent Types of Items
- {
- Useable,
- Powerups,
- Permanent
- };
-
- public:
- itemType CheckType();
- //virtual ChecksubType();
-
- private:
- itemType type;
- string itemname;
- };
-
- /* Useables are Items the Player can choose when to activate and then show an instant action/effect
- * or for a certain duration */
- class _OrxonoxExport Useable : public ShipItem
- {
- enum subItemTypeUseable //Diffrent Types of Items of the Type Useable
- {
- Rockets,
- Repairkits,
- Triggers, //trigger events usable by the player (Quests f.exp.)
- Boosters,
- Shields,
- Appearance,
- };
-
- public:
- //subItemTypeUseable CheckSubType();
-
- private:
- subItemTypeUseable subtype_usable;
- };
-
- /* Permanents are Items, that effect the Player or his Ship from the instance he picks them up
- until he drops them again */
- class _OrxonoxExport Permanent : public ShipItem
- {
- enum subItemTypePermanent //Diffrent Types of Items of the Type Permanent
- {
- Weapon,
- Thrusters,
- Shields,
- Armor
- };
-
- public:
- subItemTypePermanent CheckSubType();
-
- private:
- subItemTypePermanent subtype_permanent;
- };
-
- // Powerups effect the Player right after he picks them up for a certain Duration /or permanently.
- class _OrxonoxExport Powerups : public ShipItem
- {
- enum subItem TypePowerups //Diffrent Types of Items of the Type Powerups
- {
- Weapon,
- Boosters,
- Shields,
- Repairkits,
- Appearance,
- Trigger
- };
-
- public:
- //subItemTypePowerups CheckSubType();
-
- private:
- subItemTypePowerups subtype_powerups;
- };
-}
-
-#endif
Deleted: branches/pickups/src/orxonox/objects/pickup/Turbo.cc
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/Turbo.cc 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/Turbo.cc 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,128 +0,0 @@
-#include "OrxonoxStableHeaders.h"
-#include "Turbo.h"
-
-#include "objects/worldentities/pawns/SpaceShip.h"
-#include "core/Executor.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
-
-
- CreateFactory(Turbo);
-
- Turbo::Turbo(BaseObject* creator) : BaseItem(creator)
- {
- RegisterObject(Turbo);
-
- this->boost_ = 0;
- this->duration_ = 0;
- this->accboost_ = 1;
- this->rotacc_= 0;
- }
-
- Turbo::~Turbo()
- {
- }
-
- void Turbo::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Turbo, XMLPort, xmlelement, mode);
-
- XMLPortParam(Turbo, "boost", setBoost, getBoost, xmlelement, mode);
- XMLPortParam(Turbo, "duration", setDuration, getDuration, xmlelement, mode);
- XMLPortParam(Turbo, "accboost", setAccBoost, getAccBoost, xmlelement, mode);
- XMLPortParam(Turbo, "rotacc", setRotAcc, getRotAcc, xmlelement, mode);
- }
-
- bool Turbo::pickedUp(Pawn* player)
- {
-
- if(player-> isA(this->getPlayerBaseClass()))
- {
- SpaceShip* ship = dynamic_cast <SpaceShip*>(player);
- if(duration_==0 )
- {
- if(addTo(player))
- {
- COUT(3)<<"ITEM EQUIPPED"<<std::endl;
- this->setSpeedBoost(ship);
- return true;
- }
- return false;
- }
- else
- {
- this->setSpeedBoost(ship);
- return true;
- }
- return false;
- }
- return false;
-
- }
-
-
- void Turbo::unsetSpeedBoost(SpaceShip* ship)
- {
-/*
- ship->setMaxSpeed( ship->getMaxSpeed() - this->boost_);
- ship->setTransAcc( ship->getTransAcc()/this->accboost_);
- ship->setMaxRotation( ship->getMaxRotation()-this->rotacc_);
- ship->setRotAcc( ship->getRotAcc()-this->rotacc_);
- COUT(3)<<"BOOST UNSET"<<std::endl;
- COUT(3)<<"Speed:"<< ship->getMaxSpeed()<<std::endl;
-*/
- ship->setPermanentBoost(false);
- }
-
- void Turbo::setSpeedBoost(SpaceShip* ship)
- {
-/*
- COUT(3)<<"Speed:"<< ship->getMaxSpeed()<<std::endl;
- ship->setMaxSpeed( ship->getMaxSpeed() + this->boost_);
- ship->setTransAcc( ship->getTransAcc()*this->accboost_);
- ship->setMaxRotation( ship->getMaxRotation()+this->rotacc_);
- ship->setRotAcc( ship->getRotAcc()+this->rotacc_);
-*/
- ship->setPermanentBoost(true);
- ship->setBoost(true);
-
- if( this->duration_ != 0)
- {
- ExecutorMember<Turbo>* executor = createExecutor(createFunctor(&Turbo::unsetSpeedBoost));
- executor->setDefaultValues(ship);
- turbotimer_.setTimer(this->duration_, false, this, executor);
- }
-// COUT(3)<<"Speed:"<< ship->getMaxSpeed()<<std::endl;
- }
- bool Turbo::dropped(Pawn* player)
- {
- if (this->duration_ == 0)
- {
- COUT(0) << "ITEM DROPPED" << std::endl;
- if(remove(player)==true)
- {
- SpaceShip* ship = dynamic_cast <SpaceShip*>(player);
- this->unsetSpeedBoost(ship);
- }
- }
- return true;
- }
-
-}
-/*<Template baseclass="Turbo" name=turboitem>
- <Turbo playerclass="SpaceShip" boost=150 duration=10 accboost=10 />
- </Template>
-
- <PickupSpawner item=turboitem>
- <attached>
- <Billboard material="Examples/Flare" scale=0.2 colour="0.0, 0.0, 1.0, 1.0" />
- </attached>
- </PickupSpawner>*/
-
-
-
-
-
Deleted: branches/pickups/src/orxonox/objects/pickup/Turbo.h
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/Turbo.h 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/Turbo.h 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,56 +0,0 @@
-#ifndef _Turbo_H__
-#define _Turbo_H__
-
-#include "tools/Timer.h"
-#include "BaseItem.h"
-#include "OrxonoxPrereqs.h"
-#include "util/Math.h"
-
-namespace orxonox
-{
- class _OrxonoxExport Turbo : public BaseItem
- {
-
- public:
- Turbo(BaseObject* creator);
- virtual ~Turbo();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual bool pickedUp(Pawn* player);
- virtual bool dropped(Pawn* player); //erst bei festen Items
-
- void setSpeedBoost(SpaceShip* ship);
- void unsetSpeedBoost(SpaceShip* ship);
-
- inline void setBoost(float boost)
- { this->boost_ = boost; }
- inline float getBoost() const
- { return this->boost_; }
-
- inline void setDuration(float duration)
- { this->duration_ = duration; }
- inline float getDuration() const
- { return this->duration_; }
-
- inline void setRotAcc(Degree rotacc)
- { this->rotacc_ = rotacc; }
- inline Degree getRotAcc() const
- { return this->rotacc_; }
-
-
- inline void setAccBoost(float accboost)
- { this->accboost_ = accboost; }
- inline float getAccBoost() const
- { return this->accboost_; }
-
- private:
- Timer<Turbo> turbotimer_;
- float boost_;
- float duration_;
- float accboost_;
- Degree rotacc_;
- };
-}
-
-#endif /* _Turbo_H__ */
Deleted: branches/pickups/src/orxonox/objects/pickup/Usable.h
===================================================================
--- branches/pickups/src/orxonox/objects/pickup/Usable.h 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/pickup/Usable.h 2009-03-23 13:39:47 UTC (rev 2831)
@@ -1,12 +0,0 @@
-/*enum subItemType{ Subtypes (thrusters etc)*/
-
-namespace orxonox
-{
- class _OrxonoxExport Usable: public ShipItem
- {
- public:
- subtypeusable CheckSubType();
- private:
- subtypeusable subtype;
- };
-}
Modified: branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.cc 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.cc 2009-03-23 13:39:47 UTC (rev 2831)
@@ -32,6 +32,7 @@
#include "core/Core.h"
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
+#include "util/Exception.h"
#include "util/Math.h"
#include "PawnManager.h"
#include "objects/infos/PlayerInfo.h"
@@ -60,8 +61,6 @@
this->spawnparticleduration_ = 3.0f;
- this->getPickUp().setPlayer(this);
-
if (Core::isMaster())
{
this->weaponSystem_ = new WeaponSystem(this);
@@ -266,7 +265,7 @@
void Pawn::dropItems()
{
- pickUp.eraseAll();
+ ThrowException(NotImplemented, "Pickupsystem not implemented yet.");
}
void Pawn::setWeaponSlot(WeaponSlot * wSlot)
Modified: branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.h
===================================================================
--- branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.h 2009-03-23 13:26:35 UTC (rev 2830)
+++ branches/pickups/src/orxonox/objects/worldentities/pawns/Pawn.h 2009-03-23 13:39:47 UTC (rev 2831)
@@ -30,7 +30,6 @@
#define _Pawn_H__
#include "OrxonoxPrereqs.h"
-#include "objects/pickup/ShipEquipment.h"
#include "objects/worldentities/ControllableEntity.h"
#include "objects/RadarViewable.h"
#include "objects/weaponSystem/WeaponSystem.h"
@@ -106,9 +105,6 @@
inline unsigned int getExplosionChunks() const
{ return this->numexplosionchunks_; }
- inline ShipEquipment& getPickUp()
- {return this->pickUp;}
-
virtual void dropItems();
protected:
@@ -116,7 +112,6 @@
virtual void deatheffect();
virtual void spawneffect();
- ShipEquipment pickUp;
bool bAlive_;
More information about the Orxonox-commit
mailing list