From a4fdc72e6dae19b7f603d4f373404bead09a0abc Mon Sep 17 00:00:00 2001 From: Euphy Date: Sat, 31 Aug 2013 02:04:32 -0400 Subject: [PATCH] * 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 --- .gitignore | 3 +++ src/custom/atcommand.inc | 19 +++++++++++++++++++ src/custom/atcommand_def.inc | 11 +++++++++++ src/custom/script.inc | 19 +++++++++++++++++++ src/custom/script_def.inc | 11 +++++++++++ src/map/atcommand.c | 5 +++++ src/map/script.c | 5 +++++ 7 files changed, 73 insertions(+) create mode 100644 src/custom/atcommand.inc create mode 100644 src/custom/atcommand_def.inc create mode 100644 src/custom/script.inc create mode 100644 src/custom/script_def.inc diff --git a/.gitignore b/.gitignore index f5e40d0da4..bc46c55936 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,9 @@ /src/common/obj_sql /src/common/svnversion.h +# /src/custom/ +/src/custom + # /src/login/ /src/login/Makefile /src/login/obj_sql diff --git a/src/custom/atcommand.inc b/src/custom/atcommand.inc new file mode 100644 index 0000000000..d26d6fb5ae --- /dev/null +++ b/src/custom/atcommand.inc @@ -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) + * { + * ; + * } + **/ + +ACMD_FUNC(newcommand) +{ + clif_displaymessage(fd, "It works!"); + clif_specialeffect(&sd->bl, 343, AREA); + return 0; +} diff --git a/src/custom/atcommand_def.inc b/src/custom/atcommand_def.inc new file mode 100644 index 0000000000..300944c7fb --- /dev/null +++ b/src/custom/atcommand_def.inc @@ -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), diff --git a/src/custom/script.inc b/src/custom/script.inc new file mode 100644 index 0000000000..adfd6cd6a1 --- /dev/null +++ b/src/custom/script.inc @@ -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) + * { + * ; + * } + **/ + +BUILDIN_FUNC(example) +{ + ShowInfo("buildin_example: It works!\n"); + script_pushint(st,1); + return 0; +} diff --git a/src/custom/script_def.inc b/src/custom/script_def.inc new file mode 100644 index 0000000000..3319eea5e9 --- /dev/null +++ b/src/custom/script_def.inc @@ -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,""), diff --git a/src/map/atcommand.c b/src/map/atcommand.c index e86f424bca..a96e8aeab6 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -9081,6 +9081,9 @@ ACMD_FUNC(langtype) return -1; } + +#include "../custom/atcommand.inc" + /** * 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 **/ AtCommandInfo atcommand_base[] = { +#include "../custom/atcommand_def.inc" ACMD_DEF2R("warp", mapmove, 1), ACMD_DEF(where), ACMD_DEF(jumpto), @@ -9357,6 +9361,7 @@ void atcommand_basecommands(void) { ACMD_DEF(channel), ACMD_DEF(fontcolor), ACMD_DEF(langtype), + }; AtCommandInfo* atcommand; int i; diff --git a/src/map/script.c b/src/map/script.c index 9dc9c0a7fd..bc31326d3a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -17990,6 +17990,8 @@ BUILDIN_FUNC(getserverdef){ return 0; } +#include "../custom/script.inc" + // declarations that were supposed to be exported from npc_chat.c #ifdef PCRE_SUPPORT BUILDIN_FUNC(defpattern); @@ -18466,5 +18468,8 @@ struct script_function buildin_func[] = { BUILDIN_DEF(is_clientver,"ii?"), BUILDIN_DEF(getserverdef,"i"), + +#include "../custom/script_def.inc" + {NULL,NULL,NULL}, };