Jump to content
  • 0
ThyroDree

Atcommand.c remove warning message when compiling

Question

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..


+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;
+}
+

 

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
1 hour ago, 4144 said:

remove line with:

nullpo_retr(-1, sd);


nullpo_retr(-1, sd);

Thank you, it works!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.