|
@@ -6707,7 +6707,7 @@ BUILDIN_FUNC(viewpoint)
|
|
* @param x First position of random option id array from the script
|
|
* @param x First position of random option id array from the script
|
|
**/
|
|
**/
|
|
static int script_getitem_randomoption(struct script_state *st, struct item *it, const char *funcname, int x) {
|
|
static int script_getitem_randomoption(struct script_state *st, struct item *it, const char *funcname, int x) {
|
|
- int i, opt_id_n, opt_val_n, opt_param_n;
|
|
|
|
|
|
+ int i, opt_id_n;
|
|
struct script_data *opt_id = script_getdata(st,x);
|
|
struct script_data *opt_id = script_getdata(st,x);
|
|
struct script_data *opt_val = script_getdata(st,x+1);
|
|
struct script_data *opt_val = script_getdata(st,x+1);
|
|
struct script_data *opt_param = script_getdata(st,x+2);
|
|
struct script_data *opt_param = script_getdata(st,x+2);
|
|
@@ -6719,17 +6719,17 @@ static int script_getitem_randomoption(struct script_state *st, struct item *it,
|
|
int32 opt_param_id, opt_param_idx;
|
|
int32 opt_param_id, opt_param_idx;
|
|
struct reg_db *opt_id_ref = NULL, *opt_val_ref = NULL, *opt_param_ref = NULL;
|
|
struct reg_db *opt_id_ref = NULL, *opt_val_ref = NULL, *opt_param_ref = NULL;
|
|
|
|
|
|
- if (opt_id_var[strlen(opt_id_var)-1] == '$') {
|
|
|
|
|
|
+ if (is_string_variable(opt_id_var)) {
|
|
ShowError("buildin_%s: The array %s is not numeric type.\n", funcname, opt_id_var);
|
|
ShowError("buildin_%s: The array %s is not numeric type.\n", funcname, opt_id_var);
|
|
return SCRIPT_CMD_FAILURE;
|
|
return SCRIPT_CMD_FAILURE;
|
|
}
|
|
}
|
|
|
|
|
|
- if (opt_val_var[strlen(opt_val_var)-1] == '$') {
|
|
|
|
|
|
+ if (is_string_variable(opt_val_var)) {
|
|
ShowError("buildin_%s: The array %s is not numeric type.\n", funcname, opt_val_var);
|
|
ShowError("buildin_%s: The array %s is not numeric type.\n", funcname, opt_val_var);
|
|
return SCRIPT_CMD_FAILURE;
|
|
return SCRIPT_CMD_FAILURE;
|
|
}
|
|
}
|
|
|
|
|
|
- if (opt_param_var[strlen(opt_param_var)-1] == '$') {
|
|
|
|
|
|
+ if (is_string_variable(opt_param_var)) {
|
|
ShowError("buildin_%s: The array %s is not numeric type.\n", funcname, opt_param_var);
|
|
ShowError("buildin_%s: The array %s is not numeric type.\n", funcname, opt_param_var);
|
|
return SCRIPT_CMD_FAILURE;
|
|
return SCRIPT_CMD_FAILURE;
|
|
}
|
|
}
|
|
@@ -6745,18 +6745,6 @@ static int script_getitem_randomoption(struct script_state *st, struct item *it,
|
|
opt_val_ref = reference_getref(opt_val);
|
|
opt_val_ref = reference_getref(opt_val);
|
|
opt_param_ref = reference_getref(opt_param);
|
|
opt_param_ref = reference_getref(opt_param);
|
|
|
|
|
|
- opt_val_n = script_array_highest_key(st, NULL, opt_val_var, opt_val_ref);
|
|
|
|
- opt_param_n = script_array_highest_key(st, NULL, opt_param_var, opt_param_ref);
|
|
|
|
-
|
|
|
|
- if (opt_val_n < 1) {
|
|
|
|
- ShowError("buildin_%s: No option value listed.\n", funcname);
|
|
|
|
- return SCRIPT_CMD_FAILURE;
|
|
|
|
- }
|
|
|
|
- if (opt_param_n < 1) {
|
|
|
|
- ShowError("buildin_%s: No option parameter listed.\n", funcname);
|
|
|
|
- return SCRIPT_CMD_FAILURE;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
opt_id_id = reference_getid(opt_id);
|
|
opt_id_id = reference_getid(opt_id);
|
|
opt_val_id = reference_getid(opt_val);
|
|
opt_val_id = reference_getid(opt_val);
|
|
opt_param_id = reference_getid(opt_param);
|
|
opt_param_id = reference_getid(opt_param);
|