Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tales of MajEyal
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
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
tome
Tales of MajEyal
Commits
4a875fdf
Commit
4a875fdf
authored
11 years ago
by
DarkGod
Browse files
Options
Downloads
Patches
Plain Diff
fixed saving while profile is saving
parent
df589046
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
game/engines/default/engine/class.lua
+1
-0
1 addition, 0 deletions
game/engines/default/engine/class.lua
game/modules/tome/class/Game.lua
+1
-1
1 addition, 1 deletion
game/modules/tome/class/Game.lua
src/serial.c
+24
-5
24 additions, 5 deletions
src/serial.c
src/serial.h
+1
-0
1 addition, 0 deletions
src/serial.h
with
27 additions
and
6 deletions
game/engines/default/engine/class.lua
+
1
−
0
View file @
4a875fdf
...
...
@@ -276,6 +276,7 @@ end
-- ---------------------------------------------------------------------
-- ---------------------------------------------------------------------
__zipname_zf_store
=
{}
function
_M
:
save
(
filter
,
allow
)
filter
=
filter
or
{}
if
self
.
_no_save_fields
then
table
.
merge
(
filter
,
self
.
_no_save_fields
)
end
...
...
This diff is collapsed.
Click to expand it.
game/modules/tome/class/Game.lua
+
1
−
1
View file @
4a875fdf
...
...
@@ -1890,7 +1890,7 @@ end
--- Requests the game to save
function
_M
:
saveGame
()
self
:
registerHighscore
()
--
self:registerHighscore()
if
self
.
party
then
for
actor
,
_
in
pairs
(
self
.
party
.
members
)
do
engine
.
interface
.
PlayerHotkeys
:
updateQuickHotkeys
(
actor
)
end
end
...
...
This diff is collapsed.
Click to expand it.
src/serial.c
+
24
−
5
View file @
4a875fdf
...
...
@@ -34,6 +34,7 @@
* This simply takes a list of buffers & zip files to save and do it
********************************************************************/
struct
s_save_queue_type
{
zipFile
*
zf
;
char
*
zfname
;
char
*
filename
;
char
*
payload
;
...
...
@@ -54,11 +55,14 @@ typedef struct {
SDL_mutex
*
lock_oqueue
;
}
save_type
;
save_type
*
main_save
;
static
save_type
*
main_save
=
NULL
;
static
char
*
last_zipname
=
NULL
;
static
zipFile
*
last_zf
=
NULL
;
static
void
push_save
(
const
char
*
zfname
,
const
char
*
filename
,
char
*
payload
,
size_t
payload_len
)
static
void
push_save
(
zipFile
*
zf
,
const
char
*
zfname
,
const
char
*
filename
,
char
*
payload
,
size_t
payload_len
)
{
save_queue
*
q
=
malloc
(
sizeof
(
save_queue
));
q
->
zf
=
zf
;
q
->
zfname
=
strdup
(
zfname
);
q
->
filename
=
strdup
(
filename
);
q
->
payload
=
payload
;
...
...
@@ -155,7 +159,11 @@ int thread_save(void *data)
while
(
1
)
{
save_queue
*
q
=
pop_save
();
if
(
!
q
)
break
;
if
(
!
q
)
{
if
(
last_zipname
)
free
(
last_zipname
);
last_zipname
=
NULL
;
last_zf
=
NULL
;
break
;
}
if
(
!
zipname
||
strcmp
(
zipname
,
q
->
zfname
))
{
if
(
zf
)
{
...
...
@@ -167,7 +175,7 @@ int thread_save(void *data)
printf
(
"Saving zipname %s
\n
"
,
q
->
zfname
);
}
zipname
=
strdup
(
q
->
zfname
);
zf
=
zipOpen
(
zipname
,
APPEND_STATUS_CREATE
)
;
zf
=
q
->
zf
;
}
// printf("* %s<%s> : %ld\n", q->zfname, q->filename, q->payload_len);
...
...
@@ -258,6 +266,17 @@ static int serial_new(lua_State *L)
serial_type
*
s
=
(
serial_type
*
)
lua_newuserdata
(
L
,
sizeof
(
serial_type
));
auxiliar_setclass
(
L
,
"core{serial}"
,
-
1
);
zipFile
*
zf
=
NULL
;
if
(
!
last_zipname
||
strcmp
(
last_zipname
,
zfname
))
{
zf
=
zipOpen
(
zfname
,
APPEND_STATUS_CREATE
);
last_zf
=
zf
;
if
(
last_zipname
)
free
(
last_zipname
);
last_zipname
=
strdup
(
zfname
);
}
else
{
zf
=
last_zf
;
}
s
->
zf
=
zf
;
s
->
zfname
=
zfname
;
s
->
fname
=
fname_ref
;
s
->
fadd
=
fadd_ref
;
...
...
@@ -476,7 +495,7 @@ static int serial_tozip(lua_State *L)
}
writeTblFixed
(
s
,
"
\n
return d"
,
9
);
push_save
(
s
->
zfname
,
filename
,
s
->
buf
,
s
->
bufpos
);
push_save
(
s
->
zf
,
s
->
zfname
,
filename
,
s
->
buf
,
s
->
bufpos
);
lua_pushboolean
(
L
,
TRUE
);
return
1
;
...
...
This diff is collapsed.
Click to expand it.
src/serial.h
+
1
−
0
View file @
4a875fdf
...
...
@@ -26,6 +26,7 @@
extern
int
luaopen_serial
(
lua_State
*
L
);
typedef
struct
{
zipFile
*
zf
;
const
char
*
zfname
;
char
*
buf
;
long
bufpos
;
...
...
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