1
0
mirror of https://github.com/Tha14/toxic.git synced 2025-06-30 22:16:44 +02:00

Add ability to compile without game support

This commit is contained in:
jfreegman
2021-01-18 22:37:14 -05:00
parent 7aeb1a0aac
commit 7abf6388f8
19 changed files with 121 additions and 17 deletions

View File

@ -30,7 +30,6 @@
#include "conference.h"
#include "file_transfers.h"
#include "friendlist.h"
#include "game_base.h"
#include "line_info.h"
#include "misc_tools.h"
#include "prompt.h"
@ -38,6 +37,10 @@
#include "toxic.h"
#include "windows.h"
#ifdef GAMES
#include "game_base.h"
#endif
extern char *DATA_FILE;
extern struct Winthread Winthread;
@ -335,6 +338,8 @@ void on_lossless_custom_packet(Tox *m, uint32_t friendnumber, const uint8_t *dat
uint8_t type = data[0];
switch (type) {
#ifdef GAMES
case CUSTOM_PACKET_GAME_INVITE: {
for (size_t i = 0; i < MAX_WINDOWS_NUM; ++i) {
ToxWindow *window = windows[i];
@ -359,6 +364,8 @@ void on_lossless_custom_packet(Tox *m, uint32_t friendnumber, const uint8_t *dat
break;
}
#endif // GAMES
default: {
fprintf(stderr, "Got unknown custom packet of type: %u\n", type);
return;
@ -502,6 +509,8 @@ void on_window_resize(void)
continue;
}
#ifdef GAMES
if (w->type == WINDOW_TYPE_GAME) {
delwin(w->window_bar);
delwin(w->window);
@ -515,6 +524,8 @@ void on_window_resize(void)
continue;
}
#endif // GAMES
if (w->help->active) {
wclear(w->help->win);
}
@ -768,6 +779,8 @@ void draw_active_window(Tox *m)
a->onDraw(a, m);
wrefresh(a->window);
#ifdef GAMES
if (a->type == WINDOW_TYPE_GAME) {
int ch = getch();
@ -785,6 +798,8 @@ void draw_active_window(Tox *m)
return;
}
#endif // GAMES
wint_t ch = 0;
int printable = get_current_char(&ch);
@ -881,9 +896,14 @@ void kill_all_windows(Tox *m)
kill_chat_window(w, m);
} else if (w->type == WINDOW_TYPE_CONFERENCE) {
free_conference(w, w->num);
} else if (w->type == WINDOW_TYPE_GAME) {
}
#ifdef GAMES
else if (w->type == WINDOW_TYPE_GAME) {
game_kill(w);
}
#endif // GAMES
}
/* TODO: use enum instead of magic indices */