Project

General

Profile

Bug #775424

Detect hut by bonus type instead of cause

Added by Alexandro Ignatiev almost 2 years ago. Updated 9 months ago.

Status:
Closed
Priority:
High
Category:
Server
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:

Description

Playing the 'sandbox' in 3.0, you can't actually enter hermit's huts. The reason is that they have cause "Appear" instead of "Hut", and the code that invokes enter hut behaviour relies on extra cause instead of extra type. The workaround is: replace in too many places to list

tile_has_cause_extra(anything, EC_HUT)

on
tile_has_category_extra(anything, ECAT_BONUS)

(the latter function is to be written by mere replacement of 'cause' to 'category' in the former in common/tile.c).


Related issues

Blocks Freeciv - Task #656466: S3_0 datafile format freeze (d3f)Closed2019-10-05

History

#1 Updated by Alexandro Ignatiev almost 2 years ago

NO this simple solution would cause everything treat Ruins like also a hut. And the callback in /data/sandbox/script.lua still won't work as we remove the extra before call it. So, a working solution suggested is:
  1. Make a flag EF_HUT in enum extra_flag_id in common/extras.h and test it everywhere (autoexplorers, barbarian placing...)
  2. Either remove extra after the callback is called (maybe consulting its result if we should do it), or inform the callback of the extra type.

#2 Updated by Alexandro Ignatiev almost 2 years ago

Or we just don't need to store the real cause which generated the extra, and can just add a parameter to the ruleset extra definition what to put in this property on any generation? Don't much like the logic, but it seems to be the fastest workaround.

#3 Updated by Marko Lindqvist almost 2 years ago

  • Blocks Task #656466: S3_0 datafile format freeze (d3f) added

#4 Updated by Marko Lindqvist almost 2 years ago

The problem with EC_APPEARING is much more general. As it is, EC_APPEARING cause is rather limited as it cannot be combined with another cause without making the extra also appear because of that other cause. For example Roads, Bases, or Resources cannot be only appearing extras, as they would then have not their extension structures defined.
The whole appearing extras feature needs rethinking.

#5 Updated by Marko Lindqvist almost 2 years ago

  • Priority changed from Normal to High

Increasing priority as this is real d3f blocker.

#6 Updated by Marko Lindqvist almost 2 years ago

In case of "Road" and "Base" one can enable equivalent cause and set Buildable = FALSE. While that is not the cleanest feature imaginable, that kind of thinking might be the best we can have in short term, meaning S3_0. By introducing 'Generated' property, similar to 'Buildable', for extras we could also handle Resources and Huts.

#8 Updated by Marko Lindqvist almost 2 years ago

  • Status changed from Resolved to Closed
  • Assignee set to Marko Lindqvist

Also available in: Atom PDF