Changeset - r1855:6272210f14b5
[Not reviewed]
master
0 1 0
hackykid - 19 years ago 2005-05-22 14:10:20
hackykid@openttd.org
(svn r2361) - Feature: [newgrf] Implement varaction2 property 0x41 and 0xDA. These are the position in and length of chain of consecutive vehicles with the same type, and index of the next wagon in the chain (INVALID_VEHICLE if last), resp. Improves displaying of some engines in the dbsetxl.
1 file changed with 7 insertions and 6 deletions:
0 comments (0 inline, 0 general)
engine.c
Show inline comments
 
@@ -360,18 +360,20 @@ static RealSpriteGroup* ResolveVehicleSp
 
						veh = GetFirstVehicleInChain(veh);
 
				}
 

	
 
				if (dsg->variable == 0x40) {
 
				if (dsg->variable == 0x40 || dsg->variable == 0x41) {
 
					if (veh->type == VEH_Train) {
 
						Vehicle *u = GetFirstVehicleInChain(veh);
 
						byte chain_before = 0, chain_after = 0;
 

	
 
						while (u != veh) {
 
							chain_before++;
 
							if (dsg->variable == 0x41 && u->engine_type != veh->engine_type)
 
								chain_before = 0;
 
							u = u->next;
 
							chain_before++;
 
						}
 
						while (u->next != NULL) {
 
						while (u->next != NULL && (dsg->variable == 0x40 || u->next->engine_type == veh->engine_type)) {
 
							chain_after++;
 
							u = u->next;
 
							chain_after++;
 
						};
 

	
 
						value = chain_before | chain_after << 8
 
@@ -446,8 +448,7 @@ static RealSpriteGroup* ResolveVehicleSp
 
						veh_prop(0x57, veh->profit_last_year & 0xFF);
 
						veh_prop(0x58, veh->profit_last_year);
 
						veh_prop(0x59, veh->profit_last_year & 0xFF);
 
/*						veh_prop(0x5A, veh->next_in_chain_old);
 
						veh_prop(0x5B, veh->next_in_chain_old & 0xFF);*/
 
						veh_prop(0x5A, veh->next == NULL ? INVALID_VEHICLE : veh->next->index);
 
						veh_prop(0x5C, veh->value);
 
						veh_prop(0x5D, veh->value & 0xFFFFFF);
 
						veh_prop(0x5E, veh->value & 0xFFFF);
0 comments (0 inline, 0 general)