~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/newgrf_engine.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Matthijs Kooijman, Matthijs Kooijman
  • Date: 2009-10-01 22:52:59 UTC
  • mfrom: (1.1.8 upstream) (2.1.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091001225259-5kpkp4sthbszpyif
[ Matthijs Kooijman ]
* New upstream release
* Use printf instead of echo -en in openttd-wrapper to make it POSIX
  compatible (Closes: #547758).
* Remove three patches that are now included in upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: newgrf_engine.cpp 16482 2009-05-31 12:22:53Z rubidium $ */
 
1
/* $Id: newgrf_engine.cpp 16638 2009-06-23 20:48:48Z rubidium $ */
2
2
 
3
3
/** @file newgrf_engine.cpp NewGRF handling of engines. */
4
4
 
129
129
 
130
130
static int MapOldSubType(const Vehicle *v)
131
131
{
132
 
        if (v->type != VEH_TRAIN) return v->subtype;
133
 
        if (IsTrainEngine(v)) return 0;
134
 
        if (IsFreeWagon(v)) return 4;
135
 
        return 2;
 
132
        switch (v->type) {
 
133
                case VEH_TRAIN:
 
134
                        if (IsTrainEngine(v)) return 0;
 
135
                        if (IsFreeWagon(v)) return 4;
 
136
                        return 2;
 
137
                case VEH_ROAD:
 
138
                case VEH_SHIP:     return 0;
 
139
                case VEH_AIRCRAFT:
 
140
                case VEH_DISASTER: return v->subtype;
 
141
                case VEH_EFFECT:   return v->subtype << 1;
 
142
                default: NOT_REACHED();
 
143
        }
136
144
}
137
145
 
138
146
 
685
693
 
686
694
        /* General vehicle properties */
687
695
        switch (variable - 0x80) {
688
 
                case 0x00: return v->type;
 
696
                case 0x00: return v->type + 0x10;
689
697
                case 0x01: return MapOldSubType(v);
690
698
                case 0x04: return v->index;
691
699
                case 0x05: return GB(v->index, 8, 8);
692
 
                case 0x0A: return v->current_order.Pack();
693
 
                case 0x0B: return GB(v->current_order.Pack(), 8, 8);
 
700
                case 0x0A: return v->current_order.MapOldOrder();
 
701
                case 0x0B: return v->current_order.GetDestination();
694
702
                case 0x0C: return v->GetNumOrders();
695
703
                case 0x0D: return v->cur_order_index;
696
704
                case 0x10: return v->load_unload_time_rem;