Skip to content

Commit

Permalink
Added custom battle config support
Browse files Browse the repository at this point in the history
You can now define custom battle config structure members in src/custom/battle_config_struct.inc and initialize them in src/custom/battle_config_init.inc
You can put the configuration into any battle configuration file, but we recommend you to put it into conf/import/battle_conf.txt
  • Loading branch information
Lemongrass3110 committed Aug 10, 2016
1 parent 5090693 commit 8857ff6
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/custom/battle_config_init.inc
@@ -0,0 +1,13 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL

This comment has been minimized.

Copy link
@cydh

cydh Aug 11, 2016

Contributor

rAthena :v

// For more information, see LICENCE in the main folder

/**
* Custom battle config initializations
* Place the definition of custom battle configuration initializations in this file.
*
* Do not forget to add a comma at the end of the line, if you want to add another config
*
* Format:
* { "name", &battle_config.<variable name>, <default value>, <minimum value>, <maximum value> },
**/

14 changes: 14 additions & 0 deletions src/custom/battle_config_struct.inc
@@ -0,0 +1,14 @@
// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder

/**
* Custom battle config structure
* Place the definition of custom battle configuration structure members in this file.
*
* Make sure that the name you want is not already taken by looking into battle.h
* Do not forget to add initilization logic to battle_config_init.inc
*
* Format:
* <datatype> name;
**/

2 changes: 2 additions & 0 deletions src/map/battle.c
Expand Up @@ -8329,6 +8329,8 @@ static const struct _battle_data {
{ "exp_cost_inspiration", &battle_config.exp_cost_inspiration, 1, 0, 100, },
{ "mvp_exp_reward_message", &battle_config.mvp_exp_reward_message, 0, 0, 1, },
{ "can_damage_skill", &battle_config.can_damage_skill, 1, 0, BL_ALL, },

#include "../custom/battle_config_init.inc"
};

#ifndef STATS_OPT_OUT
Expand Down
2 changes: 2 additions & 0 deletions src/map/battle.h
Expand Up @@ -610,6 +610,8 @@ extern struct Battle_Config
int exp_cost_inspiration;
int mvp_exp_reward_message;
int can_damage_skill; //Which BL types can damage traps

#include "../custom/battle_config_struct.inc"
} battle_config;

void do_init_battle(void);
Expand Down

1 comment on commit 8857ff6

@anacondaq

This comment was marked as abuse.

Please sign in to comment.