Logo
~Sockets~
~Examples~
~Contact~

Fill Class Reference
[Commands]

Command: fill chunk with terrain. More...

#include <Fill.h>

Inheritance diagram for Fill:

Inheritance graph
[legend]
Collaboration diagram for Fill:

Collaboration graph
[legend]
List of all members.

Public Member Functions

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

Detailed Description

Command: fill chunk with terrain.

Definition at line 28 of file Fill.h.


Constructor & Destructor Documentation

Fill::Fill (  )  [inline]

Definition at line 31 of file Fill.h.

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


Member Function Documentation

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

Execute command.

Implements Command.

Definition at line 28 of file Fill.cpp.

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

00029 {
00030         Database& db = from -> GetDatabase();
00031         Player pl(db, from -> GetAccountName());
00032         Area area(db, pl.GetArea());
00033         Chunk chunk(db, area, pl.GetChunk());
00034 
00035         char fromchar = chunk.Get(pl.GetChunkX(),pl.GetChunkY());
00036         Terrain t(db, area, params.size() ? params[0] : 0);
00037         if (t.Exists())
00038         {
00039                 if (t.GetChar() != fromchar)
00040                 {
00041                         chunk.Fill(pl.GetChunkX(),pl.GetChunkY(),fromchar,t.GetChar());
00042                         chunk.Save();
00043                         from -> Send("Ok.\n");
00044                 }
00045                 else
00046                 {
00047                         from -> Send("Can't fill with same terrain.\n");
00048                 }
00049         }
00050         else
00051         {
00052                 from -> Send("Fill with what?\n");
00053         }
00054         from -> SetPrompt();
00055 }

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

Get command category.

Implements Command.

Definition at line 35 of file Fill.h.

00035 { return "Editing"; }

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

Command description.

Reimplemented from Command.

Definition at line 36 of file Fill.h.

00036 { return "Fill chunk with 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