Debian Codegraph @

src/bnetd/luainterface.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2014 HarpyWar ([email protected])
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */
18 /*****/
19 #ifdef WITH_LUA
20 #ifndef JUST_NEED_TYPES
21 #ifndef INCLUDED_LUAINTERFACE_PROTOS
22 #define INCLUDED_LUAINTERFACE_PROTOS
23
24 #ifdef WIN32
25 #pragma comment(lib, "lua5.1.lib")
26 #endif
27
28 #define JUST_NEED_TYPES
29 #include "connection.h"
30 #include "luawrapper.h"
31 #include <stdio.h>
32 #undef JUST_NEED_TYPES
33
34 namespace pvpgn
35 {
36
37 namespace bnetd
38 {
39 typedef enum {
40 luaevent_command,
41 luaevent_command_before,
42
43 luaevent_game_create,
44 luaevent_game_report,
45 luaevent_game_end,
46 luaevent_game_destroy,
47 luaevent_game_changestatus,
48 luaevent_game_userjoin,
49 luaevent_game_userleft,
50
51 luaevent_channel_message, // user-to-channel
52 luaevent_channel_userjoin,
53 luaevent_channel_userleft,
54
55 luaevent_user_whisper, // user-to-user
56 luaevent_user_login,
57 luaevent_user_disconnect,
58
59 luaevent_server_start,
60 luaevent_server_rehash,
61 luaevent_server_mainloop,
62
63 } t_luaevent_type;
64
65
66 extern void lua_load(char const * scriptdir);
67 extern void lua_unload();
68
69 extern int lua_handle_command(t_connection * c, char const * text, t_luaevent_type luaevent);
70 extern void lua_handle_game(t_game * game, t_connection * c, t_luaevent_type luaevent);
71 extern std::vector<t_game*> lua_handle_game_list(t_connection * c);
72
73 extern int lua_handle_channel(t_channel * channel, t_connection * c, char const * message_text, t_message_type message_type, t_luaevent_type luaevent);
74 extern int lua_handle_user(t_connection * c, t_connection * c_dst, char const * message_text, t_luaevent_type luaevent);
75 extern const char * lua_handle_user_icon(t_connection * c, const char * iconinfo);
76 extern void lua_handle_server(t_luaevent_type luaevent);
77
78 extern void lua_handle_client_readmemory(t_connection * c, int request_id, std::vector<int> data);
79 extern void lua_handle_client_extrawork(t_connection * c, int gametype, int length, const char * data);
80
81 }
82
83 }
84
85 #endif
86 #endif
87 #endif