Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7350 in orxonox.OLD for trunk/src/world_entities/playable.cc


Ignore:
Timestamp:
Apr 19, 2006, 3:42:23 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: our first cheat :)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/playable.cc

    r7347 r7350  
    1616
    1717#include "playable.h"
    18 
    19 #include "weapons/weapon_manager.h"
    2018#include "event_handler.h"
     19
    2120#include "player.h"
    2221#include "state.h"
     
    2524#include "util/loading/load_param.h"
    2625
    27 #include "world_entities/projectiles/projectile.h"
    28 
    2926#include "power_ups/weapon_power_up.h"
    3027#include "power_ups/param_power_up.h"
     
    3835
    3936#include "effects/explosion.h"
     37
     38#include "shell_command.h"
     39SHELL_COMMAND(orxoWeapon, Playable, addSomeWeapons_CHEAT);
    4040
    4141
     
    122122 * @param slotID the slotID to add the Weapon to.
    123123 */
    124 void Playable::addWeapon(Weapon* weapon, int configID, int slotID)
    125 {
    126   this->weaponMan.addWeapon(weapon, configID, slotID);
    127 
    128   this->weaponConfigChanged();
     124bool Playable::addWeapon(Weapon* weapon, int configID, int slotID)
     125{
     126  if(this->weaponMan.addWeapon(weapon, configID, slotID))
     127  {
     128    this->weaponConfigChanged();
     129    return true;
     130  }
     131  else
     132  {
     133    if (weapon != NULL)
     134      PRINTF(2)("Unable to add Weapon (%s::%s) to %s::%s\n",
     135             weapon->getClassName(), weapon->getName(), this->getClassName(), this->getName());
     136    else
     137      PRINTF(2)("No weapon defined\n");
     138    return false;
     139
     140  }
    129141}
    130142
     
    170182}
    171183
     184/**
     185 * @brief a Cheat that gives us some Weapons
     186 */
     187void Playable::addSomeWeapons_CHEAT()
     188{
     189  PRINTF(2)("ADDING WEAPONS - you cheater\n");
     190  this->addWeapon(Weapon::createWeapon(CL_HYPERBLASTER));
     191  this->addWeapon(Weapon::createWeapon(CL_TURRET));
     192  this->addWeapon(Weapon::createWeapon(CL_AIMING_TURRET));
     193  this->addWeapon(Weapon::createWeapon(CL_CANNON));
     194  this->addWeapon(Weapon::createWeapon(CL_TARGETING_TURRET));
     195  PRINTF(2)("ADDING WEAPONS FINISHED\n");
     196}
    172197
    173198/**
Note: See TracChangeset for help on using the changeset viewer.