59 SetVScrollCount(w, num+1); |
62 SetVScrollCount(w, num+1); |
60 |
63 |
61 sel = OrderGetSel(w); |
64 sel = OrderGetSel(w); |
62 |
65 |
63 SetDParam(2,STR_8827_FULL_LOAD); |
66 SetDParam(2,STR_8827_FULL_LOAD); |
64 switch(v->schedule_ptr[sel] & 0x1F) { |
67 switch (v->schedule_ptr[sel].type) { |
65 case OT_GOTO_STATION: |
68 case OT_GOTO_STATION: |
66 break; |
69 break; |
67 case OT_GOTO_DEPOT: |
70 case OT_GOTO_DEPOT: |
68 SETBIT(w->disabled_state, 9); /* unload */ |
71 SETBIT(w->disabled_state, 9); /* unload */ |
69 SetDParam(2,STR_SERVICE); |
72 SetDParam(2,STR_SERVICE); |
86 |
89 |
87 ord = v->schedule_ptr[i]; |
90 ord = v->schedule_ptr[i]; |
88 |
91 |
89 if ( (uint)(i - w->vscroll.pos) < 6) { |
92 if ( (uint)(i - w->vscroll.pos) < 6) { |
90 |
93 |
91 if (ord == 0) { |
94 if (ord.type == OT_NOTHING) { |
92 str = shared_schedule ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS; |
95 str = shared_schedule ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS; |
93 } else { |
96 } else { |
94 SetDParam(1, 6); |
97 SetDParam(1, 6); |
95 |
98 |
96 if ( (ord & OT_MASK) == OT_GOTO_STATION) { |
99 if (ord.type == OT_GOTO_STATION) { |
97 SetDParam(1, STR_8806_GO_TO + ((ord >> 5) & 7)); |
100 SetDParam(1, STR_8806_GO_TO + (ord.flags >> 1)); |
98 SetDParam(2, ord >> 8); |
101 SetDParam(2, ord.station); |
99 } else if ((ord & OT_MASK) == OT_GOTO_DEPOT) { |
102 } else if (ord.type == OT_GOTO_DEPOT) { |
100 StringID s = STR_NULL; |
103 StringID s = STR_NULL; |
101 if (v->type == VEH_Aircraft) { |
104 if (v->type == VEH_Aircraft) { |
102 s = STR_GO_TO_AIRPORT_HANGAR; |
105 s = STR_GO_TO_AIRPORT_HANGAR; |
103 SetDParam(2, ord>>8); |
106 SetDParam(2, ord.station); |
104 } else { |
107 } else { |
105 SetDParam(2, _depots[ord >> 8].town_index); |
108 SetDParam(2, _depots[ord.station].town_index); |
106 switch (v->type) { |
109 switch (v->type) { |
107 case VEH_Train: s = STR_880E_GO_TO_TRAIN_DEPOT; break; |
110 case VEH_Train: s = STR_880E_GO_TO_TRAIN_DEPOT; break; |
108 case VEH_Road: s = STR_9038_GO_TO_ROADVEH_DEPOT; break; |
111 case VEH_Road: s = STR_9038_GO_TO_ROADVEH_DEPOT; break; |
109 case VEH_Ship: s = STR_GO_TO_SHIP_DEPOT; break; |
112 case VEH_Ship: s = STR_GO_TO_SHIP_DEPOT; break; |
110 } |
113 } |
111 } |
114 } |
112 if (v->type == VEH_Train) |
115 if (v->type == VEH_Train && ord.flags & OF_NON_STOP) s += 2; |
113 s += (ord>>6)&2; |
116 if (ord.flags & OF_FULL_LOAD) ++s; /* XXX service */ |
114 SetDParam(1, s + ((ord>>6)&1) ); |
117 SetDParam(1, s); |
115 } else if ((ord & OT_MASK) == OT_GOTO_WAYPOINT) { |
118 } else if (ord.type == OT_GOTO_WAYPOINT) { |
116 SetDParam(2, ord >> 8); |
119 SetDParam(2, ord.station); |
117 SetDParam(1, STR_GO_TO_WAYPOINT); |
120 SetDParam(1, STR_GO_TO_WAYPOINT); |
118 } |
121 } |
119 } |
122 } |
120 { |
123 { |
121 byte color = (i == WP(w,order_d).sel) ? 0xC : 0x10; |
124 byte color = (i == WP(w,order_d).sel) ? 0xC : 0x10; |
122 SetDParam(0, i+1); |
125 SetDParam(0, i+1); |
123 if ((ord & OT_MASK) != OT_DUMMY) { |
126 if (ord.type != OT_DUMMY) { |
124 DrawString(2, y, str, color); |
127 DrawString(2, y, str, color); |
125 } else { |
128 } else { |
126 SetDParam(1, STR_INVALID_ORDER); |
129 SetDParam(1, STR_INVALID_ORDER); |
127 SetDParam(2, ord >> 8); |
130 SetDParam(2, ord.station); |
128 DrawString(2, y, str, color); |
131 DrawString(2, y, str, color); |
129 } |
132 } |
130 } |
133 } |
131 y += 10; |
134 y += 10; |
132 } |
135 } |
133 |
136 |
134 i++; |
137 i++; |
135 |
138 |
136 if (ord == 0) |
139 if (ord.type == OT_NOTHING) |
137 break; |
140 break; |
138 } |
141 } |
139 } |
142 } |
140 |
143 |
141 |
144 |
286 return; |
289 return; |
287 |
290 |
288 sel += w->vscroll.pos; |
291 sel += w->vscroll.pos; |
289 |
292 |
290 if (_ctrl_pressed && sel < v->num_orders) { // watch out for schedule_ptr overflow |
293 if (_ctrl_pressed && sel < v->num_orders) { // watch out for schedule_ptr overflow |
291 int ord = v->schedule_ptr[sel]; |
294 Order ord = v->schedule_ptr[sel]; |
292 int xy = 0; |
295 int xy = 0; |
293 switch (ord & OT_MASK) { |
296 switch (ord.type) { |
294 case OT_GOTO_STATION: /* station order */ |
297 case OT_GOTO_STATION: /* station order */ |
295 xy = _stations[ord >> 8].xy ; |
298 xy = _stations[ord.station].xy ; |
296 break; |
299 break; |
297 case OT_GOTO_DEPOT: /* goto depot order */ |
300 case OT_GOTO_DEPOT: /* goto depot order */ |
298 xy = _depots[ord >> 8].xy; |
301 xy = _depots[ord.station].xy; |
299 break; |
302 break; |
300 case OT_GOTO_WAYPOINT: /* goto waypoint order */ |
303 case OT_GOTO_WAYPOINT: /* goto waypoint order */ |
301 xy = _waypoints[ord >> 8].xy; |
304 xy = _waypoints[ord.station].xy; |
302 } |
305 } |
303 |
306 |
304 if (xy) |
307 if (xy) |
305 ScrollMainWindowToTile(xy); |
308 ScrollMainWindowToTile(xy); |
306 |
309 |