Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7351 in orxonox.OLD


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

orxonox/trunk: the cheat is now a Static function

Location:
trunk/src/world_entities
Files:
2 edited

Legend:

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

    r7350 r7351  
    3737
    3838#include "shell_command.h"
    39 SHELL_COMMAND(orxoWeapon, Playable, addSomeWeapons_CHEAT);
     39SHELL_COMMAND_STATIC(orxoWeapon, Playable, Playable::addSomeWeapons_CHEAT);
    4040
    4141
     
    133133    if (weapon != NULL)
    134134      PRINTF(2)("Unable to add Weapon (%s::%s) to %s::%s\n",
    135              weapon->getClassName(), weapon->getName(), this->getClassName(), this->getName());
     135                weapon->getClassName(), weapon->getName(), this->getClassName(), this->getName());
    136136    else
    137137      PRINTF(2)("No weapon defined\n");
     
    187187void Playable::addSomeWeapons_CHEAT()
    188188{
    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");
     189  if (State::getPlayer() != NULL)
     190  {
     191    Playable* playable = State::getPlayer()->getPlayable();
     192    if (playable != NULL)
     193    {
     194      PRINTF(2)("ADDING WEAPONS - you cheater\n");
     195      playable->addWeapon(Weapon::createWeapon(CL_HYPERBLASTER));
     196      playable->addWeapon(Weapon::createWeapon(CL_TURRET));
     197      playable->addWeapon(Weapon::createWeapon(CL_AIMING_TURRET));
     198      playable->addWeapon(Weapon::createWeapon(CL_CANNON));
     199      playable->addWeapon(Weapon::createWeapon(CL_TARGETING_TURRET));
     200      PRINTF(2)("ADDING WEAPONS FINISHED\n");
     201    }
     202  }
    196203}
    197204
  • trunk/src/world_entities/playable.h

    r7350 r7351  
    4949  inline WeaponManager& getWeaponManager() { return this->weaponMan; };
    5050  void weaponConfigChanged();
    51   void addSomeWeapons_CHEAT();
     51  static void addSomeWeapons_CHEAT();
    5252
    5353
Note: See TracChangeset for help on using the changeset viewer.