Skip to content

Commit d09a1ad

Browse files
author
s.kushnirenko
committed
gold mine: moved animation config to js
1 parent 1f24252 commit d09a1ad

File tree

6 files changed

+33
-6
lines changed

6 files changed

+33
-6
lines changed

src/building/building_raw_material.cpp

+23-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ struct clay_pit_t {
2929
animations_t anim;
3030
};
3131

32+
struct gold_mine_t {
33+
static constexpr e_building_type type = BUILDING_GOLD_MINE;
34+
e_labor_category labor_category;
35+
animations_t anim;
36+
};
37+
3238
clay_pit_t clay_pit;
39+
gold_mine_t gold_mine;
3340

3441
}
3542

@@ -38,9 +45,15 @@ void config_load_building_raw_materials() {
3845
g_config_arch.r_section("building_clay_pit", [] (archive arch) {
3946
model::clay_pit.labor_category = arch.r_type<e_labor_category>("labor_category");
4047
model::clay_pit.anim.load(arch);
48+
city_labor_set_category(model::clay_pit);
49+
});
50+
51+
g_config_arch.r_section("building_gold_mine", [] (archive arch) {
52+
model::gold_mine.labor_category = arch.r_type<e_labor_category>("labor_category");
53+
model::gold_mine.anim.load(arch);
54+
city_labor_set_category(model::gold_mine);
4155
});
4256

43-
city_labor_set_category(model::clay_pit);
4457
}
4558

4659
static void building_raw_material_draw_info(object_info& c, const char* type, e_resource resource) {
@@ -121,6 +134,13 @@ int building_mine_gold::get_produce_uptick_per_day() const {
121134
}
122135
}
123136

137+
bool building_mine_gold::draw_ornaments_and_animations_height(painter &ctx, vec2i point, tile2i tile, color color_mask) {
138+
const animation_t &anim = model::gold_mine.anim["work"];
139+
building_draw_normal_anim(ctx, point, &base, tile, anim, color_mask);
140+
141+
return true;
142+
}
143+
124144
void building_quarry_stone::on_create() {
125145
base.output_resource_first_id = RESOURCE_STONE;
126146
}
@@ -146,10 +166,8 @@ int building_clay_pit::get_fire_risk(int value) const {
146166
}
147167

148168
bool building_clay_pit::draw_ornaments_and_animations_height(painter &ctx, vec2i point, tile2i tile, color color_mask) {
149-
if (worker_percentage() > 50) {
150-
const animation_t &anim = model::clay_pit.anim["work"];
151-
building_draw_normal_anim(ctx, point, &base, tile, anim, color_mask);
152-
}
169+
const animation_t &anim = model::clay_pit.anim["work"];
170+
building_draw_normal_anim(ctx, point, &base, tile, anim, color_mask);
153171

154172
return true;
155173
}

src/building/building_raw_material.h

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class building_mine_gold : public building_impl {
2626
virtual void on_create() override;
2727
virtual void window_info_background(object_info &c) override;
2828
virtual int get_produce_uptick_per_day() const override;
29+
virtual bool draw_ornaments_and_animations_height(painter &ctx, vec2i point, tile2i tile, color color_mask) override;
2930
};
3031

3132
class building_quarry_stone : public building_impl {

src/dev/debug.h

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "input/hotkey.h"
99

1010
#include <functional>
11+
#include <iosfwd>
1112

1213
extern int debug_range_1;
1314
extern int debug_range_2;

src/scripts/building_info.js

+7
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,13 @@ building_clay_pit = {
5959
labor_category : LABOR_CATEGORY_INDUSTRY_COMMERCE,
6060
}
6161

62+
building_gold_mine = {
63+
animations : {
64+
work : { pos : [54, 15], anim_id: ANIM_GOLD_MINE, max_frames: 16 }
65+
},
66+
labor_category : LABOR_CATEGORY_INDUSTRY_COMMERCE,
67+
}
68+
6269
building_pottery = {
6370
animations : {
6471
work : { pos : [-1, -1], anim_id: IMG_POTTERY_WORKSHOP }

src/scripts/common.js

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var main_menu_window = {}
2525
var building_booth = {}
2626
var building_conservatory = {}
2727
var building_pottery = {}
28+
var building_gold_mine = {}
2829
var building_clay_pit = {}
2930
var building_hunting_lodge = {}
3031
var building_village_palace = {}

src/widget/city/ornaments.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ void draw_ornaments_and_animations_height(vec2i point, tile2i tile, painter &ctx
295295
draw_water_lift_anim(ctx, b, point.x, point.y, color_mask);
296296
break;
297297

298-
case BUILDING_GOLD_MINE:
299298
case BUILDING_COPPER_MINE:
300299
case BUILDING_GEMSTONE_MINE:
301300
building_draw_normal_anim(ctx, point + vec2i{54, 15}, b, tile, image_group(ANIM_GOLD_MINE) - 1, color_mask);

0 commit comments

Comments
 (0)