reformat the ToD page and bugfixes

Although not perfect, this makes the page usable. Using the previous version leads to multiple complex bugs at this point.
also stops a y calculation bug in table.
This commit is contained in:
Subhraman Sarkar 2024-08-10 12:19:54 +05:30 committed by Celtic Minstrel
parent b109bda9d4
commit 5958ca209e
4 changed files with 37 additions and 40 deletions

View file

@ -465,23 +465,25 @@ Of these categories, only leaders are built into the basic game rules. The other
title= _ "Time of Day"
text= _ "The time of day affects the damage of certain units as follows:
• <bold>text='Lawful'</bold> units get +25% damage in daytime, and 25% damage at night.
• <bold>text='Chaotic'</bold> units get +25% damage at night, and 25% in daytime.
• <bold>text='Neutral'</bold> units are unaffected by the time of day.
• <bold>text='Liminal'</bold> units get +25% damage during twilight." + _ "
• <span face='Serif' size='15'>LAWFUL</span> units get +25% damage in daytime, and 25% damage at night.
• <span face='Serif' size='15'>CHAOTIC</span> units get +25% damage at night, and 25% in daytime.
• <span face='Serif' size='15'>NEUTRAL</span> units are unaffected by the time of day.
• <span face='Serif' size='15'>LIMINAL</span> units get +25% damage during twilight." + _ "
The current time of day can be observed under the minimap in the status pane. For the usual day/night cycle, morning and afternoon count as day, first and second watch count as night:
<table col=2/>Dawn<jump/><img>src=misc/time-schedules/default/schedule-dawn.png align=here</img><br/>
Morning<jump/><img>src=misc/time-schedules/default/schedule-morning.png align=here</img><br/>
Afternoon<jump/><img>src=misc/time-schedules/default/schedule-afternoon.png align=here</img><br/>
Dusk<jump/><img>src=misc/time-schedules/default/schedule-dusk.png align=here</img><br/>
First Watch<jump/><img>src=misc/time-schedules/default/schedule-firstwatch.png align=here</img><br/>
Second Watch<jump/><img>src=misc/time-schedules/default/schedule-secondwatch.png align=here</img>
<endtable/>" + _ "
<img>src=misc/time-schedules/schedule-underground.png align=right float=yes</img>" + _"Keep in mind that some scenarios take place underground, where it is perpetually night!
" + "<img>src=misc/time-schedules/schedule-underground-illum.png align=right float=yes</img>" + _"Some underground locations are illuminated. They are perpetually intermediate between day and night.
" + "<img>src=misc/time-schedules/schedule-indoors.png align=right float=yes</img>" + _"Some role-playing scenarios take place indoors — these regions are similarly intermediate.
" + "<img>src=misc/time-schedules/default/schedule-firstwatch.png~BLIT(misc/tod-bright.png) align=right float=yes</img>" + _"Finally, units with the <ref>dst='ability_illuminationilluminates' text='illuminates'</ref> ability and terrain features such as <ref>dst='terrain_lava' text='lava'</ref> change the time of day bonus around them."
The current time of day can be observed under the minimap in the status pane. For the usual day/night cycle, morning and afternoon count as day, first and second watch count as night:" +
"
<table col=2/>Dawn<jump/><img>src=misc/time-schedules/default/schedule-dawn.png</img><br/>Morning<jump/><img>src=misc/time-schedules/default/schedule-morning.png</img><br/>Afternoon<jump/><img>src=misc/time-schedules/default/schedule-afternoon.png</img><br/>Dusk<jump/><img>src=misc/time-schedules/default/schedule-dusk.png</img><br/>First Watch<jump/><img>src=misc/time-schedules/default/schedule-firstwatch.png</img><br/>Second Watch<jump/><img>src=misc/time-schedules/default/schedule-secondwatch.png</img><br/><endtable/>" +
"
<img src=misc/time-schedules/schedule-underground.png align=left/>" + _"
Keep in mind that some scenarios take place underground, where it is perpetually night!" +
"<img src=misc/time-schedules/schedule-underground-illum.png align=left/>" + _"
Some underground locations are illuminated. They are perpetually intermediate between day and night." +
"<img src=misc/time-schedules/schedule-indoors.png align=left/>" + _"
Some role-playing scenarios take place indoors — these regions are similarly intermediate." +
"<img src=misc/time-schedules/default/schedule-firstwatch.png~BLIT(misc/tod-bright.png) align=left/>" + _"
Finally, units with the <ref>dst='ability_illuminationilluminates' text='illuminates'</ref> ability and terrain features such as <ref>dst='terrain_lava' text='lava'</ref> change the time of day bonus around them."
[/topic]
# wmllint: markcheck on

View file

