* Created src/custom/ folder for custom atcommands and script commands.

- A short, simple extension of atcommand.c and script.c that should help cut down on conflicts while updating.
- Concept credits to brAthena.

Signed-off-by: Euphy <euphy@rathena.org>
This commit is contained in:
Euphy 2013-08-31 02:04:32 -04:00
parent f6f1bcaeb9
commit a4fdc72e6d
7 changed files with 73 additions and 0 deletions

3
.gitignore vendored
View File

@ -57,6 +57,9 @@
/src/common/obj_sql /src/common/obj_sql
/src/common/svnversion.h /src/common/svnversion.h
# /src/custom/
/src/custom
# /src/login/ # /src/login/
/src/login/Makefile /src/login/Makefile
/src/login/obj_sql /src/login/obj_sql

19
src/custom/atcommand.inc Normal file
View File

@ -0,0 +1,19 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
/**
* Custom Atcommands
* Place the body of custom atcommands in this file.
* Format:
* ACMD_FUNC(command_name)
* {
* <code>;
* }
**/
ACMD_FUNC(newcommand)
{
clif_displaymessage(fd, "It works!");
clif_specialeffect(&sd->bl, 343, AREA);
return 0;
}

View File

@ -0,0 +1,11 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
/**
* Custom Atcommands
* Place the definition of custom atcommands in this file.
* Format:
* ACMD_DEF(command_name),
**/
//ACMD_DEF(newcommand),

19
src/custom/script.inc Normal file
View File

@ -0,0 +1,19 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
/**
* Custom Script Commands
* Place the body of custom script commands in this file.
* Format:
* BUILDIN_FUNC(command_name)
* {
* <code>;
* }
**/
BUILDIN_FUNC(example)
{
ShowInfo("buildin_example: It works!\n");
script_pushint(st,1);
return 0;
}

11
src/custom/script_def.inc Normal file
View File

@ -0,0 +1,11 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
/**
* Custom Script Commands
* Place the definition of custom script commands in this file.
* Format:
* BUILDIN_DEF(command_name,"parameters"),
**/
//BUILDIN_DEF(example,""),

View File

@ -9081,6 +9081,9 @@ ACMD_FUNC(langtype)
return -1; return -1;
} }
#include "../custom/atcommand.inc"
/** /**
* Fills the reference of available commands in atcommand DBMap * Fills the reference of available commands in atcommand DBMap
**/ **/
@ -9095,6 +9098,7 @@ void atcommand_basecommands(void) {
* TODO : all restricted command are crashing case, please look into it * TODO : all restricted command are crashing case, please look into it
**/ **/
AtCommandInfo atcommand_base[] = { AtCommandInfo atcommand_base[] = {
#include "../custom/atcommand_def.inc"
ACMD_DEF2R("warp", mapmove, 1), ACMD_DEF2R("warp", mapmove, 1),
ACMD_DEF(where), ACMD_DEF(where),
ACMD_DEF(jumpto), ACMD_DEF(jumpto),
@ -9357,6 +9361,7 @@ void atcommand_basecommands(void) {
ACMD_DEF(channel), ACMD_DEF(channel),
ACMD_DEF(fontcolor), ACMD_DEF(fontcolor),
ACMD_DEF(langtype), ACMD_DEF(langtype),
}; };
AtCommandInfo* atcommand; AtCommandInfo* atcommand;
int i; int i;

View File

@ -17990,6 +17990,8 @@ BUILDIN_FUNC(getserverdef){
return 0; return 0;
} }
#include "../custom/script.inc"
// declarations that were supposed to be exported from npc_chat.c // declarations that were supposed to be exported from npc_chat.c
#ifdef PCRE_SUPPORT #ifdef PCRE_SUPPORT
BUILDIN_FUNC(defpattern); BUILDIN_FUNC(defpattern);
@ -18466,5 +18468,8 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(is_clientver,"ii?"), BUILDIN_DEF(is_clientver,"ii?"),
BUILDIN_DEF(getserverdef,"i"), BUILDIN_DEF(getserverdef,"i"),
#include "../custom/script_def.inc"
{NULL,NULL,NULL}, {NULL,NULL,NULL},
}; };