summaryrefslogtreecommitdiff
path: root/src/network/network_func.h
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-05-30 18:20:26 +0000
committerrubidium <rubidium@openttd.org>2008-05-30 18:20:26 +0000
commit2f3b88ef9a217e911c897de49cc616e73a233b59 (patch)
treeae098eb73283ba9ab9875b3df24bbe3b5eb7fef1 /src/network/network_func.h
parente81386476f09997485e7f707f3349685e2140a97 (diff)
downloadopenttd-2f3b88ef9a217e911c897de49cc616e73a233b59.tar.xz
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
Diffstat (limited to 'src/network/network_func.h')
-rw-r--r--src/network/network_func.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/network/network_func.h b/src/network/network_func.h
new file mode 100644
index 000000000..599defb9d
--- /dev/null
+++ b/src/network/network_func.h
@@ -0,0 +1,63 @@
+/* $Id$ */
+
+/** @file network_internal.h Variables and function used internally. */
+
+#ifndef NETWORK_FUNC_H
+#define NETWORK_FUNC_H
+
+#ifdef ENABLE_NETWORK
+
+#include "network_type.h"
+#include "../console_type.h"
+
+extern NetworkGameInfo _network_game_info;
+extern NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
+extern NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];
+
+extern uint16 _network_own_client_index;
+extern uint16 _redirect_console_to_client;
+extern bool _network_need_advertise;
+extern uint32 _network_last_advertise_frame;
+extern uint8 _network_reconnect;
+extern char *_network_host_list[10];
+extern char *_network_ban_list[25];
+
+byte NetworkSpectatorCount();
+void CheckMinPlayers();
+void NetworkUpdatePlayerName();
+bool NetworkCompanyHasPlayers(PlayerID company);
+bool NetworkChangeCompanyPassword(byte argc, char *argv[]);
+void NetworkReboot();
+void NetworkDisconnect();
+void NetworkGameLoop();
+void NetworkUDPGameLoop();
+void NetworkUDPCloseAll();
+void ParseConnectionString(const char **player, const char **port, char *connection_string);
+void NetworkStartDebugLog(const char *hostname, uint16 port);
+void NetworkPopulateCompanyInfo();
+
+void NetworkUpdateClientInfo(uint16 client_index);
+bool NetworkClientConnectGame(const char *host, uint16 port);
+void NetworkClientSendRcon(const char *password, const char *command);
+void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg);
+void NetworkClientSetPassword();
+
+/*** Commands ran by the server ***/
+void NetworkServerMonthlyLoop();
+void NetworkServerYearlyLoop();
+void NetworkServerChangeOwner(PlayerID current_player, PlayerID new_player);
+void NetworkServerShowStatusToConsole();
+bool NetworkServerStart();
+
+NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index);
+NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip);
+const char* GetPlayerIP(const NetworkClientInfo *ci);
+
+void NetworkServerSendRcon(uint16 client_index, ConsoleColour colour_code, const char *string);
+void NetworkServerSendError(uint16 client_index, NetworkErrorCode error);
+void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, uint16 from_index);
+
+#define FOR_ALL_ACTIVE_CLIENT_INFOS(ci) for (ci = _network_client_info; ci != endof(_network_client_info); ci++) if (ci->client_index != NETWORK_EMPTY_INDEX)
+
+#endif /* ENABLE_NETWORK */
+#endif /* NETWORK_FUNC_H */