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
2e44873a
Commit
2e44873a
authored
9 years ago
by
est31
Browse files
Options
Downloads
Patches
Plain Diff
Inventory manager style cleanup and further checks
parent
b2160bce
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/inventorymanager.cpp
+23
-16
23 additions, 16 deletions
src/inventorymanager.cpp
with
23 additions
and
16 deletions
src/inventorymanager.cpp
+
23
−
16
View file @
2e44873a
...
...
@@ -172,16 +172,16 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
Inventory
*
inv_from
=
mgr
->
getInventory
(
from_inv
);
Inventory
*
inv_to
=
mgr
->
getInventory
(
to_inv
);
if
(
!
inv_from
){
infostream
<<
"IMoveAction::apply(): FAIL: source inventory not found: "
<<
"from_inv=
\"
"
<<
from_inv
.
dump
()
<<
"
\"
"
<<
", to_inv=
\"
"
<<
to_inv
.
dump
()
<<
"
\"
"
<<
std
::
endl
;
if
(
!
inv_from
)
{
infostream
<<
"IMoveAction::apply(): FAIL: source inventory not found: "
<<
"from_inv=
\"
"
<<
from_inv
.
dump
()
<<
"
\"
"
<<
", to_inv=
\"
"
<<
to_inv
.
dump
()
<<
"
\"
"
<<
std
::
endl
;
return
;
}
if
(
!
inv_to
){
infostream
<<
"IMoveAction::apply(): FAIL: destination inventory not found: "
<<
"from_inv=
\"
"
<<
from_inv
.
dump
()
<<
"
\"
"
<<
", to_inv=
\"
"
<<
to_inv
.
dump
()
<<
"
\"
"
<<
std
::
endl
;
if
(
!
inv_to
)
{
infostream
<<
"IMoveAction::apply(): FAIL: destination inventory not found: "
<<
"from_inv=
\"
"
<<
from_inv
.
dump
()
<<
"
\"
"
<<
", to_inv=
\"
"
<<
to_inv
.
dump
()
<<
"
\"
"
<<
std
::
endl
;
return
;
}
...
...
@@ -191,16 +191,16 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
/*
If a list doesn't exist or the source item doesn't exist
*/
if
(
!
list_from
){
infostream
<<
"IMoveAction::apply(): FAIL: source list not found: "
<<
"from_inv=
\"
"
<<
from_inv
.
dump
()
<<
"
\"
"
<<
", from_list=
\"
"
<<
from_list
<<
"
\"
"
<<
std
::
endl
;
if
(
!
list_from
)
{
infostream
<<
"IMoveAction::apply(): FAIL: source list not found: "
<<
"from_inv=
\"
"
<<
from_inv
.
dump
()
<<
"
\"
"
<<
", from_list=
\"
"
<<
from_list
<<
"
\"
"
<<
std
::
endl
;
return
;
}
if
(
!
list_to
){
infostream
<<
"IMoveAction::apply(): FAIL: destination list not found: "
<<
"to_inv=
\"
"
<<
to_inv
.
dump
()
<<
"
\"
"
<<
", to_list=
\"
"
<<
to_list
<<
"
\"
"
<<
std
::
endl
;
if
(
!
list_to
)
{
infostream
<<
"IMoveAction::apply(): FAIL: destination list not found: "
<<
"to_inv=
\"
"
<<
to_inv
.
dump
()
<<
"
\"
"
<<
", to_list=
\"
"
<<
to_list
<<
"
\"
"
<<
std
::
endl
;
return
;
}
...
...
@@ -246,6 +246,13 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
move_somewhere
=
true
;
return
;
}
if
((
u16
)
to_i
>
list_to
->
getSize
())
{
infostream
<<
"IMoveAction::apply(): FAIL: destination index out of bounds: "
<<
"to_i="
<<
to_i
<<
", size="
<<
list_to
->
getSize
()
<<
std
::
endl
;
return
;
}
/*
Do not handle rollback if both inventories are that of the same player
*/
...
...
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