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 2 years ago. Updated about 2 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().

Actions #1

Updated by Marko Lindqvist almost 2 years ago

  • Sprint/Milestone changed from 2.6.3 to 2.6.4
Actions #2

Updated by Marko Lindqvist over 1 year ago

  • Sprint/Milestone changed from 2.6.4 to 2.6.5
Actions #3

Updated by Marko Lindqvist over 1 year ago

  • Sprint/Milestone changed from 2.6.5 to 2.6.6
Actions #4

Updated by Marko Lindqvist 12 months ago

  • Sprint/Milestone changed from 2.6.6 to 3.0.1
Actions #5

Updated by Marko Lindqvist 8 months ago

  • Sprint/Milestone changed from 3.0.1 to 3.0.2
Actions #6

Updated by Marko Lindqvist 6 months ago

  • Sprint/Milestone changed from 3.0.2 to 3.0.3
Actions #7

Updated by Marko Lindqvist 4 months ago

  • Sprint/Milestone changed from 3.0.3 to 3.0.4
Actions #8

Updated by Marko Lindqvist about 2 months ago

  • Sprint/Milestone changed from 3.0.4 to 3.0.5

Also available in: Atom PDF