mirror of
https://github.com/minetest/minetest.git
synced 2024-11-24 00:23:46 +01:00
Inventory manager style cleanup and further checks
This commit is contained in:
parent
b2160bcecd
commit
2e44873ac9
@ -172,16 +172,16 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
|
|||||||
Inventory *inv_from = mgr->getInventory(from_inv);
|
Inventory *inv_from = mgr->getInventory(from_inv);
|
||||||
Inventory *inv_to = mgr->getInventory(to_inv);
|
Inventory *inv_to = mgr->getInventory(to_inv);
|
||||||
|
|
||||||
if(!inv_from){
|
if (!inv_from) {
|
||||||
infostream<<"IMoveAction::apply(): FAIL: source inventory not found: "
|
infostream << "IMoveAction::apply(): FAIL: source inventory not found: "
|
||||||
<<"from_inv=\""<<from_inv.dump()<<"\""
|
<< "from_inv=\""<<from_inv.dump() << "\""
|
||||||
<<", to_inv=\""<<to_inv.dump()<<"\""<<std::endl;
|
<< ", to_inv=\"" << to_inv.dump() << "\"" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!inv_to){
|
if (!inv_to) {
|
||||||
infostream<<"IMoveAction::apply(): FAIL: destination inventory not found: "
|
infostream << "IMoveAction::apply(): FAIL: destination inventory not found: "
|
||||||
<<"from_inv=\""<<from_inv.dump()<<"\""
|
<< "from_inv=\"" << from_inv.dump() << "\""
|
||||||
<<", to_inv=\""<<to_inv.dump()<<"\""<<std::endl;
|
<< ", to_inv=\"" << to_inv.dump() << "\"" << std::endl;
|
||||||
return;
|
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 a list doesn't exist or the source item doesn't exist
|
||||||
*/
|
*/
|
||||||
if(!list_from){
|
if (!list_from) {
|
||||||
infostream<<"IMoveAction::apply(): FAIL: source list not found: "
|
infostream << "IMoveAction::apply(): FAIL: source list not found: "
|
||||||
<<"from_inv=\""<<from_inv.dump()<<"\""
|
<< "from_inv=\"" << from_inv.dump() << "\""
|
||||||
<<", from_list=\""<<from_list<<"\""<<std::endl;
|
<< ", from_list=\"" << from_list << "\"" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(!list_to){
|
if (!list_to) {
|
||||||
infostream<<"IMoveAction::apply(): FAIL: destination list not found: "
|
infostream << "IMoveAction::apply(): FAIL: destination list not found: "
|
||||||
<<"to_inv=\""<<to_inv.dump()<<"\""
|
<< "to_inv=\""<<to_inv.dump() << "\""
|
||||||
<<", to_list=\""<<to_list<<"\""<<std::endl;
|
<< ", to_list=\"" << to_list << "\"" << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,6 +246,13 @@ void IMoveAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
|
|||||||
move_somewhere = true;
|
move_somewhere = true;
|
||||||
return;
|
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
|
Do not handle rollback if both inventories are that of the same player
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user