equal
deleted
inserted
replaced
31 #include "water_map.h" |
31 #include "water_map.h" |
32 #include "network.h" |
32 #include "network.h" |
33 #include "yapf/yapf.h" |
33 #include "yapf/yapf.h" |
34 #include "date.h" |
34 #include "date.h" |
35 #include "newgrf_engine.h" |
35 #include "newgrf_engine.h" |
|
36 #include "newgrf_sound.h" |
36 |
37 |
37 #define INVALID_COORD (-0x8000) |
38 #define INVALID_COORD (-0x8000) |
38 #define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6)) |
39 #define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6)) |
39 |
40 |
40 /* |
41 /* |
644 |
645 |
645 _first_veh_in_depot_list = NULL; // now we are sure it's initialized at the start of each tick |
646 _first_veh_in_depot_list = NULL; // now we are sure it's initialized at the start of each tick |
646 |
647 |
647 FOR_ALL_VEHICLES(v) { |
648 FOR_ALL_VEHICLES(v) { |
648 _vehicle_tick_procs[v->type - 0x10](v); |
649 _vehicle_tick_procs[v->type - 0x10](v); |
|
650 |
|
651 switch (v->type) { |
|
652 case VEH_Train: |
|
653 case VEH_Road: |
|
654 case VEH_Aircraft: |
|
655 case VEH_Ship: |
|
656 if (v->type == VEH_Train && IsTrainWagon(v)) continue; |
|
657 if (v->type == VEH_Aircraft && v->subtype > 0) continue; |
|
658 |
|
659 v->motion_counter += (v->direction & 1) ? (v->cur_speed * 3) / 4 : v->cur_speed; |
|
660 /* Play a running sound if the motion counter passes 256 (Do we not skip sounds?) */ |
|
661 if (GB(v->motion_counter, 0, 8) < v->cur_speed) PlayVehicleSound(v, VSE_RUNNING); |
|
662 |
|
663 /* Play an alterate running sound every 16 ticks */ |
|
664 if (GB(v->tick_counter, 0, 4) == 0) PlayVehicleSound(v, v->cur_speed > 0 ? VSE_RUNNING_16 : VSE_STOPPED_16); |
|
665 } |
649 } |
666 } |
650 |
667 |
651 // now we handle all the vehicles that entered a depot this tick |
668 // now we handle all the vehicles that entered a depot this tick |
652 v = _first_veh_in_depot_list; |
669 v = _first_veh_in_depot_list; |
653 while (v != NULL) { |
670 while (v != NULL) { |