12 #include "../stdafx.h"
13 #include "../company_func.h"
14 #include "../company_manager_face.h"
16 #include "../tunnelbridge_map.h"
17 #include "../tunnelbridge.h"
18 #include "../station_base.h"
19 #include "../strings_func.h"
23 #include "table/strings.h"
25 #include "../safeguards.h"
63 uint lips =
GB(face, 10, 4);
69 lips = lips * 15 / 16;
77 uint nose =
GB(face, 13, 3);
79 nose = (nose * 3 >> 3) * 3 >> 2;
86 uint tie_earring =
GB(face, 24, 4);
104 FOR_ALL_STATIONS(st) {
149 case STATION_WAYPOINT:
154 case STATION_TRUCK: {
200 if (tile < other_end) {
242 static const SaveLoad _company_desc[] = {
300 static const SaveLoad _company_settings_desc[] = {
321 static const SaveLoad _company_settings_skip_desc[] = {
343 static const SaveLoad _company_economy_desc[] = {
364 static const SaveLoad _company_ai_desc[] = {
395 static const SaveLoad _company_ai_build_rec_desc[] = {
404 static const SaveLoad _company_livery_desc[] = {
417 SlObject(c, _company_settings_desc);
420 SlObject(¬hing, _company_settings_skip_desc);
428 SlObject(&old_ai, _company_ai_desc);
429 for (i = 0; i != old_ai.num_build_rec; i++) {
430 SlObject(¬hing, _company_ai_build_rec_desc);
446 for (i = 0; i < num_liveries; i++) {
447 SlObject(&c->livery[i], _company_livery_desc);
450 if (num_liveries < LS_END) {
452 memmove(&c->livery[LS_FREIGHT_WAGON], &c->livery[LS_PASSENGER_WAGON_MONORAIL], (LS_END - LS_FREIGHT_WAGON) *
sizeof(c->livery[0]));
453 c->livery[LS_PASSENGER_WAGON_MONORAIL] = c->livery[LS_MONORAIL];
454 c->livery[LS_PASSENGER_WAGON_MAGLEV] = c->livery[LS_MAGLEV];
457 if (num_liveries == LS_END - 4) {
459 c->livery[LS_PASSENGER_TRAM] = c->livery[LS_BUS];
460 c->livery[LS_FREIGHT_TRAM] = c->livery[LS_TRUCK];
465 for (i = 0; i < num_liveries; i++) {
466 SlObject(&dummy_livery, _company_livery_desc);
471 static void SaveLoad_PLYR(
Company *c)
473 SaveLoad_PLYR_common(c, c);
476 static void Save_PLYR()
479 FOR_ALL_COMPANIES(c) {
480 SlSetArrayIndex(c->
index);
485 static void Load_PLYR()
495 static void Check_PLYR()
500 memset(cprops, 0,
sizeof(*cprops));
501 SaveLoad_PLYR_common(NULL, cprops);
506 cprops->
name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
514 if (cprops->
name == NULL && !
IsInsideMM(cprops->
name_1, SPECSTR_COMPANY_NAME_START, SPECSTR_COMPANY_NAME_LAST + 1) &&
515 cprops->
name_1 != STR_GAME_SAVELOAD_NOT_AVAILABLE && cprops->
name_1 != STR_SV_UNNAMED &&
516 cprops->
name_1 != SPECSTR_ANDCO_NAME && cprops->
name_1 != SPECSTR_PRESIDENT_NAME &&
517 cprops->
name_1 != SPECSTR_SILLY_NAME) {
518 cprops->
name_1 = STR_GAME_SAVELOAD_NOT_AVAILABLE;
525 static void Ptrs_PLYR()
528 FOR_ALL_COMPANIES(c) {
529 SlObject(c, _company_settings_desc);
535 {
'PLYR', Save_PLYR, Load_PLYR, Ptrs_PLYR, Check_PLYR, CH_ARRAY |
CH_LAST},