Changeset 7216 in orxonox.OLD for branches/std/src/world_entities/weapons/weapon.cc
- Timestamp:
- Mar 12, 2006, 8:54:30 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/std/src/world_entities/weapons/weapon.cc
r7207 r7216 165 165 * @param projectile the Name of the Projectile. 166 166 */ 167 void Weapon::setProjectileTypeC(const char* projectile) 168 { 169 if (projectile == NULL) 170 return; 167 void Weapon::setProjectileTypeC(const std::string& projectile) 168 { 171 169 FastFactory* tmpFac = FastFactory::searchFastFactory(projectile); 172 170 if (tmpFac != NULL) … … 176 174 else 177 175 { 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()); 179 177 } 180 178 } … … 613 611 * @return The Action if known, WA_NONE otherwise. 614 612 */ 615 WeaponAction Weapon::charToAction(const char*action)616 { 617 if ( !strcmp(action, "none"))613 WeaponAction Weapon::charToAction(const std::string& action) 614 { 615 if (action == "none") 618 616 return WA_NONE; 619 else if ( !strcmp(action, "shoot"))617 else if (action == "shoot") 620 618 return WA_SHOOT; 621 else if ( !strcmp(action, "charge"))619 else if (action == "charge") 622 620 return WA_CHARGE; 623 else if ( !strcmp(action, "reload"))621 else if (action == "reload") 624 622 return WA_RELOAD; 625 else if ( !strcmp(action, "acitvate"))623 else if (action == "acitvate") 626 624 return WA_ACTIVATE; 627 else if ( !strcmp(action, "deactivate"))625 else if (action == "deactivate") 628 626 return WA_DEACTIVATE; 629 else if ( !strcmp(action, "special1"))627 else if (action == "special1") 630 628 return WA_SPECIAL1; 631 629 else 632 630 { 633 PRINTF(2)("action %s could not be identified.\n", action );631 PRINTF(2)("action %s could not be identified.\n", action.c_str()); 634 632 return WA_NONE; 635 633 } … … 674 672 * @return The State if known, WS_NONE otherwise. 675 673 */ 676 WeaponState Weapon::charToState(const char*state)677 { 678 if ( !strcmp(state, "none"))674 WeaponState Weapon::charToState(const std::string& state) 675 { 676 if (state == "none") 679 677 return WS_NONE; 680 else if ( !strcmp(state, "shooting"))678 else if (state == "shooting") 681 679 return WS_SHOOTING; 682 else if ( !strcmp(state, "charging"))680 else if (state == "charging") 683 681 return WS_CHARGING; 684 else if ( !strcmp(state, "reloading"))682 else if (state == "reloading") 685 683 return WS_RELOADING; 686 else if ( !strcmp(state, "activating"))684 else if (state == "activating") 687 685 return WS_ACTIVATING; 688 else if ( !strcmp(state, "deactivating"))686 else if (state == "deactivating") 689 687 return WS_DEACTIVATING; 690 else if ( !strcmp(state, "inactive"))688 else if (state == "inactive") 691 689 return WS_INACTIVE; 692 else if ( !strcmp(state, "idle"))690 else if (state == "idle") 693 691 return WS_IDLE; 694 692 else 695 693 { 696 PRINTF(2)("state %s could not be identified.\n", state );694 PRINTF(2)("state %s could not be identified.\n", state.c_str()); 697 695 return WS_NONE; 698 696 }
Note: See TracChangeset
for help on using the changeset viewer.