Made the char-server name available (#5891)

Co-authored-by: Daegaladh <Daegaladh@users.noreply.github.com>
This commit is contained in:
Lemongrass3110
2021-04-26 19:12:08 +02:00
committed by GitHub
parent 704bf33649
commit 9837fcd2b9
3 changed files with 18 additions and 8 deletions

View File

@@ -162,24 +162,26 @@ void chmapif_sendall_playercount(int users){
* Send some misc info to new map-server.
* - Server name for whisper name
* - Default map
* HZ 0x2afb <size>.W <status>.B <name>.24B <mapname>.11B <map_x>.W <map_y>.W
* HZ 0x2afb <size>.W <status>.B <whisper name>.24B <mapname>.11B <map_x>.W <map_y>.W <server name>.24B
* @param fd
**/
void chmapif_send_misc(int fd) {
uint16 offs = 5;
unsigned char buf[45];
unsigned char buf[45+NAME_LENGTH];
memset(buf, '\0', sizeof(buf));
WBUFW(buf, 0) = 0x2afb;
// 0 succes, 1:failure
WBUFB(buf, 4) = 0;
// Send name for wisp to player
memcpy(WBUFP(buf, 5), charserv_config.wisp_server_name, NAME_LENGTH);
safestrncpy( WBUFCP( buf, 5 ), charserv_config.wisp_server_name, NAME_LENGTH );
// Default map
memcpy(WBUFP(buf, (offs+=NAME_LENGTH)), charserv_config.default_map, MAP_NAME_LENGTH); // 29
safestrncpy( WBUFCP( buf, ( offs += NAME_LENGTH ) ), charserv_config.default_map, MAP_NAME_LENGTH ); // 29
WBUFW(buf, (offs+=MAP_NAME_LENGTH)) = charserv_config.default_map_x; // 41
WBUFW(buf, (offs+=2)) = charserv_config.default_map_y; // 43
offs+=2;
safestrncpy( WBUFCP( buf, offs ), charserv_config.server_name, sizeof( charserv_config.server_name ) ); // 45
offs += NAME_LENGTH;
// Length
WBUFW(buf, 2) = offs;