merged with compatibility-develop

This commit is contained in:
SIELA1915 2016-01-31 15:42:41 +01:00
parent db771f1d2b
commit 095bc1b04c
15 changed files with 102 additions and 102 deletions

View file

@ -131,20 +131,20 @@ public:
CRyzomTime() CRyzomTime()
{ {
_RyzomDay = 0; _RyzomDay = 0;
_RyzomTime = 0; _RyzomTime = 0.f;
_LocalTime = 0.0;
_TickOffset = 0; _TickOffset = 0;
} }
// Update ryzom clock when tick occurs, local time must be given if localUpdateRyzomClock() and getLocalRyzomTime() is used // Update ryzom clock when tick occurs, local time must be given if localUpdateRyzomClock() and getLocalRyzomTime() is used
void updateRyzomClock( uint32 gameCyle, double localTime = 0 ) void updateRyzomClock( uint32 gameCyle, double localTime = 0 )
{ {
float time = ( gameCyle + _TickOffset ) / float(RYZOM_HOURS_IN_TICKS); float hours = ( gameCyle + _TickOffset ) / float(RYZOM_HOURS_IN_TICKS);
_RyzomDay = (uint32) ( time / RYZOM_DAY_IN_HOUR ) - RYZOM_START_SPRING; _RyzomDay = ( (uint)hours / RYZOM_DAY_IN_HOUR ) - RYZOM_START_SPRING;
_RyzomTime = (float) fmod( time, RYZOM_DAY_IN_HOUR ); _RyzomTime = (float) fmod( hours, (float)RYZOM_DAY_IN_HOUR );
_LocalTime = localTime; _LocalTime = localTime;
} }
// get ryzom time (synchronized with server) // get ryzom time (synchronized with server)
inline float getRyzomTime() const { return _RyzomTime; } inline float getRyzomTime() const { return _RyzomTime; }

View file

@ -1686,7 +1686,9 @@ NLMISC_COMMAND(getDatasetId,"get datasetid of bots with name matchiong the given
FOREACH(itBot, vector<CBot*>, bots) FOREACH(itBot, vector<CBot*>, bots)
{ {
CBot* bot = *itBot; CBot* bot = *itBot;
DatasetIds += bot->getSpawnObj()->dataSetRow().toString()+"|"; CSpawnBot* spawnBot = bot->getSpawnObj();
if (spawnBot!=NULL)
DatasetIds += spawnBot->dataSetRow().toString()+"|";
} }
} }

View file

@ -376,17 +376,16 @@ inline
float CStateInstance::getNelVar(std::string const& varId) float CStateInstance::getNelVar(std::string const& varId)
{ {
TNelVarList::iterator it = _NelVar.find(varId); TNelVarList::iterator it = _NelVar.find(varId);
if (it==_NelVar.end()) if (it != _NelVar.end()) return it->second->get();
{
if (NLMISC::CVariable<float>::exists(varId)) if (NLMISC::CVariable<float>::exists(varId))
{ {
nlwarning("Nel variable \"%s\" exists outside of this state instance", varId.c_str()); nlwarning("Nel variable \"%s\" exists outside of this state instance", varId.c_str());
return 0.f; return 0.f;
} }
_NelVar[varId] = new NLMISC::CVariable<float>("StateInstance", varId.c_str(), "", 0.f); _NelVar[varId] = new NLMISC::CVariable<float>("StateInstance", varId.c_str(), "", 0.f);
_NelVar[varId]->get(); return _NelVar[varId]->get();
}
return it->second->get();
} }
inline inline
@ -424,17 +423,16 @@ inline
std::string CStateInstance::getStrNelVar(std::string const& varId) std::string CStateInstance::getStrNelVar(std::string const& varId)
{ {
TStrNelVarList::iterator it = _StrNelVar.find(varId); TStrNelVarList::iterator it = _StrNelVar.find(varId);
if (it==_StrNelVar.end()) if (it != _StrNelVar.end()) return it->second->get();
{
if (NLMISC::CVariable<float>::exists(varId)) if (NLMISC::CVariable<float>::exists(varId))
{ {
nlwarning("Nel variable \"%s\" exists outside of this state instance", varId.c_str()); nlwarning("Nel variable \"%s\" exists outside of this state instance", varId.c_str());
return ""; return "";
} }
_StrNelVar[varId] = new NLMISC::CVariable<std::string>("StateInstanceVar", varId.c_str(), "", std::string());
_NelVar[varId]->get(); _StrNelVar[varId] = new NLMISC::CVariable<std::string>("StateInstanceStrVar", varId.c_str(), "", std::string());
} return _StrNelVar[varId]->get();
return it->second->get();
} }
inline inline