Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

NetworkSyncServer.h

Go to the documentation of this file.
00001 #ifndef NetworkSyncServer_H 00002 #define NetworkSyncServer_H 00003 00004 #include "NetworkSyncManager.h" 00005 00006 #if !defined(WITHOUT_NETWORKING) 00007 #include "ezsockets.h" 00008 #define NETMAXBUFFERSIZE 1020 00009 00010 class LanPlayer 00011 { 00012 public: 00013 CString name; 00014 long score; 00015 int health; 00016 int feet; 00017 int projgrade; 00018 int combo; 00019 int currstep; 00020 int steps[9]; 00021 int maxCombo; 00022 int Grade; 00023 double offset; 00024 int PlayerID; 00025 int diff; 00026 CString options; 00027 LanPlayer(); 00028 }; 00029 00030 class GameInfo 00031 { 00032 public: 00033 CString title; 00034 CString subtitle; 00035 CString artist; 00036 CString course; 00037 }; 00038 00039 class GameClient 00040 { 00041 public: 00042 bool GotStartRequest; 00043 EzSockets clientSocket; 00044 void UpdateStats(PacketFunctions &Packet); 00045 void SetClientVersion(int ver, const CString& b); 00046 void StartRequest(PacketFunctions &Packet); 00047 int GetData(PacketFunctions &Packet); 00048 GameClient(); 00049 LanPlayer Player[2]; 00050 bool IsPlaying(int Player); 00051 void StyleUpdate(PacketFunctions &Packet); 00052 bool InGame; 00053 int twoPlayers; 00054 bool hasSong; 00055 bool forceHas; 00056 bool inNetMusicSelect; 00057 int startPosition; 00058 bool isStarting; 00059 bool wasIngame; 00060 bool lowerJudge; 00061 00062 enum LastNetScreen 00063 { 00064 NS_NOWHERE = 0, 00065 NS_SELECTSCREEN, 00066 NS_OPTIONS, 00067 NS_EVALUATION 00068 } NetScreenInfo; 00069 00070 private: 00071 string build; 00072 GameInfo gameInfo; 00073 int version; 00074 }; 00075 #endif 00076 00077 class StepManiaLanServer 00078 { 00079 public: 00080 bool ServerStart(); 00081 void ServerStop(); 00082 void ServerUpdate(); 00083 StepManiaLanServer(); 00084 ~StepManiaLanServer(); 00085 CString servername; 00086 CString lastError; 00087 int lastErrorCode; 00088 00089 private: 00090 #if !defined(WITHOUT_NETWORKING) 00091 bool stop; 00092 PacketFunctions Packet; 00093 PacketFunctions Reply; 00094 vector<GameClient*> Client; 00095 EzSockets server; 00096 int ClientHost; 00097 vector<LanPlayer*> playersPtr; 00098 time_t statsTime; 00099 GameInfo CurrentSongInfo; 00100 GameInfo LastSongInfo; 00101 bool SecondSameSelect; 00102 vector<CString> bannedIPs; 00103 00104 void Hello(PacketFunctions& Packet, const unsigned int clientNum); 00105 void UpdateClients(); 00106 void NewClientCheck(); 00107 void ParseData(PacketFunctions& Packet, const unsigned int clientNum); 00108 void SendValue(uint8_t value, const unsigned int clientNum); 00109 void CheckReady(); 00110 void MoveClientToHost(); 00111 void StatsComboColumn(PacketFunctions &data, vector<LanPlayer*> &playresPtr); 00112 void SendStatsToClients(); 00113 void StatsProjgradeColumn(PacketFunctions& data, vector<LanPlayer*> &playresPtr); 00114 void StatsNameColumn(PacketFunctions& data, vector<LanPlayer*> &playresPtr); 00115 void SendNetPacket(const unsigned int clientNum, PacketFunctions &Packet); 00116 int SortStats(vector<LanPlayer*> &playresPtr); 00117 void RelayChat(CString &passedmessage, const unsigned int clientNum); 00118 void SelectSong(PacketFunctions& Packet, const unsigned int clientNum); 00119 void ServerChat(const CString& message); 00120 void SendToAllClients(PacketFunctions& Packet); 00121 bool CheckHasSongState(); 00122 void ClearHasSong(); 00123 void AssignPlayerIDs(); 00124 void SendUserList(); 00125 void GameOver(PacketFunctions& Packet, const unsigned int clientNum); 00126 void ScreenNetMusicSelectStatus(PacketFunctions& Packet, const unsigned int clientNum); 00127 void AnalizeChat(PacketFunctions &Packet, const unsigned int clientNum); 00128 CString StepManiaLanServer::ListPlayers(); 00129 void Kick(CString &name); 00130 void Ban(CString &name); 00131 bool IsBanned(CString &ip); 00132 void ForceStart(); 00133 void CheckLowerJudge(const unsigned int clientNum); 00134 bool CheckConnection(const unsigned int clientNum); 00135 void PopulatePlayersPtr(vector<LanPlayer*> &playersPtr); 00136 void Disconnect(const unsigned int clientNum); 00137 void ClientsSongSelectStart(); 00138 void ResetLastSongInfo(); 00139 #endif 00140 }; 00141 00142 #endif 00143 00144 /* 00145 * (c) 2003-2004 Joshua Allen 00146 * All rights reserved. 00147 * 00148 * Permission is hereby granted, free of charge, to any person obtaining a 00149 * copy of this software and associated documentation files (the 00150 * "Software"), to deal in the Software without restriction, including 00151 * without limitation the rights to use, copy, modify, merge, publish, 00152 * distribute, and/or sell copies of the Software, and to permit persons to 00153 * whom the Software is furnished to do so, provided that the above 00154 * copyright notice(s) and this permission notice appear in all copies of 00155 * the Software and that both the above copyright notice(s) and this 00156 * permission notice appear in supporting documentation. 00157 * 00158 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00159 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00160 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00161 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00162 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00163 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00164 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00165 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00166 * PERFORMANCE OF THIS SOFTWARE. 00167 */

Generated on Thu Jan 27 20:57:25 2005 for StepMania by doxygen 1.3.7