[Orxonox-commit 248] r2904 - in trunk/src/orxonox/objects: gametypes worldentities/pawns
scheusso at orxonox.net
scheusso at orxonox.net
Mon Apr 6 16:50:31 CEST 2009
Author: scheusso
Date: 2009-04-06 16:50:31 +0200 (Mon, 06 Apr 2009)
New Revision: 2904
Removed:
trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc
trunk/src/orxonox/objects/gametypes/TeamBaseMatch.h
trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h
Modified:
trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
trunk/src/orxonox/objects/gametypes/TeamDeathmatch.h
trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
Log:
reverted changes from 2902
Deleted: trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc
===================================================================
--- trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc 2009-04-06 14:48:32 UTC (rev 2903)
+++ trunk/src/orxonox/objects/gametypes/TeamBaseMatch.cc 2009-04-06 14:50:31 UTC (rev 2904)
@@ -1,185 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- */
-
-
-
-#include TeamBaseMatch.h
-
-
-//implement this! not done yet!
-#include "objects/worldentities/pawns/TeamBaseMatchBase.h"
-
-
-namespace orxonox
-{
- CreateUnloadableFactory(TeamBaseMatch);
-
-
- // Timer and Creator
- TeamBaseMatch::TeamBaseMatch(BaseObject* creator) : TeamDeathMatch(creator)
- {
- RegisterObject(TeamBaseMatch);
-
- this->scoreTimer_.setTimer(10, true, this, createExecutor(createFunctor(&TeamBaseMatch::winPoints)));
- this->outputTimer_.setTimer(30, true, this, createExecutor(createFunctor(&TeamBaseMatch::showPoints)));
-
- this->pointsTeam1_ = 0;
- this->pointsTeam2_ = 0;
- }
-
-
- // set the Bases positions using XML
- void TeamBaseMatch::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
-// XMLPortObject(TeamBaseMatch, WorldEntity, setNeutralshape, getNeturalshape, xmlelement, mode);
-// XMLPortObject(TeamBaseMatch, WorldEntity, setTeam1shape, getTeam1shape, xmlelement, mode);
-// XMLPortObject(TeamBaseMatch, WorldEntity, setTeam2shape, getTeam2shape, xmlelement, mode);
-
- XMLPortObject(TeamBaseMatch, TeamBaseMatchBase, addBase, getBase, xmlelement, mode);
- }
-
- // pretty useless at the moment...should be implemented in the TeamBaseMatchBase class headerfile
- // State of the Base (controlled, uncontrolled)
- int TeamBaseMatch::baseState(Base)
- {
- if(Enum state_==uncontrolled) return 0;
- if(Enum state_==controlTeam1) return 1;
- if(Enum state_==controlTeam2) return 2;
- }
-
- bool TeamBaseMatch::allowPawnDeath(Pawn* victim, Pawn* originator)
- {
- set::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.find(victim);
- if (it != this->bases_.end() && victim)
- {
- TeamBaseMatchBase* base = dynamic_cast<TeamBaseMatchBase*>(victim);
- if (base)
- {
- int teamnr = this->getTeam(originator->getPlayer());
- if (teamnr == 0)
- base->setState(BaseState::controlTeam1);
- if (teamnr == 1)
- base->setState(BaseState::controlTeam2);
- }
-
- victim->setHealth(victim->getInitialHealth());
- return false;
- }
-
- return TeamDeathmatch::allowPawnDeath(victim, originator);
- }
-
- // collect Points for killing oppenents
- void TeamBaseMatch::playerScored(PlayerInfo* player)
- {
- int teamnr = this->getTeam(player);
- this->addTeamPoints(teamnr, 5);
- }
-
- // show points or each interval of time
- void TeamBaseMatch::showPoints()
- {
-
- COUT(0) << "Points standing:" << std::endl << "Team 1: "<< pointsTeam1_ << std::endl << "Team 2: " << pointsTeam2_ << std::endl;
- if(pointsTeam1_ >=1700) COUT(0) << "Team 1 is near victory!" << std::endl;
- if(pointsTeam2_ >=1700) COUT(0) << "Team 2 is near victory!" << std::endl;
- }
-
-
- // collect Points while controlling Bases
- void TeamBaseMatch::winPoints()
- {
- int amountControlled = 0;
- int amountControlled2 = 0;
-
- for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
- {
- if((*it)->getState() == BaseState::controlTeam1)
- {
- amountControlled++;
- }
- if((*it)->getState() == BaseState::controlTeam2)
- {
- amountControlled2++;
- }
- }
-
- this->addTeamPoints(0, (amountControlled * 30));
- this->addTeamPoints(1, (amountControlled2 * 30));
- }
-
-
- // end game if one team reaches 2000 points
- void TeamBaseMatch::endGame()
- {
- if(this->pointsTeam1_>=2000 || this->pointsTeam2_ >=2000)
- {
- this->end();
- }
- }
-
- void addTeamPoints(int team, int points)
- {
- if(player && teamnr == 0)
- {
- this->pointsTeam1_ += points;
- }
- if(player && teamnr == 1)
- {
- this->pointsTeam2_ += points;
- }
-
- this->endGame();
- }
-
- void TeamBaseMatch::addBase(TeamBaseMatchBase* base)
- {
- this->bases_.insert(base);
- base->setState(BaseState::uncontrolled);
- }
-
- TeamBaseMatchBase* TeamBaseMatch::getBase(unsigned int index) const
- {
- unsigned int i = 0;
- for (std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)
- {
- i++;
- if (i > index)
- return (*it);
- }
- return 0;
- }
-
-
- // declare the functions 'getshape' and 'setshape' from the XML function here
-
-
-
-
-
-}
-
-
-
-
Deleted: trunk/src/orxonox/objects/gametypes/TeamBaseMatch.h
===================================================================
--- trunk/src/orxonox/objects/gametypes/TeamBaseMatch.h 2009-04-06 14:48:32 UTC (rev 2903)
+++ trunk/src/orxonox/objects/gametypes/TeamBaseMatch.h 2009-04-06 14:50:31 UTC (rev 2904)
@@ -1,89 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _TeamBaseMatch_H__
-#define _TeamBaseMatch_H__
-
-#include "OrxonoxPrereqs.h"
-
-#include <vector>
-#include <set>
-
-#include "TeamDeathmatch.h"
-#include "util/Timer.h"
-
-
-
-namespace orxonox
-{
-
-
-
- class _OrxonoxExport TeamBaseMatch : public TeamDeathmatch
- {
- public:
- TeamBasematch(BaseObject* creator);
-
- // if class closes, close everything
- virtual ~TeamBaseMatch() {}
-
-
- // set Base positions with XML
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);
-
- // give information about the state of a base
- virtual int baseState(Base);
-
- virtual void playerScored(PlayerInfo* player);
- virtual void showPoints();
- virtual void endGame();
-
- void addBase(TeamBaseMatchBase* base);
- TeamBaseMatchBase* getBase(unsigned int index) const;
-
- void addTeamPoints(int team, int points);
-
-
-
-
- protected:
- void winPoints();
-
- std::set<TeamBaseMatchBase*> bases_;
- Timer<TeamBaseMatch> scoreTimer_;
- Timer<TeamBaseMatch> outputTimer_;
-
- //points for each team
- int pointsTeam1_;
- int pointsTeam2_;
- };
-}
-
-#endif /* _TeamBaseMatch_H__ */
Modified: trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc
===================================================================
--- trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc 2009-04-06 14:48:32 UTC (rev 2903)
+++ trunk/src/orxonox/objects/gametypes/TeamDeathmatch.cc 2009-04-06 14:50:31 UTC (rev 2904)
@@ -188,13 +188,4 @@
}
return false;
}
-
- int TeamDeathmatch::getTeam(PlayerInfo* player)
- {
- std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);
- if (it_player != this->teamnumbers_.end())
- return it_player->second;
- else
- return -1;
- }
}
Modified: trunk/src/orxonox/objects/gametypes/TeamDeathmatch.h
===================================================================
--- trunk/src/orxonox/objects/gametypes/TeamDeathmatch.h 2009-04-06 14:48:32 UTC (rev 2903)
+++ trunk/src/orxonox/objects/gametypes/TeamDeathmatch.h 2009-04-06 14:50:31 UTC (rev 2904)
@@ -57,7 +57,6 @@
protected:
virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
bool pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2);
- int getTeam(PlayerInfo* player);
std::map<PlayerInfo*, int> teamnumbers_;
std::vector<ColourValue> teamcolours_;
Modified: trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc 2009-04-06 14:48:32 UTC (rev 2903)
+++ trunk/src/orxonox/objects/worldentities/pawns/Pawn.cc 2009-04-06 14:50:31 UTC (rev 2904)
@@ -197,7 +197,6 @@
void Pawn::death()
{
- this->setHealth(1);
if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_))
{
// Set bAlive_ to false and wait for PawnManager to do the destruction
@@ -214,6 +213,8 @@
if (GameMode::isMaster())
this->deatheffect();
}
+ else
+ this->setHealth(1);
}
void Pawn::deatheffect()
Deleted: trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h
===================================================================
--- trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h 2009-04-06 14:48:32 UTC (rev 2903)
+++ trunk/src/orxonox/objects/worldentities/pawns/TeamBaseMatchBase.h 2009-04-06 14:50:31 UTC (rev 2904)
@@ -1,95 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-
-
-// setState und getState functions declare here
-// TeamBaseMatchBase class
-
-
-// save as TeamBaseMatchBase.h in objects/worldentities/pawns/TeamBaseMatchBase.h
-
-
-#ifndef _TeamBaseMatchBase_H__
-#define _TeamBaseMatchBase_H__
-
-#include "pawn.h"
-
-namespace orxonox
-{
-
-
- namespace BaseState
- {
- enum Enum
- {
- uncontrolled,
- controlTeam1,
- controlTeam2,
- };
- }
-
- struct Base
- {
- BaseState::Enum state_;
- };
-
-
-
-
-
-
- class _OrxonoxExport TeamBaseMatchBase : public RadarViewable
- {
- public:
- TeamBaseMatchBase(BaseObject* creator);
-
- // if class closes, close everything
- virtual ~TeamBaseMatchBase();
-
- virtual void setState(base)
- {
-
-
- }
- virtual enum getState(base);
-
-
-
-
-
- protected:
-
-
-
-
-
-
-}
-
-#endif /* _TeamBaseMatchBase_H__ */
More information about the Orxonox-commit
mailing list