Follow up to 60d59124a357510a15d0039f42fce187a3104caa.

* Fixes a map server crash due to wrong casting
* Fixes #2406
* Thanks to @keitenai!
This commit is contained in:
Jey 2017-09-07 13:18:28 +02:00
parent 528539f621
commit 38d225c444

View File

@ -6760,11 +6760,11 @@ static int script_getitem_randomoption(struct script_state *st, struct item *it,
opt_param_idx = reference_getindex(opt_param);
for (i = 0; i < opt_id_n && i < MAX_ITEM_RDM_OPT; i++) {
it->option[i].id = *reinterpret_cast<short*>(__64BPRTSIZE(get_val2(st,reference_uid(opt_id_id,opt_id_idx+i),opt_id_ref)));
it->option[i].id = (short)(__64BPRTSIZE(get_val2(st,reference_uid(opt_id_id,opt_id_idx+i),opt_id_ref)));
script_removetop(st, -1, 0);
it->option[i].value = *reinterpret_cast<short*>(__64BPRTSIZE(get_val2(st,reference_uid(opt_val_id,opt_val_idx+i),opt_val_ref)));
it->option[i].value = (short)(__64BPRTSIZE(get_val2(st,reference_uid(opt_val_id,opt_val_idx+i),opt_val_ref)));
script_removetop(st, -1, 0);
it->option[i].param = *reinterpret_cast<char*>(__64BPRTSIZE(get_val2(st,reference_uid(opt_param_id,opt_param_idx+i),opt_param_ref)));
it->option[i].param = (char)(__64BPRTSIZE(get_val2(st,reference_uid(opt_param_id,opt_param_idx+i),opt_param_ref)));
script_removetop(st, -1, 0);
}
return SCRIPT_CMD_SUCCESS;