newgrf.c
changeset 2421 8bc8ff3a5eb5
parent 2400 2b258097156f
child 2438 f0bf4adbd620
equal deleted inserted replaced
2420:0c1ee5dc7072 2421:8bc8ff3a5eb5
  1051 
  1051 
  1052 	buf += 5;
  1052 	buf += 5;
  1053 
  1053 
  1054 	while (numprops-- && buf < bufend) {
  1054 	while (numprops-- && buf < bufend) {
  1055 		uint8 prop = grf_load_byte(&buf);
  1055 		uint8 prop = grf_load_byte(&buf);
  1056 
  1056 		bool ignoring = false;
  1057 		if (feature == GSF_STATION)
  1057 
  1058 			// stations don't share those common properties
  1058 		switch (feature) {
  1059 			goto run_handler;
  1059 			case GSF_TRAIN:
  1060 
  1060 			case GSF_ROAD:
  1061 		switch (prop) {
  1061 			case GSF_SHIP:
  1062 		case 0x00: { /* Introduction date */
  1062 			case GSF_AIRCRAFT:
  1063 			FOR_EACH_OBJECT {
  1063 				/* Common properties for vehicles */
  1064 				uint16 date = grf_load_word(&buf);
  1064 				switch (prop) {
  1065 
  1065 					case 0x00: { /* Introduction date */
  1066 				ei[i].base_intro = date;
  1066 						FOR_EACH_OBJECT {
  1067 			}
  1067 							uint16 date = grf_load_word(&buf);
  1068 		}	break;
  1068 
  1069 		case 0x02: { /* Decay speed */
  1069 							ei[i].base_intro = date;
  1070 			FOR_EACH_OBJECT {
  1070 						}
  1071 				uint8 decay = grf_load_byte(&buf);
  1071 					}	break;
  1072 
  1072 					case 0x02: { /* Decay speed */
  1073 				ei[i].unk2 &= 0x80;
  1073 						FOR_EACH_OBJECT {
  1074 				ei[i].unk2 |= decay & 0x7f;
  1074 							uint8 decay = grf_load_byte(&buf);
  1075 			}
  1075 
  1076 		}	break;
  1076 							ei[i].unk2 &= 0x80;
  1077 		case 0x03: { /* Vehicle life */
  1077 							ei[i].unk2 |= decay & 0x7f;
  1078 			FOR_EACH_OBJECT {
  1078 						}
  1079 				uint8 life = grf_load_byte(&buf);
  1079 					}	break;
  1080 
  1080 					case 0x03: { /* Vehicle life */
  1081 				ei[i].lifelength = life;
  1081 						FOR_EACH_OBJECT {
  1082 			}
  1082 							uint8 life = grf_load_byte(&buf);
  1083 		}	break;
  1083 
  1084 		case 0x04: { /* Model life */
  1084 							ei[i].lifelength = life;
  1085 			FOR_EACH_OBJECT {
  1085 						}
  1086 				uint8 life = grf_load_byte(&buf);
  1086 					}	break;
  1087 
  1087 					case 0x04: { /* Model life */
  1088 				ei[i].base_life = life;
  1088 						FOR_EACH_OBJECT {
  1089 			}
  1089 							uint8 life = grf_load_byte(&buf);
  1090 		}	break;
  1090 
  1091 		case 0x06: { /* Climates available */
  1091 							ei[i].base_life = life;
  1092 			FOR_EACH_OBJECT {
  1092 						}
  1093 				uint8 climates = grf_load_byte(&buf);
  1093 					}	break;
  1094 
  1094 					case 0x06: { /* Climates available */
  1095 				ei[i].railtype_climates &= 0xf0;
  1095 						FOR_EACH_OBJECT {
  1096 				ei[i].railtype_climates |= climates;
  1096 							uint8 climates = grf_load_byte(&buf);
  1097 			}
  1097 
  1098 		}	break;
  1098 							ei[i].railtype_climates &= 0xf0;
  1099 		case 0x07: { /* Loading speed */
  1099 							ei[i].railtype_climates |= climates;
  1100 			/* TODO */
  1100 						}
  1101 			/* Hyronymus explained me what does
  1101 					}	break;
  1102 			 * this mean and insists on having a
  1102 					case 0x07: { /* Loading speed */
  1103 			 * credit ;-). --pasky */
  1103 						/* TODO */
  1104 			/* TODO: This needs to be supported by
  1104 						/* Hyronymus explained me what does
  1105 			 * LoadUnloadVehicle() first. */
  1105 						 * this mean and insists on having a
  1106 			FOR_EACH_OBJECT {
  1106 						 * credit ;-). --pasky */
  1107 				grf_load_byte(&buf);
  1107 						/* TODO: This needs to be supported by
  1108 			}
  1108 						 * LoadUnloadVehicle() first. */
  1109 			goto ignoring;
  1109 						FOR_EACH_OBJECT {
  1110 		}
  1110 							grf_load_byte(&buf);
  1111 		default: {
  1111 						}
  1112 run_handler:
  1112 						ignoring = true;
  1113 			if (handler[feature](engine, numinfo, prop, &buf, bufend - buf)) {
  1113 						break;
  1114 ignoring:
  1114 					}
  1115 				grfmsg(GMS_NOTICE, "VehicleChangeInfo: Ignoring property %x (not implemented).", prop);
  1115 
  1116 			}
  1116 					default:
  1117 			break;
  1117 						if (handler[feature](engine, numinfo, prop, &buf, bufend - buf))
  1118 		}
  1118 							ignoring = true;
  1119 		}
  1119 						break;
       
  1120 				}
       
  1121 				break;
       
  1122 
       
  1123 			default:
       
  1124 				if (handler[feature](engine, numinfo, prop, &buf, bufend - buf))
       
  1125 					ignoring = true;
       
  1126 				break;
       
  1127 		}
       
  1128 
       
  1129 		if (ignoring)
       
  1130 			grfmsg(GMS_NOTICE, "VehicleChangeInfo: Ignoring property %x (not implemented).", prop);
  1120 	}
  1131 	}
  1121 }
  1132 }
  1122 
  1133 
  1123 #undef FOR_EACH_OBJECT
  1134 #undef FOR_EACH_OBJECT
  1124 
  1135