Corrected NPC view constant verification (#4398)
* Fixes #4397. * Corrected NPC view constant verification stopping at the first digit found resulting in invalid results. Thanks to @Lemongrass3110!
This commit is contained in:
parent
3c78691d2d
commit
995fb2a0a1
@ -374,7 +374,7 @@ que_ng,30,65,3 script Kuuga Gai#nq 730,{
|
||||
}
|
||||
}
|
||||
|
||||
einbroch,184,194,3 script Suspicious Man#nq 881,{
|
||||
einbroch,184,194,3 script Suspicious Man#nq 881,{
|
||||
if (NINJ_Q == 1) {
|
||||
mes "[Suspicious Man]";
|
||||
mes "I've traveled to many";
|
||||
|
@ -40,7 +40,7 @@ OnStart:
|
||||
end;
|
||||
}
|
||||
|
||||
prt_are_in,76,87,3 script Helper#party 67,4,4,{
|
||||
prt_are_in,76,87,3 script Helper#party 67,4,4,{
|
||||
if($arn_partywait == 0) {
|
||||
set $arn_partywait,1;
|
||||
emotion ET_SURPRISE;
|
||||
|
@ -383,7 +383,7 @@ SubGarrison_:
|
||||
}
|
||||
}
|
||||
|
||||
lighthalzen,322,247,6 script Ravey 86,{
|
||||
lighthalzen,322,247,6 script Ravey 86,{
|
||||
|
||||
if(gun_gs == 2)
|
||||
{
|
||||
|
@ -11016,7 +11016,7 @@ lighthalzen,141,162,3 script Old Man#reken 85,{
|
||||
close;
|
||||
}
|
||||
|
||||
einbroch,55,52,3 script Laboratory Guard#reken 852,{
|
||||
einbroch,55,52,3 script Laboratory Guard#reken 852,{
|
||||
|
||||
if(lhz_rekenber == 3)
|
||||
{
|
||||
|
@ -383,7 +383,7 @@ OnMobDead:
|
||||
}
|
||||
|
||||
|
||||
1@rev,34,126,4 script Grim Reaper Ankou#RZ Event_3 3029,{ end; }
|
||||
1@rev,34,126,4 script Grim Reaper Ankou#RZ Event_3 3029,{ end; }
|
||||
1@rev,112,126,4 duplicate(Grim Reaper Ankou#RZ Event_3) Grim Reaper Ankou#RZ Event_4 3029
|
||||
1@rev,34,55,4 duplicate(Grim Reaper Ankou#RZ Event_3) Grim Reaper Ankou#RZ Event_5 3029
|
||||
1@rev,112,48,4 duplicate(Grim Reaper Ankou#RZ Event_3) Grim Reaper Ankou#RZ Event_6 3029
|
||||
|
@ -2520,7 +2520,7 @@ static void npc_parsename(struct npc_data* nd, const char* name, const char* sta
|
||||
* Support for using Constants in place of NPC View IDs.
|
||||
*/
|
||||
int npc_parseview(const char* w4, const char* start, const char* buffer, const char* filepath) {
|
||||
int val = JT_FAKENPC, i = 0;
|
||||
int i = 0;
|
||||
char viewid[1024]; // Max size of name from const.txt, see read_constdb.
|
||||
|
||||
// Extract view ID / constant
|
||||
@ -2533,36 +2533,21 @@ int npc_parseview(const char* w4, const char* start, const char* buffer, const c
|
||||
|
||||
safestrncpy(viewid, w4, i+=1);
|
||||
|
||||
char *pid;
|
||||
int val = strtol(viewid, &pid, 0);
|
||||
|
||||
// Check if view id is not an ID (only numbers).
|
||||
if(!npc_viewisid(viewid)) {
|
||||
if (pid != nullptr && *pid != '\0') {
|
||||
// Check if constant exists and get its value.
|
||||
if(!script_get_constant(viewid, &val)) {
|
||||
ShowWarning("npc_parseview: Invalid NPC constant '%s' specified in file '%s', line'%d'. Defaulting to INVISIBLE. \n", viewid, filepath, strline(buffer,start-buffer));
|
||||
val = JT_INVISIBLE;
|
||||
}
|
||||
} else {
|
||||
// NPC has an ID specified for view id.
|
||||
val = atoi(w4);
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if given view is an ID or constant.
|
||||
*/
|
||||
bool npc_viewisid(const char * viewid)
|
||||
{
|
||||
if(atoi(viewid) != JT_FAKENPC) {
|
||||
// Loop through view, looking for non-numeric character.
|
||||
while (*viewid) {
|
||||
if (ISDIGIT(*viewid++) == 0) return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a bare NPC object.
|
||||
* @param m: Map ID
|
||||
|
@ -1212,7 +1212,6 @@ int npc_buysellsel(struct map_session_data* sd, int id, int type);
|
||||
uint8 npc_buylist(struct map_session_data* sd, uint16 n, struct s_npc_buy_list *item_list);
|
||||
uint8 npc_selllist(struct map_session_data* sd, int n, unsigned short *item_list);
|
||||
void npc_parse_mob2(struct spawn_data* mob);
|
||||
bool npc_viewisid(const char * viewid);
|
||||
struct npc_data* npc_add_warp(char* name, short from_mapid, short from_x, short from_y, short xs, short ys, unsigned short to_mapindex, short to_x, short to_y);
|
||||
int npc_globalmessage(const char* name,const char* mes);
|
||||
const char *npc_get_script_event_name(int npce_index);
|
||||
|
Loading…
x
Reference in New Issue
Block a user