1
0

Changed OnWeatherChanging hook to always read the returned weather.

Ref.: http://forum.mc-server.org/showthread.php?tid=1512
This commit is contained in:
madmaxoft
2014-07-03 17:49:21 +02:00
parent 78dd02f0c7
commit 2dbed03cbc
3 changed files with 18 additions and 4 deletions

View File

@@ -1347,18 +1347,15 @@ bool cPluginLua::OnWeatherChanging(cWorld & a_World, eWeather & a_NewWeather)
{
cCSLock Lock(m_CriticalSection);
bool res = false;
int NewWeather = a_NewWeather;
cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WEATHER_CHANGING];
for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr)
{
m_LuaState.Call((int)(**itr), &a_World, NewWeather, cLuaState::Return, res, NewWeather);
m_LuaState.Call((int)(**itr), &a_World, a_NewWeather, cLuaState::Return, res, a_NewWeather);
if (res)
{
a_NewWeather = (eWeather)NewWeather;
return true;
}
}
a_NewWeather = (eWeather)NewWeather;
return false;
}