@@ -646,8 +646,6 @@ void IDropAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
646
646
if (src_can_take_count != -1 && src_can_take_count < take_count)
647
647
take_count = src_can_take_count;
648
648
649
- int actually_dropped_count = 0 ;
650
-
651
649
// Update item due executed callbacks
652
650
src_item = list_from->getItem (from_i);
653
651
@@ -656,10 +654,12 @@ void IDropAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
656
654
item1.count = take_count;
657
655
if (PLAYER_TO_SA (player)->item_OnDrop (item1, player,
658
656
player->getBasePosition ())) {
659
- actually_dropped_count = take_count - item1.count ;
657
+ int actually_dropped_count = take_count - item1.count ;
660
658
661
659
if (actually_dropped_count == 0 ) {
662
660
infostream<<" Actually dropped no items" <<std::endl;
661
+ // Revert client prediction
662
+ mgr->setInventoryModified (from_inv);
663
663
return ;
664
664
}
665
665
@@ -670,9 +670,10 @@ void IDropAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
670
670
671
671
if (item2.count != actually_dropped_count)
672
672
errorstream<<" Could not take dropped count of items" <<std::endl;
673
-
674
- mgr->setInventoryModified (from_inv);
675
673
}
674
+
675
+ src_item.count = actually_dropped_count;
676
+ mgr->setInventoryModified (from_inv);
676
677
}
677
678
678
679
infostream<<" IDropAction::apply(): dropped "
@@ -681,7 +682,6 @@ void IDropAction::apply(InventoryManager *mgr, ServerActiveObject *player, IGame
681
682
<<" i=" <<from_i
682
683
<<std::endl;
683
684
684
- src_item.count = actually_dropped_count;
685
685
686
686
/*
687
687
Report drop to endpoints
0 commit comments