Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 17, 2005, 12:52:07 AM (20 years ago)
Author:
bensch
Message:

orxonox/branches/weaponSystem: some more definitions

File:
1 edited

Legend:

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

    r4878 r4879  
    143143{}
    144144
    145 
    146 /**
    147  *  is called, when there is no fire button pressed
    148 */
    149 void Weapon::weaponIdle()
    150 {}
    151 
    152 
    153145/**
    154146 *  this will draw the weapon
     
    157149{}
    158150
     151
     152
     153
     154
     155/**
     156 * Converts a String into an Action.
     157 * @param action the String input holding the Action.
     158 * @return The Action if known, WA_NONE otherwise.
     159 */
     160WeaponAction Weapon::charToAction(const char* action)
     161{
     162  if (!strcmp(action, "none"))
     163    return WA_NONE;
     164  else if (!strcmp(action, "shoot"))
     165    return WA_SHOOT;
     166  else if (!strcmp(action, "charge"))
     167    return WA_CHARGE;
     168  else if (!strcmp(action, "reload"))
     169    return WA_RELOAD;
     170  else if (!strcmp(action, "acitvate"))
     171    return WA_ACTIVATE;
     172  else if (!strcmp(action, "deactivate"))
     173    return WA_DEACTIVATE;
     174  else if (!strcmp(action, "special1"))
     175    return WA_SPECIAL1;
     176  else
     177  {
     178    PRINTF(2)("action %s could not be identified.\n", action);
     179    return WA_NONE;
     180  }
     181}
     182
     183/**
     184 * Converts a String into a State.
     185 * @param state the String input holding the State.
     186 * @return The State if known, WS_NONE otherwise.
     187 */
     188WeaponState Weapon::charToState(const char* state)
     189{
     190  if (!strcmp(state, "none"))
     191    return WS_NONE;
     192  else if (!strcmp(state, "shooting"))
     193    return WS_SHOOTING;
     194  else if (!strcmp(state, "reloading"))
     195    return WS_RELOADING;
     196  else if (!strcmp(state, "activating"))
     197    return WS_ACTIVATING;
     198  else if (!strcmp(state, "deactivating"))
     199    return WS_DEACTIVATING;
     200  else if (!strcmp(state, "inactive"))
     201    return WS_INACTIVE;
     202  else if (!strcmp(state, "idle"))
     203    return WS_IDLE;
     204  else
     205  {
     206    PRINTF(2)("state %s could not be identified.\n", state);
     207    return WS_NONE;
     208  }
     209}
     210
Note: See TracChangeset for help on using the changeset viewer.