equal
deleted
inserted
replaced
779 |
779 |
780 case 0x0B: /* Cost factor */ |
780 case 0x0B: /* Cost factor */ |
781 FOR_EACH_OBJECT avi[i].base_cost = grf_load_byte(&buf); // ?? is it base_cost? |
781 FOR_EACH_OBJECT avi[i].base_cost = grf_load_byte(&buf); // ?? is it base_cost? |
782 break; |
782 break; |
783 |
783 |
784 case 0x0C: /* Speed (1 unit is 8 mph) */ |
784 case 0x0C: /* Speed (1 unit is 8 mph, we translate to 1 unit is 1 km/h) */ |
785 FOR_EACH_OBJECT avi[i].max_speed = grf_load_byte(&buf); |
785 FOR_EACH_OBJECT avi[i].max_speed = (grf_load_byte(&buf) * 129) / 10; |
786 break; |
786 break; |
787 |
787 |
788 case 0x0D: /* Acceleration */ |
788 case 0x0D: /* Acceleration */ |
789 FOR_EACH_OBJECT avi[i].acceleration = grf_load_byte(&buf); |
789 FOR_EACH_OBJECT avi[i].acceleration = (grf_load_byte(&buf) * 129) / 10; |
790 break; |
790 break; |
791 |
791 |
792 case 0x0E: /* Running cost factor */ |
792 case 0x0E: /* Running cost factor */ |
793 FOR_EACH_OBJECT avi[i].running_cost = grf_load_byte(&buf); |
793 FOR_EACH_OBJECT avi[i].running_cost = grf_load_byte(&buf); |
794 break; |
794 break; |
2626 { |
2626 { |
2627 uint8 version; |
2627 uint8 version; |
2628 uint32 grfid; |
2628 uint32 grfid; |
2629 const char *name; |
2629 const char *name; |
2630 const char *info; |
2630 const char *info; |
2631 int name_len; |
|
2632 int info_len; |
|
2633 |
2631 |
2634 if (!check_length(len, 8, "Info")) return; buf++; |
2632 if (!check_length(len, 8, "Info")) return; buf++; |
2635 version = grf_load_byte(&buf); |
2633 version = grf_load_byte(&buf); |
2636 grfid = grf_load_dword(&buf); |
2634 grfid = grf_load_dword(&buf); |
2637 |
2635 |
2639 |
2637 |
2640 /* GRF IDs starting with 0xFF are reserved for internal TTDPatch use */ |
2638 /* GRF IDs starting with 0xFF are reserved for internal TTDPatch use */ |
2641 if (GB(grfid, 24, 8) == 0xFF) SETBIT(_cur_grfconfig->flags, GCF_SYSTEM); |
2639 if (GB(grfid, 24, 8) == 0xFF) SETBIT(_cur_grfconfig->flags, GCF_SYSTEM); |
2642 |
2640 |
2643 len -= 6; |
2641 len -= 6; |
2644 name = (const char*)buf; |
2642 name = grf_load_string(&buf, len); |
2645 name_len = ttd_strnlen(name, len); |
2643 _cur_grfconfig->name = TranslateTTDPatchCodes(name); |
2646 |
2644 |
2647 if (name_len < len) { |
2645 len -= strlen(name) + 1; |
2648 _cur_grfconfig->name = TranslateTTDPatchCodes(name); |
2646 if (len > 0) { |
2649 |
2647 info = grf_load_string(&buf, len); |
2650 len -= name_len + 1; |
2648 _cur_grfconfig->info = TranslateTTDPatchCodes(info); |
2651 info = name + name_len + 1; |
|
2652 info_len = ttd_strnlen(info, len); |
|
2653 |
|
2654 if (info_len < len) _cur_grfconfig->info = TranslateTTDPatchCodes(info); |
|
2655 } |
2649 } |
2656 |
2650 |
2657 /* GLS_INFOSCAN only looks for the action 8, so we can skip the rest of the file */ |
2651 /* GLS_INFOSCAN only looks for the action 8, so we can skip the rest of the file */ |
2658 _skip_sprites = -1; |
2652 _skip_sprites = -1; |
2659 } |
2653 } |