00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <Parse.h>
00021
00022 #include "Edge.h"
00023 #include "InSocket.h"
00024 #include "Chunk.h"
00025 #include "Player.h"
00026 #include "Terrain.h"
00027 #include "Area.h"
00028
00029
00030 void Edge::Execute(InSocket *from,const std::string& params,Parse& pa)
00031 {
00032 Database& db = from -> GetDatabase();
00033 Player pl(db, from -> GetAccountName());
00034 Area area(db, pl.GetArea());
00035 Chunk chunk(db, area, pl.GetChunk());
00036 std::string tstr = params;
00037 std::string widthstr = pa.getword();
00038 if (tstr.size())
00039 {
00040 Terrain t(db, area, tstr[0]);
00041 if (t.Exists())
00042 {
00043 int width = widthstr.size() ? atoi(widthstr.c_str()) : 1;
00044 chunk.Edge(t, width);
00045 chunk.Save();
00046 from -> Send("Ok.\n");
00047 }
00048 else
00049 {
00050 from -> Send("Terrain?\n");
00051 }
00052 }
00053 else
00054 {
00055 from -> Send("Usage: Edge <terrain char> <width (default 1)>\n");
00056 }
00057 from -> SetPrompt();
00058 }
00059
00060