## Public API Reference

- Main Page
- Classes
- Files

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# celGameServerManager Class Reference

This is an interface you should implement in order to manage the events from the server. More...

`#include <physicallayer/network.h>`

List of all members.

## Public Member Functions

virtual bool | AuthorizePlayer (celPlayer *player, csString &reason)=0
| A player is asking to join the game.
virtual void | HandleClientEvent (celPlayer *player, celClientEventType event_type, csTicks event_time, iCelDataBuffer *event_data)=0
| A client event has been catched.
virtual void | PersistenceProblem (celPlayer *player, iCelEntity *entity, iCelPropertyClass *pc, celPersistenceResult persist_code)=0
| An entity is controlled by a player and a problem was encountered while updating the data of this entity.
virtual void | PlayerNetworkStateChanged (celPlayer *player, celPlayerNetworkState new_state, celPlayerNetworkState previous_state)=0
| The state of the network connection to the player has changed.
virtual void | ServerEnd ()=0
| The game is finished and the server will be closed.
virtual celPlayer * | ValidatePlayerUpdate (celPlayer *previous_player_data)=0
| Check if the new data of a player are valid.

## Detailed Description

This is an interface you should implement in order to manage the events from the server.

You can use it to:

- authorize players to join the game, check the validity of the data of the players.
- listen for changes in the state of the network connections to the clients.
- catch the client events.
- handle the detection of cheats.
- close the game.

Definition at line 602 of file network.h.

## Member Function Documentation

virtual bool celGameServerManager::AuthorizePlayer | ( | celPlayer * | player,
|  | csString & | reason |
| ) |  |  | `[pure virtual]`

A player is asking to join the game.

Return true if the new player is accepted, false otherwise (for example, because the player has been banned). A text explaining the reason of a negative answer can be specified.

virtual void celGameServerManager::HandleClientEvent | ( | celPlayer * | player,
|  | celClientEventType | event_type,
|  | csTicks | event_time,
|  | iCelDataBuffer * | event_data |
| ) |  |  | `[pure virtual]`

A client event has been catched.

virtual void celGameServerManager::PersistenceProblem | ( | celPlayer * | player,
|  | iCelEntity * | entity,
|  | iCelPropertyClass * | pc,
|  | celPersistenceResult | persist_code |
| ) |  |  | `[pure virtual]`

An entity is controlled by a player and a problem was encountered while updating the data of this entity.

Parameters:

  | player | The player controlling the entity.
  | entity | The entity controlled by the player.
  | pc | The property class updated while the problem was encountered.
  | persist_code | The code of the problem.

virtual void celGameServerManager::PlayerNetworkStateChanged | ( | celPlayer * | player,
|  | celPlayerNetworkState | new_state,
|  | celPlayerNetworkState | previous_state |
| ) |  |  | `[pure virtual]`

The state of the network connection to the player has changed.

virtual void celGameServerManager::ServerEnd | ( |  | ) | `[pure virtual]`

The game is finished and the server will be closed.

You should delete here all entities and the physical layer.

virtual celPlayer* celGameServerManager::ValidatePlayerUpdate | ( | celPlayer * | previous_player_data | ) | `[pure virtual]`

Check if the new data of a player are valid.

It happens when iCelGameClient::UpdatePlayer has been called on the client side.

Returns:
  the validated data of the player.

The documentation for this class was generated from the following file:

- physicallayer/network.h