|
@@ -11477,19 +11477,19 @@ bool pc_setreg2(map_session_data *sd, const char *reg, int64 val) {
|
|
|
|
|
|
nullpo_retr(false, sd);
|
|
|
|
|
|
- if (reg[strlen(reg)-1] == '$') {
|
|
|
- ShowError("pc_setreg2: Invalid variable scope '%s'\n", reg);
|
|
|
+ if( is_string_variable( reg ) ){
|
|
|
+ ShowError( "pc_setreg2: Invalid variable '%s'. String type variables are not supported.\n", reg );
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ if( !not_server_variable( prefix ) ){
|
|
|
+ ShowError( "pc_setreg2: Invalid variable scope '%s'.\n", reg );
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
val = cap_value(val, INT_MIN, INT_MAX);
|
|
|
|
|
|
switch (prefix) {
|
|
|
- case '.':
|
|
|
- case '\'':
|
|
|
- case '$':
|
|
|
- ShowError("pc_setreg2: Invalid variable scope '%s'\n", reg);
|
|
|
- return false;
|
|
|
case '@':
|
|
|
return pc_setreg(sd, add_str(reg), val);
|
|
|
case '#':
|
|
@@ -11497,8 +11497,6 @@ bool pc_setreg2(map_session_data *sd, const char *reg, int64 val) {
|
|
|
default:
|
|
|
return pc_setglobalreg(sd, add_str(reg), val);
|
|
|
}
|
|
|
-
|
|
|
- return false;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -11512,17 +11510,17 @@ int64 pc_readreg2(map_session_data *sd, const char *reg) {
|
|
|
|
|
|
nullpo_ret(sd);
|
|
|
|
|
|
- if (reg[strlen(reg)-1] == '$') {
|
|
|
- ShowError("pc_readreg2: Invalid variable scope '%s'\n", reg);
|
|
|
+ if( is_string_variable( reg ) ){
|
|
|
+ ShowError( "pc_readreg2: Invalid variable '%s'. String type variables are not supported.\n", reg );
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ if( !not_server_variable( prefix ) ){
|
|
|
+ ShowError( "pc_readreg2: Invalid variable scope '%s'.\n", reg );
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
switch (prefix) {
|
|
|
- case '.':
|
|
|
- case '\'':
|
|
|
- case '$':
|
|
|
- ShowError("pc_readreg2: Invalid variable scope '%s'\n", reg);
|
|
|
- return 0;
|
|
|
case '@':
|
|
|
return pc_readreg(sd, add_str(reg));
|
|
|
case '#':
|
|
@@ -11530,8 +11528,6 @@ int64 pc_readreg2(map_session_data *sd, const char *reg) {
|
|
|
default:
|
|
|
return pc_readglobalreg(sd, add_str(reg));
|
|
|
}
|
|
|
-
|
|
|
- return 0;
|
|
|
}
|
|
|
|
|
|
/*==========================================
|