Skip to content

Commit c98c7af

Browse files
Show protocol version; small fix to settle on the smaller of supported protocols.
1 parent e6a64a3 commit c98c7af

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/command.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2259,8 +2259,10 @@ int command(int cn, char *ptr) // 1=ok, 0=repeat
22592259

22602260
if ((len = cmdcmp(ptr, "version", 4))) {
22612261
extern volatile int global_online;
2262+
22622263
log_char(cn, LOG_SYSTEM, 0, "Server Version %d.%d.%d (compiled %s %s)", VERSION >> 24, (VERSION >> 16) & 255, VERSION & 65535, VER_TIME, VER_DATE);
22632264
log_char(cn, LOG_SYSTEM, 0, "Area %d, Mirror %d, %d online (global: %d)", areaID, areaM, online, global_online);
2265+
log_char(cn, LOG_SYSTEM, 0, "Protocol version %d, view distance %d", get_char_version(cn), get_char_viewdist(cn));
22642266
return 1;
22652267
}
22662268

src/player.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ static void read_login(int nr) {
354354
// clients v1 and better understand SV_PROTOCOL, so we tell them the server version
355355
if (player[nr]->client_version > 0) {
356356
buf[0] = SV_PROTOCOL;
357-
buf[1] = SERVER_PROTOCOL_VERSION;
357+
buf[1] = min(player[nr]->client_version, SERVER_PROTOCOL_VERSION);
358358
psend(nr, buf, 2);
359359
}
360360

@@ -2854,6 +2854,15 @@ int get_char_version(int cn) {
28542854
else return 0;
28552855
}
28562856

2857+
int get_char_viewdist(int cn) {
2858+
int nr;
2859+
2860+
if (!player) return 0;
2861+
2862+
if ((nr = ch[cn].player) && player[nr]) return player[nr]->dist;
2863+
else return 0;
2864+
}
2865+
28572866
void player_areainfo(int nr, unsigned short cmd, unsigned short x, unsigned short y) {
28582867
char buf[80];
28592868

src/player.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ unsigned int get_player_addr(int nr);
159159
void sendquestlog(int cn, int nr);
160160
int get_player_version(int nr);
161161
int get_char_version(int cn);
162+
int get_char_viewdist(int cn);
162163

163164
#define AIC_SETID 0
164165
#define AIC_CLEAR 1

0 commit comments

Comments
 (0)