(svn r3218) -Feature: Multiheaded train engines will now stay in the same train

This means that any user attempt to remove a rear engine will tell the user to move the front engine instead
	This fixes the assert when moving multiheaded engines (introduced in r3144)
	Note: to make old savegames use this feature, some engines might be turned around in order to link engines in pairs

-Codechange: train subtype is now a bitmask
	This allows fast access to info like if it is a wagon or engine and if it is in front and so on
	Note: savegame version bump
This commit is contained in:
bjarni
2005-11-18 23:41:03 +00:00
parent 65d9eb07a9
commit 16e65960b9
17 changed files with 615 additions and 243 deletions

View File

@@ -17,6 +17,7 @@
#include "viewport.h"
#include "depot.h"
#include "waypoint.h"
#include "train.h"
static int OrderGetSel(const Window* w)
{
@@ -282,9 +283,9 @@ static bool HandleOrderVehClick(const Vehicle* v, const Vehicle* u, Window* w)
{
if (u->type != v->type) return false;
if (u->type == VEH_Train && u->subtype != TS_Front_Engine) {
if (u->type == VEH_Train && !IsFrontEngine(u)) {
u = GetFirstVehicleInChain(u);
if (u->subtype != TS_Front_Engine) return false;
if (!IsFrontEngine(u)) return false;
}
// v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet