From 75d8e3d12caacd6a538982bb5c31ff1ce6f34527 Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 11 Oct 2006 19:49:55 +0000 Subject: - Cleaned up unitattack, unittalk and unitdeadsit - Updated status_get_name to take into account fakename, also cleaned it up. - Cleaned up the char-server code when the last point of a player is not found. First it'll check if there's any mapserver online, and then, if there is, it'll look for the major cities. If this fails, then the player will be told server is closed instead of trying to send him to a "random map". git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8967 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/char_sql/char.c | 53 +++++++++++++++++++++++++---------------------------- 1 file changed, 25 insertions(+), 28 deletions(-) (limited to 'src/char_sql') diff --git a/src/char_sql/char.c b/src/char_sql/char.c index 629bbade8..b0c90be7a 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -3279,48 +3279,45 @@ int parse_char(int fd) { // if map is not found, we check major cities if (i < 0) { unsigned short j; - ShowWarning("Unable to find map-server for '%s', resorting to sending to a major city.\n", mapindex_id2name(char_dat.last_point.map)); + //First check that there's actually a map server online. + for(j = 0; j < MAX_MAP_SERVERS; j++) + if (server_fd[j] >= 0 && server[j].map[0]) + break; + if (j == MAX_MAP_SERVERS) { + ShowInfo("Connection Closed. No map servers available.\n"); + WFIFOHEAD(fd, 3); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = 1; // 01 = Server closed + WFIFOSET(fd,3); + break; + } if ((i = search_mapserver((j=mapindex_name2id(MAP_PRONTERA)),-1,-1)) >= 0) { - char_dat.last_point.map = j; - char_dat.last_point.x = 273; // savepoint coordinates + char_dat.last_point.x = 273; char_dat.last_point.y = 354; } else if ((i = search_mapserver((j=mapindex_name2id(MAP_GEFFEN)),-1,-1)) >= 0) { - char_dat.last_point.map = j; - char_dat.last_point.x = 120; // savepoint coordinates + char_dat.last_point.x = 120; char_dat.last_point.y = 100; } else if ((i = search_mapserver((j=mapindex_name2id(MAP_MORROC)),-1,-1)) >= 0) { - char_dat.last_point.map = j; - char_dat.last_point.x = 160; // savepoint coordinates + char_dat.last_point.x = 160; char_dat.last_point.y = 94; } else if ((i = search_mapserver((j=mapindex_name2id(MAP_ALBERTA)),-1,-1)) >= 0) { - char_dat.last_point.map = j; - char_dat.last_point.x = 116; // savepoint coordinates + char_dat.last_point.x = 116; char_dat.last_point.y = 57; } else if ((i = search_mapserver((j=mapindex_name2id(MAP_PAYON)),-1,-1)) >= 0) { - char_dat.last_point.map = j; - char_dat.last_point.x = 87; // savepoint coordinates + char_dat.last_point.x = 87; char_dat.last_point.y = 117; } else if ((i = search_mapserver((j=mapindex_name2id(MAP_IZLUDE)),-1,-1)) >= 0) { - char_dat.last_point.map = j; - char_dat.last_point.x = 94; // savepoint coordinates + char_dat.last_point.x = 94; char_dat.last_point.y = 103; } else { - // get first online server - i = 0; - for(j = 0; j < MAX_MAP_SERVERS; j++) - if (server_fd[j] > 0 && server[j].map[0]) { - i = j; - ShowDebug("Map-server #%d found with a map: '%s'.\n", j, mapindex_id2name(server[j].map[0])); - break; - } - // if no map-servers are connected, we send: server closed - if (j == MAX_MAP_SERVERS) { - WFIFOW(fd,0) = 0x81; - WFIFOB(fd,2) = 1; // 01 = Server closed - WFIFOSET(fd,3); - break; - } + ShowInfo("Connection Closed. No map server available that has a major city, and unable to find map-server for '%s'.\n", mapindex_id2name(char_dat.last_point.map)); + WFIFOW(fd,0) = 0x81; + WFIFOB(fd,2) = 1; // 01 = Server closed + WFIFOSET(fd,3); + break; } + ShowWarning("Unable to find map-server for '%s', sending to major city '%s'.\n", mapindex_id2name(char_dat.last_point.map), mapindex_id2name(j)); + char_dat.last_point.map = j; } WFIFOW(fd, 0) =0x71; WFIFOL(fd, 2) =char_dat.char_id; -- cgit v1.2.3-70-g09d2