1329 This way the max is 6553 millions and it is more than the 32 bit that is stored in _patches |
1329 This way the max is 6553 millions and it is more than the 32 bit that is stored in _patches |
1330 This is a nice way to send 32 bit and only use 16 bit |
1330 This is a nice way to send 32 bit and only use 16 bit |
1331 the last 8 bit is the engine. The 8 bits in front of the engine is free so it have room for 16 bit engine entries */ |
1331 the last 8 bit is the engine. The 8 bits in front of the engine is free so it have room for 16 bit engine entries */ |
1332 uint16 new_engine_type = (uint16)(p2 & 0xFFFF); |
1332 uint16 new_engine_type = (uint16)(p2 & 0xFFFF); |
1333 uint32 autorefit_money = (p2 >> 16) * 100000; |
1333 uint32 autorefit_money = (p2 >> 16) * 100000; |
1334 Vehicle *v = GetVehicle(p1); |
1334 Vehicle *v, *u; |
1335 int cost, build_cost, rear_engine_cost = 0; |
1335 int cost, build_cost, rear_engine_cost = 0; |
1336 Vehicle *u = v; |
1336 byte old_engine_type; |
1337 byte old_engine_type = v->engine_type; |
1337 |
1338 |
1338 if (!IsVehicleIndex(p1)) return CMD_ERROR; |
1339 SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES); |
1339 |
1340 |
1340 v = u = GetVehicle(p1); |
|
1341 |
|
1342 old_engine_type = v->engine_type; |
1341 |
1343 |
1342 // first we make sure that it's a valid type the user requested |
1344 // first we make sure that it's a valid type the user requested |
1343 // check that it's an engine that is in the engine array |
1345 // check that it's an engine that is in the engine array |
1344 if (new_engine_type >= TOTAL_NUM_ENGINES ) return CMD_ERROR; |
1346 if (new_engine_type >= TOTAL_NUM_ENGINES ) return CMD_ERROR; |
1345 |
1347 |