From 0f8345a0d651c067cf2e8a0040c1291514b727a7 Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Fri, 30 Sep 2011 15:30:43 +0200 Subject: [PATCH 1/2] Introduce ruleset defined effects. Add 4 user effects. They can be given meaning by the ruleset from Lua. See gna patch #2979 See osdn #41745 --- ai/default/daieffects.c | 6 ++++++ common/effects.h | 9 +++++++++ doc/README.effects | 7 +++++++ 3 files changed, 22 insertions(+) diff --git a/ai/default/daieffects.c b/ai/default/daieffects.c index c99dc63f3e..caf3b4078f 100644 --- a/ai/default/daieffects.c +++ b/ai/default/daieffects.c @@ -664,6 +664,12 @@ adv_want dai_effect_value(struct player *pplayer, struct government *gov, case EFT_INFRA_POINTS: v += amount * adv->infra_priority; break; + case EFT_USER_EFFECT_1: + case EFT_USER_EFFECT_2: + case EFT_USER_EFFECT_3: + case EFT_USER_EFFECT_4: + /* The AI has no idea what this does. */ + break; case EFT_COUNT: log_error("Bad effect type."); break; diff --git a/common/effects.h b/common/effects.h index 776d6169c0..ad5e386357 100644 --- a/common/effects.h +++ b/common/effects.h @@ -314,6 +314,15 @@ extern "C" { #define SPECENUM_VALUE125NAME "Illegal_Action_HP_Cost" #define SPECENUM_VALUE126 EFT_POPCOST_FREE #define SPECENUM_VALUE126NAME "Popcost_Free" +/* Ruleset specific effects for use from Lua scripts */ +#define SPECENUM_VALUE127 EFT_USER_EFFECT_1 +#define SPECENUM_VALUE127NAME "User_Effect_1" +#define SPECENUM_VALUE128 EFT_USER_EFFECT_2 +#define SPECENUM_VALUE128NAME "User_Effect_2" +#define SPECENUM_VALUE129 EFT_USER_EFFECT_3 +#define SPECENUM_VALUE129NAME "User_Effect_3" +#define SPECENUM_VALUE130 EFT_USER_EFFECT_4 +#define SPECENUM_VALUE130NAME "User_Effect_4" /* keep this last */ #define SPECENUM_COUNT EFT_COUNT #include "specenum_gen.h" diff --git a/doc/README.effects b/doc/README.effects index 17fbd9c30a..65988222a1 100644 --- a/doc/README.effects +++ b/doc/README.effects @@ -652,6 +652,13 @@ Infra_Points are negative after all cities have been processed, they are set to 0. +Ruleset defined effects +======================= +The effects User_Effect_1, User_Effect_2, User_Effect_3 and User_Effect_4 +are "blank". They have no meaning by them self. The ruleset does everything +they do. + + Effects and Lua =============== Lua has some integration with effects. The effects module allows you to -- 2.20.1