a
This commit is contained in:
1 parent
58e8ecf353
commit
10da6fa3f1
2 files changed
+7
-34
No files matched your search
+4
-5
@@ -33,6 +33,8 @@
|
||||
#include "lua_glib.h"
|
||||
#include "lua_hook.h"
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
#include "doomstat.h"
|
||||
|
||||
#ifndef NOBLUAJIT
|
||||
@@ -1128,7 +1130,7 @@ static UINT8 UnArchiveValue(UINT8 **p, int TABLESINDEX, boolean network)
|
||||
return 3; // Don't set the field
|
||||
}
|
||||
|
||||
LUA_PushUserdata(gL, P_FindNewPosition_Hashtable(READUINT32(*p)), META_MOBJ);
|
||||
LUA_PushUserdata(gL, P_FindNewPosition(READUINT32(*p)), META_MOBJ);
|
||||
break;
|
||||
case ARCH_PLAYER:
|
||||
LUA_PushUserdata(gL, &players[READUINT8(*p)], META_PLAYER);
|
||||
@@ -1331,8 +1333,6 @@ void LUA_Archive(savebuffer_t *save, boolean network)
|
||||
lua_pop(gL, 1); // pop tables
|
||||
}
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
void LUA_UnArchive(savebuffer_t *save, boolean network)
|
||||
{
|
||||
UINT32 mobjnum;
|
||||
@@ -1359,7 +1359,6 @@ void LUA_UnArchive(savebuffer_t *save, boolean network)
|
||||
|
||||
if (th && ((mobj_t *)th)->mobjnum == mobjnum)
|
||||
{
|
||||
CONS_Printf("using hashtable UnArchiveExtVars\n");
|
||||
UnArchiveExtVars(&save->p, th, network);
|
||||
}
|
||||
else
|
||||
@@ -1374,7 +1373,7 @@ void LUA_UnArchive(savebuffer_t *save, boolean network)
|
||||
UnArchiveExtVars(&save->p, th, network); // apply variables
|
||||
}
|
||||
}
|
||||
}while (mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||
} while (mobjnum != UINT32_MAX); // repeat until end of mobjs marker.
|
||||
|
||||
LUA_HookNetArchive(NetUnArchive, save); // call the NetArchive hook in unarchive mode
|
||||
}
|
||||
|
||||
+3
-29
@@ -33,6 +33,8 @@
|
||||
#include "lua_script.h"
|
||||
#include "p_slopes.h"
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
savedata_t savedata;
|
||||
|
||||
// Block UINT32s to attempt to ensure that the correct data is
|
||||
@@ -1881,36 +1883,10 @@ mobj_t *P_FindNewPosition(UINT32 oldposition)
|
||||
thinker_t *th;
|
||||
mobj_t *mobj;
|
||||
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
{
|
||||
if (th->function != (actionf_p1)P_MobjThinker)
|
||||
continue;
|
||||
|
||||
mobj = (mobj_t *)th;
|
||||
|
||||
if (mobj->mobjnum == oldposition)
|
||||
return mobj;
|
||||
}
|
||||
CONS_Debug(DBG_GAMELOGIC, "mobj %d not found\n", oldposition);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#include "hashtable.h"
|
||||
|
||||
// Now save the pointers, tracer and target, but at load time we must
|
||||
// relink to this; the savegame contains the old position in the pointer
|
||||
// field copyed in the info field temporarily, but finally we just search
|
||||
// for the old position and relink to it.
|
||||
mobj_t *P_FindNewPosition_Hashtable(UINT32 oldposition)
|
||||
{
|
||||
thinker_t *th;
|
||||
mobj_t *mobj;
|
||||
|
||||
th = mobjnum_ht_linkedList_Find(oldposition);
|
||||
|
||||
if (th && ((mobj_t *)th)->mobjnum == oldposition)
|
||||
{
|
||||
//CONS_Printf("using hashtable newpos\n");
|
||||
return (mobj_t *)th;
|
||||
}
|
||||
|
||||
@@ -1924,7 +1900,6 @@ mobj_t *P_FindNewPosition_Hashtable(UINT32 oldposition)
|
||||
if (mobj->mobjnum == oldposition)
|
||||
return mobj;
|
||||
}
|
||||
|
||||
CONS_Debug(DBG_GAMELOGIC, "mobj %d not found\n", oldposition);
|
||||
return NULL;
|
||||
}
|
||||
@@ -2904,7 +2879,6 @@ static void P_NetUnArchiveThinkers(savebuffer_t *save)
|
||||
|
||||
if (tclass == tc_mobj && th->function == (actionf_p1)P_MobjThinker)
|
||||
{
|
||||
//CONS_Printf("added to hashlist\n");
|
||||
mobjnum_ht_linkedList_AddEntry(th);
|
||||
}
|
||||
}
|
||||
@@ -3046,7 +3020,7 @@ static inline mobj_t *RelinkMobj(mobj_t **ptr)
|
||||
{
|
||||
UINT32 temp = (UINT32)(size_t)*ptr;
|
||||
*ptr = NULL;
|
||||
return P_SetTarget(ptr, P_FindNewPosition_Hashtable(temp));
|
||||
return P_SetTarget(ptr, P_FindNewPosition(temp));
|
||||
}
|
||||
|
||||
static void P_RelinkPointers(void)
|
||||
|
||||
Reference in new issue
Block a user