Atcommand.c remove warning message when compiling

ThyroDree

New member
Messages
556
Points
0
Location
Philippines
Github
bosxkate23
Emulator
Anyone can help me fix this warning showing on my atcommand.c when compiling?

atcommand.c: In function ‘atcommand_pk’:
../common/nullpo.h:69:23: warning: nonnull argument ‘sd’ compared to NULL [-Wnonnull-compare]
#define nullpo_chk(t) ( (t) != NULL ? false : (nullpo->assert_report(__FILE__, __LINE__, __func__, #t, "nullpo info"), true) )
^
../common/nullpo.h:124:11: note: in expansion of macro ‘nullpo_chk’
do { if (nullpo_chk(t)) return(ret); } while(0)
^~~~~~~~~~
atcommand.c:9732:2: note: in expansion of macro ‘nullpo_retr’
nullpo_retr(-1, sd);
^~~~~~~~~~~


This warning shows after I added a source mod of PK which is this lines..

Code:
+ACMD(pk) {
+
+	int64 tick = timer->gettick();
+
+	nullpo_retr(-1, sd);
+
+	if( map->list[sd->bl.m].flag.pvp || map->list[sd->bl.m].flag.gvg || map->list[sd->bl.m].flag.gvg_castle || map->list[sd->bl.m].flag.gvg_castle || map->list[sd->bl.m].flag.battleground ) {
+		clif->message(sd->fd, "You can only change your PK state on non-PVP maps.");
+		return false;
+	}
+
+	if(DIFF_TICK(sd->pk_mode_tick,tick) > 0){ //check the delay before use this command again
+		clif->message(sd->fd, "You can turn OFF your PK state after 3 minutes.");
+		return false;
+	}
+	else {
+		if (!sd->state.pk_mode) {
+			sd->state.pk_mode = 1;
+			clif->message(sd->fd, "Your PK state is now OFF");
+			sd->pk_mode_tick = tick + 0; //set the delay here
+		} else {
+			sd->state.pk_mode = 0;
+			clif->message(sd->fd, "Your PK state is now ON");
+			sd->pk_mode_tick = tick + 300000; //set the delay here
+		}
+	}
+	return true;
+}
+
 
remove line with:

Code:
nullpo_retr(-1, sd);
 
Back
Top