1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-29 11:56:44 +02:00

Add networking to game engine / add multiplayer chess

This commit is contained in:
jfreegman
2021-01-17 13:29:13 -05:00
parent 60bdcf0ba5
commit 7aeb1a0aac
18 changed files with 1186 additions and 234 deletions

View File

@ -373,7 +373,8 @@ void cmd_game(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
}
}
int ret = game_initialize(self, m, type, force_small);
uint32_t id = rand();
int ret = game_initialize(self, m, type, id, NULL, 0, force_small);
switch (ret) {
case 0: {
@ -386,6 +387,18 @@ void cmd_game(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MA
return;
}
case -2: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Game failed to initialize: Network error.");
return;
}
case -3: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0,
"Game is multiplayer only. Try the command again in the chat window of the contact you wish to play with.");
return;
}
default: {
line_info_add(self, false, NULL, NULL, SYS_MSG, 0, 0, "Game failed to initialize (error %d)", ret);
return;