Rise
The Vieneo Province
Intermedia.cpp
Go to the documentation of this file.
1 #include "../Instrument.h"
2 #include "../../Bus.h"
3 
4 Intermedia::Intermedia(int prmX, int prmY, float prmXScale, float prmYScale, Bus* prmBus, Logger* prmLogger, DeviceObject* prmDevice, std::vector<Font*> prmFonts) :
5  Instrument(prmX, prmY, prmXScale, prmYScale, prmBus, prmLogger, prmDevice, prmFonts)
6 {
7  logger->AddToCallStack("Intermedia::ctor");
8  defaultFont = 1;
9 }
10 
12 {
13  logger->AddToCallStack("Intermedia::Render");
14 
15  WCHAR str[99];
16 
17  if (!interactive.avail)
18  {
19  DrawTextW(L"INTERMEDIA PROXIMITY MENU UNAVAILABLE", 0, 0, 0, DT_NOCLIP, 0xFFA0A0A0);
20  return;
21  }
22 
24  //RECT source;
25  //source.left=0;
26  //source.right=639;
27  //source.top=0;
28  //source.bottom=371;
29  //game->m_spriteVector->Draw( game->m_pddsMenu, &source, NULL, &tempvec, 0xFF808080);
30  //game->m_spriteVector->Flush();
31 
32  if (interactive.menutype == 1 || interactive.menutype == 13) // mining expansion/demolition
33  {
34  float gradeadj = 1.0f + powf(interactive.tempplot.grade * 0.01f, 2.0f) * 63.0f;
35  if (interactive.menutype == 13)
36  gradeadj *= 0.2625f;
37  if (interactive.tempplot.constructime == 0L)
38  {
39  if (interactive.menutype == 1)
40  {
41  swprintf_s(str, 99,
42  L" Availability for construction %7i MT common %3i labor", (int)interactive.tempplot.procstorC, (short)floorf(interactive.colonistsforbuilding));
43  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
44  swprintf_s(str, 99,
45  L" %7i MT fabricated", (int)interactive.tempplot.procstormaterials);
46  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
47  }
48  else
49  {
50  swprintf_s(str, 99,
51  L" Availability for demolition %7i MT common %3i labor", (int)interactive.tempplot.procstorC, (short)floorf(interactive.colonistsforbuilding));
52  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
53  swprintf_s(str, 99,
54  L" %7i MT fabricated", (int)interactive.tempplot.procstormaterials);
55  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
56  }
57  }
58  else
59  {
60  char timerem[99];
61  if (interactive.tempplot.constructime > 103896L)
62  sprintf_s(timerem, sizeof(timerem), "%5i days left ", interactive.tempplot.constructime / 51948L); // vieneo days
63  else if (interactive.tempplot.constructime > 3600L)
64  sprintf_s(timerem, sizeof(timerem), "%5i hours left ", interactive.tempplot.constructime / 3600L);
65  else if (interactive.tempplot.constructime > 60L)
66  sprintf_s(timerem, sizeof(timerem), "%5i minutes left", interactive.tempplot.constructime / 60L);
67  else
68  sprintf_s(timerem, sizeof(timerem), "One minute left!");
69 
70  swprintf_s(str, 99,
71  L" CONSTRUCTION IN PROGRESS %S (%i colonists building)", timerem, interactive.tempplot.colonistsbuilding);
72  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
73  }
74 
75  if (interactive.menutype == 1)
76  {
77  DrawTextW(L" Structure Type Built Zoned Adds Capacity Materials Needed Colonists", 0, 35, 0, DT_NOCLIP, 0xFFA0A0A0);
78  }
79  else
80  {
81  DrawTextW(L" Structure Type Built Zoned Adds Capacity Materials Recycled Colonists", 0, 35, 0, DT_NOCLIP, 0xFFA0A0A0);
82  }
83  swprintf_s(str, 99,
84  L"1] Mining Command %-4i 1 29 colonists %3.0f MT common 19 labor", interactive.type1built, ceilf(195.0f * gradeadj));
85  DrawTextW(str, 0, 50, 0, DT_NOCLIP, 0xFFA0A0A0);
86  swprintf_s(str, 99,
87  L" 116 MT storage %3.0f MT fabricated", ceilf(143.0f * gradeadj));
88  DrawTextW(str, 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
89 
90  swprintf_s(str, 99,
91  L"2] Extraction %-4i 11 11 MT daily %3.0f MT common 4 labor", interactive.type2built, ceilf(14.0f * gradeadj));
92  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
93  swprintf_s(str, 99,
94  L" %3.0f MT fabricated", ceilf(9.0f * gradeadj));
95  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
96 
97  swprintf_s(str, 99,
98  L"3] Raw Material Storage %-4i 1 3413 MT storage %3.0f MT common 8 labor", interactive.type3built, ceilf(108.0f * gradeadj));
99  DrawTextW(str, 0, 100, 0, DT_NOCLIP, 0xFFA0A0A0);
100 
101  swprintf_s(str, 99,
102  L"4] Separator %-4i 1 110 MT daily %3.0f MT common 13 labor", interactive.type4built, ceilf(392.0f * gradeadj));
103  DrawTextW(str, 0, 125, 0, DT_NOCLIP, 0xFFA0A0A0);
104  swprintf_s(str, 99,
105  L" %3.0f MT fabricated", ceilf(201.0f * gradeadj));
106  DrawTextW(str, 0, 135, 0, DT_NOCLIP, 0xFFA0A0A0);
107 
108  swprintf_s(str, 99,
109  L"5] Material Obliteration %-4i 1 240 MT daily %3.0f MT common 16 labor", interactive.type5built, ceilf(227.0f * gradeadj));
110  DrawTextW(str, 0, 150, 0, DT_NOCLIP, 0xFFA0A0A0);
111  swprintf_s(str, 99,
112  L" 1 colonist %3.0f MT fabricated", ceilf(124.0f * gradeadj));
113  DrawTextW(str, 0, 160, 0, DT_NOCLIP, 0xFFA0A0A0);
114 
115  swprintf_s(str, 99,
116  L"6] Processed Storage %-4i 7 3413 MT storage %3.0f MT common 8 labor", interactive.type6built, ceilf(108.0f * gradeadj));
117  DrawTextW(str, 0, 175, 0, DT_NOCLIP, 0xFFA0A0A0);
118  swprintf_s(str, 99,
119  L" 1 colonist");
120  DrawTextW(str, 0, 185, 0, DT_NOCLIP, 0xFFA0A0A0);
121 
122  swprintf_s(str, 99,
123  L"7] Support Structures %-4i 17 17 colonists %3.0f MT common 12 labor", interactive.type7built, ceilf(132.0f * gradeadj));
124  DrawTextW(str, 0, 200, 0, DT_NOCLIP, 0xFFA0A0A0);
125  swprintf_s(str, 99,
126  L" %3.0f MT fabricated", ceilf(99.0f * gradeadj));
127  DrawTextW(str, 0, 210, 0, DT_NOCLIP, 0xFFA0A0A0);
128 
129  swprintf_s(str, 99,
130  L"8] Power Production %-4i 1 848 GJ daily %3.0f MT common 4 labor", interactive.type8built, ceilf(132.0f * gradeadj));
131  DrawTextW(str, 0, 225, 0, DT_NOCLIP, 0xFFA0A0A0);
132  swprintf_s(str, 99,
133  L" 1 colonist %3.0f MT fabricated", ceilf(99.0f * gradeadj));
134  DrawTextW(str, 0, 235, 0, DT_NOCLIP, 0xFFA0A0A0);
135 
136  swprintf_s(str, 99,
137  L"9] Defensive Platforms %-4i 3 1 colonist %3.0f MT common 6 labor", interactive.type9built, ceilf(132.0f * gradeadj));
138  DrawTextW(str, 0, 250, 0, DT_NOCLIP, 0xFFA0A0A0);
139  swprintf_s(str, 99,
140  L" %3.0f MT fabricated", ceilf(99.0f * gradeadj));
141  DrawTextW(str, 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
142  }
143  else if (interactive.menutype == 2 || interactive.menutype == 3) // storefront
144  {
145  // 2 is manager/trade, 3 is customer
146  if (interactive.menutype == 2)
147  {
148  DrawTextW(L" Manage Storefront (select commodity for advanced options)", 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
149 
150  swprintf_s(str, 99, L"1] Cash (%.0f CR)", floorf(interactive.tempplot.cashbalance));
151  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
152  }
153  else
154  {
155  if (interactive.tempplot.discount)
156  swprintf_s(str, 99, L"1] Fleet Bank ATM Discount: %i%%", interactive.tempplot.discount);
157  else
158  swprintf_s(str, 99, L"1] Fleet Bank ATM");
159  if (interactive.tempplot.ATMcharge > -1)
160  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
161  else
162  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFF505050);
163  }
164 
165  DrawTextW(L" Commodity Type Selling Buying", 0, 45, 0, DT_NOCLIP, 0xFFA0A0A0);
166 
167  WCHAR buyat[50], sellat[50];
168  long buypos, sellpos, maxpos;
169  long spaceavail = interactive.tempplot.maxprocstor -
170  (long)(interactive.tempplot.procstorA + interactive.tempplot.procstorfood + interactive.tempplot.procstorC + interactive.tempplot.procstorfuelore + interactive.tempplot.procstorgoods + interactive.tempplot.procstormaterials + interactive.tempplot.procstorfuel);
171  if (spaceavail < 0)
172  spaceavail = 0;
173 
174  if (interactive.tempplot.buyA > 0)
175  buypos = (long)interactive.tempplot.cashbalance / (long)interactive.tempplot.buyA;
176  else
177  buypos = 0L;
178  maxpos = (long)interactive.tempplot.maxA - (long)interactive.tempplot.procstorA;
179  maxpos = min(maxpos, spaceavail);
180  if (buypos > maxpos)
181  buypos = maxpos;
182  if (buypos > 30000L)
183  buypos = 30000L;
184  if (buypos < 0L)
185  buypos = 0L;
186  if (buypos > 0)
187  swprintf_s(buyat, 50, L"%5i MT @ %5i CR/MT", buypos, interactive.tempplot.buyA);
188  else
189  wcscpy_s(buyat, 50, L"Not trading...");
190  sellpos = (long)interactive.tempplot.procstorA - (long)interactive.tempplot.minA;
191  if (sellpos > 30000L)
192  sellpos = 30000L;
193  if (sellpos < 0L)
194  sellpos = 0L;
195  if (sellpos > 0 && interactive.tempplot.sellA > 0)
196  swprintf_s(sellat, 50, L"%5i MT @ %5i CR/MT", sellpos, interactive.tempplot.sellA);
197  else
198  wcscpy_s(sellat, 50, L"Not trading...");
199  swprintf_s(str, 99, L"2] Rare/Precious %22s %22s", sellat, buyat);
200  DrawTextW(str, 0, 70, 0, DT_NOCLIP, 0xFFA0A0A0);
201 
202  if (interactive.tempplot.buyB > 0)
203  buypos = (long)interactive.tempplot.cashbalance / (long)interactive.tempplot.buyB;
204  else
205  buypos = 0L;
206  maxpos = (long)interactive.tempplot.maxB - (long)interactive.tempplot.procstorfood;
207  maxpos = min(maxpos, spaceavail);
208  if (buypos > maxpos)
209  buypos = maxpos;
210  if (buypos > 30000L)
211  buypos = 30000L;
212  if (buypos < 0L)
213  buypos = 0L;
214  if (buypos > 0)
215  swprintf_s(buyat, 50, L"%5i MT @ %5i CR/MT", buypos, interactive.tempplot.buyB);
216  else
217  wcscpy_s(buyat, 50, L"Not trading...");
218  sellpos = (long)interactive.tempplot.procstorfood - (long)interactive.tempplot.minB;
219  if (sellpos > 30000L)
220  sellpos = 30000L;
221  if (sellpos < 0L)
222  sellpos = 0L;
223  if (sellpos > 0 && interactive.tempplot.sellB > 0)
224  swprintf_s(sellat, 50, L"%5i MT @ %5i CR/MT", sellpos, interactive.tempplot.sellB);
225  else
226  wcscpy_s(sellat, 50, L"Not trading...");
227  swprintf_s(str, 99, L"3] Foodstuffs %22s %22s", sellat, buyat);
228  DrawTextW(str, 0, 95, 0, DT_NOCLIP, 0xFFA0A0A0);
229 
230  if (interactive.tempplot.buyC > 0)
231  buypos = (long)interactive.tempplot.cashbalance / (long)interactive.tempplot.buyC;
232  else
233  buypos = 0L;
234  maxpos = (long)interactive.tempplot.maxC - (long)interactive.tempplot.procstorC;
235  maxpos = min(maxpos, spaceavail);
236  if (buypos > maxpos)
237  buypos = maxpos;
238  if (buypos > 30000L)
239  buypos = 30000L;
240  if (buypos < 0L)
241  buypos = 0L;
242  if (buypos > 0)
243  swprintf_s(buyat, 50, L"%5i MT @ %5i CR/MT", buypos, interactive.tempplot.buyC);
244  else
245  wcscpy_s(buyat, 50, L"Not trading...");
246  sellpos = (long)interactive.tempplot.procstorC - (long)interactive.tempplot.minC;
247  if (sellpos > 30000L)
248  sellpos = 30000L;
249  if (sellpos < 0L)
250  sellpos = 0L;
251  if (sellpos > 0 && interactive.tempplot.sellC > 0)
252  swprintf_s(sellat, 50, L"%5i MT @ %5i CR/MT", sellpos, interactive.tempplot.sellC);
253  else
254  wcscpy_s(sellat, 50, L"Not trading...");
255  swprintf_s(str, 99, L"4] Common Materials %22s %22s", sellat, buyat);
256  DrawTextW(str, 0, 120, 0, DT_NOCLIP, 0xFFA0A0A0);
257 
258  if (interactive.tempplot.buyD > 0)
259  buypos = (long)interactive.tempplot.cashbalance / (long)interactive.tempplot.buyD;
260  else
261  buypos = 0L;
262  maxpos = (long)interactive.tempplot.maxD - (long)interactive.tempplot.procstorfuelore;
263  maxpos = min(maxpos, spaceavail);
264  if (buypos > maxpos)
265  buypos = maxpos;
266  if (buypos > 30000L)
267  buypos = 30000L;
268  if (buypos < 0L)
269  buypos = 0L;
270  if (buypos > 0)
271  swprintf_s(buyat, 50, L"%5i MT @ %5i CR/MT", buypos, interactive.tempplot.buyD);
272  else
273  wcscpy_s(buyat, 50, L"Not trading...");
274  sellpos = (long)interactive.tempplot.procstorfuelore - (long)interactive.tempplot.minD;
275  if (sellpos > 30000L)
276  sellpos = 30000L;
277  if (sellpos < 0L)
278  sellpos = 0L;
279  if (sellpos > 0 && interactive.tempplot.sellD > 0)
280  swprintf_s(sellat, 50, L"%5i MT @ %5i CR/MT", sellpos, interactive.tempplot.sellD);
281  else
282  wcscpy_s(sellat, 50, L"Not trading...");
283  swprintf_s(str, 99, L"5] Fuel Ore %22s %22s", sellat, buyat);
284  DrawTextW(str, 0, 145, 0, DT_NOCLIP, 0xFFA0A0A0);
285 
286  if (interactive.tempplot.buyE > 0)
287  buypos = (long)interactive.tempplot.cashbalance / (long)interactive.tempplot.buyE;
288  else
289  buypos = 0L;
290  maxpos = (long)interactive.tempplot.maxE - (long)interactive.tempplot.procstorgoods;
291  maxpos = min(maxpos, spaceavail);
292  if (buypos > maxpos)
293  buypos = maxpos;
294  if (buypos > 30000L)
295  buypos = 30000L;
296  if (buypos < 0L)
297  buypos = 0L;
298  if (buypos > 0)
299  swprintf_s(buyat, 50, L"%5i MT @ %5i CR/MT", buypos, interactive.tempplot.buyE);
300  else
301  wcscpy_s(buyat, 50, L"Not trading...");
302  sellpos = (long)interactive.tempplot.procstorgoods - (long)interactive.tempplot.minE;
303  if (sellpos > 30000L)
304  sellpos = 30000L;
305  if (sellpos < 0L)
306  sellpos = 0L;
307  if (sellpos > 0 && interactive.tempplot.sellE > 0)
308  swprintf_s(sellat, 50, L"%5i MT @ %5i CR/MT", sellpos, interactive.tempplot.sellE);
309  else
310  wcscpy_s(sellat, 50, L"Not trading...");
311  swprintf_s(str, 99, L"6] Consumer Goods %22s %22s", sellat, buyat);
312  DrawTextW(str, 0, 170, 0, DT_NOCLIP, 0xFFA0A0A0);
313 
314  if (interactive.tempplot.buyF > 0)
315  buypos = (long)interactive.tempplot.cashbalance / (long)interactive.tempplot.buyF;
316  else
317  buypos = 0L;
318  maxpos = (long)interactive.tempplot.maxF - (long)interactive.tempplot.procstormaterials;
319  maxpos = min(maxpos, spaceavail);
320  if (buypos > maxpos)
321  buypos = maxpos;
322  if (buypos > 30000L)
323  buypos = 30000L;
324  if (buypos < 0L)
325  buypos = 0L;
326  if (buypos > 0)
327  swprintf_s(buyat, 50, L"%5i MT @ %5i CR/MT", buypos, interactive.tempplot.buyF);
328  else
329  wcscpy_s(buyat, 50, L"Not trading...");
330  sellpos = (long)interactive.tempplot.procstormaterials - (long)interactive.tempplot.minF;
331  if (sellpos > 30000L)
332  sellpos = 30000L;
333  if (sellpos < 0L)
334  sellpos = 0L;
335  if (sellpos > 0 && interactive.tempplot.sellF > 0)
336  swprintf_s(sellat, 50, L"%5i MT @ %5i CR/MT", sellpos, interactive.tempplot.sellF);
337  else
338  wcscpy_s(sellat, 50, L"Not trading...");
339  swprintf_s(str, 99, L"7] Fabricated Material %22s %22s", sellat, buyat);
340  DrawTextW(str, 0, 195, 0, DT_NOCLIP, 0xFFA0A0A0);
341 
342  if (interactive.tempplot.buyG > 0)
343  buypos = (long)interactive.tempplot.cashbalance / (long)interactive.tempplot.buyG;
344  else
345  buypos = 0L;
346  maxpos = (long)interactive.tempplot.maxG - (long)interactive.tempplot.procstorfuel;
347  maxpos = min(maxpos, spaceavail);
348  if (buypos > maxpos)
349  buypos = maxpos;
350  if (buypos > 30000L)
351  buypos = 30000L;
352  if (buypos < 0L)
353  buypos = 0L;
354  if (buypos > 0)
355  swprintf_s(buyat, 50, L"%5i MT @ %5i CR/MT", buypos, interactive.tempplot.buyG);
356  else
357  wcscpy_s(buyat, 50, L"Not trading...");
358  sellpos = (long)interactive.tempplot.procstorfuel - (long)interactive.tempplot.minG;
359  if (sellpos > 30000L)
360  sellpos = 30000L;
361  if (sellpos < 0L)
362  sellpos = 0L;
363  if (sellpos > 0 && interactive.tempplot.sellG > 0)
364  swprintf_s(sellat, 50, L"%5i MT @ %5i CR/MT", sellpos, interactive.tempplot.sellG);
365  else
366  wcscpy_s(sellat, 50, L"Not trading...");
367  swprintf_s(str, 99, L"8] Iagreous Fuel %22s %22s", sellat, buyat);
368  DrawTextW(str, 0, 220, 0, DT_NOCLIP, 0xFFA0A0A0);
369  }
370  else if (interactive.menutype == 4) // cargo ops
371  {
372  swprintf_s(str, 99, L" Cargo Operations %.0f of %i MT in storage", ceilf(interactive.tempplot.procstorA + interactive.tempplot.procstorfood + interactive.tempplot.procstorC + interactive.tempplot.procstorfuelore + interactive.tempplot.procstorgoods + interactive.tempplot.procstormaterials + interactive.tempplot.procstorfuel), interactive.tempplot.maxprocstor);
373  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
374 
375  DrawTextW(L" Commodity Type Inventory Units", 0, 30, 0, DT_NOCLIP, 0xFFA0A0A0);
376 
377  swprintf_s(str, 99, L"1] Rare/Precious %-9.0f MT", floorf(interactive.tempplot.procstorA));
378  DrawTextW(str, 0, 70, 0, DT_NOCLIP, 0xFFA0A0A0);
379 
380  swprintf_s(str, 99, L"2] Foodstuffs %-9.0f MT", floorf(interactive.tempplot.procstorfood));
381  DrawTextW(str, 0, 95, 0, DT_NOCLIP, 0xFFA0A0A0);
382 
383  swprintf_s(str, 99, L"3] Common Materials %-9.0f MT", floorf(interactive.tempplot.procstorC));
384  DrawTextW(str, 0, 120, 0, DT_NOCLIP, 0xFFA0A0A0);
385 
386  swprintf_s(str, 99, L"4] Fuel Ore %-9.0f MT", floorf(interactive.tempplot.procstorfuelore));
387  DrawTextW(str, 0, 145, 0, DT_NOCLIP, 0xFFA0A0A0);
388 
389  swprintf_s(str, 99, L"5] Consumer Goods %-9.0f MT", floorf(interactive.tempplot.procstorgoods));
390  DrawTextW(str, 0, 170, 0, DT_NOCLIP, 0xFFA0A0A0);
391 
392  swprintf_s(str, 99, L"6] Fabricated Materials %-9.0f MT", floorf(interactive.tempplot.procstormaterials));
393  DrawTextW(str, 0, 195, 0, DT_NOCLIP, 0xFFA0A0A0);
394 
395  swprintf_s(str, 99, L"7] Iagreous Fuel %-9.0f MT", floorf(interactive.tempplot.procstorfuel));
396  DrawTextW(str, 0, 220, 0, DT_NOCLIP, 0xFFA0A0A0);
397  }
398  else if (interactive.menutype == 5 || interactive.menutype == 14) // farming expansions
399  {
400  float gradeadj = 1.0f + powf(interactive.tempplot.grade * 0.01f, 2.0f) * 63.0f;
401  if (interactive.menutype == 14)
402  gradeadj *= 0.2625f;
403  if (interactive.tempplot.constructime == 0L)
404  {
405  if (interactive.menutype == 5)
406  {
407  swprintf_s(str, 99,
408  L" Availability for construction %7i MT common %i labor", (int)interactive.tempplot.procstorC, (short)floorf(interactive.colonistsforbuilding));
409  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
410  swprintf_s(str, 99,
411  L" %7i MT fabricated", (int)interactive.tempplot.procstormaterials);
412  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
413  }
414  else
415  {
416  swprintf_s(str, 99,
417  L" Availability for demolition %7i MT common %i labor", (int)interactive.tempplot.procstorC, (short)floorf(interactive.colonistsforbuilding));
418  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
419  swprintf_s(str, 99,
420  L" %7i MT fabricated", (int)interactive.tempplot.procstormaterials);
421  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
422  }
423  }
424  else
425  {
426  char timerem[99];
427  if (interactive.tempplot.constructime > 103896L)
428  sprintf_s(timerem, sizeof(timerem), "%5i days left ", interactive.tempplot.constructime / 51948L); // vieneo days
429  else if (interactive.tempplot.constructime > 3600L)
430  sprintf_s(timerem, sizeof(timerem), "%5i hours left ", interactive.tempplot.constructime / 3600L);
431  else if (interactive.tempplot.constructime > 60L)
432  sprintf_s(timerem, sizeof(timerem), "%5i minutes left", interactive.tempplot.constructime / 60L);
433  else
434  sprintf_s(timerem, sizeof(timerem), "One minute left!");
435 
436  swprintf_s(str, 99,
437  L" CONSTRUCTION IN PROGRESS %S (%i colonists building)", timerem, interactive.tempplot.colonistsbuilding);
438  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
439  }
440 
441  if (interactive.menutype == 5)
442  {
443  DrawTextW(L" Structure Type Built Zoned Adds Capacity Materials Needed Colonists", 0, 35, 0, DT_NOCLIP, 0xFFA0A0A0);
444  }
445  else
446  {
447  DrawTextW(L" Structure Type Built Zoned Adds Capacity Materials Recycled Colonists", 0, 35, 0, DT_NOCLIP, 0xFFA0A0A0);
448  }
449  swprintf_s(str, 99,
450  L"1] Farmstead %-4i 1 22 colonists %5.0f MT common 2 labor", interactive.type1built, ceilf(64.0f * gradeadj));
451  DrawTextW(str, 0, 50, 0, DT_NOCLIP, 0xFFA0A0A0);
452  swprintf_s(str, 99,
453  L" 34 MT storage %5.0f MT fabricated", ceilf(47.0f * gradeadj));
454  DrawTextW(str, 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
455 
456  swprintf_s(str, 99,
457  L"2] Algae Farms %-4i 21 1 MT yearly %5.0f MT common 1 labor", interactive.type2built, 0.0f);
458  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
459  swprintf_s(str, 99,
460  L" %5.0f MT fabricated", 0.0f);
461  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
462 
463  swprintf_s(str, 99,
464  L"3] Greenhouses %-4i 3 21 MT yearly %5.0f MT common 3 labor", interactive.type3built, ceilf(196.0f * gradeadj));
465  DrawTextW(str, 0, 100, 0, DT_NOCLIP, 0xFFA0A0A0);
466  swprintf_s(str, 99,
467  L" %5.0f MT fabricated", ceilf(101.0f * gradeadj));
468  DrawTextW(str, 0, 110, 0, DT_NOCLIP, 0xFFA0A0A0);
469 
470  swprintf_s(str, 99,
471  L"4] Hydroponics %-4i 2 35 MT yearly %5.0f MT common 5 labor", interactive.type4built, ceilf(392.0f * gradeadj));
472  DrawTextW(str, 0, 125, 0, DT_NOCLIP, 0xFFA0A0A0);
473  swprintf_s(str, 99,
474  L" %5.0f MT fabricated", ceilf(201.0f * gradeadj));
475  DrawTextW(str, 0, 135, 0, DT_NOCLIP, 0xFFA0A0A0);
476 
477  swprintf_s(str, 99,
478  L"5] Storage Silos %-4i 3 3413 MT storage %5.0f MT common 8 labor", interactive.type6built, ceilf(108.0f * gradeadj));
479  DrawTextW(str, 0, 150, 0, DT_NOCLIP, 0xFFA0A0A0);
480  swprintf_s(str, 99,
481  L" 1 colonist %5.0f MT fabricated", ceilf(81.0f * gradeadj));
482  DrawTextW(str, 0, 160, 0, DT_NOCLIP, 0xFFA0A0A0);
483 
484  swprintf_s(str, 99,
485  L"6] Support Structures %-4i 4 1 colonist %5.0f MT common 12 labor", interactive.type7built, ceilf(132.0f * gradeadj));
486  DrawTextW(str, 0, 175, 0, DT_NOCLIP, 0xFFA0A0A0);
487  swprintf_s(str, 99,
488  L" %5.0f MT fabricated", ceilf(99.0f * gradeadj));
489  DrawTextW(str, 0, 185, 0, DT_NOCLIP, 0xFFA0A0A0);
490 
491  swprintf_s(str, 99,
492  L"7] Defensive Platforms %-4i 1 4 GJ/burst %5.0f MT common 6 labor", interactive.type9built, ceilf(132.0f * gradeadj));
493  DrawTextW(str, 0, 200, 0, DT_NOCLIP, 0xFFA0A0A0);
494  swprintf_s(str, 99,
495  L" 1 colonist %5.0f MT fabricated", ceilf(99.0f * gradeadj));
496  DrawTextW(str, 0, 210, 0, DT_NOCLIP, 0xFFA0A0A0);
497  }
498  else if (interactive.menutype == 6) // mining command
499  {
500  if (interactive.tempplot.colonyName[0] == 0)
501  {
502  if (interactive.tempplot.boundaryName[0] == 0)
503  swprintf_s(str, 99, L" Welcome! (population %.0f)", floorf(interactive.tempplot.totalPopulation));
504  else
505  swprintf_s(str, 99, L" Welcome to %S! (population %.0f)", interactive.tempplot.boundaryName, floorf(interactive.tempplot.totalPopulation));
506  }
507  else
508  {
509  if (interactive.tempplot.boundaryName[0] == 0)
510  swprintf_s(str, 99, L" Welcome to %S (population %.0f)", interactive.tempplot.colonyName, floorf(interactive.tempplot.totalPopulation));
511  else
512  swprintf_s(str, 99, L" Welcome to %S %S (population %.0f)", interactive.tempplot.boundaryName, interactive.tempplot.colonyName, floorf(interactive.tempplot.totalPopulation));
513  }
514  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
515 
516  float opeff;
517  if (interactive.tempplot.workingPopulation >= 1.0f && interactive.mincoltorun > 0.0f)
518  {
519  opeff = (interactive.tempplot.workingPopulation - (float)interactive.tempplot.colonistsbuilding) / interactive.mincoltorun;
520  if (opeff > 1.0f)
521  opeff = 1.0f;
522  else if (opeff < 0.0f)
523  opeff = 0.0f;
524  opeff *= 0.5f + (float)interactive.type7built / 17.0f; // half as efficient to 1.5 times as efficient
525  }
526  else
527  opeff = 0.0f;
528 
529  swprintf_s(str, 99,
530  L" APN: %i%04i (%.0f%% efficiency)", interactive.tcp.u + 3038, interactive.tcp.v + 2038, opeff * 100.0f);
531  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
532 
533 
534  DrawTextW(L"1] Survey", 0, 45, 0, DT_NOCLIP, 0xFFA0A0A0);
535 
536  if (interactive.tempplot.colonyName[0] == 0)
537  {
538  DrawTextW(L"2] Name Colony", 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
539  }
540  else
541  {
542  DrawTextW(L"2] Rename Colony", 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
543  }
544  DrawTextW(L"3] Expansion", 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
545  DrawTextW(L"4] Demolition", 0, 90, 0, DT_NOCLIP, 0xFFA0A0A0);
546  DrawTextW(L"5] Manage Trade", 0, 105, 0, DT_NOCLIP, 0xFFA0A0A0);
547  DrawTextW(L"6] Cargo Operations", 0, 120, 0, DT_NOCLIP, 0xFFA0A0A0);
548  if (interactive.tempplot.ATMcharge > -1)
549  swprintf_s(str, 99, L"7] Set ATM Fee (%i CR)", interactive.tempplot.ATMcharge);
550  else
551  wcscpy_s(str, 99, L"7] No ATM Installed");
552  DrawTextW(str, 0, 135, 0, DT_NOCLIP, 0xFFA0A0A0);
553  DrawTextW(L"8] Diplomacy", 0, 150, 0, DT_NOCLIP, 0xFFA0A0A0);
554 
555  float sep = 0.0f;
556  if (interactive.tempplot.HasSeparatorResearch)
557  {
558  sep = (interactive.tempplot.oreA + interactive.tempplot.oreC + interactive.tempplot.oreD) / 255.0f;
559  if (sep > 1.0f)
560  sep = 1.0f / sep;
561  else
562  sep = 1.0f;
563  sep *= 110.0f;
564  }
565  float oblit = 0.0f;
566  if (interactive.tempplot.HasObliterator)
567  oblit = 240.0f;
568 
569  // production and consumption totals
570  swprintf_s(str, 99,
571  L" Daily Extraction: %.3f MT (%.3f MT waiting)", interactive.tempplot.DlyXtractHarvestProduce * opeff, interactive.tempplot.rawOre);
572  DrawTextW(str, 0, 170, 0, DT_NOCLIP, 0xFFA0A0A0);
573 
574  //float queued = interactive.tempplot.DlyXtractHarvestProduce * opeff + interactive.tempplot.rawOre;
575  //if (sep > queued) // 50 vs 25
576  // sep = queued;
577 
578  // @note sep already accounts for the server "capmod" which is based on oreA+oreC+oreD>255
579  swprintf_s(str, 99,
580  L" Daily Separation: %.3f MT rare", sep * static_cast<float>(interactive.tempplot.oreA) / 255.0f * opeff * 0.3f);
581  DrawTextW(str, 0, 180, 0, DT_NOCLIP, 0xFFA0A0A0);
582  swprintf_s(str, 99,
583  L" %.3f MT common", sep * static_cast<float>(interactive.tempplot.oreC) / 255.0f * opeff * 1.3f);
584  DrawTextW(str, 0, 190, 0, DT_NOCLIP, 0xFFA0A0A0);
585  swprintf_s(str, 99,
586  L" %.3f MT fuel", sep * static_cast<float>(interactive.tempplot.oreD) / 255.0f * opeff);
587  DrawTextW(str, 0, 200, 0, DT_NOCLIP, 0xFFA0A0A0);
588  swprintf_s(str, 99,
589  L" Daily Obliteration: %.3f MT (%.3F MT tailings)", oblit * opeff, interactive.tempplot.waste);
590  DrawTextW(str, 0, 210, 0, DT_NOCLIP, 0xFFA0A0A0);
591 
592  swprintf_s(str, 99,
593  L" Commodity Daily Consumption");
594  DrawTextW(str, 0, 225, 0, DT_NOCLIP, 0xFFA0A0A0);
595  swprintf_s(str, 99,
596  L" Rare %.3f MT", 0.0f);
597  DrawTextW(str, 0, 235, 0, DT_NOCLIP, 0xFFA0A0A0);
598  swprintf_s(str, 99,
599  L" Foodstuffs %.3f MT", interactive.tempplot.totalPopulation * 0.00109589f);
600  DrawTextW(str, 0, 245, 0, DT_NOCLIP, 0xFFA0A0A0);
601  swprintf_s(str, 99,
602  L" Common %.3f MT", 0.0f);
603  DrawTextW(str, 0, 255, 0, DT_NOCLIP, 0xFFA0A0A0);
604  swprintf_s(str, 99,
605  L" Fuel Ore %.3f MT", 0.0f);
606  DrawTextW(str, 0, 265, 0, DT_NOCLIP, 0xFFA0A0A0);
607  swprintf_s(str, 99,
608  L" Goods %.3f MT", interactive.tempplot.totalPopulation * 0.0f);
609  DrawTextW(str, 0, 275, 0, DT_NOCLIP, 0xFFA0A0A0);
610  swprintf_s(str, 99,
611  L" Materials %.3f MT", 0.0f);
612  DrawTextW(str, 0, 285, 0, DT_NOCLIP, 0xFFA0A0A0);
613  swprintf_s(str, 99,
614  L" Fuel %.3f MT", 0.0f);
615  DrawTextW(str, 0, 295, 0, DT_NOCLIP, 0xFFA0A0A0);
616 
617 
618 
619  // important messages
620  short x = 210, y = 45;
621  if (interactive.tempplot.totalPopulation >= 1.0f)
622  {
623  if (interactive.tempplot.procstorfood == 0.0f)
624  {
625  DrawTextW(L"** We desperately need food!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
626  y += 15;
627  }
628  else
629  {
630  if ((interactive.tempplot.totalPopulation * 0.00109589f * 7.0f) > interactive.tempplot.procstorfood)
631  {
632  DrawTextW(L"++ We have less than a week's supply of food!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
633  y += 15;
634  }
635  }
636  }
637  if (interactive.tempplot.colonyUplink == 0)
638  {
639  DrawTextW(L"++ The colony up-link has failed!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
640  y += 15;
641  }
642  if (interactive.tempplot.totalPopulation >= 1.0f && (interactive.tempplot.procstorA + interactive.tempplot.procstorfood + interactive.tempplot.procstorC + interactive.tempplot.procstorfuelore + interactive.tempplot.procstorgoods + interactive.tempplot.procstormaterials + interactive.tempplot.procstorfuel) >= interactive.tempplot.maxprocstor)
643  {
644  DrawTextW(L"++ Production halted, out of secure processed storage!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
645  y += 15;
646  }
647  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstorfuel <= 0)
648  {
649  DrawTextW(L"++ Production halted, out of refined Iagreous fuel!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
650  y += 15;
651  }
652  if (floorf(interactive.tempplot.totalPopulation) > interactive.tempplot.maxcolstor)
653  {
654  DrawTextW(L"++ The colony is overpopulated!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
655  y += 15;
656  }
657  if (interactive.tempplot.colonistsbuilding > 0)
658  {
659  swprintf_s(str, 99, L".. We have %i people reassigned for construction", interactive.tempplot.colonistsbuilding);
660  DrawTextW(str, x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
661  y += 15;
662  }
663  if (interactive.tempplot.workingPopulation < interactive.mincoltorun)
664  {
665  swprintf_s(str, 99, L".. We are understaffed by %i workers", static_cast<short>(interactive.mincoltorun) - interactive.tempplot.workingPopulation);
666  DrawTextW(str, x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
667  y += 15;
668  }
669  if (y == 45)
670  {
671  DrawTextW(L".. No new messages!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
672  }
673  }
674  else if (interactive.menutype == 7) // farmstead
675  {
676  if (interactive.tempplot.colonyName[0] == 0)
677  {
678  if (interactive.tempplot.boundaryName[0] == 0)
679  swprintf_s(str, 99, L" Welcome! (population %.0f)", floorf(interactive.tempplot.totalPopulation));
680  else
681  swprintf_s(str, 99, L" Welcome to %S! (population %.0f)", interactive.tempplot.boundaryName, floorf(interactive.tempplot.totalPopulation));
682  }
683  else
684  {
685  if (interactive.tempplot.boundaryName[0] == 0)
686  swprintf_s(str, 99, L" Welcome to %S (population %.0f)", interactive.tempplot.colonyName, floorf(interactive.tempplot.totalPopulation));
687  else
688  swprintf_s(str, 99, L" Welcome to %S %S (population %.0f)", interactive.tempplot.boundaryName, interactive.tempplot.colonyName, floorf(interactive.tempplot.totalPopulation));
689  }
690  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
691 
692  float opeff;
693  if (interactive.tempplot.workingPopulation >= 1.0f && interactive.mincoltorun > 0.0f)
694  {
695  opeff = (interactive.tempplot.workingPopulation - (float)interactive.tempplot.colonistsbuilding) / interactive.mincoltorun;
696  if (opeff > 1.0f)
697  opeff = 1.0f;
698  else if (opeff < 0.0f)
699  opeff = 0.0f;
700  opeff *= 0.5f + (float)interactive.type7built / 4.0f; // half as efficient to 1.5 times as efficient
701  }
702  else
703  opeff = 0.0f;
704 
705  swprintf_s(str, 99,
706  L" APN: %i%04i (%.0f%% efficiency)", interactive.tcp.u + 3038, interactive.tcp.v + 2038, opeff * 100.0f);
707  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
708 
709 
710  DrawTextW(L"1] Survey", 0, 45, 0, DT_NOCLIP, 0xFFA0A0A0);
711 
712  if (interactive.tempplot.colonyName[0] == 0)
713  {
714  DrawTextW(L"2] Name Colony", 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
715  }
716  else
717  {
718  DrawTextW(L"2] Rename Colony", 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
719  }
720  DrawTextW(L"3] Expansion", 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
721  DrawTextW(L"4] Demolition", 0, 90, 0, DT_NOCLIP, 0xFFA0A0A0);
722  DrawTextW(L"5] Manage Trade", 0, 105, 0, DT_NOCLIP, 0xFFA0A0A0);
723  DrawTextW(L"6] Cargo Operations", 0, 120, 0, DT_NOCLIP, 0xFFA0A0A0);
724  if (interactive.tempplot.ATMcharge > -1)
725  swprintf_s(str, 99, L"7] Set ATM Fee (%i CR)", interactive.tempplot.ATMcharge);
726  else
727  wcscpy_s(str, 99, L"7] No ATM Installed");
728  DrawTextW(str, 0, 135, 0, DT_NOCLIP, 0xFFA0A0A0);
729  DrawTextW(L"8] Diplomacy", 0, 150, 0, DT_NOCLIP, 0xFFA0A0A0);
730 
731  long offset = ((long)interactive.tcp.v + 2037) * 2579L;
732  long newseason = (interactive.tempplot.ltime + offset) / 7884000L; // quarter-year number
733  long lastharvest = (interactive.tempplot.ltime + offset) % 7884000L; // seconds since last harvest
734  long nextharvestsec = 7884000L - lastharvest;
735  long seasontype = newseason % 4;
736  char seasontext[9];
737  if (seasontype == 0)
738  sprintf_s(seasontext, sizeof(seasontext), "Spring");
739  else if (seasontype == 1)
740  sprintf_s(seasontext, sizeof(seasontext), "Summer");
741  else if (seasontype == 2)
742  sprintf_s(seasontext, sizeof(seasontext), "Fall");
743  else if (seasontype == 3)
744  sprintf_s(seasontext, sizeof(seasontext), "Winter");
745  else
746  sprintf_s(seasontext, sizeof(seasontext), "Error %i", seasontype);
747 
748 
749 
750  float dayspassed = (float)lastharvest / 86400.0f; // days passed already
751 
752  // production and consumption totals
753  swprintf_s(str, 99,
754  L" Current season: %S", seasontext);
755  DrawTextW(str, 0, 165, 0, DT_NOCLIP, 0xFFA0A0A0);
756  swprintf_s(str, 99,
757  L" Season ends: %.0f day(s)", (93.945f - dayspassed) * 1.663202f); // vieneo days
758  DrawTextW(str, 0, 175, 0, DT_NOCLIP, 0xFFA0A0A0);
759 
760  // take current storage and number of days
761  // add current production and nextharvest
762  float seasonavg = 0.0f;
763  if (dayspassed > 0.0f)
764  seasonavg = interactive.tempplot.rawFood;
765  // 8 and 10 days that is 8 MT so far
766  float fieldcrops = 0.0f;
767  if ((seasontype == 0 && interactive.tcp.v > -115 && interactive.tcp.v < 2154) ||
768  (seasontype == 1 && interactive.tcp.v > -439 && interactive.tcp.v < 2478) ||
769  (seasontype == 2 && interactive.tcp.v > 268 && interactive.tcp.v < 1771) ||
770  (seasontype == 3 && interactive.tcp.v > 559 && interactive.tcp.v < 1480))
771  fieldcrops = (float)interactive.type2built * 0.6716f * powf(1.0f - interactive.tempplot.grade / 100.0f, 2.0f);
772  float greenhouses = (float)interactive.type3built * 4.7012f;
773  float hydroponics = (float)interactive.type4built * 14.1036f;
774  seasonavg += (91.25f - dayspassed) / 93.945f * (greenhouses + hydroponics + fieldcrops);
775  // so all we have is field crops
776  // 93.945-10 is 83.945 days/93.945 is .89 of season left *(8 crops at .6716 is 5.3728) is 4.78
777  // so 8MT plus 4.78MT is 12.78 MT for the season
778  float magnitude = 0.0f;
779  if ((fieldcrops + greenhouses + hydroponics) > 0.0f)
780  magnitude = seasonavg / (fieldcrops + greenhouses + hydroponics);
781 
782  swprintf_s(str, 99,
783  L" Harvest estimates: %.3f MT food (total)", seasonavg);
784  DrawTextW(str, 0, 185, 0, DT_NOCLIP, 0xFFA0A0A0);
785  swprintf_s(str, 99,
786  L" %.3f MT food (hydroponics)", hydroponics * magnitude);
787  DrawTextW(str, 0, 195, 0, DT_NOCLIP, 0xFFA0A0A0);
788  swprintf_s(str, 99,
789  L" %.3f MT food (greenhouses)", greenhouses * magnitude);
790  DrawTextW(str, 0, 205, 0, DT_NOCLIP, 0xFFA0A0A0);
791  swprintf_s(str, 99,
792  L" %.3f MT food (algae farms)", fieldcrops * magnitude);
793  DrawTextW(str, 0, 215, 0, DT_NOCLIP, 0xFFA0A0A0);
794 
795 
796  swprintf_s(str, 99,
797  L" Commodity Daily Consumption");
798  DrawTextW(str, 0, 230, 0, DT_NOCLIP, 0xFFA0A0A0);
799  swprintf_s(str, 99,
800  L" Rare %.3f MT", 0.0f);
801  DrawTextW(str, 0, 240, 0, DT_NOCLIP, 0xFFA0A0A0);
802  swprintf_s(str, 99,
803  L" Foodstuffs %.3f MT", interactive.tempplot.totalPopulation * 0.00109589f);
804  DrawTextW(str, 0, 250, 0, DT_NOCLIP, 0xFFA0A0A0);
805  swprintf_s(str, 99,
806  L" Common %.3f MT", 0.0f);
807  DrawTextW(str, 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
808  swprintf_s(str, 99,
809  L" Fuel Ore %.3f MT", 0.0f);
810  DrawTextW(str, 0, 270, 0, DT_NOCLIP, 0xFFA0A0A0);
811  swprintf_s(str, 99,
812  L" Goods %.3f MT", interactive.tempplot.totalPopulation * 0.0f);
813  DrawTextW(str, 0, 280, 0, DT_NOCLIP, 0xFFA0A0A0);
814  swprintf_s(str, 99,
815  L" Materials %.3f MT", 0.0f);
816  DrawTextW(str, 0, 290, 0, DT_NOCLIP, 0xFFA0A0A0);
817  swprintf_s(str, 99,
818  L" Fuel %.3f MT", 0.0f);
819  DrawTextW(str, 0, 300, 0, DT_NOCLIP, 0xFFA0A0A0);
820 
821 
822  // important messages
823  short x = 210, y = 45;
824  if (interactive.tempplot.totalPopulation >= 1.0f)
825  {
826  if (interactive.tempplot.procstorfood == 0.0f)
827  {
828  DrawTextW(L"** We desperately need food!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
829  y += 15;
830  }
831  else
832  {
833  if ((interactive.tempplot.totalPopulation * 0.00109589f * 7.0f) > interactive.tempplot.procstorfood)
834  {
835  DrawTextW(L"++ We have less than a week's supply of food!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
836  y += 15;
837  }
838  }
839  }
840  if (interactive.tempplot.colonyUplink == 0)
841  {
842  DrawTextW(L"++ The colony up-link has failed!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
843  y += 15;
844  }
845  if ((interactive.tempplot.ltime - interactive.tempplot.incept + nextharvestsec) < 5256000L)
846  {
847  DrawTextW(L"++ This farm will miss this first harvest!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
848  y += 15;
849  }
850  else if (interactive.tempplot.totalPopulation >= 1.0f && (interactive.tempplot.procstorA + interactive.tempplot.procstorfood + interactive.tempplot.procstorC + interactive.tempplot.procstorfuelore + interactive.tempplot.procstorgoods + interactive.tempplot.procstormaterials + interactive.tempplot.procstorfuel) >= interactive.tempplot.maxprocstor)
851  {
852  DrawTextW(L"++ No space for the upcoming harvest!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
853  y += 15;
854  }
855  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstorfuel <= 0)
856  {
857  DrawTextW(L"++ Production halted, out of refined Iagreous fuel!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
858  y += 15;
859  }
860  if (floorf(interactive.tempplot.totalPopulation) > interactive.tempplot.maxcolstor)
861  {
862  DrawTextW(L"++ The colony is overpopulated!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
863  y += 15;
864  }
865  if (interactive.tempplot.colonistsbuilding > 0)
866  {
867  swprintf_s(str, 99, L".. We have %i people reassigned for construction", interactive.tempplot.colonistsbuilding);
868  DrawTextW(str, x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
869  y += 15;
870  }
871  if (interactive.tempplot.workingPopulation < interactive.mincoltorun)
872  {
873  swprintf_s(str, 99, L".. We are understaffed by %i workers", static_cast<short>(interactive.mincoltorun) - interactive.tempplot.workingPopulation);
874  DrawTextW(str, x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
875  y += 15;
876  }
877  if (!((seasontype == 0 && interactive.tcp.v > -115 && interactive.tcp.v < 2154) ||
878  (seasontype == 1 && interactive.tcp.v > -439 && interactive.tcp.v < 2478) ||
879  (seasontype == 2 && interactive.tcp.v > 268 && interactive.tcp.v < 1771) ||
880  (seasontype == 3 && interactive.tcp.v > 559 && interactive.tcp.v < 1480)))
881  {
882  DrawTextW(L".. Algae farms are currently out of season", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
883  y += 15;
884  }
885 
886  if (y == 45)
887  {
888  DrawTextW(L".. No new messages!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
889  }
890  }
891  else if (interactive.menutype == 8) // dock trade
892  {
893  char buy[15], sell[15];
894  DrawTextW(L" Commodity Type Inventory Units Buying Selling", 0, 30, 0, DT_NOCLIP, 0xFFA0A0A0);
895 
896  if (interactive.tempdock.buyA == 0)
897  sprintf_s(buy, sizeof(buy), "No");
898  else
899  sprintf_s(buy, sizeof(buy), "%i CR/MT", interactive.tempdock.buyA);
900  if (interactive.tempdock.sellA == 0)
901  sprintf_s(sell, sizeof(sell), "No");
902  else
903  sprintf_s(sell, sizeof(sell), "%i CR/MT", interactive.tempdock.sellA);
904  swprintf_s(str, 99, L"1] Rare/Precious %-9.0f MT %-12S %-12S", floorf(interactive.tempdock.procstorA), buy, sell);
905  DrawTextW(str, 0, 70, 0, DT_NOCLIP, 0xFFA0A0A0);
906 
907  if (interactive.tempdock.buyB == 0)
908  sprintf_s(buy, sizeof(buy), "No");
909  else
910  sprintf_s(buy, sizeof(buy), "%i CR/MT", interactive.tempdock.buyB);
911  if (interactive.tempdock.sellB == 0)
912  sprintf_s(sell, sizeof(sell), "No");
913  else
914  sprintf_s(sell, sizeof(sell), "%i CR/MT", interactive.tempdock.sellB);
915  swprintf_s(str, 99, L"2] Foodstuffs %-9.0f MT %-12S %-12S", floorf(interactive.tempdock.procstorfood), buy, sell);
916  DrawTextW(str, 0, 95, 0, DT_NOCLIP, 0xFFA0A0A0);
917 
918  if (interactive.tempdock.buyC == 0)
919  sprintf_s(buy, sizeof(buy), "No");
920  else
921  sprintf_s(buy, sizeof(buy), "%i CR/MT", interactive.tempdock.buyC);
922  if (interactive.tempdock.sellC == 0)
923  sprintf_s(sell, sizeof(sell), "No");
924  else
925  sprintf_s(sell, sizeof(sell), "%i CR/MT", interactive.tempdock.sellC);
926  swprintf_s(str, 99, L"3] Common Materials %-9.0f MT %-12S %-12S", floorf(interactive.tempdock.procstorC), buy, sell);
927  DrawTextW(str, 0, 120, 0, DT_NOCLIP, 0xFFA0A0A0);
928 
929  if (interactive.tempdock.buyD == 0)
930  sprintf_s(buy, sizeof(buy), "No");
931  else
932  sprintf_s(buy, sizeof(buy), "%i CR/MT", interactive.tempdock.buyD);
933  if (interactive.tempdock.sellD == 0)
934  sprintf_s(sell, sizeof(sell), "No");
935  else
936  sprintf_s(sell, sizeof(sell), "%i CR/MT", interactive.tempdock.sellD);
937  swprintf_s(str, 99, L"4] Fuel Ore %-9.0f MT %-12S %-12S", floorf(interactive.tempdock.procstorfuelore), buy, sell);
938  DrawTextW(str, 0, 145, 0, DT_NOCLIP, 0xFFA0A0A0);
939 
940  if (interactive.tempdock.buyE == 0)
941  sprintf_s(buy, sizeof(buy), "No");
942  else
943  sprintf_s(buy, sizeof(buy), "%i CR/MT", interactive.tempdock.buyE);
944  if (interactive.tempdock.sellE == 0)
945  sprintf_s(sell, sizeof(sell), "No");
946  else
947  sprintf_s(sell, sizeof(sell), "%i CR/MT", interactive.tempdock.sellE);
948  swprintf_s(str, 99, L"5] Consumer Goods %-9.0f MT %-12S %-12S", floorf(interactive.tempdock.procstorgoods), buy, sell);
949  DrawTextW(str, 0, 170, 0, DT_NOCLIP, 0xFFA0A0A0);
950 
951  if (interactive.tempdock.buyF == 0)
952  sprintf_s(buy, sizeof(buy), "No");
953  else
954  sprintf_s(buy, sizeof(buy), "%i CR/MT", interactive.tempdock.buyF);
955  if (interactive.tempdock.sellF == 0)
956  sprintf_s(sell, sizeof(sell), "No");
957  else
958  sprintf_s(sell, sizeof(sell), "%i CR/MT", interactive.tempdock.sellF);
959  swprintf_s(str, 99, L"6] Fabricated Materials %-9.0f MT %-12S %-12S", floorf(interactive.tempdock.procstormaterials), buy, sell);
960  DrawTextW(str, 0, 195, 0, DT_NOCLIP, 0xFFA0A0A0);
961 
962  if (interactive.tempdock.buyG == 0)
963  sprintf_s(buy, sizeof(buy), "No");
964  else
965  sprintf_s(buy, sizeof(buy), "%i CR/MT", interactive.tempdock.buyG);
966  if (interactive.tempdock.sellG == 0)
967  sprintf_s(sell, sizeof(sell), "No");
968  else
969  sprintf_s(sell, sizeof(sell), "%i CR/MT", interactive.tempdock.sellG);
970  swprintf_s(str, 99, L"7] Iagreous Fuel %-9.0f MT %-12S %-12S", floorf(interactive.tempdock.procstorfuel), buy, sell);
971  DrawTextW(str, 0, 220, 0, DT_NOCLIP, 0xFFA0A0A0);
972  }
973  else if (interactive.menutype == 9 || interactive.menutype == 12) // township expansion/demolition
974  {
975  float gradeadj = 1.0f + powf(interactive.tempplot.grade * 0.01f, 2.0f) * 63.0f;
976  if (interactive.menutype == 12)
977  gradeadj *= 0.2625f;
978  if (interactive.tempplot.constructime == 0L)
979  {
980  if (interactive.menutype == 9)
981  {
982  swprintf_s(str, 99,
983  L" Availability for construction %7i MT common %i labor", (int)interactive.tempplot.procstorC, (short)floorf(interactive.colonistsforbuilding));
984  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
985  swprintf_s(str, 99,
986  L" %7i MT fabricated", (int)interactive.tempplot.procstormaterials);
987  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
988  }
989  else
990  {
991  swprintf_s(str, 99,
992  L" Availability for demolition %7i MT common %i labor", (int)interactive.tempplot.procstorC, (short)floorf(interactive.colonistsforbuilding));
993  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
994  swprintf_s(str, 99,
995  L" %7i MT fabricated", (int)interactive.tempplot.procstormaterials);
996  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
997  }
998 
999  }
1000  else
1001  {
1002  char timerem[99];
1003  if (interactive.tempplot.constructime > 103896L)
1004  sprintf_s(timerem, sizeof(timerem), "%5i days left ", interactive.tempplot.constructime / 51948L); // vieneo days
1005  else if (interactive.tempplot.constructime > 3600L)
1006  sprintf_s(timerem, sizeof(timerem), "%5i hours left ", interactive.tempplot.constructime / 3600L);
1007  else if (interactive.tempplot.constructime > 60L)
1008  sprintf_s(timerem, sizeof(timerem), "%5i minutes left", interactive.tempplot.constructime / 60L);
1009  else
1010  sprintf_s(timerem, sizeof(timerem), "One minute left!");
1011 
1012  swprintf_s(str, 99,
1013  L" CONSTRUCTION IN PROGRESS %S (%i colonists building)", timerem, interactive.tempplot.colonistsbuilding);
1014  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
1015  }
1016 
1017  if (interactive.menutype == 9)
1018  {
1019  DrawTextW(L" Structure Type Built Zoned Adds Capacity Materials Needed Colonists", 0, 35, 0, DT_NOCLIP, 0xFFA0A0A0);
1020  }
1021  else
1022  {
1023  DrawTextW(L" Structure Type Built Zoned Adds Capacity Materials Recycled Colonists", 0, 35, 0, DT_NOCLIP, 0xFFA0A0A0);
1024  }
1025  swprintf_s(str, 99,
1026  L"1] Town Hall %-4i 1 96 colonists %5.0f MT common 13 labor", interactive.type1built, ceilf(387.0f * gradeadj));
1027  DrawTextW(str, 0, 50, 0, DT_NOCLIP, 0xFFA0A0A0);
1028  swprintf_s(str, 99,
1029  L" %5.0f MT fabricated", ceilf(284.0f * gradeadj));
1030  DrawTextW(str, 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
1031 
1032  swprintf_s(str, 99,
1033  L"2] Residences %-4i 4 932 colonists %5.0f MT common 2 labor", interactive.type2built, ceilf(301.0f * gradeadj));
1034  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1035  swprintf_s(str, 99,
1036  L" %5.0f MT fabricated", ceilf(220.0f * gradeadj));
1037  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
1038 
1039  swprintf_s(str, 99,
1040  L"3] Industry %-4i 3 Refinement/ %5.0f MT common 16 labor", interactive.type3built, ceilf(490.0f * gradeadj));
1041  DrawTextW(str, 0, 100, 0, DT_NOCLIP, 0xFFA0A0A0);
1042  swprintf_s(str, 99,
1043  L" Manufacturing %5.0f MT fabricated", ceilf(359.0f * gradeadj));
1044  DrawTextW(str, 0, 110, 0, DT_NOCLIP, 0xFFA0A0A0);
1045 
1046  swprintf_s(str, 99,
1047  L"4] Research Lab %-4i 1 Technologies/ %5.0f MT common 9 labor", interactive.type4built, ceilf(410.0f * gradeadj));
1048  DrawTextW(str, 0, 125, 0, DT_NOCLIP, 0xFFA0A0A0);
1049  swprintf_s(str, 99,
1050  L" Products %5.0f MT fabricated", ceilf(301.0f * gradeadj));
1051  DrawTextW(str, 0, 135, 0, DT_NOCLIP, 0xFFA0A0A0);
1052 
1053  swprintf_s(str, 99,
1054  L"5] Recreation %-4i 3 Casinos %5.0f MT common 3 labor", interactive.type5built, ceilf(240.0f * gradeadj));
1055  DrawTextW(str, 0, 150, 0, DT_NOCLIP, 0xFFA0A0A0);
1056  swprintf_s(str, 99,
1057  L" Parks/Shopping %5.0f MT fabricated", ceilf(176.0f * gradeadj));
1058  DrawTextW(str, 0, 160, 0, DT_NOCLIP, 0xFFA0A0A0);
1059 
1060  swprintf_s(str, 99,
1061  L"6] Material Storage %-4i 1 20479 MT storage %5.0f MT common 8 labor", interactive.type6built, ceilf(649.0f * gradeadj));
1062  DrawTextW(str, 0, 175, 0, DT_NOCLIP, 0xFFA0A0A0);
1063  swprintf_s(str, 99,
1064  L" %5.0f MT fabricated", 0.0f);
1065  DrawTextW(str, 0, 185, 0, DT_NOCLIP, 0xFFA0A0A0);
1066 
1067  swprintf_s(str, 99,
1068  L"7] Support Structures %-4i 5 Government %5.0f MT common 12 labor", interactive.type7built, ceilf(132.0f * gradeadj));
1069  DrawTextW(str, 0, 200, 0, DT_NOCLIP, 0xFFA0A0A0);
1070  swprintf_s(str, 99,
1071  L" %5.0f MT fabricated", ceilf(99.0f * gradeadj));
1072  DrawTextW(str, 0, 210, 0, DT_NOCLIP, 0xFFA0A0A0);
1073 
1074  swprintf_s(str, 99,
1075  L"8] Power Production %-4i 1 848 GJ daily %5.0f MT common 4 labor", interactive.type8built, ceilf(132.0f * gradeadj));
1076  DrawTextW(str, 0, 225, 0, DT_NOCLIP, 0xFFA0A0A0);
1077  swprintf_s(str, 99,
1078  L" 7 MT fuel/day %5.0f MT fabricated", ceilf(99.0f * gradeadj));
1079  DrawTextW(str, 0, 235, 0, DT_NOCLIP, 0xFFA0A0A0);
1080 
1081  swprintf_s(str, 99,
1082  L"9] Defensive Platforms %-4i 1 4 GJ/burst %5.0f MT common 6 labor", interactive.type9built, ceilf(132.0f * gradeadj));
1083  DrawTextW(str, 0, 250, 0, DT_NOCLIP, 0xFFA0A0A0);
1084  swprintf_s(str, 99,
1085  L" 1 colonist %5.0f MT fabricated", ceilf(99.0f * gradeadj));
1086  DrawTextW(str, 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
1087  }
1088  else if (interactive.menutype == 10) // town hall
1089  {
1090  if (interactive.tempplot.colonyName[0] == 0)
1091  {
1092  if (interactive.tempplot.boundaryName[0] == 0)
1093  swprintf_s(str, 99, L" Welcome! (population %.0f)", floorf(interactive.tempplot.totalPopulation));
1094  else
1095  swprintf_s(str, 99, L" Welcome to %S! (population %.0f)", interactive.tempplot.boundaryName, floorf(interactive.tempplot.totalPopulation));
1096  }
1097  else
1098  {
1099  if (interactive.tempplot.boundaryName[0] == 0)
1100  swprintf_s(str, 99, L" Welcome to %S (population %.0f)", interactive.tempplot.colonyName, floorf(interactive.tempplot.totalPopulation));
1101  else
1102  swprintf_s(str, 99, L" Welcome to %S %S (population %.0f)", interactive.tempplot.boundaryName, interactive.tempplot.colonyName, floorf(interactive.tempplot.totalPopulation));
1103  }
1104  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
1105 
1106  float opeff;
1107  if (interactive.tempplot.workingPopulation >= 1.0f && interactive.mincoltorun > 0.0f)
1108  {
1109  opeff = (interactive.tempplot.workingPopulation * 0.75f - (float)interactive.tempplot.colonistsbuilding) / interactive.mincoltorun;
1110  if (opeff > 1.0f)
1111  opeff = 1.0f;
1112  else if (opeff < 0.0f)
1113  opeff = 0.0f;
1114  opeff *= 0.5f + (float)interactive.type7built / 5.0f; // half as efficient to 1.5 times as efficient
1115  }
1116  else
1117  opeff = 0.0f;
1118 
1119  swprintf_s(str, 99,
1120  L" APN: %i%04i (%.0f%% efficiency)", interactive.tcp.u + 3038, interactive.tcp.v + 2038, opeff * 100.0f);
1121  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
1122 
1123 
1124  DrawTextW(L"1] Survey", 0, 45, 0, DT_NOCLIP, 0xFFA0A0A0);
1125 
1126  if (interactive.tempplot.colonyName[0] == 0)
1127  {
1128  DrawTextW(L"2] Name Colony", 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
1129  }
1130  else
1131  {
1132  DrawTextW(L"2] Rename Colony", 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
1133  }
1134  DrawTextW(L"3] Expansion", 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1135  DrawTextW(L"4] Demolition", 0, 90, 0, DT_NOCLIP, 0xFFA0A0A0);
1136  DrawTextW(L"5] Manage Trade", 0, 105, 0, DT_NOCLIP, 0xFFA0A0A0);
1137  DrawTextW(L"6] Cargo Operations", 0, 120, 0, DT_NOCLIP, 0xFFA0A0A0);
1138  if (interactive.tempplot.ATMcharge > -1)
1139  swprintf_s(str, 99, L"7] Set ATM Fee (%i CR)", interactive.tempplot.ATMcharge);
1140  else
1141  wcscpy_s(str, 99, L"7] No ATM Installed");
1142  DrawTextW(str, 0, 135, 0, DT_NOCLIP, 0xFFA0A0A0);
1143  DrawTextW(L"8] Diplomacy", 0, 150, 0, DT_NOCLIP, 0xFFA0A0A0);
1144 
1145  float matprod = 0.0f, natused = 0.0f, fuelprod = 0.0f, fueloreused = 0.0f, rarused = 0.0f, goodprod = 0.0f, matused = 0.0f, foodused = 0.0f, fuelused = 0.0f;
1146  if (interactive.tempplot.procstorA > interactive.tempplot.minA &&
1147  interactive.tempplot.procstorC > interactive.tempplot.minC &&
1148  interactive.tempplot.procstormaterials < interactive.tempplot.maxF)
1149  {
1150  float staff = interactive.tempplot.workingPopulation * (float)interactive.tempplot.makeF * 0.01f * 0.25f;
1151  staff *= interactive.tempplot.DlyXtractHarvestProduce;
1152  // used to be 80 MT per 100 but based on global pricing over last 14 years of data we are adjusting this to 50 as of 10/8/2020
1153  matprod = staff / 100.0f * 50.0f * opeff; // 25 per 100 people per day
1154  natused += staff / 100.0f * 50.0f * opeff / 0.98f; // 2% wasted
1155  rarused += staff / 100.0f * 50.0f * opeff / 0.98f * 0.060212377f;
1156  fuelused += matprod * 0.011538462f;
1157  }
1158 
1159  if (interactive.tempplot.procstorfuelore > interactive.tempplot.minD && interactive.tempplot.procstorfuel < interactive.tempplot.maxG)
1160  {
1161  float staff = interactive.tempplot.workingPopulation * (float)interactive.tempplot.makeG * 0.01f * 0.25f;
1162  staff *= interactive.tempplot.DlyXtractHarvestProduce;
1163  // used to be 4.08 MT per 140 but based on global pricing over last 14 years of data we are doubling it as of 10/8/2020
1164  fuelprod = staff / 100.0f * 6.0f * opeff;
1165  fueloreused += fuelprod / 0.4642857143f; // 42 gal becomes 19.5 gal
1166  fuelused += fuelprod * 0.0029312f;
1167  }
1168 
1169  if (interactive.tempplot.procstorfood > interactive.tempplot.minB &&
1170  interactive.tempplot.procstormaterials > interactive.tempplot.minF &&
1171  interactive.tempplot.procstorgoods < interactive.tempplot.maxE)
1172  {
1173  float staff = interactive.tempplot.workingPopulation * (float)interactive.tempplot.makeE * 0.01f * 0.25f;
1174  staff *= interactive.tempplot.DlyXtractHarvestProduce;
1175  goodprod = staff / 100.0f * 2.5f * opeff; // 2.5 per 100 people per day
1176  foodused += goodprod * 0.1f * 1.1f;
1177  matused += goodprod * 0.9f * 1.1f;
1178  fuelused += goodprod * 0.25f;
1179  }
1180 
1181  // production and consumption totals
1182  swprintf_s(str, 99,
1183  L" Daily Production: %.3f MT refined fuel", fuelprod);
1184  DrawTextW(str, 0, 170, 0, DT_NOCLIP, 0xFFA0A0A0);
1185  swprintf_s(str, 99,
1186  L" %.3f MT materials", matprod);
1187  DrawTextW(str, 0, 180, 0, DT_NOCLIP, 0xFFA0A0A0);
1188  swprintf_s(str, 99,
1189  L" %.3f MT goods", goodprod);
1190  DrawTextW(str, 0, 190, 0, DT_NOCLIP, 0xFFA0A0A0);
1191 
1192  swprintf_s(str, 99,
1193  L" Commodity Daily Consumption");
1194  DrawTextW(str, 0, 205, 0, DT_NOCLIP, 0xFFA0A0A0);
1195  swprintf_s(str, 99,
1196  L" Rare %.3f MT", rarused);
1197  DrawTextW(str, 0, 215, 0, DT_NOCLIP, 0xFFA0A0A0);
1198  swprintf_s(str, 99,
1199  L" Foodstuffs %.3f MT", interactive.tempplot.totalPopulation * 0.00109589f + foodused);
1200  DrawTextW(str, 0, 225, 0, DT_NOCLIP, 0xFFA0A0A0);
1201  swprintf_s(str, 99,
1202  L" Common %.3f MT", natused);
1203  DrawTextW(str, 0, 235, 0, DT_NOCLIP, 0xFFA0A0A0);
1204  swprintf_s(str, 99,
1205  L" Fuel Ore %.3f MT", fueloreused);
1206  DrawTextW(str, 0, 245, 0, DT_NOCLIP, 0xFFA0A0A0);
1207  swprintf_s(str, 99,
1208  L" Goods %.3f MT", interactive.tempplot.totalPopulation * 0.00094486628821917808219178082191781f);
1209  DrawTextW(str, 0, 255, 0, DT_NOCLIP, 0xFFA0A0A0);
1210  swprintf_s(str, 99,
1211  L" Materials %.3f MT", matused);
1212  DrawTextW(str, 0, 265, 0, DT_NOCLIP, 0xFFA0A0A0);
1213  swprintf_s(str, 99,
1214  L" Fuel %.3f MT", interactive.tempplot.totalPopulation * 0.000011785f + fuelused);
1215  DrawTextW(str, 0, 275, 0, DT_NOCLIP, 0xFFA0A0A0);
1216 
1217 
1218  // important messages
1219  short x = 210, y = 45;
1220  if (interactive.tempplot.totalPopulation >= 1.0f)
1221  {
1222  if (interactive.tempplot.procstorfood == 0.0f)
1223  {
1224  DrawTextW(L"** We desperately need food!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1225  y += 15;
1226  }
1227  else
1228  {
1229  if ((interactive.tempplot.totalPopulation * 0.00109589f * 7.0f) > interactive.tempplot.procstorfood)
1230  {
1231  DrawTextW(L"++ We have less than a week's supply of food!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1232  y += 15;
1233  }
1234  }
1235  }
1236  if (interactive.tempplot.colonyUplink == 0)
1237  {
1238  DrawTextW(L"++ The colony up-link has failed!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1239  y += 15;
1240  }
1241  if (interactive.tempplot.totalPopulation >= 1.0f && (interactive.tempplot.procstorA + interactive.tempplot.procstorfood + interactive.tempplot.procstorC + interactive.tempplot.procstorfuelore + interactive.tempplot.procstorgoods + interactive.tempplot.procstormaterials + interactive.tempplot.procstorfuel) >= interactive.tempplot.maxprocstor)
1242  {
1243  DrawTextW(L"++ Production halted, out of secure processed storage!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1244  y += 15;
1245  }
1246  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstorfuel <= 0)
1247  {
1248  DrawTextW(L"++ Production halted, out of refined Iagreous fuel!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1249  y += 15;
1250  }
1251  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstorA <= interactive.tempplot.minA)
1252  {
1253  DrawTextW(L"++ Fabricated production halted,", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1254  y += 15;
1255  DrawTextW(L"++ into reserves of rare material!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1256  y += 15;
1257  }
1258  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstorC <= interactive.tempplot.minC)
1259  {
1260  DrawTextW(L"++ Fabricated production halted,", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1261  y += 15;
1262  DrawTextW(L"++ into reserves of common material!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1263  y += 15;
1264  }
1265  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstormaterials >= interactive.tempplot.maxF)
1266  {
1267  DrawTextW(L"++ Fabricated production halted,", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1268  y += 15;
1269  DrawTextW(L"++ surplus of fabricated materials!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1270  y += 15;
1271  }
1272  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstorfuelore <= interactive.tempplot.minD)
1273  {
1274  DrawTextW(L"++ Fuel refining halted,", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1275  y += 15;
1276  DrawTextW(L"++ into reserves of unrefined fuel ore!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1277  y += 15;
1278  }
1279  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstorfuel >= interactive.tempplot.maxG)
1280  {
1281  DrawTextW(L"++ Fuel refining halted,", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1282  y += 15;
1283  DrawTextW(L"++ surplus of refined fuel!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1284  y += 15;
1285  }
1286 
1287  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstorfood <= interactive.tempplot.minB)
1288  {
1289  DrawTextW(L"++ Consumer goods production halted,", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1290  y += 15;
1291  DrawTextW(L"++ into reserves of foodstuffs!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1292  y += 15;
1293  }
1294  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstormaterials <= interactive.tempplot.minF)
1295  {
1296  DrawTextW(L"++ Consumer goods production halted,", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1297  y += 15;
1298  DrawTextW(L"++ into reserves of fabricated material!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1299  y += 15;
1300  }
1301  if (interactive.tempplot.totalPopulation >= 1.0f && interactive.tempplot.procstorgoods >= interactive.tempplot.maxE)
1302  {
1303  DrawTextW(L"++ Consumer goods production halted,", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1304  y += 15;
1305  DrawTextW(L"++ surplus of consumer goods!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1306  y += 15;
1307  }
1308 
1309  if (floorf(interactive.tempplot.totalPopulation) > interactive.tempplot.maxcolstor)
1310  {
1311  DrawTextW(L"++ The colony is overpopulated!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1312  y += 15;
1313  }
1314  if (interactive.tempplot.colonistsbuilding > 0)
1315  {
1316  swprintf_s(str, 99, L".. We have %i people reassigned for construction", interactive.tempplot.colonistsbuilding);
1317  DrawTextW(str, x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1318  y += 15;
1319  }
1320  if (interactive.tempplot.workingPopulation < interactive.mincoltorun)
1321  {
1322  swprintf_s(str, 99, L".. We are understaffed by %i workers", static_cast<short>(interactive.mincoltorun) - interactive.tempplot.workingPopulation);
1323  DrawTextW(str, x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1324  y += 15;
1325  }
1326  if (y == 45)
1327  {
1328  DrawTextW(L".. No new messages!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1329  }
1330  }
1331  else if (interactive.menutype == 11) // commodity trade
1332  {
1333  DrawTextW(L" Commodity Type Options Held We Paid Trading At", 0, 30, 0, DT_NOCLIP, 0xFFA0A0A0);
1334 
1335  swprintf_s(str, 99, L"1] Rare/Precious %-9.0f MT %-5i CR %-5i CR", floorf(interactive.tempdock.procstorA), interactive.tempdock.sellA, interactive.tempdock.buyA);
1336  DrawTextW(str, 0, 70, 0, DT_NOCLIP, 0xFFA0A0A0);
1337 
1338  swprintf_s(str, 99, L"2] Foodstuffs %-9.0f MT %-5i CR %-5i CR", floorf(interactive.tempdock.procstorfood), interactive.tempdock.sellB, interactive.tempdock.buyB);
1339  DrawTextW(str, 0, 95, 0, DT_NOCLIP, 0xFFA0A0A0);
1340 
1341  swprintf_s(str, 99, L"3] Common Materials %-9.0f MT %-5i CR %-5i CR", floorf(interactive.tempdock.procstorC), interactive.tempdock.sellC, interactive.tempdock.buyC);
1342  DrawTextW(str, 0, 120, 0, DT_NOCLIP, 0xFFA0A0A0);
1343 
1344  swprintf_s(str, 99, L"4] Fuel Ore %-9.0f MT %-5i CR %-5i CR", floorf(interactive.tempdock.procstorfuelore), interactive.tempdock.sellD, interactive.tempdock.buyD);
1345  DrawTextW(str, 0, 145, 0, DT_NOCLIP, 0xFFA0A0A0);
1346 
1347  swprintf_s(str, 99, L"5] Consumer Goods %-9.0f MT %-5i CR %-5i CR", floorf(interactive.tempdock.procstorgoods), interactive.tempdock.sellE, interactive.tempdock.buyE);
1348  DrawTextW(str, 0, 170, 0, DT_NOCLIP, 0xFFA0A0A0);
1349 
1350  swprintf_s(str, 99, L"6] Fabricated Materials %-9.0f MT %-5i CR %-5i CR", floorf(interactive.tempdock.procstormaterials), interactive.tempdock.sellF, interactive.tempdock.buyF);
1351  DrawTextW(str, 0, 195, 0, DT_NOCLIP, 0xFFA0A0A0);
1352 
1353  swprintf_s(str, 99, L"7] Iagreous Fuel %-9.0f MT %-5i CR %-5i CR", floorf(interactive.tempdock.procstorfuel), interactive.tempdock.sellG, interactive.tempdock.buyG);
1354  DrawTextW(str, 0, 220, 0, DT_NOCLIP, 0xFFA0A0A0);
1355 
1356 
1357  if (interactive.tempdock.lastannouncement > 34081)
1358  {
1359  DrawTextW(L" Trading volume today: Record-breaking!", 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
1360  }
1361  else if (interactive.tempdock.lastannouncement > 27264)
1362  {
1363  DrawTextW(L" Trading volume today: Very heavy", 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
1364  }
1365  else if (interactive.tempdock.lastannouncement > 20448)
1366  {
1367  DrawTextW(L" Trading volume today: Moderately heavy", 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
1368  }
1369  else if (interactive.tempdock.lastannouncement > 13632)
1370  {
1371  DrawTextW(L" Trading volume today: Average", 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
1372  }
1373  else if (interactive.tempdock.lastannouncement > 6816)
1374  {
1375  DrawTextW(L" Trading volume today: Moderately light", 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
1376  }
1377  else if (interactive.tempdock.lastannouncement > 0)
1378  {
1379  DrawTextW(L" Trading volume today: Very light", 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
1380  }
1381  else
1382  {
1383  DrawTextW(L" Trading volume today: None", 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
1384  }
1385  }
1386  else if (interactive.menutype == 141) // FBO airfield
1387  {
1388  if (interactive.tempplot.colonyName[0] == 0)
1389  {
1390  if (interactive.tempplot.boundaryName[0] == 0)
1391  swprintf_s(str, 99, L" Welcome! (population %.0f)", floorf(interactive.tempplot.totalPopulation));
1392  else
1393  swprintf_s(str, 99, L" Welcome to %S! (population %.0f)", interactive.tempplot.boundaryName, floorf(interactive.tempplot.totalPopulation));
1394  }
1395  else
1396  {
1397  if (interactive.tempplot.boundaryName[0] == 0)
1398  swprintf_s(str, 99, L" Welcome to %S (population %.0f)", interactive.tempplot.colonyName, floorf(interactive.tempplot.totalPopulation));
1399  else
1400  swprintf_s(str, 99, L" Welcome to %S %S (population %.0f)", interactive.tempplot.boundaryName, interactive.tempplot.colonyName, floorf(interactive.tempplot.totalPopulation));
1401  }
1402  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
1403 
1404  float opeff;
1405  if (interactive.tempplot.workingPopulation >= 1.0f && interactive.mincoltorun > 0.0f)
1406  {
1407  opeff = (interactive.tempplot.workingPopulation * 0.75f - (float)interactive.tempplot.colonistsbuilding) / interactive.mincoltorun;
1408  if (opeff > 1.0f)
1409  opeff = 1.0f;
1410  else if (opeff < 0.0f)
1411  opeff = 0.0f;
1412  opeff *= 0.5f + (float)interactive.type7built / 5.0f; // half as efficient to 1.5 times as efficient
1413  }
1414  else
1415  opeff = 0.0f;
1416 
1417  swprintf_s(str, 99,
1418  L" APN: %i%04i (%.0f%% efficiency)", interactive.tcp.u + 3038, interactive.tcp.v + 2038, opeff * 100.0f);
1419  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
1420 
1421 
1422  DrawTextW(L"1] Survey", 0, 45, 0, DT_NOCLIP, 0xFFA0A0A0);
1423 
1424  if (interactive.tempplot.colonyName[0] == 0)
1425  {
1426  DrawTextW(L"2] Name Colony", 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
1427  }
1428  else
1429  {
1430  DrawTextW(L"2] Rename Colony", 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
1431  }
1432  DrawTextW(L"3] Expansion", 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1433  DrawTextW(L"4] Demolition", 0, 90, 0, DT_NOCLIP, 0xFFA0A0A0);
1434  DrawTextW(L"5] Manage Trade", 0, 105, 0, DT_NOCLIP, 0xFFA0A0A0);
1435  DrawTextW(L"6] Cargo Operations", 0, 120, 0, DT_NOCLIP, 0xFFA0A0A0);
1436  if (interactive.tempplot.ATMcharge > -1)
1437  swprintf_s(str, 99, L"7] Set ATM Fee (%i CR)", interactive.tempplot.ATMcharge);
1438  else
1439  wcscpy_s(str, 99, L"7] No ATM Installed");
1440  DrawTextW(str, 0, 135, 0, DT_NOCLIP, 0xFFA0A0A0);
1441  DrawTextW(L"8] Diplomacy", 0, 150, 0, DT_NOCLIP, 0xFFA0A0A0);
1442 
1443  // float matprod = 0.0f, fuelprod = 0.0f;
1444  float natused = 0.0f, fuelused = 0.0f, rarused = 0.0f;
1445  //if (interactive.tempplot.procstorC > interactive.tempplot.minC && interactive.tempplot.procstormaterials < interactive.tempplot.maxF) // minimum to keep on hand
1446  //{
1447  // float staff = interactive.tempplot.workingPopulation*(float)interactive.tempplot.makeF*0.01f*0.25f;
1448  // staff *= interactive.tempplot.DlyXtractC;
1449  // matprod += staff / 100.0f*80.0f*opeff; // 80 per 100 people per day
1450  // natused += staff / 100.0f*80.0f*opeff / 0.98f; // 2% wasted
1451  // rarused += staff / 100.0f*80.0f*opeff / 0.98f*0.060212377f;
1452  //}
1453 
1454  //if (interactive.tempplot.procstorfuelore > interactive.tempplot.minD && interactive.tempplot.procstorfuel < interactive.tempplot.maxG)
1455  //{
1456  // float staff = interactive.tempplot.workingPopulation*(float)interactive.tempplot.makeG*0.01f*0.25f;
1457  // staff *= interactive.tempplot.DlyXtractC;
1458  // fuelprod += staff / 140.0f*4.08f*opeff; // takes 140 people to produce 4.08 MT of fuel ore
1459  // fuelused += staff / 140.0f*4.08f*opeff / 0.4642857143f; // 42 gal becomes 19.5 gal
1460  //}
1461 
1462  // production and consumption totals
1463  /*swprintf_s(str, 99,
1464  L" Daily Production: %.3f MT refined fuel", fuelprod);
1465  DrawTextW(str, 0, 170, 0, DT_NOCLIP, 0xFFA0A0A0);
1466  swprintf_s(str, 99,
1467  L" %.3f MT materials", matprod);
1468  DrawTextW(str, 0, 180, 0, DT_NOCLIP, 0xFFA0A0A0);
1469  swprintf_s(str, 99,
1470  L" %.3f MT goods", 0.0f);
1471  DrawTextW(str, 0, 190, 0, DT_NOCLIP, 0xFFA0A0A0);*/
1472 
1473  swprintf_s(str, 99,
1474  L" Commodity Daily Consumption");
1475  DrawTextW(str, 0, 205, 0, DT_NOCLIP, 0xFFA0A0A0);
1476  swprintf_s(str, 99,
1477  L" Rare %.3f MT", rarused);
1478  DrawTextW(str, 0, 215, 0, DT_NOCLIP, 0xFFA0A0A0);
1479  swprintf_s(str, 99,
1480  L" Foodstuffs %.3f MT", interactive.tempplot.totalPopulation * 0.00109589f);
1481  DrawTextW(str, 0, 225, 0, DT_NOCLIP, 0xFFA0A0A0);
1482  swprintf_s(str, 99,
1483  L" Common %.3f MT", natused);
1484  DrawTextW(str, 0, 235, 0, DT_NOCLIP, 0xFFA0A0A0);
1485  swprintf_s(str, 99,
1486  L" Fuel Ore %.3f MT", fuelused);
1487  DrawTextW(str, 0, 245, 0, DT_NOCLIP, 0xFFA0A0A0);
1488  swprintf_s(str, 99,
1489  L" Goods %.3f MT", 0.0f);
1490  DrawTextW(str, 0, 255, 0, DT_NOCLIP, 0xFFA0A0A0);
1491  swprintf_s(str, 99,
1492  L" Materials %.3f MT", 0.0f);
1493  DrawTextW(str, 0, 265, 0, DT_NOCLIP, 0xFFA0A0A0);
1494  swprintf_s(str, 99,
1495  L" Fuel %.3f MT", 0.0f);
1496  DrawTextW(str, 0, 275, 0, DT_NOCLIP, 0xFFA0A0A0);
1497 
1498 
1499  // important messages
1500  short x = 210, y = 45;
1501  if (interactive.tempplot.totalPopulation >= 1.0f)
1502  {
1503  if (interactive.tempplot.procstorfood == 0.0f)
1504  {
1505  DrawTextW(L"** We desperately need food!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1506  y += 15;
1507  }
1508  else
1509  {
1510  if ((interactive.tempplot.totalPopulation * 0.00109589f * 7.0f) > interactive.tempplot.procstorfood)
1511  {
1512  DrawTextW(L"++ We have less than a week's supply of food!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1513  y += 15;
1514  }
1515  }
1516  if (interactive.tempplot.procstorfuel <= 0)
1517  {
1518  DrawTextW(L"++ We are experiencing power outages, no more refined Iagreous fuel!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1519  y += 15;
1520  }
1521  }
1522  if (interactive.tempplot.colonyUplink == 0)
1523  {
1524  DrawTextW(L"++ The colony up-link has failed!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1525  y += 15;
1526  }
1527  if (floorf(interactive.tempplot.totalPopulation) > interactive.tempplot.maxcolstor)
1528  {
1529  DrawTextW(L"++ The colony is overpopulated!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1530  y += 15;
1531  }
1532  if (interactive.tempplot.colonistsbuilding > 0)
1533  {
1534  swprintf_s(str, 99, L".. We have %i people reassigned for construction", interactive.tempplot.colonistsbuilding);
1535  DrawTextW(str, x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1536  y += 15;
1537  }
1538  if (interactive.tempplot.workingPopulation < interactive.mincoltorun)
1539  {
1540  swprintf_s(str, 99, L".. We are understaffed by %i workers", static_cast<short>(interactive.mincoltorun) - interactive.tempplot.workingPopulation);
1541  DrawTextW(str, x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1542  y += 15;
1543  }
1544  if (y == 45)
1545  {
1546  DrawTextW(L".. No new messages!", x, y, 0, DT_NOCLIP, 0xFFA0A0A0);
1547  }
1548  }
1549  else if (interactive.menutype == 142 || interactive.menutype == 143) // airfield expansion/demolition
1550  {
1551  float gradeadj = 1.0f; // airfields have to be flat so no premium for foundations!
1552  if (interactive.menutype == 143) // demolition
1553  gradeadj *= 0.2625f;
1554  if (interactive.tempplot.constructime == 0L)
1555  {
1556  if (interactive.menutype == 142)
1557  {
1558  swprintf_s(str, 99,
1559  L" Availability for construction %7i MT common %i labor", (int)interactive.tempplot.procstorC, (short)floorf(interactive.colonistsforbuilding));
1560  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
1561  swprintf_s(str, 99,
1562  L" %7i MT fabricated", (int)interactive.tempplot.procstormaterials);
1563  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
1564  }
1565  else
1566  {
1567  swprintf_s(str, 99,
1568  L" Availability for demolition %7i MT common %i labor", (int)interactive.tempplot.procstorC, (short)floorf(interactive.colonistsforbuilding));
1569  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
1570  swprintf_s(str, 99,
1571  L" %7i MT fabricated", (int)interactive.tempplot.procstormaterials);
1572  DrawTextW(str, 0, 20, 0, DT_NOCLIP, 0xFFA0A0A0);
1573  }
1574  }
1575  else
1576  {
1577  char timerem[99];
1578  if (interactive.tempplot.constructime > 103896L)
1579  sprintf_s(timerem, sizeof(timerem), "%5i days left ", interactive.tempplot.constructime / 51948L); // vieneo days
1580  else if (interactive.tempplot.constructime > 3600L)
1581  sprintf_s(timerem, sizeof(timerem), "%5i hours left ", interactive.tempplot.constructime / 3600L);
1582  else if (interactive.tempplot.constructime > 60L)
1583  sprintf_s(timerem, sizeof(timerem), "%5i minutes left", interactive.tempplot.constructime / 60L);
1584  else
1585  sprintf_s(timerem, sizeof(timerem), "One minute left!");
1586 
1587  swprintf_s(str, 99,
1588  L" CONSTRUCTION IN PROGRESS %S (%i colonists building)", timerem, interactive.tempplot.colonistsbuilding);
1589  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
1590  }
1591 
1592  if (interactive.menutype == 142)
1593  {
1594  DrawTextW(L" Structure Type Built Zoned Adds Capacity Materials Needed Colonists", 0, 35, 0, DT_NOCLIP, 0xFFA0A0A0);
1595  }
1596  else
1597  {
1598  DrawTextW(L" Structure Type Built Zoned Adds Capacity Materials Recycled Colonists", 0, 35, 0, DT_NOCLIP, 0xFFA0A0A0);
1599  }
1600  swprintf_s(str, 99,
1601  L"1] Fixed-base Operator %-4i 2 5 colonists %3.0f MT common 1 labor", interactive.type1built, ceilf(23.37f * gradeadj));
1602  DrawTextW(str, 0, 50, 0, DT_NOCLIP, 0xFFA0A0A0);
1603  swprintf_s(str, 99,
1604  L" %3.0f MT fabricated", ceilf(17.13f * gradeadj));
1605  DrawTextW(str, 0, 60, 0, DT_NOCLIP, 0xFFA0A0A0);
1606 
1607 #pragma region Runway
1608  if (interactive.menutype == 142)
1609  {
1610  // ReSharper disable once CppIdenticalOperandsInBinaryExpression
1611  if (!(0x80000000 >> (96 - 96) & interactive.tempplot.layout4))
1612  {
1613  swprintf_s(str, 99,
1614  L"2] Runway 0 1 Phase 1/3 %3.0f MT common 4 labor", ceilf(0.0f * gradeadj));
1615  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1616  swprintf_s(str, 99,
1617  L" Marston Mat %3.0f MT fabricated", ceilf(999.0f * gradeadj));
1618  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
1619  }
1620  else if (!(0x80000000 >> (97 - 96) & interactive.tempplot.layout4))
1621  {
1622  swprintf_s(str, 99,
1623  L"2] Runway 0 1 Phase 2/3 %3.0f MT common 4 labor", ceilf(0.0f * gradeadj));
1624  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1625  swprintf_s(str, 99,
1626  L" Marston Mat %3.0f MT fabricated", ceilf(999.0f * gradeadj));
1627  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
1628  }
1629  else if ((!(0x80000000 >> (98 - 96) & interactive.tempplot.layout4)))
1630  {
1631  swprintf_s(str, 99,
1632  L"2] Runway 0 1 Phase 3/3 %3.0f MT common 4 labor", ceilf(0.0f * gradeadj));
1633  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1634  swprintf_s(str, 99,
1635  L" Marston Mat %3.0f MT fabricated", ceilf(125.0f * gradeadj));
1636  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
1637  }
1638  else
1639  {
1640  swprintf_s(str, 99,
1641  L"2] Runway 1 1 %3.0f MT common 4 labor", ceilf(0.0f * gradeadj));
1642  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1643  swprintf_s(str, 99,
1644  L" Marston Mat %3.0f MT fabricated", ceilf(2123.0f * gradeadj));
1645  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
1646  }
1647  }
1648  else if (interactive.menutype == 143)
1649  {
1650  // ReSharper disable once CppIdenticalOperandsInBinaryExpression
1651  if (!(0x80000000 >> (96 - 96) & interactive.tempplot.layout4))
1652  {
1653  swprintf_s(str, 99,
1654  L"2] Runway 0 1 %3.0f MT common 4 labor", ceilf(0.0f * gradeadj));
1655  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1656  swprintf_s(str, 99,
1657  L" %3.0f MT fabricated", ceilf(2123.0f * gradeadj));
1658  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
1659  }
1660  else if (!(0x80000000 >> (97 - 96) & interactive.tempplot.layout4))
1661  {
1662  swprintf_s(str, 99,
1663  L"2] Runway 0 1 Phase 1/3 %3.0f MT common 4 labor", ceilf(0.0f * gradeadj));
1664  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1665  swprintf_s(str, 99,
1666  L" Marston Mat %3.0f MT fabricated", ceilf(999.0f * gradeadj));
1667  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
1668  }
1669  else if (!(0x80000000 >> (98 - 96) & interactive.tempplot.layout4))
1670  {
1671  swprintf_s(str, 99,
1672  L"2] Runway 0 1 Phase 2/3 %3.0f MT common 4 labor", ceilf(0.0f * gradeadj));
1673  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1674  swprintf_s(str, 99,
1675  L" Marston Mat %3.0f MT fabricated", ceilf(999.0f * gradeadj));
1676  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
1677  }
1678  else
1679  {
1680  swprintf_s(str, 99,
1681  L"2] Runway 1 1 Phase 3/3 %3.0f MT common 4 labor", ceilf(0.0f * gradeadj));
1682  DrawTextW(str, 0, 75, 0, DT_NOCLIP, 0xFFA0A0A0);
1683  swprintf_s(str, 99,
1684  L" Marston Mat %3.0f MT fabricated", ceilf(125.0f * gradeadj));
1685  DrawTextW(str, 0, 85, 0, DT_NOCLIP, 0xFFA0A0A0);
1686  }
1687  }
1688 #pragma endregion
1689 
1690  swprintf_s(str, 99,
1691  L"3] Terminal %-4i 1 8 colonists %3.0f MT common 11 labor", interactive.type3built, ceilf(267.01f * gradeadj));
1692  DrawTextW(str, 0, 100, 0, DT_NOCLIP, 0xFFA0A0A0);
1693  swprintf_s(str, 99,
1694  L" 20479 MT storage %3.0f MT fabricated", ceilf(195.72f * gradeadj));
1695  DrawTextW(str, 0, 110, 0, DT_NOCLIP, 0xFFA0A0A0);
1696 
1697  swprintf_s(str, 99,
1698  L"4] Hangar %-4i 1 6 colonists %3.0f MT common 61 labor", interactive.type4built, ceilf(143.04f * gradeadj));
1699  DrawTextW(str, 0, 125, 0, DT_NOCLIP, 0xFFA0A0A0);
1700  swprintf_s(str, 99,
1701  L" %3.0f MT fabricated", ceilf(104.85f * gradeadj));
1702  DrawTextW(str, 0, 135, 0, DT_NOCLIP, 0xFFA0A0A0);
1703 
1704  swprintf_s(str, 99,
1705  L"5] Hotel %-4i 2 824 colonists %3.0f MT common 6 labor", interactive.type5built, ceilf(151.13f * gradeadj));
1706  DrawTextW(str, 0, 150, 0, DT_NOCLIP, 0xFFA0A0A0);
1707  swprintf_s(str, 99,
1708  L" %3.0f MT fabricated", ceilf(110.78f * gradeadj));
1709  DrawTextW(str, 0, 160, 0, DT_NOCLIP, 0xFFA0A0A0);
1710 
1711  swprintf_s(str, 99,
1712  L"6] Fuel Farm %-4i 2 25810 MT storage %3.0f MT common 5 labor", interactive.type6built, ceilf(58.57f * gradeadj));
1713  DrawTextW(str, 0, 175, 0, DT_NOCLIP, 0xFFA0A0A0);
1714  swprintf_s(str, 99,
1715  L" %3.0f MT fabricated", ceilf(42.93f * gradeadj));
1716  DrawTextW(str, 0, 185, 0, DT_NOCLIP, 0xFFA0A0A0);
1717 
1718  swprintf_s(str, 99,
1719  L"7] Support Structures %-4i 5 %3.0f MT common 2 labor", interactive.type7built, ceilf(42.96f * gradeadj));
1720  DrawTextW(str, 0, 200, 0, DT_NOCLIP, 0xFFA0A0A0);
1721  swprintf_s(str, 99,
1722  L" %3.0f MT fabricated", ceilf(31.49f * gradeadj));
1723  DrawTextW(str, 0, 210, 0, DT_NOCLIP, 0xFFA0A0A0);
1724 
1725  swprintf_s(str, 99,
1726  L"8] Power Production %-4i 1 212 GJ daily %3.0f MT common 1 labor", interactive.type8built, ceilf(31.88f * gradeadj));
1727  DrawTextW(str, 0, 225, 0, DT_NOCLIP, 0xFFA0A0A0);
1728  swprintf_s(str, 99,
1729  L" 1 colonist %3.0f MT fabricated", ceilf(23.37f * gradeadj));
1730  DrawTextW(str, 0, 235, 0, DT_NOCLIP, 0xFFA0A0A0);
1731 
1732  swprintf_s(str, 99,
1733  L"9] Control Tower %-4i 1 1 colonist %3.0f MT common 2 labor", interactive.type9built, ceilf(36.40f * gradeadj));
1734  DrawTextW(str, 0, 250, 0, DT_NOCLIP, 0xFFA0A0A0);
1735  swprintf_s(str, 99,
1736  L" %3.0f MT fabricated", ceilf(26.68f * gradeadj));
1737  DrawTextW(str, 0, 260, 0, DT_NOCLIP, 0xFFA0A0A0);
1738  }
1739  else // new advanced plot management
1740  {
1741  // 21-27 for grade A through refined fuel
1742  int maxonhand, minonhand, buyingprice, sellingprice;
1743  char stafftoproduce;
1744  switch (interactive.menutype)
1745  {
1746  case 21: swprintf_s(str, 99, L" Rare/Precious %.0f MT on hand", floorf(interactive.tempplot.procstorA));
1747  maxonhand = interactive.tempplot.maxA;
1748  minonhand = interactive.tempplot.minA;
1749  buyingprice = interactive.tempplot.buyA;
1750  sellingprice = interactive.tempplot.sellA;
1751  stafftoproduce = 0;
1752  break;
1753  case 22: swprintf_s(str, 99, L" Foodstuffs %.0f MT on hand", floorf(interactive.tempplot.procstorfood));
1754  maxonhand = interactive.tempplot.maxB;
1755  minonhand = interactive.tempplot.minB;
1756  buyingprice = interactive.tempplot.buyB;
1757  sellingprice = interactive.tempplot.sellB;
1758  stafftoproduce = 0;
1759  break;
1760  case 23: swprintf_s(str, 99, L" Common Materials %.0f MT on hand", floorf(interactive.tempplot.procstorC));
1761  maxonhand = interactive.tempplot.maxC;
1762  minonhand = interactive.tempplot.minC;
1763  buyingprice = interactive.tempplot.buyC;
1764  sellingprice = interactive.tempplot.sellC;
1765  stafftoproduce = 0;
1766  break;
1767  case 24: swprintf_s(str, 99, L" Fuel Ore %.0f MT on hand", floorf(interactive.tempplot.procstorfuelore));
1768  maxonhand = interactive.tempplot.maxD;
1769  minonhand = interactive.tempplot.minD;
1770  buyingprice = interactive.tempplot.buyD;
1771  sellingprice = interactive.tempplot.sellD;
1772  stafftoproduce = 0;
1773  break;
1774  case 25: swprintf_s(str, 99, L" Consumer Goods %.0f MT on hand", floorf(interactive.tempplot.procstorgoods));
1775  maxonhand = interactive.tempplot.maxE;
1776  minonhand = interactive.tempplot.minE;
1777  buyingprice = interactive.tempplot.buyE;
1778  sellingprice = interactive.tempplot.sellE;
1779  stafftoproduce = interactive.tempplot.makeE;
1780  break;
1781  case 26: swprintf_s(str, 99, L" Fabricated Materials %.0f MT on hand", floorf(interactive.tempplot.procstormaterials));
1782  maxonhand = interactive.tempplot.maxF;
1783  minonhand = interactive.tempplot.minF;
1784  buyingprice = interactive.tempplot.buyF;
1785  sellingprice = interactive.tempplot.sellF;
1786  stafftoproduce = interactive.tempplot.makeF;
1787  break;
1788  case 27: swprintf_s(str, 99, L" Refined Fuel %.0f MT on hand", floorf(interactive.tempplot.procstorfuel));
1789  maxonhand = interactive.tempplot.maxG;
1790  minonhand = interactive.tempplot.minG;
1791  buyingprice = interactive.tempplot.buyG;
1792  sellingprice = interactive.tempplot.sellG;
1793  stafftoproduce = interactive.tempplot.makeG;
1794  break;
1795  default:
1796  maxonhand = minonhand = buyingprice = sellingprice = 0;
1797  stafftoproduce = 0;
1798  break;
1799  }
1800 
1801  DrawTextW(str, 0, 10, 0, DT_NOCLIP, 0xFFA0A0A0);
1802 
1803  DrawTextW(L" Option Type Value", 0, 45, 0, DT_NOCLIP, 0xFFA0A0A0);
1804 
1805  swprintf_s(str, 99, L"1] Maximum on hand %i MT", maxonhand);
1806  DrawTextW(str, 0, 65, 0, DT_NOCLIP, 0xFFA0A0A0);
1807  if (buyingprice > 0)
1808  swprintf_s(str, 99, L"2] Buying price %i CR per MT", buyingprice);
1809  else
1810  swprintf_s(str, 99, L"2] Buying price Not trading...");
1811  DrawTextW(str, 0, 90, 0, DT_NOCLIP, 0xFFA0A0A0);
1812 
1813  if (interactive.tempplot.type == PlotType::UserTownship && (interactive.menutype == 25 || interactive.menutype == 26 || interactive.menutype == 27))
1814  swprintf_s(str, 99, L"3] Staff to produce %i%% (%.0f colonists)", stafftoproduce, floorf(interactive.tempplot.workingPopulation * 0.25f * (float)stafftoproduce * 0.01f));
1815  else
1816  swprintf_s(str, 99, L"3] Staff to produce N/A");
1817 
1818  // 21 a 22 b 23 c 24 d 25 e 26 f 27 g
1819  if (interactive.tempplot.type == PlotType::UserTownship && (interactive.menutype == 25 || interactive.menutype == 26 || interactive.menutype == 27))
1820  DrawTextW(str, 0, 115, 0, DT_NOCLIP, 0xFFA0A0A0);
1821  else
1822  DrawTextW(str, 0, 115, 0, DT_NOCLIP, 0xFF505050);
1823 
1824  //if (interactive.tempplot.type == PlotType::UserTownship)
1825  // swprintf_s(str, 99, L" Staff to transfer %i%% (%.0f colonists)", 0, 0.0f);
1826  //else
1827  // swprintf_s(str, 99, L" Staff to transfer %i%% (%.0f colonists)", 0, 0.0f);
1828  //DrawTextW(str, 0, 140, 0, DT_NOCLIP, 0xFF505050);
1829 
1830  //DrawTextW(L" Manage Transfers Use Player Portal", 0, 165, 0, DT_NOCLIP, 0xFFA0A0A0);
1831 
1832  if (sellingprice > 0)
1833  swprintf_s(str, 99, L"6] Selling price %i CR per MT", sellingprice);
1834  else
1835  swprintf_s(str, 99, L"6] Selling price Not trading...");
1836  DrawTextW(str, 0, 190, 0, DT_NOCLIP, 0xFFA0A0A0);
1837 
1838  swprintf_s(str, 99, L"7] Minimum on hand %i MT", minonhand);
1839  DrawTextW(str, 0, 215, 0, DT_NOCLIP, 0xFFA0A0A0);
1840  }
1841 }
1842 
1843 bool Intermedia::HandleKeyPress(short key, bool shift)
1844 {
1845  logger->AddToCallStack("Intermedia::HandleKeyPress");
1846  if (!interactive.avail) return false;
1847  if (g_bTextInput != 0) return false;
1848  if (shift) return false;
1849 
1850  switch (key)
1851  {
1852  case 2: // 1
1853  case 3: // 2
1854  case 4: // 3
1855  case 5: // 4
1856  case 6: // 5
1857  case 7: // 6
1858  case 8: // 7
1859  case 9: // 8
1860  case 10: // 9
1861  case 11: // 0
1863  return true;
1864  }
1865 
1866  return false;
1867 }
short type1built
Definition: globals.h:772
SPlotData tempplot
Definition: globals.h:767
short type8built
Definition: globals.h:772
Definition: Logger.h:9
Sinteractive interactive
Definition: globals.cpp:183
float colonistsforbuilding
Definition: globals.h:771
short type6built
Definition: globals.h:772
char g_bTextInput
Definition: globals.cpp:108
Definition: Bus.h:16
short type5built
Definition: globals.h:772
float mincoltorun
Definition: globals.h:771
short type2built
Definition: globals.h:772
UINT defaultFont
Definition: Instrument.h:20
Intermedia(int prmX, int prmY, float prmXScale, float prmYScale, Bus *prmBus, Logger *prmLogger, DeviceObject *prmDevice, std::vector< Font *> prmFonts)
Definition: Intermedia.cpp:4
short outboundMenuSelect
Definition: globals.h:762
short type3built
Definition: globals.h:772
Logger * logger
Definition: Instrument.h:19
void Render() override
Definition: Intermedia.cpp:11
bool avail
Definition: globals.h:760
short type9built
Definition: globals.h:772
SDockingPorts tempdock
Definition: globals.h:768
VECTOR2SHORT tcp
Definition: globals.h:763
short type7built
Definition: globals.h:772
bool HandleKeyPress(short key, bool shift) override
void AddToCallStack(const char *msg)
Definition: Logger.cpp:86
unsigned char menutype
Definition: globals.h:761
short type4built
Definition: globals.h:772