![]() |
Fill Class ReferenceCommand: fill chunk with terrain.
More...
|
Public Member Functions | |
Fill () | |
void | Execute (InSocket *, const std::string ¶ms, Parse &) |
Execute command. | |
std::string | Category () |
Get command category. | |
std::string | Description () |
Command description. |
Definition at line 28 of file Fill.h.
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] |
std::string Fill::Description | ( | ) | [inline, virtual] |