mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix incorrect virtual inventory id in scripting
This commit is contained in:
parent
d0fbbeecbe
commit
f4b80b1740
1 changed files with 3 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue