/* * Return the weather at the specified position & time. * In case of failure (such as a position outside a continent), return unknownWeather. */ CRyzomTime::EWeather CWeatherEverywhere::getWeather( const NLMISC::CVector& pos, const CRyzomTime& ryzomTime ) const { if ( ! _WeatherFunctionParamsSheet ) return CRyzomTime::unknownWeather; // Get continent of which the position belongs CContinent *continent = CZoneManager::getInstance().getContinent( pos ); if ( ! continent ) return CRyzomTime::unknownWeather; // Predict weather float weatherFloatValue = CPredictWeather::predictWeather( ryzomTime.getRyzomDay(), ryzomTime.getRyzomTime(), *_WeatherFunctionParamsSheet, _WeatherFunctionsBySeasonByContinent[continent->getId()] ); // Map from weather setup to EWeather value uint weatherSetupIndex = min( (uint)(weatherFloatValue*((float)NB_WEATHER_SETUPS)), NB_WEATHER_SETUPS-1 ); //nldebug( "Weather setup of position is %u", weatherSetupIndex ); return WeatherSetupsToValue[weatherSetupIndex]; }
//----------------------------------------------------------------------------- bool CGmTpPendingCommand::getTpPendingforCharacter( const std::string& CharacterName, COfflineEntityState& state, CCharacter& character ) { TCharacterTpPending::iterator it = _CharacterTpPending.find( CharacterName ); if( it == _CharacterTpPending.end() ) { return false; } else { state = (*it).second; _CharacterTpPending.erase( it ); saveMap(); if( character.getCurrentContinent() == CONTINENT::NEWBIELAND ) { CContinent * cont = CZoneManager::getInstance().getContinent(state.X, state.Y); if(cont == 0) return false; if((CONTINENT::TContinent)cont->getId() != CONTINENT::NEWBIELAND ) return false; } return true; } }