Ball for the server.It symbolizes the ball, checks all ball manipulations. More...
#include <SBall.hh>

Public Member Functions | |
| SBall (SRules *r, SMatch *m) | |
| void | setCoordinates (const Coordinates &coord, bool advertise_client=true) |
| Sets ball coordinates and advertises the client if it changed. | |
| void | setOwner (SPlayer *p) |
| Sets ball owner and advertises the client if it has changed. | |
| void | removeFromField () |
| Removes the ball from the field. | |
| void | bounce (int nb=1) |
| Bounces the ball around. | |
| void | scatter (int nb) |
| Scatters the ball in a random direction. | |
| void | throwIn () |
| Makes spectators throw the ball in the field. | |
| void | setThrown () |
| bool | hasBeenThrown () const |
| void | resetTurn () |
| void | sendCoordinates (Coordinates old_coord) const |
| Send change of ball's coordinates. | |
Ball for the server.
It symbolizes the ball, checks all ball manipulations.
You will have only one instance of this class at runtime, handled by SRules class.
| void SBall::removeFromField | ( | ) |
Removes the ball from the field.
References Ball< SPlayer >::coord_, sendCoordinates(), and setOwner().
| void SBall::scatter | ( | int | nb | ) |
Scatters the ball in a random direction.
| nb | Number of squares covered. |
References Ball< SPlayer >::coord_, Field< T >::dirToCoord(), Match< T >::getField(), and Dice::roll().
| void SBall::sendCoordinates | ( | Coordinates | old_coord | ) | const |
Send change of ball's coordinates.
| old_coord | Where the ball was just before. |
References Coordinates::col, Ball< SPlayer >::coord_, Coordinates::row, and BaseSRules::sendPacket().
Referenced by removeFromField(), and setCoordinates().
| void SBall::setCoordinates | ( | const Coordinates & | coord, | |
| bool | advertise_client = true | |||
| ) |
Sets ball coordinates and advertises the client if it changed.
| coord | Where to place the ball. | |
| advertise_client | Whether or not send a MSG_BALLCOORD to clients. |
References Ball< SPlayer >::coord_, and sendCoordinates().
Referenced by SPlayer::finishBlockAction(), SPlayer::finishBlockPush(), and SPlayer::tryMove().
1.6.3