summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-13 09:34:49 +0000
committerai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec>2011-01-13 09:34:49 +0000
commit0e628dcfe81a8067def049d0bfaafdcefbd1a847 (patch)
treeaba2b649e943a585f93efa3e40414745512cacb8 /src/map
parent2552c703729fb2b01123da59fa22f40b82e9282a (diff)
downloadhercules-0e628dcfe81a8067def049d0bfaafdcefbd1a847.tar.gz
hercules-0e628dcfe81a8067def049d0bfaafdcefbd1a847.tar.bz2
hercules-0e628dcfe81a8067def049d0bfaafdcefbd1a847.tar.xz
hercules-0e628dcfe81a8067def049d0bfaafdcefbd1a847.zip
* Reformatting and minor cleanups to console-plugin related code.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14664 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.c56
1 files changed, 35 insertions, 21 deletions
diff --git a/src/map/map.c b/src/map/map.c
index f10c92f32..b1e92a62d 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3012,7 +3012,7 @@ static int char_ip_set = 0;
/*==========================================
* Console Command Parser [Wizputer]
*------------------------------------------*/
-int parse_console(char* buf)
+int parse_console(const char* buf)
{
char type[64];
char command[64];
@@ -3026,14 +3026,20 @@ int parse_console(char* buf)
memset(&sd, 0, sizeof(struct map_session_data));
strcpy(sd.status.name, "console");
- if( (n=sscanf(buf, "%[^:]:%[^:]:%99s %d %d[^\n]",type,command,map,&x,&y)) < 5 )
- if( (n=sscanf(buf, "%[^:]:%[^\n]",type,command)) < 2 )
- n = sscanf(buf,"%[^\n]",type);
+ if( ( n = sscanf(buf, "%63[^:]:%63[^:]:%63s %d %d[^\n]", type, command, map, &x, &y) ) < 5 )
+ {
+ if( ( n = sscanf(buf, "%63[^:]:%63[^\n]", type, command) ) < 2 )
+ {
+ n = sscanf(buf, "%63[^\n]", type);
+ }
+ }
- if( n == 5 ) {
+ if( n == 5 )
+ {
m = map_mapname2mapid(map);
- if( m < 0 ){
- ShowWarning("Console: Unknown map\n");
+ if( m < 0 )
+ {
+ ShowWarning("Console: Unknown map.\n");
return 0;
}
sd.bl.m = m;
@@ -3042,32 +3048,40 @@ int parse_console(char* buf)
sd.bl.x = x;
if( y > 0 )
sd.bl.y = y;
- } else {
+ }
+ else
+ {
map[0] = '\0';
- if( n < 2 ) command[0] = '\0';
- if( n < 1 ) type[0] = '\0';
+ if( n < 2 )
+ command[0] = '\0';
+ if( n < 1 )
+ type[0] = '\0';
}
- ShowInfo("Type of command: '%s' || Command: '%s' || Map: '%s' Coords: %d %d\n", type, command, map, x, y);
+ ShowNotice("Type of command: '%s' || Command: '%s' || Map: '%s' Coords: %d %d\n", type, command, map, x, y);
- if( n == 5 && strcmpi("admin",type) == 0 ){
- if( !is_atcommand(sd.fd,&sd,command,0) )
+ if( n == 5 && strcmpi("admin",type) == 0 )
+ {
+ if( !is_atcommand(sd.fd, &sd, command, 0) )
ShowInfo("Console: not atcommand\n");
- } else if( n == 2 && strcmpi("server",type) == 0 ){
- if( strcmpi("shutdown",command) == 0 ||
- strcmpi("exit",command) == 0 ||
- strcmpi("quit",command) == 0 ){
+ }
+ else if( n == 2 && strcmpi("server", type) == 0 )
+ {
+ if( strcmpi("shutdown", command) == 0 || strcmpi("exit", command) == 0 || strcmpi("quit", command) == 0 )
+ {
runflag = 0;
}
- } else if( strcmpi("help",type) == 0 ){
- ShowNotice("To use GM commands:\n");
- ShowInfo("admin:<gm command>:<map of \"gm\"> <x> <y>\n");
+ }
+ else if( strcmpi("help", type) == 0 )
+ {
+ ShowInfo("To use GM commands:\n");
+ ShowInfo(" admin:<gm command>:<map of \"gm\"> <x> <y>\n");
ShowInfo("You can use any GM command that doesn't require the GM.\n");
ShowInfo("No using @item or @warp however you can use @charwarp\n");
ShowInfo("The <map of \"gm\"> <x> <y> is for commands that need coords of the GM\n");
ShowInfo("IE: @spawn\n");
ShowInfo("To shutdown the server:\n");
- ShowInfo("server:shutdown\n");
+ ShowInfo(" server:shutdown\n");
}
return 0;