minor optimizations in ItemCreator
This commit is contained in:
+6
-7
@@ -1494,12 +1494,10 @@ void ItemCreator::generate_weapon_shop_item_special(
|
|||||||
pt.push(e.value);
|
pt.push(e.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pt.shuffle(this->random_crypt);
|
|
||||||
|
|
||||||
// TODO: mode should be an enum class, but I'm too lazy to make the types work
|
// Note: The original code shuffles pt and then pops a single value from it.
|
||||||
// out in the intermediate structures (WeightTableEntry and ProbabilityTable)
|
// For simplicity, we just sample a single value (and don't pop it) instead.
|
||||||
uint8_t mode = pt.pop();
|
switch (pt.sample(this->random_crypt)) {
|
||||||
switch (mode) {
|
|
||||||
case 0:
|
case 0:
|
||||||
item.data1[4] = 0;
|
item.data1[4] = 0;
|
||||||
break;
|
break;
|
||||||
@@ -1569,9 +1567,10 @@ void ItemCreator::generate_weapon_shop_item_bonus1(
|
|||||||
pt.push(e.value);
|
pt.push(e.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pt.shuffle(this->random_crypt);
|
|
||||||
|
|
||||||
item.data1[6] = pt.pop();
|
// Note: The original code shuffles pt and then pops a single value from it.
|
||||||
|
// For simplicity, we just sample a single value (and don't pop it) instead.
|
||||||
|
item.data1[6] = pt.sample(this->random_crypt);
|
||||||
if (item.data1[6] == 0) {
|
if (item.data1[6] == 0) {
|
||||||
item.data1[7] = 0;
|
item.data1[7] = 0;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user