|
SuperTuxKart
|

Public Member Functions | |
| GameEventsProtocol () | |
| This class handles all 'major' game events. More... | |
| virtual bool | notifyEvent (Event *event) OVERRIDE |
| Notify a protocol matching the Event type of that event. More... | |
| void | kartFinishedRace (AbstractKart *kart, float time) |
| This function is called from the server when a kart finishes a race. More... | |
| void | kartFinishedRace (const NetworkString &ns) |
| This function is called on a client when it receives a kartFinishedRace event from the server. More... | |
| void | sendStartupBoost (uint8_t kart_id) |
| virtual void | setup () OVERRIDE |
| Called when the protocol is going to start. More... | |
| virtual void | update (int ticks) OVERRIDE |
| Called by the protocol listener, synchronously with the main loop. More... | |
| virtual void | asynchronousUpdate () OVERRIDE |
| Called by the protocol listener as often as possible. More... | |
| virtual bool | notifyEventAsynchronous (Event *event) OVERRIDE |
| Notify a protocol matching the Event type of that event. More... | |
Public Member Functions inherited from Protocol | |
| Protocol (ProtocolType type) | |
| Constructor Sets the basic protocol parameters, as the callback object and the protocol type. More... | |
| virtual | ~Protocol () |
| Destructor. | |
| bool | checkDataSize (Event *event, unsigned int minimum_size) |
| functions to check incoming data easily More... | |
| void | sendMessageToPeers (NetworkString *message, bool reliable=true) |
| Sends a message to all validated peers in game, encrypt the message if needed. More... | |
| void | sendMessageToPeersInServer (NetworkString *message, bool reliable=true) |
| Sends a message to all validated peers in server, encrypt the message if needed. More... | |
| void | sendToServer (NetworkString *message, bool reliable=true) |
| Sends a message from a client to the server. | |
| virtual void | requestStart () |
| Starts a request in the protocol manager to start this protocol. | |
| virtual void | requestTerminate () |
| Submits a request to the ProtocolManager to terminate this protocol. | |
| ProtocolType | getProtocolType () const |
| Method to get a protocol's type. More... | |
| void | setHandleConnections (bool b) |
| Sets if this protocol should receive connection events. | |
| void | setHandleDisconnections (bool b) |
| Sets if this protocol should receive disconnection events. | |
| virtual bool | handleConnects () const |
| Return true if this protocol should be informed about connects. | |
| virtual bool | handleDisconnects () const |
| Return true if this protocol should be informed about disconnects. | |
Private Member Functions | |
| void | eliminatePlayer (const NetworkString &ns) |
Private Attributes | |
| int | m_last_finished_position |
Additional Inherited Members | |
Protected Attributes inherited from Protocol | |
| ProtocolType | m_type |
| The type of the protocol. | |
| bool | m_handle_connections |
| True if this protocol should receive connection events. | |
| bool | m_handle_disconnections |
| TRue if this protocol should recceiver disconnection events. | |
| GameEventsProtocol::GameEventsProtocol | ( | ) |
This class handles all 'major' game events.
E.g. finishing a race or goal etc. The game events manager is notified from the game code, and it calls the corresponding function in this class. The server then notifies all clients. Clients receive the message in the synchronous notifyEvent function here, decode the message and call the original game code. The functions name are identical, e.g. kartFinishedRace(some parameter) is called from the GameEventManager on the server, and the received message is then handled by kartFinishedRace(const NetworkString &).
|
inlinevirtual |
| void GameEventsProtocol::kartFinishedRace | ( | AbstractKart * | kart, |
| float | time | ||
| ) |
This function is called from the server when a kart finishes a race.
It sends a notification to all clients about this event.
| kart | The kart that finished the race. |
| time | The time at which the kart finished. |
| void GameEventsProtocol::kartFinishedRace | ( | const NetworkString & | ns | ) |
This function is called on a client when it receives a kartFinishedRace event from the server.
It updates the game with this information.
| ns | The message from the server. |
|
virtual |
|
inlinevirtual |
|
inlinevirtual |
|
virtual |
Called by the protocol listener, synchronously with the main loop.
Must be re-defined.
Implements Protocol.