Ver código fonte

Follow up to 4af46ba
* Added a map session data check back into the GM kick process so atcommand kickall does not remove vendors or buyingstores.
* Adjusted the checks for when a player logs back into their account so it properly removes any vending or buyinstore information.

aleos 8 anos atrás
pai
commit
e8b9cf06ce
2 arquivos alterados com 15 adições e 17 exclusões
  1. 6 10
      src/map/chrif.c
  2. 9 7
      src/map/clif.c

+ 6 - 10
src/map/chrif.c

@@ -1173,17 +1173,13 @@ int chrif_disconnectplayer(int fd) {
 		return -1;
 	}
 
-	if (!sd->fd) { //No connection
-		if (sd->state.autotrade){
-			if( sd->state.vending ){
-				vending_closevending(sd);
-			}
-			else if( sd->state.buyingstore ){
-				buyingstore_close(sd);
-			}
+	if (sd->state.vending)
+		vending_closevending(sd);
+	else if (sd->state.buyingstore)
+		buyingstore_close(sd);
 
-			map_quit(sd); //Remove it.
-		}
+	if (!sd->fd) {
+		map_quit(sd);
 		//Else we don't remove it because the char should have a timer to remove the player because it force-quit before,
 		//and we don't want them kicking their previous instance before the 10 secs penalty time passes. [Skotlex]
 		return 0;

+ 9 - 7
src/map/clif.c

@@ -8937,23 +8937,25 @@ void clif_GM_kick(struct map_session_data *sd, struct map_session_data *tsd)
 {
 	int fd;
 
-	nullpo_retv(sd);
 	nullpo_retv(tsd);
 
 	fd = tsd->fd;
 
-	// Close vending/buyingstore
-	if (tsd->state.vending)
-		vending_closevending(tsd);
-	else if (tsd->state.buyingstore)
-		buyingstore_close(tsd);
+	if (sd) {
+		// Close vending/buyingstore
+		if (tsd->state.vending)
+			vending_closevending(tsd);
+		else if (tsd->state.buyingstore)
+			buyingstore_close(tsd);
+	}
 
 	if (fd > 0)
 		clif_authfail_fd(fd, 15);
 	else
 		map_quit(tsd);
 
-	clif_GM_kickack(sd, tsd->status.account_id);
+	if (sd)
+		clif_GM_kickack(sd, tsd->status.account_id);
 }