Skip to content

Commit dc77e65

Browse files
author
s.kushnirenko
committed
building: restored logic for brewery
1 parent ff20409 commit dc77e65

7 files changed

+35
-13
lines changed

src/building/building.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "building/building_firehouse.h"
1111
#include "building_architect_post.h"
1212
#include "building/storage_yard.h"
13+
#include "building/building_brewery.h"
1314
#include "building/monument_mastaba.h"
1415
#include "building/building_bandstand.h"
1516
#include "building/building_bricklayers_guild.h"
@@ -169,10 +170,6 @@ static void building_new_fill_in_data_for_type(building* b, e_building_type type
169170
case BUILDING_CLAY_PIT:
170171
b->output_resource_first_id = RESOURCE_CLAY;
171172
break;
172-
case BUILDING_BREWERY_WORKSHOP:
173-
b->data.industry.first_material_id = RESOURCE_BARLEY;
174-
b->output_resource_first_id = RESOURCE_BEER;
175-
break;
176173
case BUILDING_WEAVER_WORKSHOP:
177174
b->data.industry.first_material_id = RESOURCE_FLAX;
178175
b->output_resource_first_id = RESOURCE_LINEN;
@@ -334,6 +331,7 @@ building_impl *building::dcast() {
334331
case BUILDING_APOTHECARY: _ptr = new building_apothecary(*this); break;
335332
case BUILDING_POTTERY_WORKSHOP: _ptr = new building_pottery(*this); break;
336333
case BUILDING_WELL: _ptr = new building_well(*this); break;
334+
case BUILDING_BREWERY_WORKSHOP: _ptr = new building_brewery(*this); break;
337335

338336
case BUILDING_SHRINE_OSIRIS:
339337
case BUILDING_SHRINE_RA:

src/building/building.h

+5
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,11 @@ class building_impl {
402402
inline tile2i tile() const { return base.tile; }
403403
inline e_building_type type() const { return base.type; }
404404

405+
virtual bool is_workshop() const { return false; }
406+
407+
using resources_vec = std::array<e_resource, 4>;
408+
virtual resources_vec required_resource() const { return {}; }
409+
405410
building &base;
406411
building::impl_data_t &data;
407412
};

src/building/building_brewery.cpp

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "building/building_brewery.h"
2+
3+
#include "building/building_workshop.h"
4+
5+
void building_brewery::on_create() {
6+
data.industry.first_material_id = RESOURCE_BARLEY;
7+
base.output_resource_first_id = RESOURCE_BEER;
8+
}
9+
10+
void building_brewery::window_info_background(object_info& c) {
11+
e_resource input_resource = RESOURCE_BARLEY;
12+
e_resource output_resource = RESOURCE_BEER;
13+
14+
building_workshop_draw_info(c, 96, "brewery", 122, output_resource, input_resource);
15+
}

src/building/building_brewery.h

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#pragma once
2+
3+
#include "building/building.h"
4+
5+
class building_brewery : public building_impl {
6+
public:
7+
building_brewery(building &b) : building_impl(b) {}
8+
virtual void on_create() override;
9+
virtual bool is_workshop() const override { return true; }
10+
virtual void window_info_background(object_info &c) override;
11+
12+
virtual resources_vec required_resource() const override { return {RESOURCE_BARLEY}; }
13+
};

src/building/building_workshop.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,6 @@ static void building_workshop_draw_info(object_info& c, int help_id, const char*
122122
window_building_draw_employment(&c, y_offset + 48);
123123
}
124124

125-
void building_brewery_draw_info(object_info& c) {
126-
e_resource input_resource = RESOURCE_BARLEY;
127-
e_resource output_resource = RESOURCE_BEER;
128-
129-
building_workshop_draw_info(c, 96, "brewery", 122, output_resource, input_resource);
130-
}
131-
132125
void building_flax_workshop_draw_info(object_info& c) {
133126
e_resource input_resource = RESOURCE_FLAX;
134127
e_resource output_resource = RESOURCE_LINEN;

src/building/building_workshop.h

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
struct object_info;
77
struct painter;
88

9-
void building_brewery_draw_info(object_info& c);
109
void building_flax_workshop_draw_info(object_info& c);
1110
void building_weapons_workshop_draw_info(object_info& c);
1211
void building_luxury_workshop_draw_info(object_info& c);

src/window/window_building_info.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,6 @@ static void draw_refresh_background() {
553553
case BUILDING_COPPER_MINE: building_copper_mine_draw_info(context); break;
554554
case BUILDING_SANDSTONE_QUARRY: building_sandstone_quarry_draw_info(context); break;
555555
case BUILDING_GRANITE_QUARRY: building_granite_quarry_draw_info(context); break;;
556-
case BUILDING_BREWERY_WORKSHOP: building_brewery_draw_info(context); break;
557556
case BUILDING_WEAVER_WORKSHOP: building_flax_workshop_draw_info(context); break;
558557
case BUILDING_WEAPONS_WORKSHOP: building_weapons_workshop_draw_info(context); break;
559558
case BUILDING_JEWELS_WORKSHOP: building_luxury_workshop_draw_info(context); break;

0 commit comments

Comments
 (0)