1
0
forked from 0ad/0ad

Add WaterChanged message, for things that need to be recomputed when the water height changes.

This was SVN commit r15226.
This commit is contained in:
Ykkrosh 2014-05-26 13:44:24 +00:00
parent 6407b593d6
commit 41f62cd3ff
4 changed files with 30 additions and 0 deletions

View File

@ -291,6 +291,19 @@ public:
bool error; // whether we failed to start moving (couldn't find any path)
};
/**
* Sent when water height has been changed.
*/
class CMessageWaterChanged : public CMessage
{
public:
DEFAULT_MESSAGE_IMPL(WaterChanged)
CMessageWaterChanged()
{
}
};
/**
* Sent when terrain (texture or elevation) has been changed.
*/

View File

@ -46,6 +46,7 @@ MESSAGE(TerritoryPositionChanged)
MESSAGE(MotionChanged)
MESSAGE(RangeUpdate)
MESSAGE(TerrainChanged)
MESSAGE(WaterChanged)
MESSAGE(TerritoriesChanged)
MESSAGE(PathResult)
MESSAGE(ValueModification)

View File

@ -118,6 +118,9 @@ public:
// Tell the terrain it'll need to recompute its cached render data
GetSimContext().GetTerrain().MakeDirty(RENDERDATA_UPDATE_VERTICES);
CMessageWaterChanged msg;
GetSimContext().GetComponentManager().BroadcastMessage(msg);
}
virtual entity_pos_t GetWaterLevel(entity_pos_t UNUSED(x), entity_pos_t UNUSED(z))

View File

@ -282,6 +282,19 @@ CMessage* CMessageTerrainChanged::FromJSVal(ScriptInterface& scriptInterface, js
////////////////////////////////
jsval CMessageWaterChanged::ToJSVal(ScriptInterface& scriptInterface) const
{
TOJSVAL_SETUP();
return OBJECT_TO_JSVAL(obj);
}
CMessage* CMessageWaterChanged::FromJSVal(ScriptInterface& UNUSED(scriptInterface), jsval UNUSED(val))
{
return new CMessageWaterChanged();
}
////////////////////////////////
jsval CMessageTerritoriesChanged::ToJSVal(ScriptInterface& scriptInterface) const
{
TOJSVAL_SETUP();