Skip to content

Commit 632b650

Browse files
author
s.kushnirenko
committed
building: moved pottery workshop from common to own file
1 parent 074a50c commit 632b650

6 files changed

+29
-13
lines changed

src/building/building.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include "building/building_bricklayers_guild.h"
1616
#include "building/building_booth.h"
1717
#include "building/building_health.h"
18+
#include "building/building_pottery.h"
1819
#include "city/buildings.h"
1920
#include "city/population.h"
2021
#include "city/warning.h"
@@ -181,10 +182,6 @@ static void building_new_fill_in_data_for_type(building* b, e_building_type type
181182
b->data.industry.first_material_id = RESOURCE_GEMS;
182183
b->output_resource_first_id = RESOURCE_LUXURY_GOODS;
183184
break;
184-
case BUILDING_POTTERY_WORKSHOP:
185-
b->data.industry.first_material_id = RESOURCE_CLAY;
186-
b->output_resource_first_id = RESOURCE_POTTERY;
187-
break;
188185
case BUILDING_HUNTING_LODGE:
189186
b->output_resource_first_id = RESOURCE_GAMEMEAT;
190187
break;
@@ -332,6 +329,7 @@ building_impl *building::dcast() {
332329
case BUILDING_BANDSTAND: _ptr = new building_bandstand(*this); break;
333330
case BUILDING_BOOTH: _ptr = new building_booth(*this); break;
334331
case BUILDING_APOTHECARY: _ptr = new building_apothecary(*this); break;
332+
case BUILDING_POTTERY_WORKSHOP: _ptr = new building_pottery(*this); break;
335333

336334
case BUILDING_SMALL_MASTABA:
337335
case BUILDING_SMALL_MASTABA_SIDE:

src/building/building_pottery.cpp

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

src/building/building_pottery.h

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#pragma once
2+
3+
#include "building/building.h"
4+
5+
class building_pottery : public building_impl {
6+
public:
7+
building_pottery(building &b) : building_impl(b) {}
8+
virtual void on_create() override;
9+
virtual void window_info_background(object_info &c) override;
10+
};

src/building/building_workshop.cpp

+1-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include "sound/sound_building.h"
1717
#include "game/game.h"
1818

19-
static void building_workshop_draw_info(object_info& c, int help_id, const char* type, int group_id, e_resource resource, e_resource input_resource) {
19+
void building_workshop_draw_info(object_info& c, int help_id, pcstr type, int group_id, e_resource resource, e_resource input_resource) {
2020
c.help_id = help_id;
2121
window_building_play_sound(&c, snd::get_building_info_sound(type));
2222

@@ -148,12 +148,6 @@ void building_luxury_workshop_draw_info(object_info& c) {
148148
building_workshop_draw_info(c, 99, "luxury_workshop", 125, output_resource, input_resource);
149149
}
150150

151-
void building_pottery_workshop_draw_info(object_info& c) {
152-
e_resource output_resource = RESOURCE_POTTERY;
153-
154-
building_workshop_draw_info(c, 1, "pottery_workshop", 126, output_resource, RESOURCE_CLAY);
155-
}
156-
157151
void building_papyrus_workshop_draw_info(object_info& c) {
158152
e_resource output_resource = RESOURCE_PAPYRUS;
159153

src/building/building_workshop.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#pragma once
22

33
#include "graphics/color.h"
4+
#include "game/resource.h"
45

56
struct object_info;
67
struct painter;
@@ -9,8 +10,8 @@ void building_brewery_draw_info(object_info& c);
910
void building_flax_workshop_draw_info(object_info& c);
1011
void building_weapons_workshop_draw_info(object_info& c);
1112
void building_luxury_workshop_draw_info(object_info& c);
12-
void building_pottery_workshop_draw_info(object_info& c);
1313
void building_brick_maker_workshop_draw_info(object_info& c);
1414
void building_papyrus_workshop_draw_info(object_info &c);
1515
void building_cattle_ranch_draw_info(object_info &c);
16+
void building_workshop_draw_info(object_info &c, int help_id, pcstr type, int group_id, e_resource resource, e_resource input_resource);
1617
void building_workshop_draw_raw_material_storage(painter &ctx, const building *b, vec2i pos, color color_mask);

src/window/window_building_info.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,6 @@ static void draw_refresh_background() {
631631
case BUILDING_WEAVER_WORKSHOP: building_flax_workshop_draw_info(context); break;
632632
case BUILDING_WEAPONS_WORKSHOP: building_weapons_workshop_draw_info(context); break;
633633
case BUILDING_JEWELS_WORKSHOP: building_luxury_workshop_draw_info(context); break;
634-
case BUILDING_POTTERY_WORKSHOP: building_pottery_workshop_draw_info(context); break;
635634
case BUILDING_PAPYRUS_WORKSHOP: building_papyrus_workshop_draw_info(context); break;
636635
case BUILDING_CATTLE_RANCH: building_cattle_ranch_draw_info(context); break;
637636
case BUILDING_BRICKS_WORKSHOP: building_brick_maker_workshop_draw_info(context); break;

0 commit comments

Comments
 (0)