Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
netplus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
John FrostFox
netplus
Commits
5133c6c9
Unverified
Commit
5133c6c9
authored
3 years ago
by
John FrostFox
Browse files
Options
Downloads
Patches
Plain Diff
LUA savestate loading optimization with hashtables
parent
336be738
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/hashtable.c
+0
-3
0 additions, 3 deletions
src/hashtable.c
src/lua_script.c
+2
-1
2 additions, 1 deletion
src/lua_script.c
src/p_savenetrb.h
+1
-0
1 addition, 0 deletions
src/p_savenetrb.h
with
3 additions
and
4 deletions
src/hashtable.c
+
0
−
3
View file @
5133c6c9
...
@@ -69,16 +69,13 @@ void mobjnum_ht_linkedList_AddEntry (thinker_t* thinker)
...
@@ -69,16 +69,13 @@ void mobjnum_ht_linkedList_AddEntry (thinker_t* thinker)
{
{
if
(
!
currentEntry
->
thinker
)
if
(
!
currentEntry
->
thinker
)
{
{
// CONS_Printf("mobj not exists, adding\n");
currentEntry
->
thinker
=
thinker
;
currentEntry
->
thinker
=
thinker
;
break
;
break
;
}
}
else
else
{
{
// CONS_Printf("mobj exists, go next\n");
if
(
!
currentEntry
->
next
)
if
(
!
currentEntry
->
next
)
{
{
// CONS_Printf("next not exists, create\n");
currentEntry
->
next
=
malloc
(
sizeof
(
mobjnum_linkedList
));
currentEntry
->
next
=
malloc
(
sizeof
(
mobjnum_linkedList
));
currentEntry
->
next
->
thinker
=
thinker
;
currentEntry
->
next
->
thinker
=
thinker
;
currentEntry
->
next
->
next
=
NULL
;
currentEntry
->
next
->
next
=
NULL
;
...
...
This diff is collapsed.
Click to expand it.
src/lua_script.c
+
2
−
1
View file @
5133c6c9
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
#include
"doomstat.h"
#include
"doomstat.h"
#include
"g_state.h"
#include
"g_state.h"
#include
"p_savenetrb.h"
//for P_FindNewPosition_Hashtable
#include
"hashtable.h"
#include
"hashtable.h"
lua_State
*
gL
=
NULL
;
lua_State
*
gL
=
NULL
;
...
@@ -1455,7 +1456,7 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
...
@@ -1455,7 +1456,7 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
LUA_PushUserdata
(
gL
,
&
states
[
READUINT16
(
save_p
)],
META_STATE
);
LUA_PushUserdata
(
gL
,
&
states
[
READUINT16
(
save_p
)],
META_STATE
);
break
;
break
;
case
ARCH_MOBJ
:
case
ARCH_MOBJ
:
LUA_PushUserdata
(
gL
,
P_FindNewPosition
(
READUINT32
(
save_p
)),
META_MOBJ
);
LUA_PushUserdata
(
gL
,
P_FindNewPosition
_Hashtable
(
READUINT32
(
save_p
)),
META_MOBJ
);
break
;
break
;
case
ARCH_PLAYER
:
case
ARCH_PLAYER
:
LUA_PushUserdata
(
gL
,
&
players
[
READUINT8
(
save_p
)],
META_PLAYER
);
LUA_PushUserdata
(
gL
,
&
players
[
READUINT8
(
save_p
)],
META_PLAYER
);
...
...
This diff is collapsed.
Click to expand it.
src/p_savenetrb.h
+
1
−
0
View file @
5133c6c9
...
@@ -24,5 +24,6 @@ extern char netDebugText[10000];
...
@@ -24,5 +24,6 @@ extern char netDebugText[10000];
// TODO: Find GPLv2 hashtable library and optimize the lua object loading code
// TODO: Find GPLv2 hashtable library and optimize the lua object loading code
void
P_GameStateFreeMemory
(
savestate_t
*
savestate
);
void
P_GameStateFreeMemory
(
savestate_t
*
savestate
);
void
P_SaveGameState
(
savestate_t
*
savestate
);
void
P_SaveGameState
(
savestate_t
*
savestate
);
mobj_t
*
P_FindNewPosition_Hashtable
(
UINT32
oldposition
);
boolean
P_LoadGameState
(
const
savestate_t
*
savestate
);
boolean
P_LoadGameState
(
const
savestate_t
*
savestate
);
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment