(svn r16613) -Fix [NewGRF]: some of the var action 2 80+ variables contained wrong results due to OpenTTD codechanges

This commit is contained in:
yexo
2009-06-21 10:11:04 +00:00
parent 41c8baa7dc
commit 548a605263
3 changed files with 44 additions and 7 deletions

View File

@@ -129,6 +129,28 @@ uint32 Order::Pack() const
return this->dest << 16 | this->flags << 8 | this->type;
}
uint16 Order::MapOldOrder() const
{
uint16 order = this->GetType();
switch (this->type) {
case OT_GOTO_STATION:
if (this->GetUnloadType() & OUFB_UNLOAD) SetBit(order, 5);
if (this->GetLoadType() & OLFB_FULL_LOAD) SetBit(order, 6);
if (this->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) SetBit(order, 7);
order |= GB(this->GetDestination(), 0, 8) << 8;
break;
case OT_GOTO_DEPOT:
if (!(this->GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) SetBit(order, 6);
SetBit(order, 7);
order |= GB(this->GetDestination(), 0, 8) << 8;
break;
case OT_LOADING:
if (this->GetLoadType() & OLFB_FULL_LOAD) SetBit(order, 6);
break;
}
return order;
}
Order::Order(uint32 packed)
{
this->type = (OrderType)GB(packed, 0, 8);