Add [terrain_type] max_light= and min_light=.
The defaults for these attributes fix bug #19250.
This commit is contained in:
parent
00be5cfa20
commit
01292136b1
5 changed files with 24 additions and 6 deletions
|
@ -28,6 +28,7 @@ Version 1.11.0+svn:
|
|||
* Sighted events should be reliable, provided the player does not activate
|
||||
delayed shroud updates (which is still a major caveat).
|
||||
* Added [effect] apply_to=overlay
|
||||
* Added [terrain_type] max_light= and min_light=.
|
||||
* Miscellaneous and bug fixes:
|
||||
* Fix invalid memory access crash resulting from deleting all saved games
|
||||
in the Load Game dialog
|
||||
|
|
|
@ -1017,6 +1017,7 @@
|
|||
string=Ql
|
||||
aliasof=Qt
|
||||
light=25
|
||||
max_light=35
|
||||
editor_group=cave, obstacle
|
||||
[/terrain_type]
|
||||
|
||||
|
@ -1027,6 +1028,7 @@
|
|||
string=Qlf
|
||||
aliasof=Qt
|
||||
light=25
|
||||
max_light=35
|
||||
editor_group=cave, obstacle
|
||||
[/terrain_type]
|
||||
|
||||
|
@ -1038,6 +1040,7 @@
|
|||
string=Mv
|
||||
aliasof=Qt
|
||||
light=25
|
||||
max_light=35
|
||||
editor_group=rough, obstacle
|
||||
[/terrain_type]
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ terrain_type::terrain_type() :
|
|||
submerge_(0.0),
|
||||
submerge_set_(false),
|
||||
light_modification_(0),
|
||||
max_light_(0),
|
||||
min_light_(0),
|
||||
heals_(0),
|
||||
income_description_(),
|
||||
income_description_ally_(),
|
||||
|
@ -80,6 +82,8 @@ terrain_type::terrain_type(const config& cfg) :
|
|||
submerge_(cfg["submerge"].to_double()),
|
||||
submerge_set_(!cfg["submerge"].empty()),
|
||||
light_modification_(cfg["light"]),
|
||||
max_light_(cfg["max_light"].to_int(light_modification_)),
|
||||
min_light_(cfg["min_light"].to_int(light_modification_)),
|
||||
heals_(cfg["heals"]),
|
||||
income_description_(),
|
||||
income_description_ally_(),
|
||||
|
@ -98,7 +102,7 @@ terrain_type::terrain_type(const config& cfg) :
|
|||
* @todo reenable these validations. The problem is that all MP
|
||||
* scenarios/campaigns share the same namespace and one rogue scenario
|
||||
* can avoid the player to create a MP game. So every scenario/campaign
|
||||
* should get it's own namespace to be safe.
|
||||
* should get its own namespace to be safe.
|
||||
*/
|
||||
#if 0
|
||||
VALIDATE(number_ != t_translation::NONE_TERRAIN,
|
||||
|
@ -189,6 +193,8 @@ terrain_type::terrain_type(const terrain_type& base, const terrain_type& overlay
|
|||
submerge_(base.submerge_),
|
||||
submerge_set_(base.submerge_set_),
|
||||
light_modification_(base.light_modification_ + overlay.light_modification_),
|
||||
max_light_(std::max(base.max_light_, overlay.max_light_)),
|
||||
min_light_(std::min(base.min_light_, overlay.min_light_)),
|
||||
heals_(std::max<int>(base.heals_, overlay.heals_)),
|
||||
income_description_(),
|
||||
income_description_ally_(),
|
||||
|
@ -272,6 +278,8 @@ bool terrain_type::operator==(const terrain_type& other) const {
|
|||
&& submerge_ == other.submerge_
|
||||
&& submerge_set_ == other.submerge_set_
|
||||
&& light_modification_ == other.light_modification_
|
||||
&& max_light_ == other.max_light_
|
||||
&& min_light_ == other.min_light_
|
||||
&& heals_ == other.heals_
|
||||
&& village_ == other.village_
|
||||
&& castle_ == other.castle_
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "config.hpp"
|
||||
#include "terrain_translation.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
class terrain_type
|
||||
{
|
||||
|
@ -46,7 +47,10 @@ public:
|
|||
|
||||
bool is_nonnull() const { return (number_ != t_translation::NONE_TERRAIN) &&
|
||||
(number_ != t_translation::VOID_TERRAIN ); }
|
||||
int light_modification() const { return light_modification_; }
|
||||
/// Returns the light (lawful) bonus for this terrain when the time of day
|
||||
/// gives a @a base bonus.
|
||||
int light_bonus(int base) const
|
||||
{ return bounded_add(base, light_modification_, max_light_, min_light_); }
|
||||
|
||||
int unit_height_adjust() const { return height_adjust_; }
|
||||
double unit_submerge() const { return submerge_; }
|
||||
|
@ -103,7 +107,10 @@ private:
|
|||
double submerge_;
|
||||
bool submerge_set_;
|
||||
|
||||
int light_modification_, heals_;
|
||||
int light_modification_;
|
||||
int max_light_;
|
||||
int min_light_;
|
||||
int heals_;
|
||||
|
||||
t_string income_description_;
|
||||
t_string income_description_ally_;
|
||||
|
|
|
@ -129,9 +129,8 @@ const time_of_day tod_manager::get_illuminated_time_of_day(const map_location& l
|
|||
|
||||
if ( map.on_board_with_border(loc) )
|
||||
{
|
||||
// now add illumination
|
||||
const int terrain_light = map.get_terrain_info(loc).light_modification()
|
||||
+ tod.lawful_bonus;
|
||||
// Now add terrain illumination.
|
||||
const int terrain_light = map.get_terrain_info(loc).light_bonus(tod.lawful_bonus);
|
||||
|
||||
std::vector<int> mod_list;
|
||||
std::vector<int> max_list;
|
||||
|
|
Loading…
Add table
Reference in a new issue