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