1 /* ---------------------------------------------------------------------- *
2 * monument.c
3 * This file is part of lincity.
4 * Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001.
5 * (c) Corey Keasling, 2004
6 * ---------------------------------------------------------------------- */
7
8 #include <lctypes.h>
9 #include <lcintl.h>
10 #include <lcconfig.h>
11 #include <cliglobs.h>
12 #include <engglobs.h>
13 #include <stats.h>
14 #include <mps.h>
15 #include <monument.h>
16
17 void
do_monument(int x,int y)18 do_monument (int x, int y)
19 {
20 /*
21 // int_1 holds the jobs used
22 // int_2 holds the tech points made
23 // int_3 holds the tail off count
24 */
25 if (MP_INFO(x,y).int_1 < BUILD_MONUMENT_JOBS)
26 if (get_jobs (x, y, MONUMENT_GET_JOBS) != 0)
27 MP_INFO(x,y).int_1 += MONUMENT_GET_JOBS;
28
29 /* now choose a graphic */
30 if (MP_INFO(x,y).int_1 >= BUILD_MONUMENT_JOBS)
31 {
32 MP_TYPE(x,y) = CST_MONUMENT_5;
33 /* inc tech level only if fully built and tech less
34 than MONUMENT_TECH_EXPIRE */
35 if (tech_level < (MONUMENT_TECH_EXPIRE * 1000)
36 && (total_time % MONUMENT_DAYS_PER_TECH) == 1)
37 {
38 if (MP_INFO(x,y).int_3++ > (tech_level / 10000) - 2)
39 {
40 tech_level++;
41 MP_INFO(x,y).int_2++;
42 MP_INFO(x,y).int_3 = 0;
43 }
44 }
45 }
46 else if (MP_INFO(x,y).int_1 >= ((BUILD_MONUMENT_JOBS * 4) / 5))
47 MP_TYPE(x,y) = CST_MONUMENT_4;
48 else if (MP_INFO(x,y).int_1 >= ((BUILD_MONUMENT_JOBS * 3) / 5))
49 MP_TYPE(x,y) = CST_MONUMENT_3;
50 else if (MP_INFO(x,y).int_1 >= ((BUILD_MONUMENT_JOBS * 2) / 5))
51 MP_TYPE(x,y) = CST_MONUMENT_2;
52 else if (MP_INFO(x,y).int_1 >= (BUILD_MONUMENT_JOBS / 20))
53 MP_TYPE(x,y) = CST_MONUMENT_1;
54 else
55 MP_TYPE(x,y) = CST_MONUMENT_0;
56 }
57
58 void
mps_monument(int x,int y)59 mps_monument (int x, int y)
60 {
61 int i = 0;
62
63 mps_store_title(i++,_("Monument"));
64 i++;
65 i++;
66
67 /* Display tech contribution only after monument is complete */
68 if ((MP_INFO(x,y).int_1 * 100 / BUILD_MONUMENT_JOBS) >= 100) {
69 mps_store_title(i++,_("Wisdom Bestowed"));
70 i++;
71 mps_store_f(i++, MP_INFO(x,y).int_2 * 100.0 / MAX_TECH_LEVEL);
72 } else {
73 mps_store_title(i++,_("% Complete"));
74 i++;
75 mps_store_fp(i++, MP_INFO(x,y).int_1 * 100.0 /
76 BUILD_MONUMENT_JOBS);
77 }
78 }
79