From: Mikko Rasa Date: Thu, 7 Nov 2013 20:31:50 +0000 (+0200) Subject: Rename turnout/sensor_id fields in Track and Block to *_addr X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=b28062f2dc88e082ee5a28b2e1f7c4c8bd989023;p=r2c2.git Rename turnout/sensor_id fields in Track and Block to *_addr That's what they really are. The *_id names would get in the way of what I'm going to do next. --- diff --git a/source/designer/designer.cpp b/source/designer/designer.cpp index 30b022f..6706db6 100644 --- a/source/designer/designer.cpp +++ b/source/designer/designer.cpp @@ -516,17 +516,17 @@ void Designer::update_track_icon(Track3D &track) if(track.get_track().get_flex()) overlay->add_graphic(track, "flex"); - if(unsigned sid = track.get_track().get_sensor_id()) + if(unsigned saddr = track.get_track().get_sensor_address()) { overlay->add_graphic(track, "sensor"); - overlay->set_label(track, lexical_cast(sid)); + overlay->set_label(track, lexical_cast(saddr)); } - else if(unsigned tid = track.get_track().get_turnout_id()) + else if(unsigned taddr = track.get_track().get_turnout_address()) { - if(tid<0x800) + if(taddr<0x800) { overlay->add_graphic(track, "turnout"); - overlay->set_label(track, lexical_cast(tid)); + overlay->set_label(track, lexical_cast(taddr)); } } } @@ -566,10 +566,10 @@ string Designer::tooltip(int x, int y) { if(mode!=CATALOGUE && abs(track->get_tilt()).radians()>1e-4) info += format(" (slope %.1f%%)", abs(tan(track->get_tilt())*100)); - if(track->get_turnout_id()) - info += format(" (turnout %d)", track->get_turnout_id()); - else if(track->get_sensor_id()) - info += format(" (sensor %d)", track->get_sensor_id()); + if(track->get_turnout_address()) + info += format(" (turnout %d)", track->get_turnout_address()); + else if(track->get_sensor_address()) + info += format(" (sensor %d)", track->get_sensor_address()); } return info; } @@ -594,8 +594,8 @@ void Designer::show_route(const Route &route) Track3D &t3d = layout_3d->get_3d(**i); Path3D *path = new Path3D(t3d); path->set_color(GL::Color(0.5, 0.8, 1.0)); - if(unsigned tid = (*i)->get_turnout_id()) - path->set_path(route.get_turnout(tid)); + if(unsigned taddr = (*i)->get_turnout_address()) + path->set_path(route.get_turnout(taddr)); } } diff --git a/source/designer/trackproperties.cpp b/source/designer/trackproperties.cpp index c95ad02..59ce751 100644 --- a/source/designer/trackproperties.cpp +++ b/source/designer/trackproperties.cpp @@ -24,17 +24,17 @@ TrackProperties::TrackProperties(const Selection &s): { GLtk::Row row(*layout); - add(*(lbl1 = new GLtk::Label("Turnout ID"))); - add(*(ent_turnout_id = new GLtk::Entry)); - ent_turnout_id->set_edit_size(5, 1); + add(*(lbl1 = new GLtk::Label("Turnout address"))); + add(*(ent_turnout_addr = new GLtk::Entry)); + ent_turnout_addr->set_edit_size(5, 1); } { GLtk::Row row(*layout); - add(*(lbl2 = new GLtk::Label("Sensor ID"))); + add(*(lbl2 = new GLtk::Label("Sensor address"))); layout->add_constraint(*lbl1, GLtk::Layout::COPY_WIDTH, *lbl2); - add(*(ent_sensor_id = new GLtk::Entry)); - ent_sensor_id->set_edit_size(5, 1); + add(*(ent_sensor_addr = new GLtk::Entry)); + ent_sensor_addr->set_edit_size(5, 1); } GLtk::Button *btn; @@ -51,25 +51,25 @@ TrackProperties::TrackProperties(const Selection &s): if(selection.size()==1) { - if(unsigned tid = selection.get_object()->get_turnout_id()) - ent_turnout_id->set_text(lexical_cast(tid)); + if(unsigned taddr = selection.get_object()->get_turnout_address()) + ent_turnout_addr->set_text(lexical_cast(taddr)); } const set &tracks = selection.get_objects(); - int sensor_id = -1; + int sensor_addr = -1; for(set::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) { - if(static_cast((*i)->get_sensor_id())!=sensor_id) + if(static_cast((*i)->get_sensor_address())!=sensor_addr) { - if(sensor_id==-1) - sensor_id = (*i)->get_sensor_id(); + if(sensor_addr==-1) + sensor_addr = (*i)->get_sensor_address(); else - sensor_id = -2; + sensor_addr = -2; } } - if(sensor_id>=0) - ent_sensor_id->set_text(lexical_cast(sensor_id)); + if(sensor_addr>=0) + ent_sensor_addr->set_text(lexical_cast(sensor_addr)); } void TrackProperties::on_response(int code) @@ -80,17 +80,17 @@ void TrackProperties::on_response(int code) { Track *track = selection.get_object(); if(track->get_type().is_turnout()) - track->set_turnout_id(lexical_cast(ent_turnout_id->get_text())); + track->set_turnout_address(lexical_cast(ent_turnout_addr->get_text())); } - string sensor_id_text = ent_sensor_id->get_text(); - if(!sensor_id_text.empty()) + string sensor_addr_text = ent_sensor_addr->get_text(); + if(!sensor_addr_text.empty()) { - unsigned sensor_id = lexical_cast(sensor_id_text); + unsigned sensor_addr = lexical_cast(sensor_addr_text); const set &tracks = selection.get_objects(); for(set::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) if(!(*i)->get_type().is_turnout()) - (*i)->set_sensor_id(sensor_id); + (*i)->set_sensor_address(sensor_addr); } } } diff --git a/source/designer/trackproperties.h b/source/designer/trackproperties.h index 1e31951..7c29464 100644 --- a/source/designer/trackproperties.h +++ b/source/designer/trackproperties.h @@ -10,8 +10,8 @@ class TrackProperties: public Msp::GLtk::Dialog { private: const Selection &selection; - Msp::GLtk::Entry *ent_turnout_id; - Msp::GLtk::Entry *ent_sensor_id; + Msp::GLtk::Entry *ent_turnout_addr; + Msp::GLtk::Entry *ent_sensor_addr; public: TrackProperties(const Selection &); diff --git a/source/engineer/engineer.cpp b/source/engineer/engineer.cpp index c88bae8..87e3dda 100644 --- a/source/engineer/engineer.cpp +++ b/source/engineer/engineer.cpp @@ -193,7 +193,7 @@ void Engineer::button_press(unsigned btn) Object *obj = pick_object(pointer); if(Track *track = dynamic_cast(obj)) { - if(track->get_turnout_id()) + if(track->get_turnout_address()) { Block &block = track->get_block(); if(block.get_train() && block.get_train()->is_block_critical(block)) @@ -210,14 +210,14 @@ void Engineer::button_press(unsigned btn) ++i; } track->set_active_path(i); - set_status(format("Turnout %d", track->get_turnout_id())); + set_status(format("Turnout %d", track->get_turnout_address())); } } - if(unsigned sid = track->get_sensor_id()) + if(unsigned saddr = track->get_sensor_address()) { if(options.simulate) - layout.get_driver().set_sensor(sid, !layout.get_driver().get_sensor(sid)); - set_status(format("Sensor %d", sid)); + layout.get_driver().set_sensor(saddr, !layout.get_driver().get_sensor(saddr)); + set_status(format("Sensor %d", saddr)); } } else if(Vehicle *veh = dynamic_cast(obj)) diff --git a/source/libr2c2/block.cpp b/source/libr2c2/block.cpp index 33627f8..59ad3a3 100644 --- a/source/libr2c2/block.cpp +++ b/source/libr2c2/block.cpp @@ -16,8 +16,8 @@ namespace R2C2 { Block::Block(Layout &l, Track &start): TrackChain(l), id(0), - sensor_id(start.get_sensor_id()), - turnout_id(start.get_turnout_id()), + sensor_addr(start.get_sensor_address()), + turnout_addr(start.get_turnout_address()), conflict(false), sensor(0), train(0) @@ -49,7 +49,7 @@ Block::Block(Layout &l, Track &start): for(set::const_iterator i=blocks.begin(); (!conflict && i!=blocks.end()); ++i) conflict = (id==(*i)->get_id()); - if(!conflict && sensor_id) + if(!conflict && sensor_addr) sensor = new TrackCircuit(layout, *this); layout.add(*this); @@ -81,7 +81,7 @@ void Block::on_track_added(Track &track) TrackChain::Validity Block::check_validity(Track &track) const { - if(track.get_sensor_id()!=sensor_id || track.get_turnout_id()!=turnout_id) + if(track.get_sensor_address()!=sensor_addr || track.get_turnout_address()!=turnout_addr) return INCOMPATIBLE; return TrackChain::check_validity(track); @@ -174,10 +174,10 @@ bool Block::reserve(Train *t) void Block::determine_id() { - if(sensor_id) - id = 0x1000|sensor_id; - else if(turnout_id) - id = 0x2000|turnout_id; + if(sensor_addr) + id = 0x1000|sensor_addr; + else if(turnout_addr) + id = 0x2000|turnout_addr; else if(endpoints.size()==2) { unsigned id1 = endpoints[0].link ? endpoints[0].link->get_id() : 1; diff --git a/source/libr2c2/block.h b/source/libr2c2/block.h index c3b7c87..2f898b0 100644 --- a/source/libr2c2/block.h +++ b/source/libr2c2/block.h @@ -32,8 +32,8 @@ public: private: unsigned id; - unsigned sensor_id; - unsigned turnout_id; + unsigned sensor_addr; + unsigned turnout_addr; bool conflict; TrackCircuit *sensor; std::vector endpoints; @@ -49,8 +49,8 @@ private: public: unsigned get_id() const { return id; } - unsigned get_sensor_id() const { return sensor_id; } - unsigned get_turnout_id() const { return turnout_id; } + unsigned get_sensor_address() const { return sensor_addr; } + unsigned get_turnout_address() const { return turnout_addr; } TrackCircuit *get_sensor() const { return sensor; } const std::vector &get_endpoints() const { return endpoints; } const Endpoint &get_endpoint(unsigned) const; diff --git a/source/libr2c2/blockallocator.cpp b/source/libr2c2/blockallocator.cpp index e28558a..2c92ddc 100644 --- a/source/libr2c2/blockallocator.cpp +++ b/source/libr2c2/blockallocator.cpp @@ -42,7 +42,7 @@ BlockAllocator::BlockAllocator(Train &t): const set &tracks = layout.get_all(); for(set::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) - if((*i)->get_turnout_id()) + if((*i)->get_turnout_address()) { (*i)->signal_path_changing.connect(sigc::hide(sigc::bind(sigc::mem_fun(this, &BlockAllocator::turnout_path_changing), sigc::ref(**i)))); (*i)->signal_path_changed.connect(sigc::hide(sigc::bind(sigc::mem_fun(this, &BlockAllocator::turnout_path_changed), sigc::ref(**i)))); @@ -207,7 +207,7 @@ void BlockAllocator::reserve_more() float dist = 0; for(BlockList::const_iterator i=cur_blocks_end; i!=blocks.end(); ++i) { - if((*i)->get_sensor_id()) + if((*i)->get_sensor_address()) ++nsens; if(nsens>0) dist += (*i)->get_path_length(i->entry()); @@ -228,7 +228,7 @@ void BlockAllocator::reserve_more() // The track ends here break; - if(block->get_turnout_id() && !prev->get_turnout_id()) + if(block->get_turnout_address() && !prev->get_turnout_address()) { /* We are arriving at a turnout. See if we have enough blocks and distance reserved. */ @@ -279,7 +279,7 @@ void BlockAllocator::reserve_more() if(&*block==stop_at_block) break; - if(block->get_sensor_id()) + if(block->get_sensor_address()) ++nsens; if(nsens>0) dist += block->get_path_length(block.entry()); @@ -611,8 +611,8 @@ void BlockAllocator::Loader::block(unsigned id) obj.blocks.push_back(BlockIter(blk, entry)); blk->reserve(&obj.train); - if(blk->get_sensor_id()) - obj.train.get_layout().get_driver().set_sensor(blk->get_sensor_id(), true); + if(blk->get_sensor_address()) + obj.train.get_layout().get_driver().set_sensor(blk->get_sensor_address(), true); prev_block = blk; } diff --git a/source/libr2c2/blockiter.cpp b/source/libr2c2/blockiter.cpp index a3f6d87..9dcca6c 100644 --- a/source/libr2c2/blockiter.cpp +++ b/source/libr2c2/blockiter.cpp @@ -40,7 +40,7 @@ const Block::Endpoint &BlockIter::endpoint() const int BlockIter::get_exit(const Route *route) const { const vector &eps = _block->get_endpoints(); - if(_block->get_turnout_id()) + if(_block->get_turnout_address()) { /* The endpoints of a turnout block exactly correspond to the endpoints of the track. */ diff --git a/source/libr2c2/layout.cpp b/source/libr2c2/layout.cpp index c2de1c5..c23ad38 100644 --- a/source/libr2c2/layout.cpp +++ b/source/libr2c2/layout.cpp @@ -39,7 +39,7 @@ namespace R2C2 { Layout::Layout(Catalogue &c, Driver *d): catalogue(c), driver(d), - next_turnout_id(0x800) + next_turnout_addr(0x800) { clock.set_rate(60); } @@ -227,18 +227,18 @@ void Layout::remove(BeamGate &g) remove(static_cast(g)); } -unsigned Layout::allocate_turnout_id() +unsigned Layout::allocate_turnout_address() { - set used_ids; + set used_addrs; const set &tracks = objects.get(); for(set::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) - if((*i)->get_turnout_id()) - used_ids.insert((*i)->get_turnout_id()); + if((*i)->get_turnout_address()) + used_addrs.insert((*i)->get_turnout_address()); - unsigned result = next_turnout_id; - while(used_ids.count(result)) + unsigned result = next_turnout_addr; + while(used_addrs.count(result)) ++result; - next_turnout_id = result+1; + next_turnout_addr = result+1; return result; } @@ -449,8 +449,8 @@ void Layout::save_dynamic(const string &fn) const const set &tracks = objects.get(); for(set::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) - if(unsigned tid = (*i)->get_turnout_id()) - writer.write((DataFile::Statement("turnout"), tid, (*i)->get_active_path())); + if(unsigned taddr = (*i)->get_turnout_address()) + writer.write((DataFile::Statement("turnout"), taddr, (*i)->get_active_path())); for(map::const_iterator i=trains.begin(); i!=trains.end(); ++i) { diff --git a/source/libr2c2/layout.h b/source/libr2c2/layout.h index 59eae08..d1428cf 100644 --- a/source/libr2c2/layout.h +++ b/source/libr2c2/layout.h @@ -88,7 +88,7 @@ private: Storage sensors; std::map trains; Msp::Time::TimeStamp last_tick; - unsigned next_turnout_id; + unsigned next_turnout_addr; public: Layout(Catalogue &, Driver * = 0); @@ -119,7 +119,7 @@ public: void remove(Sensor &); void remove(BeamGate &); - unsigned allocate_turnout_id(); + unsigned allocate_turnout_address(); Block &get_block(unsigned) const; void create_blocks(); diff --git a/source/libr2c2/route.cpp b/source/libr2c2/route.cpp index c8f1ed3..b3dc474 100644 --- a/source/libr2c2/route.cpp +++ b/source/libr2c2/route.cpp @@ -157,7 +157,7 @@ void Route::update_turnouts() for(set::const_iterator i=tracks.begin(); i!=tracks.end(); ++i) if((*i)->get_type().is_turnout()) { - found.insert((*i)->get_turnout_id()); + found.insert((*i)->get_turnout_address()); update_turnout(**i); } @@ -186,7 +186,7 @@ void Route::update_turnout(Track &track) if(link->get_type().is_turnout()) { const TrackType::Endpoint &link_ep = link->get_type().get_endpoint(link->get_link_slot(track)); - int p = get_turnout(link->get_turnout_id()); + int p = get_turnout(link->get_turnout_address()); if(p>=0 && !link_ep.has_path(p)) // The linked track is a turnout and has a path which is incompatible with this endpoint ep_mask = ~ep_mask; @@ -195,17 +195,17 @@ void Route::update_turnout(Track &track) mask &= ep_mask; } - unsigned tid = track.get_turnout_id(); + unsigned taddr = track.get_turnout_address(); if(mask && !(mask&(mask-1))) { // Exactly one possible choice, set the path accordingly unsigned path = 0; for(; (mask && !(mask&1)); mask>>=1, ++path) ; - turnouts[tid] = path; + turnouts[taddr] = path; } - else if(!turnouts.count(tid)) + else if(!turnouts.count(taddr)) // More than one possible choice, and no existing entry - set as undecided - turnouts[tid] = -1; + turnouts[taddr] = -1; } int Route::get_turnout(unsigned id) const @@ -218,9 +218,9 @@ int Route::get_turnout(unsigned id) const unsigned Route::get_path(Track &trk) const { - if(unsigned tid = trk.get_turnout_id()) + if(unsigned taddr = trk.get_turnout_address()) { - map::const_iterator i = turnouts.find(tid); + map::const_iterator i = turnouts.find(taddr); if(i!=turnouts.end()) return i->second; } @@ -295,7 +295,7 @@ void Route::Loader::finish() for(set::const_iterator i=ltracks.begin(); i!=ltracks.end(); ++i) if((*i)->get_type().is_turnout()) { - TurnoutMap::iterator j = turnouts.find((*i)->get_turnout_id()); + TurnoutMap::iterator j = turnouts.find((*i)->get_turnout_address()); if(j!=turnouts.end()) turnout_tracks[*i] = j->second; } diff --git a/source/libr2c2/signal.cpp b/source/libr2c2/signal.cpp index 73563b6..72b35a7 100644 --- a/source/libr2c2/signal.cpp +++ b/source/libr2c2/signal.cpp @@ -110,7 +110,7 @@ void Signal::tick(const Time::TimeDelta &) BlockIter iter = block.next(); while(iter && iter->get_train()==train) { - if(iter->get_sensor_id()) + if(iter->get_sensor_address()) ++n_blocks; iter=iter.next(); } @@ -160,7 +160,7 @@ void Signal::train_advanced(Block &b) { if(&b==block.block()) passing = true; - else if(passing && b.get_sensor_id()) + else if(passing && b.get_sensor_address()) { layout.get_driver().set_signal(address, type.get_indications().back().aspect); reset(); diff --git a/source/libr2c2/track.cpp b/source/libr2c2/track.cpp index 2515986..44d992b 100644 --- a/source/libr2c2/track.cpp +++ b/source/libr2c2/track.cpp @@ -33,20 +33,20 @@ Track::Track(Layout &l, const TrackType &t): block(0), slope(0), flex(false), - turnout_id(0), - sensor_id(0), + turnout_addr(0), + sensor_addr(0), links(type.get_endpoints().size()), active_path(0), path_changing(false) { if(type.is_turnout()) { - turnout_id = layout.allocate_turnout_id(); + turnout_addr = layout.allocate_turnout_address(); if(layout.has_driver()) { Driver &driver = layout.get_driver(); - driver.add_turnout(turnout_id, type); + driver.add_turnout(turnout_addr, type); driver.signal_turnout.connect(sigc::mem_fun(this, &Track::turnout_event)); } } @@ -60,8 +60,8 @@ Track::Track(Layout &l, const TrackType &t): Track::~Track() { break_links(); - if(layout.has_driver() && turnout_id) - layout.get_driver().remove_turnout(turnout_id); + if(layout.has_driver() && turnout_addr) + layout.get_driver().remove_turnout(turnout_addr); layout.remove(*this); } @@ -157,43 +157,43 @@ void Track::check_slope() signal_moved.emit(); } -void Track::set_turnout_id(unsigned i) +void Track::set_turnout_address(unsigned a) { if(!type.is_turnout()) throw logic_error("not a turnout"); - if(!i) + if(!a) throw invalid_argument("Track::set_turnout_id"); Driver *driver = (layout.has_driver() ? &layout.get_driver() : 0); - if(driver && turnout_id) - driver->remove_turnout(turnout_id); - turnout_id = i; + if(driver && turnout_addr) + driver->remove_turnout(turnout_addr); + turnout_addr = a; layout.create_blocks(*this); layout.update_routes(); - if(driver && turnout_id) - driver->add_turnout(turnout_id, type); + if(driver && turnout_addr) + driver->add_turnout(turnout_addr, type); } -void Track::set_sensor_id(unsigned i) +void Track::set_sensor_address(unsigned a) { if(type.is_turnout()) throw logic_error("is a turnout"); - sensor_id = i; + sensor_addr = a; layout.create_blocks(*this); } void Track::set_active_path(unsigned p) { - if(!turnout_id) + if(!turnout_addr) throw logic_error("not a turnout"); if(!(type.get_paths()&(1< &st) const st.push_back((DataFile::Statement("position"), position.x, position.y, position.z)); st.push_back((DataFile::Statement("rotation"), rotation.radians())); st.push_back((DataFile::Statement("tilt"), tilt.radians())); - if(turnout_id) - st.push_back((DataFile::Statement("turnout_id"), turnout_id)); - if(sensor_id) - st.push_back((DataFile::Statement("sensor_id"), sensor_id)); + if(turnout_addr) + st.push_back((DataFile::Statement("turnout_address"), turnout_addr)); + if(sensor_addr) + st.push_back((DataFile::Statement("sensor_address"), sensor_addr)); if(flex) st.push_back((DataFile::Statement("flex"), true)); } void Track::turnout_event(unsigned addr, unsigned state) { - if(addr==turnout_id) + if(addr==turnout_addr) { active_path = state; path_changing = false; @@ -423,8 +423,10 @@ Track::Loader::Loader(Track &t): add("position", &Loader::position); add("rotation", &Loader::rotation); add("tilt", &Loader::tilt); - add("turnout_id", &Loader::turnout_id); - add("sensor_id", &Loader::sensor_id); + add("turnout_id", &Loader::turnout_address); + add("turnout_address", &Loader::turnout_address); + add("sensor_id", &Loader::sensor_address); + add("sensor_address", &Loader::sensor_address); add("flex", &Track::flex); // deprecated @@ -441,9 +443,9 @@ void Track::Loader::rotation(float r) obj.set_rotation(Angle::from_radians(r)); } -void Track::Loader::sensor_id(unsigned id) +void Track::Loader::sensor_address(unsigned addr) { - obj.set_sensor_id(id); + obj.set_sensor_address(addr); } void Track::Loader::slope(float s) @@ -456,9 +458,9 @@ void Track::Loader::tilt(float t) obj.set_tilt(Angle::from_radians(t)); } -void Track::Loader::turnout_id(unsigned id) +void Track::Loader::turnout_address(unsigned addr) { - obj.set_turnout_id(id); + obj.set_turnout_address(addr); } } // namespace R2C2 diff --git a/source/libr2c2/track.h b/source/libr2c2/track.h index 79365af..1d8cd71 100644 --- a/source/libr2c2/track.h +++ b/source/libr2c2/track.h @@ -25,10 +25,10 @@ public: private: void position(float, float, float); void rotation(float); - void sensor_id(unsigned); + void sensor_address(unsigned); void slope(float); void tilt(float); - void turnout_id(unsigned); + void turnout_address(unsigned); }; typedef std::list AttachmentList; @@ -42,8 +42,8 @@ private: Block *block; float slope; bool flex; - unsigned turnout_id; - unsigned sensor_id; + unsigned turnout_addr; + unsigned sensor_addr; std::vector links; unsigned active_path; bool path_changing; @@ -70,10 +70,10 @@ private: void check_slope(); public: - void set_turnout_id(unsigned); - void set_sensor_id(unsigned); - unsigned get_turnout_id() const { return turnout_id; } - unsigned get_sensor_id() const { return sensor_id; } + void set_turnout_address(unsigned); + void set_sensor_address(unsigned); + unsigned get_turnout_address() const { return turnout_addr; } + unsigned get_sensor_address() const { return sensor_addr; } void set_active_path(unsigned); unsigned get_active_path() const { return active_path; } bool is_path_changing() const { return path_changing; } diff --git a/source/libr2c2/trackcircuit.cpp b/source/libr2c2/trackcircuit.cpp index 7efe4d0..851a2ba 100644 --- a/source/libr2c2/trackcircuit.cpp +++ b/source/libr2c2/trackcircuit.cpp @@ -10,7 +10,7 @@ TrackCircuit::TrackCircuit(Layout &l, Block &b): Sensor(l), block(b) { - Sensor::set_address(block.get_sensor_id()); + Sensor::set_address(block.get_sensor_address()); } void TrackCircuit::set_address(unsigned) diff --git a/source/libr2c2/train.cpp b/source/libr2c2/train.cpp index b166463..50ad137 100644 --- a/source/libr2c2/train.cpp +++ b/source/libr2c2/train.cpp @@ -255,7 +255,7 @@ BlockIter Train::get_first_noncritical_block() const dist += i->get_path_length(i.entry()); - if(i->get_sensor_id()) + if(i->get_sensor_address()) sensor_seen = true; } @@ -444,7 +444,7 @@ void Train::sensor_state_changed(Sensor &sensor, Sensor::State state) if(last_entry_block && &*last_entry_block!=block) { for(BlockIter i=last_entry_block.next(); (i && &*i!=block); i=i.next()) - if(i->get_train()!=this || i->get_sensor_id()) + if(i->get_train()!=this || i->get_sensor_address()) return; } diff --git a/source/libr2c2/trainrouter.cpp b/source/libr2c2/trainrouter.cpp index 100842b..b5a5bef 100644 --- a/source/libr2c2/trainrouter.cpp +++ b/source/libr2c2/trainrouter.cpp @@ -183,9 +183,9 @@ void TrainRouter::block_reserved(Block &block, Train *t) if(advance_route(route, block)) { // Check if the block is a turnout and set it to proper path - if(unsigned tid = block.get_turnout_id()) + if(unsigned taddr = block.get_turnout_address()) { - int path = (*route)->get_turnout(tid); + int path = (*route)->get_turnout(taddr); if(path>=0) b_iter.track_iter()->set_active_path(path); } diff --git a/source/libr2c2/vehicle.cpp b/source/libr2c2/vehicle.cpp index 02fb1af..099644a 100644 --- a/source/libr2c2/vehicle.cpp +++ b/source/libr2c2/vehicle.cpp @@ -247,7 +247,7 @@ void Vehicle::propagate_backward() void Vehicle::check_sensor(const TrackOffsetIter &t, unsigned &sensor, bool release) { - unsigned s = t->get_sensor_id(); + unsigned s = t->get_sensor_address(); if(s!=sensor) { unsigned old = sensor;