- let's save the terrain properties as names so that they survive a change in the definition files.

This commit is contained in:
Christoph Oelckers 2016-01-09 12:28:42 +01:00
commit 23cfd29dbb
4 changed files with 30 additions and 2 deletions

View file

@ -46,6 +46,7 @@
#include "s_sound.h"
#include "p_local.h"
#include "templates.h"
#include "farchive.h"
// MACROS ------------------------------------------------------------------
@ -704,3 +705,26 @@ int P_FindTerrain (FName name)
}
return -1;
}
void P_SerializeTerrain(FArchive &arc, int &terrainnum)
{
FName val;
if (arc.IsStoring())
{
if (terrainnum < 0 || terrainnum >= (int)Terrains.Size())
{
val = NAME_Null;
}
else
{
val = Terrains[terrainnum].Name;
}
arc << val;
}
else
{
arc << val;
terrainnum = P_FindTerrain(val);
}
}