Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #874090

open

rssanity: Check if effect reqs are of a supported range

Added by Alexandro Ignatiev over 4 years ago. Updated 7 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
Server
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Currently, there are very few checks for if requirements are valid for a specific effect. In fact, many requirements can be redundant since the effect is calculated without checking the object they refer to (e.g., as Wahazar noticed here, a city can't directly contribute into National_History, because the function is get_player_bonus(pplayer, EFT_NATION_HISTORY)) or checks not the thing one would think it does (e.g. no effects other than Unit_Bribe_Cost_Pct are interested in a unit's home city). Since effect reqs are calculated to RPT_CERTAIN on the server, that means one silently does not get what was desired. I did document effect factors on Fandom but I think it would be much better if sanity checks catched what is possible on ruleset load.

Likely, we make

#define SPECENUM_NAME req_factor
#define SPECENUM_VALUE0 RQP_PLAYER
#define SPECENUM_VALUE0NAME "player" 
#define SPECENUM_VALUE1 RQP_OTHER_PLAYER
#define SPECENUM_VALUE1NAME "other player" 
#define SPECENUM_VALUE2 RQP_CITY
#define SPECENUM_VALUE2NAME "city" 
#define SPECENUM_VALUE3 RQP_IMPR_TYPE
#define SPECENUM_VALUE3NAME "improvement" 
#define SPECENUM_VALUE4 RQP_TILE
#define SPECENUM_VALUE4NAME "tile" 
#define SPECENUM_VALUE5 RQP_UNIT
#define SPECENUM_VALUE5NAME "unit" 
#define SPECENUM_VALUE6 RQP_UNIT_TYPE
#define SPECENUM_VALUE6NAME "unit type" 
#define SPECENUM_VALUE7 RQP_OUTPUT_TYPE
#define SPECENUM_VALUE7NAME "output type" 
#define SPECENUM_VALUE8 RQP_SPECIALIST
#define SPECENUM_VALUE8NAME "specialist" 
#define SPECENUM_VALUE9 RQP_ACTION
#define SPECENUM_VALUE9NAME "action" 
#define SPECENUM_COUNT RQP_COUNT
#define SPECENUM_BITVECTOR bv_req_factors
#include "specenum_gen.h" 

static bv_req_factors req_factors[REQ_RANGE_COUNT][VUT_COUNT] = ...

static bv_req_factors effect_factors[EFT_COUNT] = ...

And check that each req_factors[req][range] is subset of effect_factors[eft]. This requires much work but allows also to simplify req_from_str().

Also available in: Atom PDF