oldloader.c
changeset 193 0a7025304867
parent 123 d550772c61e6
child 206 7f8c26d8526b
equal deleted inserted replaced
192:614bba52258d 193:0a7025304867
   312 	byte x_offs, y_offs;
   312 	byte x_offs, y_offs;
   313 	byte sprite_width, sprite_height, z_height;
   313 	byte sprite_width, sprite_height, z_height;
   314 	byte owner;
   314 	byte owner;
   315 	uint16 tile;
   315 	uint16 tile;
   316 	uint16 cur_image;
   316 	uint16 cur_image;
   317 	
   317 
   318 	int16 left_coord, right_coord, top_coord, bottom_coord; // NOLOAD, calculated automatically.
   318 	int16 left_coord, right_coord, top_coord, bottom_coord; // NOLOAD, calculated automatically.
   319 	uint16 vehstatus;
   319 	uint16 vehstatus;
   320 	uint16 cur_speed;
   320 	uint16 cur_speed;
   321 	byte subspeed;
   321 	byte subspeed;
   322 	byte acceleration;
   322 	byte acceleration;
   418 	uint16 timer_counter;
   418 	uint16 timer_counter;
   419 	uint16 land_code; // NOLOAD: never needed in game
   419 	uint16 land_code; // NOLOAD: never needed in game
   420 	uint16 age_cargo_skip_counter;
   420 	uint16 age_cargo_skip_counter;
   421 	uint16 tick_counter;
   421 	uint16 tick_counter;
   422 	uint16 cur_tileloop_tile;
   422 	uint16 cur_tileloop_tile;
   423 	
   423 
   424 	OldPrice prices[49];
   424 	OldPrice prices[49];
   425 	OldPaymentRate cargo_payment_rates[12];
   425 	OldPaymentRate cargo_payment_rates[12];
   426 	
   426 
   427 	byte map_owner[256*256];
   427 	byte map_owner[256*256];
   428 	byte map2[256*256];
   428 	byte map2[256*256];
   429 	uint16 map3[256*256];
   429 	uint16 map3[256*256];
   430 	byte map_extra[256*256/4];
   430 	byte map_extra[256*256/4];
   431 	
   431 
   432 	OldStation stations[250];
   432 	OldStation stations[250];
   433 	OldIndustry industries[90];
   433 	OldIndustry industries[90];
   434 	OldPlayer players[8];
   434 	OldPlayer players[8];
   435 	OldVehicle vehicles[850];
   435 	OldVehicle vehicles[850];
   436 	OldName names[500];
   436 	OldName names[500];
   437 		
   437 
   438 	uint16 vehicle_position_hash[0x1000]; // NOLOAD, calculated automatically.
   438 	uint16 vehicle_position_hash[0x1000]; // NOLOAD, calculated automatically.
   439 
   439 
   440 	OldSign signs[40];
   440 	OldSign signs[40];
   441 	OldEngine engines[256];
   441 	OldEngine engines[256];
   442 
   442 
   453 	//NOLOAD. These are calculated from InitializeLandscapeVariables
   453 	//NOLOAD. These are calculated from InitializeLandscapeVariables
   454 	uint16 cargo_names_s[12], cargo_names_p[12], cargo_names_long_s[12], cargo_names_long_p[12], cargo_names_short[12];
   454 	uint16 cargo_names_s[12], cargo_names_p[12], cargo_names_long_s[12], cargo_names_long_p[12], cargo_names_short[12];
   455 	uint16 cargo_sprites[12];
   455 	uint16 cargo_sprites[12];
   456 
   456 
   457 	uint16 engine_name_strings[256];
   457 	uint16 engine_name_strings[256];
   458 	
   458 
   459 	//NOLOAD. These are calculated from InitializeLandscapeVariables
   459 	//NOLOAD. These are calculated from InitializeLandscapeVariables
   460 	uint16 railveh_by_cargo_1[12], railveh_by_cargo_2[12], railveh_by_cargo_3[12];
   460 	uint16 railveh_by_cargo_1[12], railveh_by_cargo_2[12], railveh_by_cargo_3[12];
   461 	uint16 roadveh_by_cargo_start[12];
   461 	uint16 roadveh_by_cargo_start[12];
   462 	byte roadveh_by_cargo_count[12];
   462 	byte roadveh_by_cargo_count[12];
   463 	uint16 ship_of_type_start[12];
   463 	uint16 ship_of_type_start[12];
   484 	byte trees_tick_ctr;
   484 	byte trees_tick_ctr;
   485 	byte vehicle_design_names;
   485 	byte vehicle_design_names;
   486 	byte snow_line_height;
   486 	byte snow_line_height;
   487 
   487 
   488 	byte new_industry_randtable[32]; // NOLOAD. Not needed due to different code design.
   488 	byte new_industry_randtable[32]; // NOLOAD. Not needed due to different code design.
   489 	
   489 
   490 	//NOLOAD. Initialized by InitializeLandscapeVariables
   490 	//NOLOAD. Initialized by InitializeLandscapeVariables
   491 	byte cargo_weights[12]; 
   491 	byte cargo_weights[12];
   492 	byte transit_days_table_1[12];
   492 	byte transit_days_table_1[12];
   493 	byte transit_days_table_2[12];
   493 	byte transit_days_table_2[12];
   494 
   494 
   495 	byte map_type_and_height[256*256];
   495 	byte map_type_and_height[256*256];
   496 	byte map5[256*256];
   496 	byte map5[256*256];
   555 		if (lss->count != 0) {
   555 		if (lss->count != 0) {
   556 			lss->count--;
   556 			lss->count--;
   557 			return GetSavegameByteFromBuffer();
   557 			return GetSavegameByteFromBuffer();
   558 		}
   558 		}
   559 	}
   559 	}
   560 	
   560 
   561 	x = GetSavegameByteFromBuffer();
   561 	x = GetSavegameByteFromBuffer();
   562 	if (x >= 0) {
   562 	if (x >= 0) {
   563 		lss->count = x;
   563 		lss->count = x;
   564 		lss->mode = 1;
   564 		lss->mode = 1;
   565 		return GetSavegameByteFromBuffer();
   565 		return GetSavegameByteFromBuffer();
   566 	} else {
   566 	} else {
   567 		lss->mode = -1;
   567 		lss->mode = -1;
   568 		lss->count = -x;
   568 		lss->count = -x;
   569 		lss->rep_char = GetSavegameByteFromBuffer();
   569 		lss->rep_char = GetSavegameByteFromBuffer();
   570 		return lss->rep_char;
   570 		return lss->rep_char;
   571 	}	
   571 	}
   572 }
   572 }
   573 
   573 
   574 static void LoadSavegameBytes(void *p, size_t count)
   574 static void LoadSavegameBytes(void *p, size_t count)
   575 {
   575 {
   576 	byte *ptr = (byte*)p;
   576 	byte *ptr = (byte*)p;
   640 		i->accepts_cargo[1] = o->accepts_cargo[1];
   640 		i->accepts_cargo[1] = o->accepts_cargo[1];
   641 		i->accepts_cargo[2] = o->accepts_cargo[2];
   641 		i->accepts_cargo[2] = o->accepts_cargo[2];
   642 		i->prod_level = o->prod_level;
   642 		i->prod_level = o->prod_level;
   643 		i->last_mo_production[0] = o->last_mo_production[0];
   643 		i->last_mo_production[0] = o->last_mo_production[0];
   644 		i->last_mo_production[1] = o->last_mo_production[1];
   644 		i->last_mo_production[1] = o->last_mo_production[1];
   645 		
   645 
   646 		i->last_mo_transported[0] = o->last_mo_transported[0];
   646 		i->last_mo_transported[0] = o->last_mo_transported[0];
   647 		i->last_mo_transported[1] = o->last_mo_transported[1];
   647 		i->last_mo_transported[1] = o->last_mo_transported[1];
   648 		i->last_mo_transported[2] = o->last_mo_transported[2];
   648 		i->last_mo_transported[2] = o->last_mo_transported[2];
   649 
   649 
   650 		i->pct_transported[0] = o->pct_transported[0];
   650 		i->pct_transported[0] = o->pct_transported[0];
   651 		i->pct_transported[1] = o->pct_transported[1];
   651 		i->pct_transported[1] = o->pct_transported[1];
   652 
   652 
   653 		i->total_production[0] = o->total_production[0];
   653 		i->total_production[0] = o->total_production[0];
   654 		i->total_production[1] = o->total_production[1];
   654 		i->total_production[1] = o->total_production[1];
   655 		
   655 
   656 		i->total_transported[0] = i->total_transported[0];
   656 		i->total_transported[0] = i->total_transported[0];
   657 		i->total_transported[1] = i->total_transported[1];
   657 		i->total_transported[1] = i->total_transported[1];
   658 
   658 
   659 		i->type = o->type;
   659 		i->type = o->type;
   660 		i->owner = o->owner;
   660 		i->owner = o->owner;
   686 		s->bus_tile = o->bus_tile;
   686 		s->bus_tile = o->bus_tile;
   687 		s->lorry_tile = o->lorry_tile;
   687 		s->lorry_tile = o->lorry_tile;
   688 		s->train_tile = o->train_tile;
   688 		s->train_tile = o->train_tile;
   689 		s->airport_tile = o->airport_tile;
   689 		s->airport_tile = o->airport_tile;
   690 		s->dock_tile = o->dock_tile;
   690 		s->dock_tile = o->dock_tile;
   691 		
   691 
   692 		if (o->train_tile) {
   692 		if (o->train_tile) {
   693 			int w = (o->platforms >> 3) & 0x7;
   693 			int w = (o->platforms >> 3) & 0x7;
   694 			int h = (o->platforms & 0x7);
   694 			int h = (o->platforms & 0x7);
   695 			if (_map5[o->train_tile]&1) intswap(w,h);
   695 			if (_map5[o->train_tile]&1) intswap(w,h);
   696 			s->trainst_w = w;
   696 			s->trainst_w = w;
   697 			s->trainst_h = h;
   697 			s->trainst_h = h;
   698 		}
   698 		}
   699 		
   699 
   700 		s->string_id = RemapOldStringID(o->string_id);
   700 		s->string_id = RemapOldStringID(o->string_id);
   701 		s->had_vehicle_of_type = o->had_vehicle_of_type;
   701 		s->had_vehicle_of_type = o->had_vehicle_of_type;
   702 		FixGoodsEntry(s->goods, o->goods, lengthof(o->goods));
   702 		FixGoodsEntry(s->goods, o->goods, lengthof(o->goods));
   703 		s->time_since_load = o->time_since_load;
   703 		s->time_since_load = o->time_since_load;
   704 		s->time_since_unload = o->time_since_unload;
   704 		s->time_since_unload = o->time_since_unload;
   725 static void FixVehicle(Vehicle *n, OldVehicle *o, int num)
   725 static void FixVehicle(Vehicle *n, OldVehicle *o, int num)
   726 {
   726 {
   727 	do {
   727 	do {
   728 		n->type = o->type;
   728 		n->type = o->type;
   729 		n->subtype = o->subtype;
   729 		n->subtype = o->subtype;
   730 		
   730 
   731 		if (o->schedule_ptr == 0xFFFFFFFF || o->schedule_ptr == 0) {
   731 		if (o->schedule_ptr == 0xFFFFFFFF || o->schedule_ptr == 0) {
   732 			n->schedule_ptr = NULL;
   732 			n->schedule_ptr = NULL;
   733 		} else {
   733 		} else {
   734 			n->schedule_ptr = _order_array + REMAP_ORDER_IDX(o->schedule_ptr);
   734 			n->schedule_ptr = _order_array + REMAP_ORDER_IDX(o->schedule_ptr);
   735 			assert(n->schedule_ptr >= _order_array && n->schedule_ptr < _ptr_to_next_order);
   735 			assert(n->schedule_ptr >= _order_array && n->schedule_ptr < _ptr_to_next_order);
   756 		n->sprite_height = o->sprite_height;
   756 		n->sprite_height = o->sprite_height;
   757 		n->z_height = o->z_height;
   757 		n->z_height = o->z_height;
   758 		n->owner = o->owner;
   758 		n->owner = o->owner;
   759 		n->tile = o->tile;
   759 		n->tile = o->tile;
   760 		n->cur_image = o->cur_image;
   760 		n->cur_image = o->cur_image;
   761 	
   761 
   762 		n->vehstatus = o->vehstatus;
   762 		n->vehstatus = o->vehstatus;
   763 		n->cur_speed = o->cur_speed;
   763 		n->cur_speed = o->cur_speed;
   764 		n->subspeed = o->subspeed;
   764 		n->subspeed = o->subspeed;
   765 		n->acceleration = o->acceleration;
   765 		n->acceleration = o->acceleration;
   766 		n->progress = o->progress;
   766 		n->progress = o->progress;
   785 		n->profit_this_year = o->profit_this_year;
   785 		n->profit_this_year = o->profit_this_year;
   786 		n->profit_last_year = o->profit_last_year;
   786 		n->profit_last_year = o->profit_last_year;
   787 		n->next = o->next_in_chain == 0xffff ? NULL : &_vehicles[o->next_in_chain];
   787 		n->next = o->next_in_chain == 0xffff ? NULL : &_vehicles[o->next_in_chain];
   788 		n->value = o->value;
   788 		n->value = o->value;
   789 		n->string_id = RemapOldStringID(o->string_id);
   789 		n->string_id = RemapOldStringID(o->string_id);
   790 		
   790 
   791 		switch(o->type) {
   791 		switch(o->type) {
   792 		case VEH_Train:
   792 		case VEH_Train:
   793 			n->u.rail.track = o->u.rail.track;
   793 			n->u.rail.track = o->u.rail.track;
   794 			n->u.rail.force_proceed = o->u.rail.force_proceed;
   794 			n->u.rail.force_proceed = o->u.rail.force_proceed;
   795 			n->u.rail.crash_anim_pos = o->u.rail.crash_anim_pos;
   795 			n->u.rail.crash_anim_pos = o->u.rail.crash_anim_pos;
   862 
   862 
   863 static void FixPlayer(Player *n, OldPlayer *o, int num, byte town_name_type)
   863 static void FixPlayer(Player *n, OldPlayer *o, int num, byte town_name_type)
   864 {
   864 {
   865 	int i, j;
   865 	int i, j;
   866 	int x = 0;
   866 	int x = 0;
   867 	
   867 
   868 	do {
   868 	do {
   869 		n->name_1 = RemapOldStringID(o->name_1);
   869 		n->name_1 = RemapOldStringID(o->name_1);
   870 		n->name_2 = o->name_2;
   870 		n->name_2 = o->name_2;
   871 		/*	In every Old TTD(Patch) game Player1 (0) is human, and all others are AI
   871 		/*	In every Old TTD(Patch) game Player1 (0) is human, and all others are AI
   872 		 *	(Except in .SV2 savegames, which were 2 player games, but we are not fixing
   872 		 *	(Except in .SV2 savegames, which were 2 player games, but we are not fixing
   880 			n->is_ai = 1;
   880 			n->is_ai = 1;
   881 		}
   881 		}
   882 
   882 
   883 		if (o->name_1 != 0)
   883 		if (o->name_1 != 0)
   884 			n->is_active = true;
   884 			n->is_active = true;
   885 		
   885 
   886 		n->face = o->face;
   886 		n->face = o->face;
   887 		n->president_name_1 = o->pres_name_1;
   887 		n->president_name_1 = o->pres_name_1;
   888 		n->president_name_2 = o->pres_name_2;
   888 		n->president_name_2 = o->pres_name_2;
   889 		
   889 
   890 		n->money64 = n->player_money = o->money;
   890 		n->money64 = n->player_money = o->money;
   891 		n->current_loan = o->loan;
   891 		n->current_loan = o->loan;
   892 		
   892 
   893 		// Correct money for scenario loading. 
   893 		// Correct money for scenario loading.
   894 		// It's always 893288 pounds (and no loan), if not corrected
   894 		// It's always 893288 pounds (and no loan), if not corrected
   895 		if(o->money==0xda168)
   895 		if(o->money==0xda168)
   896 			n->money64 = n->player_money = n->current_loan =100000;
   896 			n->money64 = n->player_money = n->current_loan =100000;
   897 
   897 
   898 		n->player_color = o->color;
   898 		n->player_color = o->color;
   903 		n->quarters_of_bankrupcy = o->quarters_of_bankrupcy;
   903 		n->quarters_of_bankrupcy = o->quarters_of_bankrupcy;
   904 		n->bankrupt_asked = o->bankrupt_asked;
   904 		n->bankrupt_asked = o->bankrupt_asked;
   905 		n->bankrupt_value = o->bankrupt_value;
   905 		n->bankrupt_value = o->bankrupt_value;
   906 		n->bankrupt_timeout = o->bankrupt_timeout;
   906 		n->bankrupt_timeout = o->bankrupt_timeout;
   907 		n->cargo_types = o->cargo_types;
   907 		n->cargo_types = o->cargo_types;
   908 		
   908 
   909 		for(i=0; i!=3; i++)
   909 		for(i=0; i!=3; i++)
   910 			for(j=0; j!=13; j++)
   910 			for(j=0; j!=13; j++)
   911 				n->yearly_expenses[i][j] = o->expenses[i].cost[j];
   911 				n->yearly_expenses[i][j] = o->expenses[i].cost[j];
   912 
   912 
   913 		FixEconomy(&n->cur_economy, &o->economy[0]);
   913 		FixEconomy(&n->cur_economy, &o->economy[0]);
   914 		for(i=0; i!=24; i++) FixEconomy(&n->old_economy[i], &o->economy[i+1]);
   914 		for(i=0; i!=24; i++) FixEconomy(&n->old_economy[i], &o->economy[i+1]);
   915 		n->inaugurated_year = o->inaugurated_date - 1920;
   915 		n->inaugurated_year = o->inaugurated_date - 1920;
   916 		n->last_build_coordinate = o->last_build_coordinate;
   916 		n->last_build_coordinate = o->last_build_coordinate;
   917 		n->num_valid_stat_ent = o->num_valid_stat_ent;
   917 		n->num_valid_stat_ent = o->num_valid_stat_ent;
   918 
   918 
   919 		/*	Not good, since AI doesn't have a vehicle assigned as 
   919 		/*	Not good, since AI doesn't have a vehicle assigned as
   920 		 *	in p->ai.cur_veh and thus will crash on certain actions.
   920 		 *	in p->ai.cur_veh and thus will crash on certain actions.
   921 		 *	Best is to set state to AiStateVehLoop (2)
   921 		 *	Best is to set state to AiStateVehLoop (2)
   922 		 *	n->ai.state = o->ai_state;
   922 		 *	n->ai.state = o->ai_state;
   923 		 */
   923 		 */
   924 		n->ai.state = 2;
   924 		n->ai.state = 2;
   925 		n->ai.state_mode = o->ai_state_mode;
   925 		n->ai.state_mode = o->ai_state_mode;
   926 		n->ai.state_counter = o->ai_state_counter;
   926 		n->ai.state_counter = o->ai_state_counter;
   927 		n->ai.timeout_counter = o->ai_timeout_counter;
   927 		n->ai.timeout_counter = o->ai_timeout_counter;
   928 		n->ai.banned_tile_count = o->ai_banned_tile_count;
   928 		n->ai.banned_tile_count = o->ai_banned_tile_count;
   929 		n->ai.railtype_to_use = o->ai_railtype_to_use;
   929 		n->ai.railtype_to_use = o->ai_railtype_to_use;
   930 		
   930 
   931 		FixAiBuildRec(&n->ai.src, &o->ai_src);
   931 		FixAiBuildRec(&n->ai.src, &o->ai_src);
   932 		FixAiBuildRec(&n->ai.dst, &o->ai_dst);
   932 		FixAiBuildRec(&n->ai.dst, &o->ai_dst);
   933 		FixAiBuildRec(&n->ai.mid1, &o->ai_mid1);
   933 		FixAiBuildRec(&n->ai.mid1, &o->ai_mid1);
   934 		FixAiBuildRec(&n->ai.mid2, &o->ai_mid2);
   934 		FixAiBuildRec(&n->ai.mid2, &o->ai_mid2);
   935 		
   935 
   936 		n->ai.cargo_type = o->ai_cargo_type;
   936 		n->ai.cargo_type = o->ai_cargo_type;
   937 		n->ai.num_wagons = o->ai_num_wagons;
   937 		n->ai.num_wagons = o->ai_num_wagons;
   938 		n->ai.num_build_rec = o->ai_num_build_rec;
   938 		n->ai.num_build_rec = o->ai_num_build_rec;
   939 		n->ai.num_loco_to_build = o->ai_num_loco_to_build;
   939 		n->ai.num_loco_to_build = o->ai_num_loco_to_build;
   940 		n->ai.num_want_fullload = o->ai_num_want_fullload;
   940 		n->ai.num_want_fullload = o->ai_num_want_fullload;
   941 		
   941 
   942 		for(i=0; i!=9; i++) n->ai.wagon_list[i] = o->ai_wagonlist[i];
   942 		for(i=0; i!=9; i++) n->ai.wagon_list[i] = o->ai_wagonlist[i];
   943 		memcpy(n->ai.order_list_blocks, o->ai_order_list_blocks, 20);
   943 		memcpy(n->ai.order_list_blocks, o->ai_order_list_blocks, 20);
   944 		n->ai.start_tile_a = o->ai_start_tile_a;
   944 		n->ai.start_tile_a = o->ai_start_tile_a;
   945 		n->ai.start_tile_b = o->ai_start_tile_b;
   945 		n->ai.start_tile_b = o->ai_start_tile_b;
   946 		n->ai.cur_tile_a = o->ai_cur_tile_a;
   946 		n->ai.cur_tile_a = o->ai_cur_tile_a;
   947 		n->ai.cur_tile_b = o->ai_cur_tile_b;
   947 		n->ai.cur_tile_b = o->ai_cur_tile_b;
   948 		n->ai.start_dir_a = o->ai_start_dir_a;
   948 		n->ai.start_dir_a = o->ai_start_dir_a;
   949 		n->ai.start_dir_b = o->ai_start_dir_b;
   949 		n->ai.start_dir_b = o->ai_start_dir_b;
   950 		n->ai.cur_dir_a = o->ai_cur_dir_a;
   950 		n->ai.cur_dir_a = o->ai_cur_dir_a;
   951 		n->ai.cur_dir_b = o->ai_cur_dir_b;
   951 		n->ai.cur_dir_b = o->ai_cur_dir_b;
   952 		
   952 
   953 		for(i=0; i!=16; i++) {
   953 		for(i=0; i!=16; i++) {
   954 			n->ai.banned_tiles[i] = o->banned_tiles[i].tile;
   954 			n->ai.banned_tiles[i] = o->banned_tiles[i].tile;
   955 			n->ai.banned_val[i] = o->banned_tiles[i].data;
   955 			n->ai.banned_val[i] = o->banned_tiles[i].data;
   956 		}
   956 		}
   957 
   957 
  1079 
  1079 
  1080 	// go through the tables and see if we can find any ttdpatch presignals. Then convert those to our format.
  1080 	// go through the tables and see if we can find any ttdpatch presignals. Then convert those to our format.
  1081 	for(i=0; i!=256*256; i++) {
  1081 	for(i=0; i!=256*256; i++) {
  1082 		if (IS_TILETYPE(i, MP_RAILWAY) && (_map5[i] & 0xC0) == 0x40) {
  1082 		if (IS_TILETYPE(i, MP_RAILWAY) && (_map5[i] & 0xC0) == 0x40) {
  1083 			// this byte is always zero in real ttd.
  1083 			// this byte is always zero in real ttd.
  1084 			if (_map3_hi[i]) { 
  1084 			if (_map3_hi[i]) {
  1085 				// convert ttdpatch presignal format to openttd presignal format.
  1085 				// convert ttdpatch presignal format to openttd presignal format.
  1086 				_map3_hi[i] = (_map3_hi[i] >> 1) & 7;
  1086 				_map3_hi[i] = (_map3_hi[i] >> 1) & 7;
  1087 			}
  1087 			}
  1088 		}
  1088 		}
  1089 	}
  1089 	}
  1096 	FixStation(_stations, m->stations, lengthof(m->stations));
  1096 	FixStation(_stations, m->stations, lengthof(m->stations));
  1097 
  1097 
  1098 	FixDepot(_depots, m->depots, lengthof(m->depots));
  1098 	FixDepot(_depots, m->depots, lengthof(m->depots));
  1099 	FixVehicle(_vehicles, m->vehicles, lengthof(m->vehicles));
  1099 	FixVehicle(_vehicles, m->vehicles, lengthof(m->vehicles));
  1100 	FixSubsidy(_subsidies, m->subsidies, lengthof(m->subsidies));
  1100 	FixSubsidy(_subsidies, m->subsidies, lengthof(m->subsidies));
  1101 	
  1101 
  1102 	FixPlayer(_players, m->players, lengthof(m->players), m->town_name_type);
  1102 	FixPlayer(_players, m->players, lengthof(m->players), m->town_name_type);
  1103 	FixName(m->names, lengthof(m->names));
  1103 	FixName(m->names, lengthof(m->names));
  1104 	FixSign(_sign_list, m->signs, lengthof(m->signs));
  1104 	FixSign(_sign_list, m->signs, lengthof(m->signs));
  1105 	FixEngine(_engines, m->engines, lengthof(m->engines));
  1105 	FixEngine(_engines, m->engines, lengthof(m->engines));
  1106 
  1106 
  1152 
  1152 
  1153 	for(i=0; i!=lengthof(m->cargo_payment_rates); i++) {
  1153 	for(i=0; i!=lengthof(m->cargo_payment_rates); i++) {
  1154 		_cargo_payment_rates[i] = -(int32)m->cargo_payment_rates[i].price;
  1154 		_cargo_payment_rates[i] = -(int32)m->cargo_payment_rates[i].price;
  1155 		_cargo_payment_rates_frac[i] = m->cargo_payment_rates[i].frac;
  1155 		_cargo_payment_rates_frac[i] = m->cargo_payment_rates[i].frac;
  1156 	}
  1156 	}
  1157 	
  1157 
  1158 	free(m);
  1158 	free(m);
  1159 	fclose(lss.fin);
  1159 	fclose(lss.fin);
  1160 	return true;
  1160 	return true;
  1161 }
  1161 }
  1162 
  1162