Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 12, 2006, 8:54:30 AM (19 years ago)
Author:
bensch
Message:

orxonox/std:: compile and run again, with many more std::strings….

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/std/src/world_entities/weapons/weapon.cc

    r7207 r7216  
    165165 * @param projectile the Name of the Projectile.
    166166 */
    167 void Weapon::setProjectileTypeC(const char* projectile)
    168 {
    169   if (projectile == NULL)
    170     return;
     167void Weapon::setProjectileTypeC(const std::string& projectile)
     168{
    171169  FastFactory* tmpFac = FastFactory::searchFastFactory(projectile);
    172170  if (tmpFac != NULL)
     
    176174  else
    177175  {
    178     PRINTF(1)("Projectile %s does not exist for weapon %s\n", projectile, this->getName());
     176    PRINTF(1)("Projectile %s does not exist for weapon %s\n", projectile.c_str(), this->getName());
    179177  }
    180178}
     
    613611 * @return The Action if known, WA_NONE otherwise.
    614612 */
    615 WeaponAction Weapon::charToAction(const char* action)
    616 {
    617   if (!strcmp(action, "none"))
     613WeaponAction Weapon::charToAction(const std::string& action)
     614{
     615  if (action == "none")
    618616    return WA_NONE;
    619   else if (!strcmp(action, "shoot"))
     617  else if (action == "shoot")
    620618    return WA_SHOOT;
    621   else if (!strcmp(action, "charge"))
     619  else if (action == "charge")
    622620    return WA_CHARGE;
    623   else if (!strcmp(action, "reload"))
     621  else if (action == "reload")
    624622    return WA_RELOAD;
    625   else if (!strcmp(action, "acitvate"))
     623  else if (action == "acitvate")
    626624    return WA_ACTIVATE;
    627   else if (!strcmp(action, "deactivate"))
     625  else if (action == "deactivate")
    628626    return WA_DEACTIVATE;
    629   else if (!strcmp(action, "special1"))
     627  else if (action == "special1")
    630628    return WA_SPECIAL1;
    631629  else
    632630  {
    633     PRINTF(2)("action %s could not be identified.\n", action);
     631    PRINTF(2)("action %s could not be identified.\n", action.c_str());
    634632    return WA_NONE;
    635633  }
     
    674672 * @return The State if known, WS_NONE otherwise.
    675673 */
    676 WeaponState Weapon::charToState(const char* state)
    677 {
    678   if (!strcmp(state, "none"))
     674WeaponState Weapon::charToState(const std::string& state)
     675{
     676  if (state == "none")
    679677    return WS_NONE;
    680   else if (!strcmp(state, "shooting"))
     678  else if (state == "shooting")
    681679    return WS_SHOOTING;
    682   else if (!strcmp(state, "charging"))
     680  else if (state == "charging")
    683681    return WS_CHARGING;
    684   else if (!strcmp(state, "reloading"))
     682  else if (state == "reloading")
    685683    return WS_RELOADING;
    686   else if (!strcmp(state, "activating"))
     684  else if (state == "activating")
    687685    return WS_ACTIVATING;
    688   else if (!strcmp(state, "deactivating"))
     686  else if (state == "deactivating")
    689687    return WS_DEACTIVATING;
    690   else if (!strcmp(state, "inactive"))
     688  else if (state == "inactive")
    691689    return WS_INACTIVE;
    692   else if (!strcmp(state, "idle"))
     690  else if (state == "idle")
    693691    return WS_IDLE;
    694692  else
    695693  {
    696     PRINTF(2)("state %s could not be identified.\n", state);
     694    PRINTF(2)("state %s could not be identified.\n", state.c_str());
    697695    return WS_NONE;
    698696  }
Note: See TracChangeset for help on using the changeset viewer.