312 |
312 |
313 } else { |
313 } else { |
314 // TTDPatch runs on little-endian arch; |
314 // TTDPatch runs on little-endian arch; |
315 // Variable is 0x80 + offset in TTD's vehicle structure |
315 // Variable is 0x80 + offset in TTD's vehicle structure |
316 switch (dsg->variable - 0x80) { |
316 switch (dsg->variable - 0x80) { |
317 #define veh_prop(id_, value_) case id_: value = value_; break |
317 #define veh_prop(id_, value_) case (id_): value = (value_); break |
318 veh_prop(0x00, veh->type); |
318 veh_prop(0x00, veh->type); |
319 veh_prop(0x01, veh->subtype); |
319 veh_prop(0x01, veh->subtype); |
320 veh_prop(0x04, veh->index); |
320 veh_prop(0x04, veh->index); |
321 veh_prop(0x05, veh->index & 0xFF); |
321 veh_prop(0x05, veh->index & 0xFF); |
322 /* XXX? Is THIS right? */ |
322 /* XXX? Is THIS right? */ |
323 veh_prop(0x0A, veh->next_order_param << 8 | veh->next_order); |
323 veh_prop(0x0A, PackOrder(&veh->current_order)); |
324 veh_prop(0x0B, veh->next_order); |
324 veh_prop(0x0B, PackOrder(&veh->current_order) & 0xff); |
325 veh_prop(0x0C, veh->num_orders); |
325 veh_prop(0x0C, veh->num_orders); |
326 veh_prop(0x0D, veh->cur_order_index); |
326 veh_prop(0x0D, veh->cur_order_index); |
327 veh_prop(0x10, veh->load_unload_time_rem); |
327 veh_prop(0x10, veh->load_unload_time_rem); |
328 veh_prop(0x11, veh->load_unload_time_rem & 0xFF); |
328 veh_prop(0x11, veh->load_unload_time_rem & 0xFF); |
329 veh_prop(0x12, veh->date_of_last_service); |
329 veh_prop(0x12, veh->date_of_last_service); |