From 9d592fdc636acb6eb4f4fd9d5f9d8833cb583732 Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Wed, 5 Sep 2012 00:02:05 +0200 Subject: [PATCH] Changed: #1469 TPositionOrEntity from string conversion changed to support previous pos and return pos --HG-- branch : gsoc2012-fabien --- .../position_or_entity_type_helper.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/position_or_entity_type_helper.cpp b/code/ryzom/server/src/entities_game_service/camera_animation_manager/position_or_entity_type_helper.cpp index cffbfb806..2fe68b899 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/position_or_entity_type_helper.cpp +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/position_or_entity_type_helper.cpp @@ -25,19 +25,32 @@ #include "mission_manager/mission_parser.h" #include "egs_mirror.h" +#define POS_OR_ENTITY_PREVIOUS_POS_VALUE "_PreviousPos_" +#define POS_OR_ENTITY_RETURN_POS_VALUE "_ReturnPos_" + const TPositionOrEntity CPositionOrEntityHelper::Invalid = TPositionOrEntity(); TPositionOrEntity CPositionOrEntityHelper::fromString(const std::string& s) { + // If the string is empty it's a previous pos if (s.empty()) { - nlerror("TPositionOrentityHelper : empty position or entity given to parse"); - return TPositionOrEntity(); + return TPositionOrEntity(TPositionOrEntity::EPreviousPos); } std::string str = s; CMissionParser::removeBlanks(str); + // We already check if it's a special position or entity object + if (NLMISC::toLower(str) == POS_OR_ENTITY_PREVIOUS_POS_VALUE) + { + return TPositionOrEntity(TPositionOrEntity::EPreviousPos); + } + else if (NLMISC::toLower(str) == POS_OR_ENTITY_RETURN_POS_VALUE) + { + return TPositionOrEntity(TPositionOrEntity::EReturnPos); + } + std::vector resS; NLMISC::splitString(str, ";", resS); // If we don't have 3 components, it's an entity