Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
SRB2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
STJr
SRB2
Commits
ae05f11c
Commit
ae05f11c
authored
Apr 28, 2020
by
LJ Sonic
Browse files
Options
Downloads
Patches
Plain Diff
Optimise number archiving
parent
3e8fb8db
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!985
Shaders next merge
,
!904
Optimise net-archiving of Lua strings, numbers and booleans
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lua_script.c
+24
-4
24 additions, 4 deletions
src/lua_script.c
with
24 additions
and
4 deletions
src/lua_script.c
+
24
−
4
View file @
ae05f11c
...
@@ -732,7 +732,9 @@ enum
...
@@ -732,7 +732,9 @@ enum
ARCH_NULL
=
0
,
ARCH_NULL
=
0
,
ARCH_TRUE
,
ARCH_TRUE
,
ARCH_FALSE
,
ARCH_FALSE
,
ARCH_SIGNED
,
ARCH_INT8
,
ARCH_INT16
,
ARCH_INT32
,
ARCH_SMALLSTRING
,
ARCH_SMALLSTRING
,
ARCH_LARGESTRING
,
ARCH_LARGESTRING
,
ARCH_TABLE
,
ARCH_TABLE
,
...
@@ -824,8 +826,21 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
...
@@ -824,8 +826,21 @@ static UINT8 ArchiveValue(int TABLESINDEX, int myindex)
case
LUA_TNUMBER
:
case
LUA_TNUMBER
:
{
{
lua_Integer
number
=
lua_tointeger
(
gL
,
myindex
);
lua_Integer
number
=
lua_tointeger
(
gL
,
myindex
);
WRITEUINT8
(
save_p
,
ARCH_SIGNED
);
if
(
number
>=
INT8_MIN
&&
number
<=
INT8_MAX
)
{
WRITEUINT8
(
save_p
,
ARCH_INT8
);
WRITESINT8
(
save_p
,
number
);
}
else
if
(
number
>=
INT16_MIN
&&
number
<=
INT16_MAX
)
{
WRITEUINT8
(
save_p
,
ARCH_INT16
);
WRITEINT16
(
save_p
,
number
);
}
else
{
WRITEUINT8
(
save_p
,
ARCH_INT32
);
WRITEFIXED
(
save_p
,
number
);
WRITEFIXED
(
save_p
,
number
);
}
break
;
break
;
}
}
case
LUA_TSTRING
:
case
LUA_TSTRING
:
...
@@ -1193,8 +1208,13 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
...
@@ -1193,8 +1208,13 @@ static UINT8 UnArchiveValue(int TABLESINDEX)
case
ARCH_FALSE
:
case
ARCH_FALSE
:
lua_pushboolean
(
gL
,
false
);
lua_pushboolean
(
gL
,
false
);
break
;
break
;
case
ARCH_INT8
:
lua_pushinteger
(
gL
,
READSINT8
(
save_p
));
break
;
case
ARCH_INT16
:
lua_pushinteger
(
gL
,
READINT16
(
save_p
));
break
;
break
;
case
ARCH_
SIGNED
:
case
ARCH_
INT32
:
lua_pushinteger
(
gL
,
READFIXED
(
save_p
));
lua_pushinteger
(
gL
,
READFIXED
(
save_p
));
break
;
break
;
case
ARCH_SMALLSTRING
:
case
ARCH_SMALLSTRING
:
...
...
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