1 /* ---------------------------------------------------------------------- *
2  * road.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 <lin-city.h>
9 #include <lctypes.h>
10 #include <engglobs.h>
11 #include <cliglobs.h>
12 #include <stats.h>
13 #include <transport.h>
14 #include <lcintl.h>
15 #include <mps.h>
16 #include <road.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 
31 
32 void
do_road(int x,int y)33 do_road (int x, int y)
34 {
35     static int wb_count = 0;
36     int *pol = &MP_POL(x,y);
37     Map_Point_Info *minfo = &MP_INFO(x,y);
38     ++transport_cost;
39     if (total_time % DAYS_PER_ROAD_POLLUTION == 0)
40 	*pol += ROAD_POLLUTION;
41     if ((total_time & ROAD_GOODS_USED_MASK) == 0 && minfo->int_4 > 0) {
42 	--minfo->int_4;
43 	++minfo->int_7;
44     }
45     general_transport (minfo, pol, MAX_WASTE_ON_ROAD, &wb_count);
46 }
47 
48 void
mps_road(int x,int y)49 mps_road (int x, int y)
50 {
51   int i = 0;
52 
53   mps_store_title(i++,_("Road"));
54   i++;
55 
56   mps_store_sfp(i++,_("Food"),
57 		MP_INFO(x,y).int_1 * 100.0 / MAX_FOOD_ON_ROAD);
58   mps_store_sfp(i++,_("Jobs"),
59 		MP_INFO(x,y).int_2 * 100.0 / MAX_JOBS_ON_ROAD);
60   mps_store_sfp(i++,_("Coal"),
61 		MP_INFO(x,y).int_3 * 100.0 / MAX_COAL_ON_ROAD);
62   mps_store_sfp(i++,_("Goods"),
63 		MP_INFO(x,y).int_4 * 100.0 / MAX_GOODS_ON_ROAD);
64   mps_store_sfp(i++,_("Ore"),
65 		MP_INFO(x,y).int_5 * 100.0 / MAX_ORE_ON_ROAD);
66   mps_store_sfp(i++,_("Steel"),
67 		MP_INFO(x,y).int_6 * 100.0 / MAX_STEEL_ON_ROAD);
68   mps_store_sfp(i++,_("Waste"),
69 		MP_INFO(x,y).int_7 * 100.0 / MAX_WASTE_ON_ROAD);
70 
71 }
72