Skip to content

Commit

Permalink
fix incorrect virtual inventory id in scripting
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Dec 5, 2024
1 parent 458186d commit 92cad2b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/items/Inventories.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ std::shared_ptr<Inventory> Inventories::create(size_t size) {
std::shared_ptr<Inventory> Inventories::createVirtual(size_t size) {
int64_t id;
do {
id = -std::max<int64_t>(1LL, std::llabs(random.rand64()));
// lua does not support long integers because Number is floating-point
// type. Changing int_consumer to use 64 bit integer does not change anything
id = -std::max<int64_t>(1LL, std::llabs(random.rand64() % 1000'000'000));
} while (map.find(id) != map.end());

auto inv = std::make_shared<Inventory>(id, size);
Expand Down

0 comments on commit 92cad2b

Please sign in to comment.