|
@@ -52,6 +52,14 @@ void Inventar::setSelected( int slot )
|
|
|
selected = INVENTORY_SLOTS - 1;
|
|
|
}
|
|
|
|
|
|
+bool Inventar::hatAbklingzeit( GegenstandTyp typ ) const
|
|
|
+{
|
|
|
+ for( int i = 0; i < INVENTORY_SLOTS; i++ )
|
|
|
+ if( slots[ i ] == typ && abklingzeit[ i ] > 0 )
|
|
|
+ return 1;
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
GegenstandTyp Inventar::useItem()
|
|
|
{
|
|
|
if( slots[ selected ] != KEIN_GEGENSTAND && abklingzeit[ selected ] <= 0 )
|
|
@@ -107,6 +115,31 @@ GegenstandTyp Inventar::selectedItem() const
|
|
|
return slots[ selected ];
|
|
|
}
|
|
|
|
|
|
+int Inventar::getItemAnzahl() const
|
|
|
+{
|
|
|
+ int sum = 0;
|
|
|
+ for( int i = 0; i < INVENTORY_SLOTS; i++ )
|
|
|
+ sum += anzahl[ i ];
|
|
|
+ return sum;
|
|
|
+}
|
|
|
+
|
|
|
+int Inventar::getItemAnzahl( GegenstandTyp typ ) const
|
|
|
+{
|
|
|
+ for( int i = 0; i < INVENTORY_SLOTS; i++ )
|
|
|
+ {
|
|
|
+ if( slots[ i ] == typ )
|
|
|
+ return anzahl[ i ];
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+GegenstandTyp Inventar::getItemTyp( int index ) const
|
|
|
+{
|
|
|
+ if( index < 0 || index >= INVENTORY_SLOTS )
|
|
|
+ return KEIN_GEGENSTAND;
|
|
|
+ return slots[ index ];
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
Spieler::Spieler( int id, Team *team, int spawnX, int spawnY, int farbe )
|
|
|
: GameObject( SPIELER, spawnX, spawnY, 40, 50 )
|
|
@@ -538,6 +571,11 @@ void Spieler::setLebensRegeneration( float reg )
|
|
|
lebensRegeneration = reg;
|
|
|
}
|
|
|
|
|
|
+void Spieler::setName( const char *name )
|
|
|
+{
|
|
|
+ this->name = name;
|
|
|
+}
|
|
|
+
|
|
|
float Spieler::getLebensRegenneration() const
|
|
|
{
|
|
|
return lebensRegeneration;
|
|
@@ -578,6 +616,11 @@ Team *Spieler::zTeam() const
|
|
|
return team;
|
|
|
}
|
|
|
|
|
|
+Team *Spieler::getTeam() const
|
|
|
+{
|
|
|
+ return team ? (Team *)team->getThis() : 0;
|
|
|
+}
|
|
|
+
|
|
|
int Spieler::getFarbe() const
|
|
|
{
|
|
|
return color;
|
|
@@ -648,7 +691,7 @@ bool Spieler::istGegenstandErlaubt( GegenstandTyp typ ) const
|
|
|
if( !erlaubt )
|
|
|
return 0;
|
|
|
}
|
|
|
- return 1;
|
|
|
+ return !inv.hatAbklingzeit( typ );
|
|
|
}
|
|
|
|
|
|
Richtung Spieler::getAusrichtung() const
|
|
@@ -665,3 +708,108 @@ int Spieler::getId() const
|
|
|
{
|
|
|
return spielerNummer;
|
|
|
}
|
|
|
+
|
|
|
+int Spieler::getLevel() const
|
|
|
+{
|
|
|
+ return level;
|
|
|
+}
|
|
|
+
|
|
|
+float Spieler::getLeben() const
|
|
|
+{
|
|
|
+ return leben;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getMaxLeben() const
|
|
|
+{
|
|
|
+ return maxLeben;
|
|
|
+}
|
|
|
+
|
|
|
+float Spieler::getErfahrung() const
|
|
|
+{
|
|
|
+ return erfahrung;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getMaxErfahrung() const
|
|
|
+{
|
|
|
+ return maxErfahrung;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getTode() const
|
|
|
+{
|
|
|
+ return tode;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getKills() const
|
|
|
+{
|
|
|
+ return kills;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getTreffer() const
|
|
|
+{
|
|
|
+ return treffer;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getGetroffen() const
|
|
|
+{
|
|
|
+ return getroffen;
|
|
|
+}
|
|
|
+
|
|
|
+float Spieler::getErlittenerSchaden() const
|
|
|
+{
|
|
|
+ return schadenGenommen;
|
|
|
+}
|
|
|
+
|
|
|
+float Spieler::getGemachterSchaden() const
|
|
|
+{
|
|
|
+ return schadenGemacht;
|
|
|
+}
|
|
|
+
|
|
|
+float Spieler::getGeheiltesLeben() const
|
|
|
+{
|
|
|
+ return lebenGeheilt;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getItemsAufgehoben() const
|
|
|
+{
|
|
|
+ return itemsAufgehoben;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getItemsVerwendet() const
|
|
|
+{
|
|
|
+ return itemsVerwendet;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getItemsInInventory() const
|
|
|
+{
|
|
|
+ return inv.getItemAnzahl();
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getItemsInInventory( GegenstandTyp typ ) const
|
|
|
+{
|
|
|
+ return inv.getItemAnzahl( typ );
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getTunnelBenutzt() const
|
|
|
+{
|
|
|
+ return tunnelBenutzt;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getSchalterAktiviert() const
|
|
|
+{
|
|
|
+ return schalterAktiviert;
|
|
|
+}
|
|
|
+
|
|
|
+int Spieler::getGeschossen() const
|
|
|
+{
|
|
|
+ return geschosseGeschossen;
|
|
|
+}
|
|
|
+
|
|
|
+GegenstandTyp Spieler::getInventorySlot( int index ) const
|
|
|
+{
|
|
|
+ return inv.getItemTyp( index );
|
|
|
+}
|
|
|
+
|
|
|
+const char *Spieler::getName() const
|
|
|
+{
|
|
|
+ return name;
|
|
|
+}
|