Skip to content

Commit 5784e9c

Browse files
committed
figure: correct switch walking animation when switch terrain
1 parent 29a5870 commit 5784e9c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/figure/figure.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,10 @@ void figure_impl::on_post_load() {
320320
}
321321

322322
void figure_impl::on_change_terrain(int old, int current) {
323-
const bool is_water = (!!(base.terrain_type & TERRAIN_WATER) || !!(base.terrain_type & TERRAIN_DEEPWATER));
323+
const bool is_water = (!!(current & TERRAIN_WATER) || !!(current & TERRAIN_DEEPWATER)
324+
&& !(current & TERRAIN_SHORE))
325+
&& !(current & TERRAIN_BUILDING);
326+
324327
const bool is_swim_animaion = base.anim.id == animkeys().swim;
325328
const bool is_walk_animaion = base.anim.id == animkeys().walk;
326329
const bool is_moving_animation = is_swim_animaion || is_walk_animaion;

src/widget/widget_top_menu_game.cpp

+9-4
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ void top_menu_widget::update_month_year_max_width(uint8_t month, int year) {
148148

149149
static void menu_debug_render_text(int opt, bool v) {
150150
auto& data = g_top_menu;
151-
static const char *debug_text_rend[][2] = {
151+
struct option { pcstr on, off; };
152+
static option debug_text_rend[] = {
152153
{"Buildings ON", "Buildings OFF"},
153154
{"Tile Size ON", "Tile Size OFF"},
154155
{"Roads ON", "Roads OFF"},
@@ -175,12 +176,15 @@ static void menu_debug_render_text(int opt, bool v) {
175176
{"Marshland Depl ON", "Marshland Depl OFF"},
176177
{"Dmg Fire ON", "Dmg Fire OFF"},
177178
{"Desirability ON", "Desirability OFF"},
179+
{"River Shore ON", "River Shore OFF"},
178180
};
179-
g_top_menu.menu_item_update("debug_render", opt, debug_text_rend[opt][v ? 0 : 1]);
181+
const auto &current = debug_text_rend[opt];
182+
g_top_menu.menu_item_update("debug_render", opt, v ? current.on : current.off);
180183
}
181184

182185
static void menu_debug_opt_text(int opt, bool v) {
183-
static const char* debug_text_opt[][2] = {
186+
struct option { pcstr on, off; };
187+
static option debug_text_opt[] = {
184188
{"Pages ON", "Pages OFF"},
185189
{"Game Time ON", "Game Time OFF"},
186190
{"Build Planner ON", "Build Planner OFF"},
@@ -198,7 +202,8 @@ static void menu_debug_opt_text(int opt, bool v) {
198202
{"Full Screenshot", "Full Screenshot"},
199203
{"Write Video ON", "Write Video OFF"},
200204
};
201-
g_top_menu.menu_item_update("debug", opt, debug_text_opt[opt][v ? 0 : 1]);
205+
const auto &current = debug_text_opt[opt];
206+
g_top_menu.menu_item_update("debug", opt, v ? current.on : current.off);
202207
}
203208

204209
static void menu_debug_screenshot(int opt) {

0 commit comments

Comments
 (0)