Skip to content

Commit

Permalink
CHG: vehicle behaviour at intersections
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@4775 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
TurfIt committed Aug 13, 2011
1 parent c605dfa commit b00b523
Show file tree
Hide file tree
Showing 6 changed files with 250 additions and 103 deletions.
13 changes: 8 additions & 5 deletions dataobj/ribi.h
Expand Up @@ -169,11 +169,6 @@ class ribi_t {
// Alle Abfragen über statische Tabellen wg. Performance
// Ranges werden nicht geprüft!
//
static ribi doppelt(ribi x) { return doppelr[x]; }
static ribi rueckwaerts(ribi x) { return rwr[x]; }
static ribi get_forward(ribi x) { return fwrd[x]; } // all ribis, that are in front of this thing
static ribi rotate90(ribi x) { return ((x&8) ? 1|((x<<1)&0x0E) : x<<1); }

static bool is_twoway(ribi x) { return (flags[x]&twoway)!=0; }
static bool is_threeway(ribi x) { return (flags[x]&threeway)!=0; }

Expand All @@ -186,6 +181,14 @@ class ribi_t {
static bool ist_gerade_ow(ribi x) { return (flags[x] & gerade_ow) != 0; }
static bool ist_kreuzung(ribi x) { return x > 0 && flags[x] == 0; }

static ribi doppelt(ribi x) { return doppelr[x]; }
static ribi rueckwaerts(ribi x) { return rwr[x]; }
static ribi get_forward(ribi x) { return fwrd[x]; } // all ribis, that are in front of this thing
static ribi rotate90(ribi x) { return ((x&8) ? 1|((x<<1)&0x0E) : x<<1); } // 90 to the right
static ribi rotate90l(ribi x) { return ((x&1) ? 8|(x>>1) : x>>1); } // 90 to the left
static ribi rotate45(ribi x) { return (ist_einfach(x) ? x|rotate90(x) : x&rotate90(x)); } // 45 to the right
static ribi rotate45l(ribi x) { return (ist_einfach(x) ? x|rotate90l(x) : x&rotate90l(x)); } // 45 to the left

static dir get_dir(ribi x) { return dirs[x]; }
};

Expand Down
8 changes: 4 additions & 4 deletions simconvoi.cc
Expand Up @@ -1012,7 +1012,7 @@ void convoi_t::step()
vehikel_t* v = fahr[0];

int restart_speed=-1;
if (v->ist_weg_frei(restart_speed)) {
if (v->ist_weg_frei(restart_speed,false)) {
// can reserve new block => drive on
state = (steps_driven>=0) ? LEAVING_DEPOT : DRIVING;
if(haltestelle_t::get_halt(welt,v->get_pos(),besitzer_p).is_bound()) {
Expand Down Expand Up @@ -1041,7 +1041,7 @@ void convoi_t::step()
case WAITING_FOR_CLEARANCE:
{
int restart_speed=-1;
if (fahr[0]->ist_weg_frei(restart_speed)) {
if (fahr[0]->ist_weg_frei(restart_speed,false)) {
state = (steps_driven>=0) ? LEAVING_DEPOT : DRIVING;
}
if(restart_speed>=0) {
Expand Down Expand Up @@ -1138,7 +1138,7 @@ void convoi_t::new_month()
// check, if now free ...
// migh also reset the state!
int restart_speed=-1;
if (fahr[0]->ist_weg_frei(restart_speed)) {
if (fahr[0]->ist_weg_frei(restart_speed,false)) {
state = DRIVING;
}
if(restart_speed>=0) {
Expand Down Expand Up @@ -1815,7 +1815,7 @@ void convoi_t::vorfahren()

// to advance more smoothly
int restart_speed=-1;
if(fahr[0]->ist_weg_frei(restart_speed)) {
if(fahr[0]->ist_weg_frei(restart_speed,false)) {
// can reserve new block => drive on
if(haltestelle_t::get_halt(welt,k0,besitzer_p).is_bound()) {
fahr[0]->play_sound();
Expand Down
1 change: 1 addition & 0 deletions simutrans/history.txt
Expand Up @@ -16,6 +16,7 @@
CHG: enable building under flying aircrafts
CHG: renovated factory dialog to include statistics and other indicators; preparation for factory renaming
FIX: convoi reservation for street convois longer than one tile is now fixed
CHG: road vehicles less likely to block intersections or drive through each other when turning


Release of 110.0.1 (r4359 on 12-Mar-2011):
Expand Down

0 comments on commit b00b523

Please sign in to comment.