@@ -140,64 +140,62 @@ uint8_t granary_3quarters_button_text[] = "18";
140
140
uint8_t granary_half_button_text[] = " 12" ;
141
141
uint8_t granary_quarter_button_text[] = " 6" ;
142
142
143
- std::pair<bstring64, e_font> window_building_get_order_instruction (int instr_kind, const storage_t *storage, e_resource resource, int market_order) {
144
- if (storage != nullptr ) {
145
- switch (storage->resource_state [resource]) {
146
- case STORAGE_STATE_PHARAOH_ACCEPT:
147
- {
148
- int max_accept = storage->resource_max_accept [resource];
149
- bstring64 text;
150
- text.printf (" %d" , max_accept);
151
-
152
- if (max_accept == 3200 ) { text = ui::str (99 , 28 ); }
153
- else if (max_accept == 2400 ) { text = ui::str (99 , 27 ); }
154
- else if (max_accept == 1600 ) { text = ui::str (99 , 26 ); }
155
- else if (max_accept == 800 ) { text = ui::str (99 , 25 ); }
156
-
157
- pcstr adv_text = " " ;
158
- if (max_accept == 2400 || max_accept == 1600 || max_accept == 800 )
159
- adv_text = ui::str (99 , 29 );
143
+ std::pair<bstring64, e_font> window_market_get_order_instruction (int instr_kind, e_resource resource, int market_order) {
144
+ switch (market_order) {
145
+ case BAZAAR_ORDER_STATE_BUY:
146
+ return { ui::str (97 , 8 ), FONT_NORMAL_WHITE_ON_DARK };
160
147
161
- bstring64 full_text;
162
- full_text.printf (" %s %s %s" , ui::str (99 , 18 ), text, adv_text);
163
- return { full_text, FONT_NORMAL_WHITE_ON_DARK };
164
- }
165
-
166
- case STORAGE_STATE_PHARAOH_REFUSE:
167
- return { ui::str (99 , 8 ), FONT_NORMAL_BLACK_ON_DARK };
168
-
169
- case STORAGE_STATE_PHARAOH_GET:
170
- {
171
- int max_get = storage->resource_max_get [resource];
172
- bstring64 text;
173
- text.printf (" %d" , max_get);
174
- if (max_get == 3200 ) { text = ui::str (99 , 31 ); }
175
- else if (max_get == 2400 ) { text = ui::str (99 , 27 ); }
176
- else if (max_get == 1600 ) { text = ui::str (99 , 26 ); }
177
- else if (max_get == 800 ) { text = ui::str (99 , 25 ); }
178
-
179
- pcstr adv_text = " " ;
180
- if (max_get == 2400 || max_get == 1600 || max_get == 800 )
181
- adv_text = ui::str (99 , 29 );
148
+ case BAZAAR_ORDER_STATE_DONT_BUY:
149
+ return { ui::str (97 , 9 ), FONT_NORMAL_BLACK_ON_DARK };
150
+ }
151
+ }
182
152
183
- bstring64 full_text;
184
- full_text.printf (" %s %s %s" , ui::str (99 , 19 ), text, adv_text);
185
- return { full_text, FONT_NORMAL_YELLOW };
186
- }
187
- case STORAGE_STATE_PHARAOH_EMPTY:
188
- return { ui::str (99 , 21 ), FONT_NORMAL_BLACK_ON_DARK };
189
- }
190
- } else {
191
- switch (market_order) {
192
- case BAZAAR_ORDER_STATE_BUY:
193
- return { ui::str (97 , 8 ), FONT_NORMAL_WHITE_ON_DARK };
153
+ std::pair<bstring64, e_font> window_building_get_order_instruction (int instr_kind, const storage_t &storage, e_resource resource) {
154
+ switch (storage.resource_state [resource]) {
155
+ case STORAGE_STATE_PHARAOH_ACCEPT: {
156
+ int max_accept = storage.resource_max_accept [resource];
157
+ bstring64 text;
158
+ text.printf (" %d" , max_accept);
159
+
160
+ if (max_accept == 3200 ) { text = ui::str (99 , 28 ); }
161
+ else if (max_accept == 2400 ) { text = ui::str (99 , 27 ); }
162
+ else if (max_accept == 1600 ) { text = ui::str (99 , 26 ); }
163
+ else if (max_accept == 800 ) { text = ui::str (99 , 25 ); }
164
+
165
+ pcstr adv_text = " " ;
166
+ if (max_accept == 2400 || max_accept == 1600 || max_accept == 800 )
167
+ adv_text = ui::str (99 , 29 );
168
+
169
+ bstring64 full_text;
170
+ full_text.printf (" %s %s %s" , ui::str (99 , 18 ), text, adv_text);
171
+ return { full_text, FONT_NORMAL_WHITE_ON_DARK };
172
+ }
194
173
195
- case BAZAAR_ORDER_STATE_DONT_BUY:
196
- return { ui::str (97 , 9 ), FONT_NORMAL_BLACK_ON_DARK };
197
- }
174
+ case STORAGE_STATE_PHARAOH_REFUSE:
175
+ return { ui::str (99 , 8 ), FONT_NORMAL_BLACK_ON_DARK };
176
+
177
+ case STORAGE_STATE_PHARAOH_GET: {
178
+ int max_get = storage.resource_max_get [resource];
179
+ bstring64 text;
180
+ text.printf (" %d" , max_get);
181
+ if (max_get == 3200 ) { text = ui::str (99 , 31 ); }
182
+ else if (max_get == 2400 ) { text = ui::str (99 , 27 ); }
183
+ else if (max_get == 1600 ) { text = ui::str (99 , 26 ); }
184
+ else if (max_get == 800 ) { text = ui::str (99 , 25 ); }
185
+
186
+ pcstr adv_text = " " ;
187
+ if (max_get == 2400 || max_get == 1600 || max_get == 800 )
188
+ adv_text = ui::str (99 , 29 );
189
+
190
+ bstring64 full_text;
191
+ full_text.printf (" %s %s %s" , ui::str (99 , 19 ), text, adv_text);
192
+ return { full_text, FONT_NORMAL_YELLOW };
193
+ }
194
+ case STORAGE_STATE_PHARAOH_EMPTY:
195
+ return { ui::str (99 , 21 ), FONT_NORMAL_BLACK_ON_DARK };
198
196
}
199
197
200
- return { " unknow_storage " , FONT_NORMAL_BLACK_ON_DARK };
198
+ return { " unknown_storage " , FONT_NORMAL_BLACK_ON_DARK };
201
199
}
202
200
203
201
void window_building_draw_order_instruction (int instr_kind, const storage_t * storage, e_resource resource, vec2i pos, int market_order) {
0 commit comments