Revised 3.7.3

This commit is contained in:
Jonatan Pålsson 2011-05-12 22:34:31 +02:00
parent 81a22bc124
commit f61a832dea

View file

@ -6827,12 +6827,38 @@ Game-Command
from a client, it is passed along to the game VM through a function called from a client, it is passed along to the game VM through a function called
\emph on \emph on
playerCommand
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
tt playerCommand}
\end_layout
\end_inset
\emph default \emph default
which is the entry point for each game and has to be implemented by the which is the entry point for each game and has to be implemented by the
developer; one can think of it like the developer; it can be seen as the
\emph on \emph on
main()
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
tt main()}
\end_layout
\end_inset
\emph default \emph default
function of a C or Java program function of a C or Java program
\emph on \emph on
@ -6841,7 +6867,20 @@ main()
\emph default \emph default
Typically the Typically the
\emph on \emph on
playerCommand
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
tt playerCommand}
\end_layout
\end_inset
\emph default \emph default
function contains conditional constructs which decide the next action to function contains conditional constructs which decide the next action to
take. take.
@ -6854,7 +6893,20 @@ reference "alg:A-concrete-example"
an example of the an example of the
\emph on \emph on
playerCommand
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
tt playerCommand}
\end_layout
\end_inset
\emph default \emph default
function can be seen. function can be seen.
\end_layout \end_layout
@ -6869,24 +6921,46 @@ reference "alg:A-concrete-example"
the the
\emph on \emph on
playerCommand
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
tt playerCommand}
\end_layout
\end_inset
\emph default \emph default
function accepts two different commands. function accepts two different commands.
The first command is a command which allows chat clients connected to the The first command is a command which allows chat clients connected to the
chat server to change nicknames, which are used when chatting. chat server to change nicknames, which are used when chatting.
In order to change the nickname, a client must send a Game-Command In order to change the nickname, a client must send a Game-Command
\begin_inset Quotes eld \noun on
\end_inset
nick nick
\begin_inset Quotes erd \noun default
with the actual new nick name as a argument.
When a message arrives to the GGS which has the form corresponding to the
nick name change, the
\emph on
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
tt playerCommand}
\end_layout
\end_inset \end_inset
with the actual new nickname as a argument.
When a message arrives to the GGS which has the form corresponding to the
nickname change, the
\emph on
playerCommand
\emph default \emph default
function is called with the parameters function is called with the parameters
\emph on \emph on
@ -6902,26 +6976,61 @@ args
\begin_layout Standard \begin_layout Standard
The The
\emph on \emph on
playerCommand
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
tt playerCommand}
\end_layout
\end_inset
\emph default \emph default
function is responsible for calling the helper functions responsibly for function is responsible for calling the helper functions responsibly for
carrying out the actions of each message received. carrying out the actions of each message received.
\emph on \emph on
changeNick
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
tt changeNick}
\end_layout
\end_inset
\emph default \emph default
is a function which is called when the is a function which is called when the
\begin_inset Quotes eld \noun on
\end_inset
nick nick
\begin_inset Quotes erd \noun default
\end_inset
message is received. message is received.
The The
\emph on \emph on
changeNick
\begin_inset ERT
status open
\begin_layout Plain Layout
{
\backslash
tt changeNick}
\end_layout
\end_inset
\emph default \emph default
function uses a feature of the GGS called localstorage (see section function uses a feature of the GGS called localstorage (see section
\begin_inset CommandInset ref \begin_inset CommandInset ref
@ -6945,12 +7054,19 @@ reference "sub:The-database-module"
\end_layout \end_layout
\begin_layout Standard \begin_layout Standard
Access to the localStorage is provided through the Access to the
\noun on
localStorage
\noun default
is provided through the
\emph on \emph on
GGS object \noun on
GGS
\noun default
\emph default \emph default
, which also can be used to communicate with the rest of the system from object, which also can be used to communicate with the rest of the system
the GDL. from the GDL.
Implementation specifics of the GGS object are provided in Implementation specifics of the GGS object are provided in
\begin_inset CommandInset ref \begin_inset CommandInset ref
LatexCommand ref LatexCommand ref