Print version of among-sus on client connection

This commit is contained in:
Ultracoolguy 2020-11-15 16:22:01 -04:00 committed by Eyal Sawady
parent 1e43573346
commit 6ff83c2761
No known key found for this signature in database
GPG Key ID: 604D3459E53A9952
2 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,6 @@
.POSIX:
all:
$(CC) -o among-sus $(CFLAGS) main.c $(LDFLAGS)
$(CC) -o among-sus $(CFLAGS) $$(git rev-parse --short HEAD >/dev/null 2>/dev/null && printf -- '-DVERSION="%s"' "$$(git rev-parse --short HEAD)" || printf -- '-DVERSION="unknown"') main.c $(LDFLAGS)
clean:
rm -f among-sus

3
main.c
View File

@ -1371,6 +1371,9 @@ welcome_player(int fd)
continue;
}
snprintf(buf, sizeof(buf), "among-sus server: version %s\n", VERSION);
write(fd, buf, strlen(buf));
if(state.stage != STAGE_LOBBY) {
snprintf(buf, sizeof(buf), "There is a game in progress, waiting for the match to finish...\n");
write(fd, buf, strlen(buf));