1 /* ---------------------------------------------------------------------- *
2 * school.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 <lin-city.h>
9 #include <lctypes.h>
10 #include <lcintl.h>
11 #include <lcconfig.h>
12 #include <engglobs.h>
13 #include <cliglobs.h>
14 #include <stats.h>
15 #include <mps.h>
16 #include <school.h>
17
18
19 void
do_school(int x,int y)20 do_school (int x, int y)
21 {
22 /*
23 // int_1 contains the job pool
24 // int_2 contains the goods at the school
25 // int_3 has the tech points made
26 // int_4 is the tech count so far this 100 days
27 // int_5 is the tech count last 100 days to give a % of max production
28 */
29 if (MP_INFO(x,y).int_1 < (MAX_JOBS_AT_SCHOOL - SCHOOL_JOBS))
30 if (get_jobs (x, y, SCHOOL_JOBS) != 0)
31 MP_INFO(x,y).int_1 += SCHOOL_JOBS;
32 if (MP_INFO(x,y).int_2 < (MAX_GOODS_AT_SCHOOL - SCHOOL_GOODS))
33 if (get_goods (x, y, SCHOOL_GOODS) != 0)
34 MP_INFO(x,y).int_2 += SCHOOL_GOODS;
35 if (MP_INFO(x,y).int_1 >= JOBS_MAKE_TECH_SCHOOL
36 && MP_INFO(x,y).int_2 >= GOODS_MAKE_TECH_SCHOOL)
37 {
38 MP_INFO(x,y).int_1 -= JOBS_MAKE_TECH_SCHOOL;
39 MP_INFO(x,y).int_2 -= GOODS_MAKE_TECH_SCHOOL;
40 MP_INFO(x,y).int_3 += TECH_MADE_BY_SCHOOL;
41 MP_INFO(x,y).int_4++;
42 tech_level += TECH_MADE_BY_SCHOOL;
43 }
44 school_cost += SCHOOL_RUNNING_COST;
45 if ((total_time % 100) == 0)
46 {
47 MP_INFO(x,y).int_5 = MP_INFO(x,y).int_4;
48 MP_INFO(x,y).int_4 = 0;
49 }
50 }
51
52 void
mps_school(int x,int y)53 mps_school (int x, int y)
54 {
55 int i = 0;
56 mps_store_title(i++,_("School"));
57 i++;
58 mps_store_title(i++,_("Lessons Learned"));
59 mps_store_f(i++,MP_INFO(x,y).int_3 * 100.0 / MAX_TECH_LEVEL);
60 i++;
61 mps_store_title(i++,_("Inventory"));
62 mps_store_sfp(i++,_("Jobs"),
63 MP_INFO(x,y).int_1 * 100.0 / MAX_JOBS_AT_SCHOOL);
64 mps_store_sfp(i++,_("Goods"),
65 MP_INFO(x,y).int_2 * 100.0 / MAX_GOODS_AT_SCHOOL);
66
67 mps_store_sfp(i++,_("Capacity"), MP_INFO(x,y).int_5 * 4);
68
69 }
70