diff options
Diffstat (limited to 'src/char_sql/char.c')
-rw-r--r-- | src/char_sql/char.c | 53 |
1 files changed, 25 insertions, 28 deletions
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;
|