make drop_item less confusing

This commit is contained in:
Martin Michelsen
2023-06-11 12:21:01 -07:00
parent 0c12e6c4bc
commit a963c3316c
+6 -8
View File
@@ -960,10 +960,14 @@ static bool drop_item(
float z, float z,
uint16_t request_id) { uint16_t request_id) {
PlayerInventoryItem item; // If the game is not BB, forward the request to the leader instead of
// generating the item drop command
if (l->version != GameVersion::BB) {
return false;
}
// If the game is BB, run the rare + common drop logic // If the game is BB, run the rare + common drop logic
if (l->version == GameVersion::BB) { PlayerInventoryItem item;
if (!l->item_creator.get()) { if (!l->item_creator.get()) {
throw runtime_error("received box drop subcommand without item creator present"); throw runtime_error("received box drop subcommand without item creator present");
} }
@@ -975,12 +979,6 @@ static bool drop_item(
item.data = l->item_creator->on_box_item_drop(area); item.data = l->item_creator->on_box_item_drop(area);
} }
// If the game is not BB, forward the request to the leader instead of
// generating the item drop command
} else {
return false;
}
item.data.id = l->generate_item_id(0xFF); item.data.id = l->generate_item_id(0xFF);
if (l->flags & Lobby::Flag::ITEM_TRACKING_ENABLED) { if (l->flags & Lobby::Flag::ITEM_TRACKING_ENABLED) {