@ -1614,6 +1614,7 @@
2CFD4922B64EA6C9F71F71A2 /* preferences.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = preferences.hpp; path = preferences/preferences.hpp; sourceTree = "<group>"; };
3D284B9A81882806D8B25006 /* spritesheet_generator.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = spritesheet_generator.hpp; sourceTree = "<group>"; };
3975405BB582CA290366CD21 /* test_help_markup.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = test_help_markup.cpp; sourceTree = "<group>"; };
3D284B9A81882806D8B25006 /* spritesheet_generator.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = spritesheet_generator.hpp; path = spritesheet_generator.hpp; sourceTree = "<group>"; };
46081FED2B2F0F6A006ACAD7 /* libpcre2-8.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libpcre2-8.0.dylib"; path = "lib/libpcre2-8.0.dylib"; sourceTree = "<group>"; };
46081FF02B2F103E006ACAD7 /* libwebpdemux.2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libwebpdemux.2.dylib; path = lib/libwebpdemux.2.dylib; sourceTree = "<group>"; };
46081FF32B2F11F3006ACAD7 /* libsharpyuv.0.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsharpyuv.0.dylib; path = lib/libsharpyuv.0.dylib; sourceTree = "<group>"; };
@ -6706,6 +6707,7 @@
DDE34117BDAA30C965F6E4DB /* preferences.cpp in Sources */,
4A1D4916A16C7C6E07D0BAB2 /* spritesheet_generator.cpp in Sources */,
C3854DF5A850564161932EE5 /* test_help_markup.cpp in Sources */,
4A1D4916A16C7C6E07D0BAB2 /* spritesheet_generator.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View file

@ -342,7 +342,7 @@ config rich_label::get_parsed_text(const config& parsed_text)
bool in_table = false;
unsigned col_idx = 0;
unsigned col_width = 0;
unsigned max_col_height = 0;
unsigned max_row_height = 0;
unsigned row_y = 0;
DBG_GUI_RL << parsed_text.debug();
@ -420,8 +420,8 @@ config rich_label::get_parsed_text(const config& parsed_text)
}
if (col_width > 0) {
max_col_height = std::max(max_col_height, txt_height_);
max_col_height = std::max(max_col_height, static_cast<unsigned>(img_size.y));
max_row_height = std::max(max_row_height, txt_height_);
max_row_height = std::max(max_row_height, static_cast<unsigned>(img_size.y));
txt_height_ = 0;
col_idx++;
@ -453,33 +453,32 @@ config rich_label::get_parsed_text(const config& parsed_text)
DBG_GUI_RL << txt_height_;
DBG_GUI_RL << img_size;
max_col_height = std::max(max_col_height, txt_height_);
max_col_height = std::max(max_col_height, static_cast<unsigned>(img_size.y));
max_row_height = std::max(max_row_height, txt_height_);
max_row_height = std::max(max_row_height, static_cast<unsigned>(img_size.y));
DBG_GUI_RL << max_col_height;
DBG_GUI_RL << "row height: " << max_row_height;
//linebreak
col_idx = 0;
x_ = 0;
prev_blk_height_ += max_col_height + padding_;
prev_blk_height_ = row_y;
prev_blk_height_ += max_row_height + padding_;
row_y = prev_blk_height_;
(*curr_item)["actions"] = boost::str(boost::format("([set_var('pos_x', 0), set_var('pos_y', pos_y + %d + %d), set_var('tw', width - pos_x - %d)])") % max_col_height % padding_ % col_width);
(*curr_item)["actions"] = boost::str(boost::format("([set_var('pos_x', 0), set_var('pos_y', pos_y + %d + %d), set_var('tw', width - pos_x - %d)])") % max_row_height % padding_ % col_width);
max_col_height = 0;
max_row_height = 0;
txt_height_ = 0;
} else {
// TODO correct height update
if (is_image && !is_float) {
x_ = 0;
(*curr_item)["actions"] = "([set_var('pos_x', 0), set_var('pos_y', pos_y + image_height + padding)])";
img_size.y = 0;
} else {
add_text_with_attribute(*curr_item, "\n");
}
}
x_ = 0;
is_image = false;
img_size = point(0,0);
@ -497,7 +496,7 @@ config rich_label::get_parsed_text(const config& parsed_text)
new_text_block = false;
}
DBG_GUI_RL << "end table: " << max_col_height;
DBG_GUI_RL << "end table: " << max_row_height;
col_width = 0;
in_table = false;
is_image = false;

View file

@ -497,14 +497,8 @@ std::string unit_topic_generator::operator()() const {
must_have_count << "\n (" << must_have_traits.size() << ") : ";
std::stringstream random_count;
random_count << " (" << (type_.num_traits() - must_have_traits.size() - must_have_nameless_traits) << ") : ";
// int second_line_whitespace = font::pango_line_width(traits_label+must_have_count.str(), normal_font_size)
// - font::pango_line_width(random_count.str(), normal_font_size);
// This ensures that the second line is justified so that the ':' characters are aligned.
ss << must_have_count.str();
print_trait_list(ss, must_have_traits);
// ss << "\n" << jump(second_line_whitespace) << random_count.str();
ss << "\n" << random_count.str();
print_trait_list(ss, random_traits);
} else {
@ -618,14 +612,14 @@ std::string unit_topic_generator::operator()() const {
ss << "\n" << detailed_description;
if(const auto notes = type_.special_notes(); !notes.empty()) {
ss << "\n" << _("<header>Special Notes</header>");
ss << "<br/><header>" << _("Special Notes") << "</header>\n";
for(const auto& note : notes) {
ss << font::unicode_bullet << " <i>" << note << "</i>" << '\n';
}
}
// Print the attacks table
ss << "\n<header>Attacks</header>";
ss << "\n<header>" << _("Attacks") << "</header>";
if (!type_.attacks().empty()) {
// Start table
@ -711,9 +705,9 @@ std::string unit_topic_generator::operator()() const {
}
// Print the resistance table of the unit.
ss << "\n<header>Resistances</header>";
ss << "\n<header>" << _("Resistances") << "</header>";
// Start table
// Start table
ss << "<table col=2/>";
ss << _("<b>Attack Type</b>") << "<jump/>";
ss << _("<b>Resistance</b>") << "<br/>";
@ -743,7 +737,7 @@ std::string unit_topic_generator::operator()() const {
if (std::shared_ptr<terrain_type_data> tdata = load_terrain_types_data()) {
// Print the terrain modifier table of the unit.
ss << "\n<header>Terrain Modifiers</header>";
ss << "\n<header>" << _("Terrain Modifiers") << "</header>";
ss << "<table col=3/>";
ss << _("<b>Terrain</b>") << "<jump/>";
ss << _("<b>Defense</b>") << "<jump/>";