Logo
~Sockets~
~Examples~
~Contact~

Clear Class Reference
[Commands]

Command: clear chunk from terrain. More...

#include <Clear.h>

Inheritance diagram for Clear:

Inheritance graph
[legend]
Collaboration diagram for Clear:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Clear ()
void Execute (InSocket *, const std::string &params, Parse &)
 Execute command.
std::string Category ()
 Get command category.
std::string Description ()
 Command description.

Detailed Description

Command: clear chunk from terrain.

Definition at line 28 of file Clear.h.


Constructor & Destructor Documentation

Clear::Clear (  )  [inline]

Definition at line 31 of file Clear.h.

00031 : Command("clear", true) {}


Member Function Documentation

void Clear::Execute ( InSocket ,
const std::string &  arg,
Parse &   
) [virtual]

Execute command.

Implements Command.

Definition at line 27 of file Clear.cpp.

References Player::GetArea(), Player::GetChunk(), Player::GetChunkX(), and Player::GetChunkY().

00028 {
00029         Database& db = from -> GetDatabase();
00030         Player pl(db, from -> GetAccountName());
00031         Area area(db, pl.GetArea());
00032         Chunk chunk(db, area, pl.GetChunk());
00033 
00034         char fromchar = chunk.Get(pl.GetChunkX(),pl.GetChunkY());
00035         if (' ' != fromchar)
00036         {
00037                 chunk.Fill(pl.GetChunkX(),pl.GetChunkY(),fromchar,' ');
00038                 chunk.Save();
00039                 from -> Send("Ok.\n");
00040         }
00041         else
00042         {
00043                 from -> Send("Can't fill with same terrain.\n");
00044         }
00045         from -> SetPrompt();
00046 }

std::string Clear::Category (  )  [inline, virtual]

Get command category.

Implements Command.

Definition at line 35 of file Clear.h.

00035 { return "Editing"; }

std::string Clear::Description (  )  [inline, virtual]

Command description.

Reimplemented from Command.

Definition at line 36 of file Clear.h.

00036 { return "Clear chunk from terrain"; }


The documentation for this class was generated from the following files:
Page, code, and content Copyright (C) 2006 by Anders Hedström
Generated on Mon Aug 29 20:21:47 2005 for C++ Sockets by  doxygen 1.4.4