1 /* ---------------------------------------------------------------------- *
2 * rail.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 #include <config.h>
8 #include <lcintl.h>
9 #include <lin-city.h>
10 #include <lctypes.h>
11 #include <engglobs.h>
12 #include <cliglobs.h>
13 #include <stats.h>
14 #include <mps.h>
15 #include <transport.h>
16 #include <rail.h>
17
18 /* ---------------------------------------------------------------------
19 For track, road and rail:
20
21 int_1 contains the amount of food
22 int_2 contains the amount of jobs
23 int_3 contains the amount of coal
24 int_4 contains the amount of goods
25 int_5 contains the amount of ore
26 int_6 contains the amount of steel
27 int_7 contains the amount of waste
28 --------------------------------------------------------------------- */
29
30 void
do_rail(int x,int y)31 do_rail (int x, int y)
32 {
33 static int wb_count = 0;
34 int *pol = &MP_POL(x,y);
35 Map_Point_Info *minfo = &MP_INFO(x,y);
36 transport_cost += 3;
37 if (total_time % DAYS_PER_RAIL_POLLUTION == 0)
38 *pol += RAIL_POLLUTION;
39 if ((total_time & RAIL_GOODS_USED_MASK) == 0 && minfo->int_4 > 0) {
40 --minfo->int_4;
41 ++minfo->int_7;
42 }
43 if ((total_time & RAIL_STEEL_USED_MASK) == 0 && minfo->int_6 > 0) {
44 --minfo->int_6;
45 ++minfo->int_7;
46 }
47 general_transport (minfo, pol, MAX_WASTE_ON_RAIL, &wb_count);
48 }
49
50
51 void
mps_rail(int x,int y)52 mps_rail (int x, int y)
53 {
54 int i = 0;
55
56 mps_store_title(i++,_("Rail"));
57 i++;
58
59 mps_store_sfp(i++,_("Food"),
60 MP_INFO(x,y).int_1 * 100.0 / MAX_FOOD_ON_RAIL);
61 mps_store_sfp(i++,_("Jobs"),
62 MP_INFO(x,y).int_2 * 100.0 / MAX_JOBS_ON_RAIL);
63 mps_store_sfp(i++,_("Coal"),
64 MP_INFO(x,y).int_3 * 100.0 / MAX_COAL_ON_RAIL);
65 mps_store_sfp(i++,_("Goods"),
66 MP_INFO(x,y).int_4 * 100.0 / MAX_GOODS_ON_RAIL);
67 mps_store_sfp(i++,_("Ore"),
68 MP_INFO(x,y).int_5 * 100.0 / MAX_ORE_ON_RAIL);
69 mps_store_sfp(i++,_("Steel"),
70 MP_INFO(x,y).int_6 * 100.0 / MAX_STEEL_ON_RAIL);
71 mps_store_sfp(i++,_("Waste"),
72 MP_INFO(x,y).int_7 * 100.0 / MAX_WASTE_ON_RAIL);
73
74 }
75