Logo
~Sockets~
~Examples~
~Contact~

List Class Reference
[Commands]

Command: list terrain | wizards | areas. More...

#include <List.h>

Inheritance diagram for List:

Inheritance graph
[legend]
Collaboration diagram for List:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 List ()
void Execute (InSocket *, const std::string &params, Parse &)
 Execute command.
std::string Category ()
 Get command category.

Detailed Description

Command: list terrain | wizards | areas.

Definition at line 28 of file List.h.


Constructor & Destructor Documentation

List::List (  )  [inline]

Definition at line 31 of file List.h.

References Command::AddArgument().

00031                : Command("list") {
00032                 AddArgument("terrain");
00033                 AddArgument("wizards", true);
00034                 AddArgument("areas", true);
00035         }


Member Function Documentation

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

Execute command.

Implements Command.

Definition at line 31 of file List.cpp.

References Player::GetArea().

00032 {
00033         Database& db = from -> GetDatabase();
00034         Query q(db);
00035         if (param == "terrain")
00036         {
00037                 Player pl(db, from -> GetAccountName());
00038                 Area area(db, pl.GetArea());
00039                 q.get_result("select * from terrain where area=" + Utility::l2string(area.GetNum()));
00040                 while (q.fetch_row())
00041                 {
00042                         db::Terrain t(&db, &q);
00043                         from -> Send(t.tcolor + t.tchar + "&n    " + t.name + (t.impassable ? "    (Impassable)" : "") + "\n");
00044                 }
00045                 q.free_result();
00046         }
00047         else
00048         if (param == "wizards")
00049         {
00050                 q.get_result("select * from account where wizard<>0");
00051                 while (q.fetch_row())
00052                 {
00053                         db::Account x(&db, &q);
00054                         from -> Send("  " + x.display_name + "\n");
00055                 }
00056                 q.free_result();
00057         }
00058         else
00059         if (param == "areas")
00060         {
00061                 q.get_result("select * from area");
00062                 while (q.fetch_row())
00063                 {
00064                         db::Area area(&db, &q);
00065                         from -> Sendf("#%ld: %2ldx%2ld %s\n", area.num, area.width, area.height, area.name.c_str());
00066                 }
00067                 q.free_result();
00068         }
00069         else
00070         {
00071                 from -> Send("List what?\n");
00072         }
00073         from -> SetPrompt();
00074 }

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

Get command category.

Implements Command.

Definition at line 39 of file List.h.

00039 { return "General"; }


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