diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index 8d1257fd1..6cdba9602 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -876,12 +876,8 @@ class CAHGuildSheetOpen : public IActionHandler rt.updateRyzomClock(rGuildMembers[i].EnterDate); ucstring str = toString("%03d", (sint)RT.getRyzomWeek()) + " "; str += CI18N::get("ui"+WEEKDAY::toString( (WEEKDAY::EWeekDay)RT.getRyzomDayOfWeek() )) + " - "; - ucstring year = CI18N::get("uiYear"); - if (year.length() == 0) { - str += toString("%04d", RT.getRyzomYear()) + " - "; - } else { - str += year + " - "; - } + ucstring year = RT.getRyzomYearStr(); + str += year + " - " str += CI18N::get("uiEon"); pViewEnterDate->setText(str); } diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 9b21fb14c..8fbbf34cd 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -1487,12 +1487,8 @@ void CInterfaceManager::updateFrameEvents() str += toString("%02d", (sint)RT.getRyzomTime()) + CI18N::get("uiMissionTimerHour") + " - "; str += toString("%d", (sint)RT.getRyzomWeek()) + " "; str += CI18N::get("ui"+WEEKDAY::toString( (WEEKDAY::EWeekDay)RT.getRyzomDayOfWeek() )) + " - "; - ucstring year = CI18N::get("uiYear"); - if (year.length() == 0) { - str += toString("%04d", RT.getRyzomYear()) + " - "; - } else { - str += year + " - "; - } + ucstring year = RT.getRyzomYearStr(); + str += year + " - "; str += CI18N::get("uiEon"); pVT = dynamic_cast(CWidgetManager::getInstance()->getElementFromId("ui:interface:map:content:map_content:time")); diff --git a/code/ryzom/common/src/game_share/time_weather_season/time_and_season.h b/code/ryzom/common/src/game_share/time_weather_season/time_and_season.h index 7534fd4a1..cb8c4caef 100644 --- a/code/ryzom/common/src/game_share/time_weather_season/time_and_season.h +++ b/code/ryzom/common/src/game_share/time_weather_season/time_and_season.h @@ -20,6 +20,7 @@ #define RY_TIME_AND_SEASON_H #include "nel/misc/types_nl.h" +#include "nel/misc/i18n.h" const uint RYZOM_HOURS_IN_TICKS = 9000; const uint RYZOM_DAY_IN_HOUR = 24; @@ -130,20 +131,20 @@ public: CRyzomTime() { _RyzomDay = 0; - _RyzomTime = 0; + _RyzomTime = 0.f; + _LocalTime = 0.0; _TickOffset = 0; } // Update ryzom clock when tick occurs, local time must be given if localUpdateRyzomClock() and getLocalRyzomTime() is used void updateRyzomClock( uint32 gameCyle, double localTime = 0 ) { - float time = ( gameCyle + _TickOffset ) / float(RYZOM_HOURS_IN_TICKS); - _RyzomDay = (uint32) ( time / RYZOM_DAY_IN_HOUR ) - RYZOM_START_SPRING; - _RyzomTime = (float) fmod( time, RYZOM_DAY_IN_HOUR ); + float hours = ( gameCyle + _TickOffset ) / float(RYZOM_HOURS_IN_TICKS); + _RyzomDay = ( (uint)hours / RYZOM_DAY_IN_HOUR ) - RYZOM_START_SPRING; + _RyzomTime = (float) fmod( hours, (float)RYZOM_DAY_IN_HOUR ); _LocalTime = localTime; } - // get ryzom time (synchronized with server) inline float getRyzomTime() const { return _RyzomTime; } @@ -153,6 +154,9 @@ public: // get ryzom Year inline uint32 getRyzomYear() const { return _RyzomDay / RYZOM_YEAR_IN_DAY + RYZOM_START_YEAR; } + // get ryzom Year as string + inline ucstring getRyzomYearStr() const { return NLMISC::CI18N::get("uiYear").length()==0?NLMISC::toString(_RyzomDay / RYZOM_YEAR_IN_DAY + RYZOM_START_YEAR):NLMISC::CI18N::get("uiYear"); } + // get ryzom week inline uint32 getRyzomWeek() const { return (_RyzomDay % RYZOM_YEAR_IN_DAY) / RYZOM_WEEK_IN_DAY; } diff --git a/code/ryzom/server/src/ai_service/commands.cpp b/code/ryzom/server/src/ai_service/commands.cpp index c190b4351..966462331 100644 --- a/code/ryzom/server/src/ai_service/commands.cpp +++ b/code/ryzom/server/src/ai_service/commands.cpp @@ -39,7 +39,7 @@ #include "fx_entity_manager.h" #include "ai_script_data_manager.h" #include "commands.h" - +#include "nel/misc/i18n.h" #include "ais_user_models.h" extern bool GrpHistoryRecordLog; @@ -1686,7 +1686,9 @@ NLMISC_COMMAND(getDatasetId,"get datasetid of bots with name matchiong the given FOREACH(itBot, vector, bots) { CBot* bot = *itBot; - DatasetIds += bot->getSpawnObj()->dataSetRow().toString()+"|"; + CSpawnBot* spawnBot = bot->getSpawnObj(); + if (spawnBot!=NULL) + DatasetIds += spawnBot->dataSetRow().toString()+"|"; } } @@ -3065,19 +3067,13 @@ static void displayTime(const CRyzomTime &rt, NLMISC::CLog &log) log.displayNL(result.c_str()); std::string week = toString("%03d", rt.getRyzomWeek()); std::string dayName = CI18N::get("ui"+WEEKDAY::toString((WEEKDAY::EWeekDay) rt.getRyzomDayOfWeek())).toUtf8(); - std::string year; + std::string year = rt.getRyzomYearStr().toUtf8(); std::string eon = CI18N::get("uiEon").toUtf8(); - ucstring yearBool = CI18N::get("uiYear"); - if (yearBool.length() == 0) { - year = toString("%04d", rt.getRyzomYear()); - } else { - year = yearBool.toUtf8(); - } result = NLMISC::toString("week:day:year:eon = %s:%s:%s:%s", - week, - dayName, - year, - eon); + week.c_str(), + dayName.c_str(), + year.c_str(), + eon.c_str()); log.displayNL(result.c_str()); log.displayNL("day of year = %d/%d", (int) (rt.getRyzomDayOfYear() + 1), (int) RYZOM_YEAR_IN_DAY); log.displayNL("season = %d/4 (%s)", (int) rt.getRyzomSeason() + 1, EGSPD::CSeason::toString(rt.getRyzomSeason()).c_str()); diff --git a/code/ryzom/server/src/ai_service/nf_grp.cpp b/code/ryzom/server/src/ai_service/nf_grp.cpp index a14eca493..47ee114cb 100644 --- a/code/ryzom/server/src/ai_service/nf_grp.cpp +++ b/code/ryzom/server/src/ai_service/nf_grp.cpp @@ -3366,19 +3366,13 @@ void getRyzomDateStr__s(CStateInstance* entity, CScriptStack& stack) std::string week = toString("%03d", rt.getRyzomWeek()); std::string dayName = CI18N::get("ui"+WEEKDAY::toString((WEEKDAY::EWeekDay) rt.getRyzomDayOfWeek())).toUtf8(); - std::string year; + std::string year = toString(rt.getRyzomYearStr()); std::string eon = CI18N::get("uiEon").toUtf8(); - ucstring yearBool = CI18N::get("uiYear"); - if (yearBool.length() == 0) { - year = toString("%04d", rt.getRyzomYear()); - } else { - year = yearBool.toUtf8(); - } result += NLMISC::toString(" / %s %s - %s - %s", - week, - dayName, - year, - eon); + week.c_str(), + dayName.c_str(), + year.c_str(), + eon.c_str()); stack.push( result ); } diff --git a/code/ryzom/server/src/ai_service/state_instance.h b/code/ryzom/server/src/ai_service/state_instance.h index 802172825..916b6bc47 100644 --- a/code/ryzom/server/src/ai_service/state_instance.h +++ b/code/ryzom/server/src/ai_service/state_instance.h @@ -44,14 +44,14 @@ class CStateInstance public: inline CStateInstance(CAIState* startState); - + void init(CAIState* startState); - + virtual CPersistentStateInstance* getPersistentStateInstance(); - + ////////////////////////////////////////////////////////////////////////// // State Persistent. - + struct CStatePersistentObjEntry { CStatePersistentObjEntry(); @@ -61,78 +61,78 @@ public: NLMISC::CSmartPtr _Obj; }; typedef std::vector TStatePersistentObjList; - + TStatePersistentObjList _StatePersistentObjList; - + // Made to allow obj with life time less or equal to state affectation life time. void addStatePersistentObj(CAIState const* keyState, NLMISC::CSmartPtr anyObj); void removeExceptForState(CAIState const* keyState); - + /** Try to obtain a group interface from the CStateInstance. Can return NULL if the * CStateInstance if not implemeted by a group related objet. */ // Bad, Bad, Bad .. virtual CGroup* getGroup() = 0; - + ////////////////////////////////////////////////////////////////////////// - - CAITimerExtended& timerStateTimeout() { return _StateTimeout; } - CAITimerExtended& timerPunctTimeout() { return _PunctualStateTimeout; } + + CAITimerExtended& timerStateTimeout() { return _StateTimeout; } + CAITimerExtended& timerPunctTimeout() { return _PunctualStateTimeout; } CAITimerExtended& timerUser(uint idx); - + CAIState* getCAIState(); - + virtual CAliasTreeOwner* aliasTreeOwner() = 0; - + virtual void stateChange(CAIState const* oldState, CAIState const* newState) = 0; - + CAIState* getState() const { return _state; } void setNextState(CAIState*); - + CAIState* getPunctualState() const { return _PunctualState; } CAIState* getNextPunctualState() const { return _NextPunctualState; } void setNextPunctualState(CAIState* state); void cancelPunctualState() { _CancelPunctualState = true; } - + std::string buidStateInstanceDebugString() const; - + void dumpVarsAndFunctions(CStringWriter& sw) const; - + virtual CDebugHistory* getDebugHistory () = 0; - + CAIState const* getActiveState() const; - + sint32 getUserTimer(uint timerId); void setUserTimer(uint timerId, sint32 time); - + void logicVarsToString(std::string& str) const; - + float getNelVar(std::string const& varId); void setNelVar(std::string const& varId, float value); void delNelVar(std::string const& varId); - + std::string getStrNelVar(std::string const& varId); void setStrNelVar(std::string const& varId, std::string const& value); void delStrNelVar(std::string const& varId); static void setGlobalNelVar(std::string const& varId, float value); static void setGlobalNelVar(std::string const& varId, std::string value); - + CAITimerExtended const& userTimer (uint32 index) const; - + bool advanceUserTimer(uint32 nbTicks); - + void processStateEvent(CAIEvent const& stateEvent, CAIState const* state = NULL); - + // callerStateInstance could be NULL; void interpretCode(AIVM::IScriptContext* callerStateInstance, AIVM::CByteCodeEntry const& codeScriptEntry); void interpretCode(AIVM::IScriptContext* callerStateInstance, NLMISC::CSmartPtr const& codeScript); - + /// @name IScriptContext implementation //@{ virtual std::string getContextName(); virtual void interpretCodeOnChildren(AIVM::CByteCodeEntry const& codeScriptEntry); - + float getLogicVar(NLMISC::TStringId varId); void setLogicVar(NLMISC::TStringId varId, float value); std::string getStrLogicVar(NLMISC::TStringId varId); @@ -140,19 +140,19 @@ public: AIVM::IScriptContext* getCtxLogicVar(NLMISC::TStringId varId); void setCtxLogicVar(NLMISC::TStringId varId, AIVM::IScriptContext* value); void setFirstBotSpawned(); - + virtual AIVM::IScriptContext* findContext(NLMISC::TStringId const strId); - + virtual void setScriptCallBack(NLMISC::TStringId const& eventName, AIVM::CByteCodeEntry const& codeScriptEntry); virtual AIVM::CByteCodeEntry const* getScriptCallBackPtr(NLMISC::TStringId const& eventName) const; virtual void callScriptCallBack(AIVM::IScriptContext* caller, NLMISC::TStringId const& funcName, int mode = 0, std::string const& inParamsSig = "", std::string const& outParamsSig = "", AIVM::CScriptStack* stack = NULL); virtual void callNativeCallBack(AIVM::IScriptContext* caller, std::string const& funcName, int mode = 0, std::string const& inParamsSig = "", std::string const& outParamsSig = "", AIVM::CScriptStack* stack = NULL); - + void blockUserEvent(uint32 eventId); void unblockUserEvent(uint32 eventId); bool isUserEventBlocked(uint32 eventId) const; //@} - + protected: /// Logic variables typedef std::map TLogicVarList; @@ -162,38 +162,38 @@ protected: TLogicVarList _LogicVar; TStrLogicVarList _StrLogicVar; TCtxLogicVarList _CtxLogicVar; - + // Nel variables typedef std::map*> TNelVarList; typedef std::map*> TStrNelVarList; TNelVarList _NelVar; TStrNelVarList _StrNelVar; - + // Callbacks (?) typedef std::map TCallBackList; TCallBackList _CallBacks; - + /// Flag for variable modification bool _LogicVarChanged; bool _LogicVarChangedList[4]; //TLogicVarIndex _VarIndex; // update logic timers --------------------------------------------- /// 4 timers available for user logic - CAITimerExtended _UserTimer[4]; - + CAITimerExtended _UserTimer[4]; + /// timer for timing positional states - CAITimerExtended _StateTimeout; - /// current state (index into manager's state vector) + CAITimerExtended _StateTimeout; + /// current state (index into manager's state vector) CAIState* _state; /// variable set to request a state change (std::numeric_limits::max() otherwise) CAIState* _NextState; - + /// timer for timing punctual states CAITimerExtended _PunctualStateTimeout; - + CAIState* _PunctualState; CAIState* _NextPunctualState; - + /// Flag for leaving the punctual state, returning to normal behavior bool _CancelPunctualState; bool _FirstBotSpawned; @@ -213,35 +213,35 @@ class CPersistentStateInstance public: CPersistentStateInstance(CStateMachine& reactionContainer); virtual ~CPersistentStateInstance(); - + typedef std::vector > TChildList; - + void setParentStateInstance(CPersistentStateInstance* parentStateInstance); - + CPersistentStateInstance* getParentStateInstance() const { return _ParentStateInstance; } - + void addChildStateInstance(CPersistentStateInstance* parentStateInstance); - + void removeChildStateInstance(CPersistentStateInstance* parentStateInstance); - + TChildList& childs() { return _PSIChilds; } - + TChildList _PSIChilds; - + // Interface to state status variables ----------------------------- CAIState* getStartState() { return _StartState; } void setStartState(CAIState* state); - + CStateMachine& getEventContainer() { return _Container; } - + void updateStateInstance(); - + ////////////////////////////////////////////////////////////////////////// // CStateInstance CPersistentStateInstance* getPersistentStateInstance() { return this; } - + ////////////////////////////////////////////////////////////////////////// - + private: /// id of the state to use at startup NLMISC::CDbgPtr _StartState; @@ -330,9 +330,9 @@ void CStateInstance::setLogicVar(NLMISC::TStringId varId, float value) //_VarIndex[varId] _LogicVarChangedList[static_cast(index)] = true; } - + } - + } inline @@ -354,7 +354,7 @@ void CStateInstance::setStrLogicVar(NLMISC::TStringId varId, std::string const& //_VarIndex[varId] _LogicVarChangedList[static_cast(index)] = true; } - + } //_LogicVarChangedList[_VarIndex[varId]] = true; } @@ -376,17 +376,16 @@ inline float CStateInstance::getNelVar(std::string const& varId) { TNelVarList::iterator it = _NelVar.find(varId); - if (it==_NelVar.end()) + if (it != _NelVar.end()) return it->second->get(); + + if (NLMISC::CVariable::exists(varId)) { - if (NLMISC::CVariable::exists(varId)) - { - nlwarning("Nel variable \"%s\" exists outside of this state instance", varId.c_str()); - return 0.f; - } - _NelVar[varId] = new NLMISC::CVariable("StateInstance", varId.c_str(), "", 0.f); - _NelVar[varId]->get(); + nlwarning("Nel variable \"%s\" exists outside of this state instance", varId.c_str()); + return 0.f; } - return it->second->get(); + + _NelVar[varId] = new NLMISC::CVariable("StateInstance", varId.c_str(), "", 0.f); + return _NelVar[varId]->get(); } inline @@ -424,17 +423,16 @@ inline std::string CStateInstance::getStrNelVar(std::string const& varId) { TStrNelVarList::iterator it = _StrNelVar.find(varId); - if (it==_StrNelVar.end()) + if (it != _StrNelVar.end()) return it->second->get(); + + if (NLMISC::CVariable::exists(varId)) { - if (NLMISC::CVariable::exists(varId)) - { - nlwarning("Nel variable \"%s\" exists outside of this state instance", varId.c_str()); - return ""; - } - _StrNelVar[varId] = new NLMISC::CVariable("StateInstanceVar", varId.c_str(), "", std::string()); - _NelVar[varId]->get(); + nlwarning("Nel variable \"%s\" exists outside of this state instance", varId.c_str()); + return ""; } - return it->second->get(); + + _StrNelVar[varId] = new NLMISC::CVariable("StateInstanceStrVar", varId.c_str(), "", std::string()); + return _StrNelVar[varId]->get(); } inline @@ -483,7 +481,7 @@ bool CStateInstance::advanceUserTimer(uint32 nbTicks) setUserTimer(k, (t>nbTicks)?(t-nbTicks):0); } return true; -} +} inline void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState const* state) @@ -496,7 +494,7 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons if (!state) return; } - + bool foundReaction=false; // nlassert(_mgr); for (uint i=0;iaddHistory("STATE: '%s' EVENT: '%s' REACTION: '%s'", state->getAliasNode()->fullName().c_str(), stateEvent.getName().c_str(), reaction.getAliasNode()->fullName().c_str()); - + foundReaction=true; - + if (!reaction.getAction()) { nlwarning("Failed to find action for event: %s",reaction.getAliasNode()->fullName().c_str()); @@ -521,14 +519,14 @@ void CStateInstance::processStateEvent(CAIEvent const& stateEvent, CAIState cons aliasTreeOwner()->getAliasNode()->fullName().c_str(), state->getAliasNode()->fullName().c_str()); continue; } - + } if (!foundReaction) { getDebugHistory()->addHistory("STATE: '%s' EVENT: '%s' NO REACTION", state->getAliasNode()->fullName().c_str(), stateEvent.getName().c_str()); } - + } inline @@ -540,38 +538,38 @@ void CStateInstance::setNextState(CAIState* state) _NextState = state; return; } - + // make sure the state is positional (not punctual) - if (!state->isPositional()) - { + if (!state->isPositional()) + { nlwarning("setNextState(): State should not be punctual '%s'%s - setting state to std::numeric_limits::max()", state->getAliasNode()->fullName().c_str(), state->getAliasString().c_str()); _NextState = NULL; return; } - + // set the next state _NextState = state; } inline void CStateInstance::setNextPunctualState(CAIState* state) -{ +{ // we're allowed to set state to 'no state' if (!state) return; - + // make sure the state is not positional (ie punctual) - if (state->isPositional()) - { + if (state->isPositional()) + { nlwarning("CStateInstance::setNextPunctualState(): State should be punctual '%s'%s - setting state to std::numeric_limits::max()", state->getAliasNode()->fullName().c_str(), state->getAliasString().c_str()); state = NULL; return; - } - + } + // set the next state _NextPunctualState = state; } @@ -626,7 +624,7 @@ void CPersistentStateInstance::removeChildStateInstance(CPersistentStateInstance TChildList::iterator it = std::find(_PSIChilds.begin(), _PSIChilds.end(), NLMISC::CDbgPtr(parentStateInstance)); #if !FINAL_VERSION nlassert(it!=_PSIChilds.end()); -#endif +#endif if (it!=_PSIChilds.end()) _PSIChilds.erase(it); } diff --git a/code/ryzom/tools/translation/translated/bodypart_words_es.txt b/code/ryzom/tools/translation/translated/bodypart_words_es.txt index a695b23a3..55df54341 100644 Binary files a/code/ryzom/tools/translation/translated/bodypart_words_es.txt and b/code/ryzom/tools/translation/translated/bodypart_words_es.txt differ diff --git a/code/ryzom/tools/translation/translated/career_words_es.txt b/code/ryzom/tools/translation/translated/career_words_es.txt index 8de86c670..a53738f04 100644 Binary files a/code/ryzom/tools/translation/translated/career_words_es.txt and b/code/ryzom/tools/translation/translated/career_words_es.txt differ diff --git a/code/ryzom/tools/translation/translated/characteristic_words_es.txt b/code/ryzom/tools/translation/translated/characteristic_words_es.txt index 63a63c834..1cd7f4b4e 100644 Binary files a/code/ryzom/tools/translation/translated/characteristic_words_es.txt and b/code/ryzom/tools/translation/translated/characteristic_words_es.txt differ diff --git a/code/ryzom/tools/translation/translated/classificationtype_words_wk.txt b/code/ryzom/tools/translation/translated/classificationtype_words_wk.txt index 3855774fe..0d7d54a22 100644 Binary files a/code/ryzom/tools/translation/translated/classificationtype_words_wk.txt and b/code/ryzom/tools/translation/translated/classificationtype_words_wk.txt differ diff --git a/code/ryzom/tools/translation/translated/damagetype_words_es.txt b/code/ryzom/tools/translation/translated/damagetype_words_es.txt index 55a7e6347..35af6bcc5 100644 Binary files a/code/ryzom/tools/translation/translated/damagetype_words_es.txt and b/code/ryzom/tools/translation/translated/damagetype_words_es.txt differ diff --git a/code/ryzom/tools/translation/translated/ecosystem_words_es.txt b/code/ryzom/tools/translation/translated/ecosystem_words_es.txt index 45a0b59e1..0cf292eeb 100644 Binary files a/code/ryzom/tools/translation/translated/ecosystem_words_es.txt and b/code/ryzom/tools/translation/translated/ecosystem_words_es.txt differ diff --git a/code/ryzom/tools/translation/translated/faction_words_es.txt b/code/ryzom/tools/translation/translated/faction_words_es.txt index 957c6f7af..81b0fe15b 100644 Binary files a/code/ryzom/tools/translation/translated/faction_words_es.txt and b/code/ryzom/tools/translation/translated/faction_words_es.txt differ diff --git a/code/ryzom/tools/translation/translated/item_words_en.txt b/code/ryzom/tools/translation/translated/item_words_en.txt index 6e8780556..d8a09406c 100644 Binary files a/code/ryzom/tools/translation/translated/item_words_en.txt and b/code/ryzom/tools/translation/translated/item_words_en.txt differ diff --git a/code/ryzom/tools/translation/translated/job_words_es.txt b/code/ryzom/tools/translation/translated/job_words_es.txt index 69177dfe7..701fc479b 100644 Binary files a/code/ryzom/tools/translation/translated/job_words_es.txt and b/code/ryzom/tools/translation/translated/job_words_es.txt differ diff --git a/code/ryzom/tools/translation/translated/powertype_words_es.txt b/code/ryzom/tools/translation/translated/powertype_words_es.txt index 2d1f42cbe..6934de333 100644 Binary files a/code/ryzom/tools/translation/translated/powertype_words_es.txt and b/code/ryzom/tools/translation/translated/powertype_words_es.txt differ diff --git a/code/ryzom/tools/translation/translated/score_words_es.txt b/code/ryzom/tools/translation/translated/score_words_es.txt index 8469aa471..f22125af2 100644 Binary files a/code/ryzom/tools/translation/translated/score_words_es.txt and b/code/ryzom/tools/translation/translated/score_words_es.txt differ diff --git a/code/ryzom/tools/translation/translated/skill_words_de.txt b/code/ryzom/tools/translation/translated/skill_words_de.txt index b382742c4..77e43f4fa 100644 Binary files a/code/ryzom/tools/translation/translated/skill_words_de.txt and b/code/ryzom/tools/translation/translated/skill_words_de.txt differ