修复宕机问题
This commit is contained in:
parent
6d76bf63cd
commit
654630c3d3
@ -1431,8 +1431,15 @@ Weapon* Creature::ChooseNextWeapon(int curr_weapon_slot_id, int begin_slot_id, i
|
||||
for (int i = 1; i <= (end_slot_id - begin_slot_id); ++i) {
|
||||
int slot_id = begin_slot_id +
|
||||
(i + curr_weapon_slot_id - begin_slot_id) % (end_slot_id - begin_slot_id + 1);
|
||||
if (weapons[slot_id].weapon_id != 0) {
|
||||
next_weapon = &weapons[slot_id];
|
||||
int idx = -1;
|
||||
if (slot_id >= SPEC1_IS_BEGIN && slot_id <= SPEC1_IS_END) {
|
||||
idx = SPEC1_SLOT_BEGIN + (slot_id - SPEC1_IS_BEGIN);
|
||||
}
|
||||
if (slot_id >= SPEC2_IS_BEGIN && slot_id <= SPEC2_IS_END) {
|
||||
idx = SPEC2_SLOT_BEGIN + (slot_id - SPEC2_IS_BEGIN);
|
||||
}
|
||||
if (idx != -1 && weapons.at(idx).weapon_id != 0) {
|
||||
next_weapon = &weapons[idx];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user