Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7412 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Apr 28, 2006, 12:03:54 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: Another CompletionMode is working

Location:
trunk/src/world_entities
Files:
2 edited

Legend:

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

    r7356 r7412  
    563563Playable::Playmode Playable::stringToPlaymode(const std::string& playmode)
    564564{
    565   if (playmode == "Vertical")
     565  if (playmode == Playable::playmodeNames[0])
    566566    return Playable::Vertical;
    567   if (playmode == "Horizontal")
     567  if (playmode == Playable::playmodeNames[1])
    568568    return Playable::Horizontal;
    569   if (playmode == "FromBehind")
     569  if (playmode == Playable::playmodeNames[2])
    570570    return Playable::FromBehind;
    571   if (playmode == "Full3D")
     571  if (playmode == Playable::playmodeNames[3])
    572572    return Playable::Full3D;
    573573
     
    581581 * @returns the String.
    582582 */
    583 const char* Playable::playmodeToString(Playable::Playmode playmode)
     583const std::string& Playable::playmodeToString(Playable::Playmode playmode)
    584584{
    585585  switch(playmode)
    586586  {
    587587    case Playable::Vertical:
    588       return "Vertical";
     588      return Playable::playmodeNames[0];
    589589    case Playable::Horizontal:
    590       return "Horizontal";
     590      return Playable::playmodeNames[1];
    591591    case Playable::FromBehind:
    592       return "FromBehind";
     592      return Playable::playmodeNames[2];
    593593    case Playable::Full3D:
    594       return "Full3D";
     594      return Playable::playmodeNames[3];
    595595
    596596    default:
    597       return "Full3D";
    598   }
    599 
    600 }
     597      return Playable::playmodeNames[3];
     598  }
     599}
     600
     601/**
     602 * @brief PlaymodeNames
     603 */
     604const std::string Playable::playmodeNames[] =
     605{
     606  "Vertical",
     607  "Horizontal",
     608  "FromBehind",
     609  "Full3D"
     610};
  • trunk/src/world_entities/playable.h

    r7351 r7412  
    3333    FromBehind       = 4,       //!< Seen from behind (move in z-y)
    3434    Full3D           = 8,       //!< Full featured 3D-mode. (move in all directions x-y-z)
     35
     36    PlaymodeCount    = 4,
    3537  } Playmode;
    3638
     
    8789  // Transformations:
    8890  static Playable::Playmode stringToPlaymode(const std::string& playmode);
    89   static const char* playmodeToString(Playable::Playmode playmode);
     91  static const std::string& playmodeToString(Playable::Playmode playmode);
     92  static const std::string playmodeNames[];
     93
    9094protected:
    9195  Playable();
Note: See TracChangeset for help on using the changeset viewer.