Skip to content

Commit d75d7ef

Browse files
author
s.kushnirenko
committed
feat: add support for shrine buildings
what: + implement window_info_background function for shrine buildings
1 parent a8635db commit d75d7ef

File tree

4 files changed

+36
-27
lines changed

4 files changed

+36
-27
lines changed

src/building/building.cpp

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "building/building_health.h"
1818
#include "building/building_pottery.h"
1919
#include "building/building_well.h"
20+
#include "building/building_shrine.h"
2021
#include "city/buildings.h"
2122
#include "city/population.h"
2223
#include "city/warning.h"
@@ -332,12 +333,20 @@ building_impl *building::dcast() {
332333
case BUILDING_APOTHECARY: _ptr = new building_apothecary(*this); break;
333334
case BUILDING_POTTERY_WORKSHOP: _ptr = new building_pottery(*this); break;
334335
case BUILDING_WELL: _ptr = new building_well(*this); break;
336+
337+
case BUILDING_SHRINE_OSIRIS:
338+
case BUILDING_SHRINE_RA:
339+
case BUILDING_SHRINE_PTAH:
340+
case BUILDING_SHRINE_SETH:
341+
case BUILDING_SHRINE_BAST:
342+
_ptr = new building_shrine(*this);
343+
break;
335344

336345
case BUILDING_SMALL_MASTABA:
337346
case BUILDING_SMALL_MASTABA_SIDE:
338347
case BUILDING_SMALL_MASTABA_ENTRANCE:
339348
case BUILDING_SMALL_MASTABA_WALL:
340-
_ptr = new building_small_mastaba(*this);
349+
_ptr = new building_small_mastaba(*this);
341350
break;
342351
default:
343352
_ptr = new building_impl(*this);

src/building/building_shrine.cpp

+19-14
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "window/building/figures.h"
1414
#include "sound/sound_building.h"
1515
#include "game/game.h"
16+
#include "building_shrine.h"
1617

1718
static void building_shrine_draw_info(object_info& c, const char* type, int text_id, int image_offset) {
1819
painter ctx = game.painter();
@@ -28,18 +29,22 @@ static void building_shrine_draw_info(object_info& c, const char* type, int text
2829
}
2930
}
3031

31-
void building_shrine_osiris_draw_info(object_info& c) {
32-
building_shrine_draw_info(c, "shrine_osiris", 0, 21);
33-
}
34-
void building_shrine_ra_draw_info(object_info& c) {
35-
building_shrine_draw_info(c, "shrine_ra", 2, 22);
36-
}
37-
void building_shrine_ptah_draw_info(object_info& c) {
38-
building_shrine_draw_info(c, "shrine_ptah", 4, 23);
39-
}
40-
void building_shrine_seth_draw_info(object_info& c) {
41-
building_shrine_draw_info(c, "shrine_seth", 6, 24);
32+
void building_shrine::window_info_background(object_info &ctx) {
33+
switch (base.type) {
34+
case BUILDING_SHRINE_OSIRIS:
35+
building_shrine_draw_info(ctx, "shrine_osiris", 0, 21);
36+
break;
37+
case BUILDING_SHRINE_RA:
38+
building_shrine_draw_info(ctx, "shrine_ra", 2, 22);
39+
break;
40+
case BUILDING_SHRINE_PTAH:
41+
building_shrine_draw_info(ctx, "shrine_ptah", 4, 23);
42+
break;
43+
case BUILDING_SHRINE_SETH:
44+
building_shrine_draw_info(ctx, "shrine_seth", 6, 24);
45+
break;
46+
case BUILDING_SHRINE_BAST:
47+
building_shrine_draw_info(ctx, "shrine_bast", 8, 25);
48+
break;
49+
}
4250
}
43-
void building_shrine_bast_draw_info(object_info& c) {
44-
building_shrine_draw_info(c, "shrine_bast", 8, 25);
45-
}

src/building/building_shrine.h

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

3-
struct object_info;
3+
#include "building/building.h"
44

5-
void building_shrine_osiris_draw_info(object_info& c);
6-
void building_shrine_ra_draw_info(object_info& c);
7-
void building_shrine_ptah_draw_info(object_info& c);
8-
void building_shrine_seth_draw_info(object_info& c);
9-
void building_shrine_bast_draw_info(object_info& c);
5+
class building_shrine : public building_impl {
6+
public:
7+
building_shrine(building &b) : building_impl(b) {}
8+
9+
virtual void window_info_background(object_info &ctx) override;
10+
};

src/window/window_building_info.cpp

-6
Original file line numberDiff line numberDiff line change
@@ -687,12 +687,6 @@ static void draw_refresh_background() {
687687
building_temple_bast_draw_info(context);
688688
break;
689689

690-
case BUILDING_SHRINE_OSIRIS: building_shrine_osiris_draw_info(context); break;
691-
case BUILDING_SHRINE_RA: building_shrine_ra_draw_info(context); break;
692-
case BUILDING_SHRINE_PTAH: building_shrine_ptah_draw_info(context); break;
693-
case BUILDING_SHRINE_SETH: building_shrine_seth_draw_info(context); ;
694-
case BUILDING_SHRINE_BAST: building_shrine_bast_draw_info(context); break;
695-
696690
case BUILDING_ORACLE: window_building_draw_oracle(&context); break;
697691

698692
case BUILDING_PERSONAL_MANSION:

0 commit comments

Comments
 (0)