Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
illuna-minetest
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Illuna-Minetest
illuna-minetest
Commits
80acdab9
Commit
80acdab9
authored
14 years ago
by
Perttu Ahola
Browse files
Options
Downloads
Patches
Plain Diff
Commented out some debug output about saving players on server.
parent
1c776c3d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/environment.cpp
+13
-11
13 additions, 11 deletions
src/environment.cpp
with
13 additions
and
11 deletions
src/environment.cpp
+
13
−
11
View file @
80acdab9
...
@@ -322,7 +322,7 @@ void Environment::serializePlayers(const std::string &savedir)
...
@@ -322,7 +322,7 @@ void Environment::serializePlayers(const std::string &savedir)
// Full path to this file
// Full path to this file
std
::
string
path
=
players_path
+
"/"
+
player_files
[
i
].
name
;
std
::
string
path
=
players_path
+
"/"
+
player_files
[
i
].
name
;
dstream
<<
"Checking player file "
<<
path
<<
std
::
endl
;
//
dstream<<"Checking player file "<<path<<std::endl;
// Load player to see what is its name
// Load player to see what is its name
ServerRemotePlayer
testplayer
;
ServerRemotePlayer
testplayer
;
...
@@ -337,18 +337,18 @@ void Environment::serializePlayers(const std::string &savedir)
...
@@ -337,18 +337,18 @@ void Environment::serializePlayers(const std::string &savedir)
testplayer
.
deSerialize
(
is
);
testplayer
.
deSerialize
(
is
);
}
}
dstream
<<
"Loaded test player with name "
<<
testplayer
.
getName
()
<<
std
::
endl
;
//
dstream<<"Loaded test player with name "<<testplayer.getName()<<std::endl;
// Search for the player
// Search for the player
std
::
string
playername
=
testplayer
.
getName
();
std
::
string
playername
=
testplayer
.
getName
();
Player
*
player
=
getPlayer
(
playername
.
c_str
());
Player
*
player
=
getPlayer
(
playername
.
c_str
());
if
(
player
==
NULL
)
if
(
player
==
NULL
)
{
{
dstream
<<
"Didn't find matching player, ignoring file
."
<<
std
::
endl
;
dstream
<<
"Didn't find matching player, ignoring file
"
<<
path
<<
std
::
endl
;
continue
;
continue
;
}
}
dstream
<<
"Found matching player, overwriting."
<<
std
::
endl
;
//
dstream<<"Found matching player, overwriting."<<std::endl;
// OK, found. Save player there.
// OK, found. Save player there.
{
{
...
@@ -370,15 +370,15 @@ void Environment::serializePlayers(const std::string &savedir)
...
@@ -370,15 +370,15 @@ void Environment::serializePlayers(const std::string &savedir)
Player
*
player
=
*
i
;
Player
*
player
=
*
i
;
if
(
saved_players
.
find
(
player
)
!=
NULL
)
if
(
saved_players
.
find
(
player
)
!=
NULL
)
{
{
dstream
<<
"Player "
<<
player
->
getName
()
/*
dstream<<"Player "<<player->getName()
<<
" was already saved."
<<
std
::
endl
;
<<" was already saved."<<std::endl;
*/
continue
;
continue
;
}
}
std
::
string
playername
=
player
->
getName
();
std
::
string
playername
=
player
->
getName
();
// Don't save unnamed player
// Don't save unnamed player
if
(
playername
==
""
)
if
(
playername
==
""
)
{
{
dstream
<<
"Not saving unnamed player."
<<
std
::
endl
;
//
dstream<<"Not saving unnamed player."<<std::endl;
continue
;
continue
;
}
}
/*
/*
...
@@ -399,24 +399,26 @@ void Environment::serializePlayers(const std::string &savedir)
...
@@ -399,24 +399,26 @@ void Environment::serializePlayers(const std::string &savedir)
}
}
if
(
found
==
false
)
if
(
found
==
false
)
{
{
dstream
<<
"Didn't find free file for player"
<<
std
::
endl
;
dstream
<<
"
WARNING:
Didn't find free file for player"
<<
std
::
endl
;
continue
;
continue
;
}
}
{
{
dstream
<<
"Saving player "
<<
player
->
getName
()
<<
" to "
/*
dstream<<"Saving player "<<player->getName()<<" to "
<<
path
<<
std
::
endl
;
<<path<<std::endl;
*/
// Open file and serialize
// Open file and serialize
std
::
ofstream
os
(
path
.
c_str
(),
std
::
ios_base
::
binary
);
std
::
ofstream
os
(
path
.
c_str
(),
std
::
ios_base
::
binary
);
if
(
os
.
good
()
==
false
)
if
(
os
.
good
()
==
false
)
{
{
dstream
<<
"Failed to overwrite "
<<
path
<<
std
::
endl
;
dstream
<<
"
WARNING:
Failed to overwrite "
<<
path
<<
std
::
endl
;
continue
;
continue
;
}
}
player
->
serialize
(
os
);
player
->
serialize
(
os
);
saved_players
.
insert
(
player
,
true
);
saved_players
.
insert
(
player
,
true
);
}
}
}
}
//dstream<<"Saved "<<saved_players.size()<<" players."<<std::endl;
}
}
void
Environment
::
deSerializePlayers
(
const
std
::
string
&
savedir
)
void
Environment
::
deSerializePlayers
(
const
std
::
string
&
savedir
)
...
...
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