~ubuntu-branches/ubuntu/raring/simutrans/raring-proposed

« back to all changes in this revision

Viewing changes to vehicle/simvehikel.h

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2011-11-03 19:59:02 UTC
  • mfrom: (1.2.7)
  • Revision ID: package-import@ubuntu.com-20111103195902-uopgwf488mfctb75
Tags: 111.0-1
* New upstream release.
* debian/rules: Update get-orig-source target for new upstream release.
* Use xz compression for source and binary packages.
* Use override_* targets to simplify debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 */
7
7
 
8
8
/*
9
 
 * Fahrzeuge in der Welt von Sim
10
 
 *
11
 
 * 01.11.99  getrennt von simdings.h
12
 
 * Hj. Malthaner
 
9
 * Vehicle base type.
13
10
 */
14
11
 
15
12
#ifndef _simvehikel_h
46
43
        static sint8 dxdy[16];
47
44
 
48
45
        // to make the length on diagonals configurable
49
 
        static uint8 old_diagonal_length;
50
 
        static uint8 diagonal_length;
 
46
        // Number of vehicle steps along a diagonal...
 
47
        // remember to subtract one when stepping down to 0
 
48
        static uint8 diagonal_vehicle_steps_per_tile;
 
49
        static uint8 old_diagonal_vehicle_steps_per_tile;
51
50
        static uint16 diagonal_multiplier;
52
51
 
53
52
        // [0]=xoff [1]=yoff
62
61
        // true on slope (make calc_height much faster)
63
62
        uint8 use_calc_height:1;
64
63
 
65
 
        // true, if hop_check failed
66
 
        uint8 hop_check_failed:1;
 
64
        // if true, use offests to emulate driving on other side
 
65
        uint8 drives_on_left:1;
67
66
 
68
67
        sint8 dx, dy;
69
68
 
106
105
        static void set_overtaking_offsets( bool driving_on_the_left );
107
106
 
108
107
        // if true, this convoi needs to restart for correct alignment
109
 
        bool need_realignment();
 
108
        bool need_realignment() const;
110
109
 
111
110
        uint32 fahre_basis(uint32 dist);        // basis movement code
112
111
 
126
125
 
127
126
        ribi_t::ribi get_fahrtrichtung() const {return fahrtrichtung;}
128
127
 
 
128
        koord3d get_pos_next() const {return pos_next;}
 
129
 
129
130
        virtual waytype_t get_waytype() const = 0;
130
131
 
131
132
        // true, if this vehicle did not moved for some time
248
249
 
249
250
        virtual void rotate90();
250
251
 
251
 
        virtual bool ist_weg_frei(int &/*restart_speed*/) {return true;}
 
252
        virtual bool ist_weg_frei( int &/*restart_speed*/, bool /*second_check*/ ) { return true; }
252
253
 
253
254
        virtual void betrete_feld();
254
255
 
308
309
 
309
310
        ~vehikel_t();
310
311
 
311
 
        void rauche();
 
312
        void rauche() const;
312
313
 
313
314
        /**
314
 
        * �ffnet ein neues Beobachtungsfenster f�r das Objekt.
 
315
        * Effnet ein neues Beobachtungsfenster fur das Objekt.
315
316
        * @author Hj. Malthaner
316
317
        */
317
318
        void zeige_info();
326
327
        * Ermittelt fahrtrichtung
327
328
        * @author Hj. Malthaner
328
329
        */
329
 
        ribi_t::ribi richtung();
 
330
        ribi_t::ribi richtung() const;
330
331
 
331
332
        /* return friction constant: changes in hill and curves; may even negative downhill *
332
333
        * @author prissi
374
375
        * Info-Fenster
375
376
        * @author Hj. Malthaner
376
377
        */
377
 
        void get_fracht_info(cbuffer_t & buf);
 
378
        void get_fracht_info(cbuffer_t & buf) const;
378
379
 
379
380
        /**
380
381
        * loescht alle fracht aus dem Fahrzeug
475
476
 
476
477
        virtual bool calc_route(koord3d start, koord3d ziel, sint32 max_speed, route_t* route);
477
478
 
478
 
        virtual bool ist_weg_frei(int &restart_speed);
 
479
        virtual bool ist_weg_frei(int &restart_speed, bool second_check );
479
480
 
480
481
        // returns true for the way search to an unknown target.
481
482
        virtual bool ist_ziel(const grund_t *,const grund_t *) const;
500
501
 */
501
502
class waggon_t : public vehikel_t
502
503
{
503
 
private:
504
 
        signal_t *ist_blockwechsel(koord3d k2) const;
505
 
 
506
504
protected:
507
505
        bool ist_befahrbar(const grund_t *bd) const;
508
506
 
530
528
        virtual bool ist_ziel(const grund_t *,const grund_t *) const;
531
529
 
532
530
        // handles all block stuff and route choosing ...
533
 
        virtual bool ist_weg_frei(int &restart_speed);
 
531
        virtual bool ist_weg_frei(int &restart_speed, bool );
534
532
 
535
533
        // reserves or unreserves all blocks and returns the handle to the next block (if there)
536
534
        // returns true on successful reservation
634
632
public:
635
633
        waytype_t get_waytype() const { return water_wt; }
636
634
 
637
 
        virtual bool ist_weg_frei(int &restart_speed);
 
635
        virtual bool ist_weg_frei(int &restart_speed, bool);
638
636
 
639
637
        // returns true for the way search to an unknown target.
640
638
        virtual bool ist_ziel(const grund_t *,const grund_t *) const {return 0;}
671
669
        koord3d search_start;
672
670
        koord3d search_end;
673
671
 
674
 
        enum flight_state { taxiing=0, departing=1, flying=2, landing=3, looking_for_parking=4, flying2=5, taxiing_to_halt=6  };
 
672
        enum flight_state { taxiing=0, departing=1, flying=2, landing=3, looking_for_parking=4, circling=5, taxiing_to_halt=6  };
675
673
 
676
674
        flight_state state;     // functions needed for the search without destination from find_route
677
675
 
687
685
 
688
686
        void betrete_feld();
689
687
 
690
 
        bool block_reserver( uint32 start, uint32 end, bool reserve );
 
688
        bool block_reserver( uint32 start, uint32 end, bool reserve ) const;
691
689
 
692
690
        // find a route and reserve the stop position
693
691
        bool find_route_to_stop_position();
710
708
        // how expensive to go here (for way search)
711
709
        virtual int get_kosten(const grund_t *, const sint32, koord) const;
712
710
 
713
 
        virtual bool ist_weg_frei(int &restart_speed);
 
711
        virtual bool ist_weg_frei(int &restart_speed, bool);
714
712
 
715
713
        virtual void set_convoi(convoi_t *c);
716
714
 
739
737
        // the speed calculation happens it calc_height
740
738
        void calc_akt_speed(const grund_t*) {}
741
739
 
742
 
        bool is_on_ground() const { return flughoehe==0  &&  state!=flying; }
 
740
        bool is_on_ground() const { return flughoehe==0  &&  !(state==circling  ||  state==flying); }
 
741
 
 
742
        const char * ist_entfernbar(const spieler_t *sp);
743
743
};
744
744
 
745
745
#endif