The latest Standard release has a stop moving feature, but Pak128.Britain doesn't have a button for this, I don't think - it would be a useful thing to add. We could use something similar to the stop upgrading button graphic, I think, perhaps with the 'bus stop sign on the left being greyed out and having the same colour head as the one on the right?
jamespetts
thank you that you that speak on.
Do you mean the "Replace a Stop" button?
Thank you wlindley i have that overview.
Quote from: wlindley on December 05, 2012, 06:38:13 PM
Do you mean the "Replace a Stop" button?
No, it's not the same - there's a new stop moving tool in the latest versions of Standard.
Quote from: jamespetts on December 05, 2012, 11:56:28 PM
No, it's not the same - there's a new stop moving tool in the latest versions of Standard.
What do you mean? I wasn't aware of this. :confused:
Could you please advise me? We are preparing a new release as well as you guys. ;)
Quote from: jamespetts on December 05, 2012, 11:56:28 PM
No, it's not the same - there's a new stop moving tool in the latest versions of Standard.
What does it do? Haven't read of it yet.
See this code in simwerkz.cc
image_id wkz_stop_moving_t::get_marker_image()
{
return cursor;
}
void wkz_stop_moving_t::read_start_position(karte_t *welt, spieler_t *sp, const koord3d &pos)
{
waytype[0] = invalid_wt;
waytype[1] = invalid_wt;
last_halt = halthandle_t();
grund_t *bd = welt->lookup(pos);
if (bd==NULL) {
return;
}
// now assign waytypes
if(bd->ist_wasser()) {
waytype[0] = water_wt;
}
else {
waytype[0] = bd->get_weg_nr(0)->get_waytype();
if(bd->get_weg_nr(1)) {
waytype[1] = bd->get_weg_nr(1)->get_waytype();
}
}
// .. and halt
last_halt = haltestelle_t::get_halt(welt,pos,sp);
}
uint8 wkz_stop_moving_t::is_valid_pos( karte_t *welt, spieler_t *sp, const koord3d &pos, const char *&error, const koord3d &start)
{
grund_t *bd = welt->lookup(pos);
if (bd==NULL) {
error = "";
return 0;
}
// check halt ownership
halthandle_t h = haltestelle_t::get_halt(welt,pos,sp);
if( h.is_bound() && !spieler_t::check_owner( sp, h->get_besitzer() ) ) {
error = "Das Feld gehoert\neinem anderen Spieler\n";
return 0;
}
// check for halt on the tile
if( h.is_bound() && !(bd->is_halt() || (h->get_station_type()&haltestelle_t::dock && bd->ist_wasser()) ) ) {
error = "No suitable ground!";
return 0;
}
if (start==koord3d::invalid) {
// check for existing ways
if (bd->ist_wasser() || bd->hat_wege()) {
return 2;
}
else {
error = "No suitable ground!";
return 0;
}
}
else {
// read conditions at start point
read_start_position(welt, sp, start);
// check halts vs waypoints
if(h.is_bound() ^ last_halt.is_bound()) {
error = "Can only move from halt to halt or waypoint to waypoint.";
return 0;
}
// check waytypes
if( (waytype[0] == water_wt && bd->ist_wasser()) || bd->hat_weg(waytype[0]) || bd->hat_weg(waytype[1]) ) {
// ok
return 2;
}
else {
error = "No suitable ground!";
return 0;
}
}
}
const char *wkz_stop_moving_t::do_work( karte_t *welt, spieler_t *sp, const koord3d &last_pos, const koord3d &pos)
{
// read conditions at start point
read_start_position(welt, sp, last_pos);
// second click
grund_t *bd = welt->lookup(pos);
halthandle_t h = haltestelle_t::get_halt(welt,pos,sp);
if (bd) {
const halthandle_t new_halt = h;
// depending on the waytype we simply build replacements lists
// in the worst case we have to iterate over all tiles twice ...
for( uint i=0; i<2; i++ ) {
const waytype_t wt = waytype[i];
slist_tpl <koord3d>old_platform;
if(bd->ist_wasser()) {
if(wt!=water_wt) {
break;
}
}
else if(!bd->hat_weg(wt)) {
continue;
}
// platform, stop or just tile moving?
const bool catch_all_halt = (wt==water_wt || wt==air_wt) && last_halt.is_bound();
if(!last_halt.is_bound()) {
old_platform.append(last_pos);
}
else if(!catch_all_halt) {
// builds a coordinate list
if(wt==road_wt) {
old_platform.append(last_pos);
}
else {
// all connected tiles for start pos
uint8 ribi = welt->lookup(last_pos)->get_weg_ribi_unmasked(wt);
koord delta = ribi_t::ist_gerade_ns(ribi) ? koord(0,1) : koord(1,0);
koord3d start_pos=last_pos;
while(ribi&12) {
koord3d test_pos = start_pos+delta;
grund_t *gr = welt->lookup(test_pos);
if(!gr || !gr->is_halt() || (ribi=gr->get_weg_ribi_unmasked(wt))==0) {
break;
}
start_pos = test_pos;
}
// now add all of them
while(ribi&3) {
koord3d test_pos = start_pos-delta;
grund_t *gr = welt->lookup(test_pos);
old_platform.append(start_pos);
if(!gr || !gr->is_halt() || (ribi=gr->get_weg_ribi_unmasked(wt))==0) {
break;
}
start_pos = test_pos;
}
}
}
// first, check convoi without line
FOR(vector_tpl<convoihandle_t>, const cnv, welt->convoys()) {
// check line and owner
if(!cnv->get_line().is_bound() && cnv->get_besitzer()==sp) {
schedule_t *fpl = cnv->get_schedule();
// check waytype
if(fpl && fpl->ist_halt_erlaubt(bd)) {
bool updated = false;
FOR(minivec_tpl<linieneintrag_t>, & k, fpl->eintrag) {
if ((catch_all_halt && haltestelle_t::get_halt(welt, k.pos, cnv->get_besitzer()) == last_halt) ||
old_platform.is_contained(k.pos)) {
k.pos = pos;
updated = true;
}
}
if(updated) {
fpl->cleanup();
// Knightly : remove lineless convoy from old stop
if( last_halt.is_bound() ) {
last_halt->remove_convoy(cnv);
}
// Knightly : register lineless convoy at new stop
if( new_halt.is_bound() ) {
new_halt->add_convoy(cnv);
}
if( !fpl->ist_abgeschlossen() ) {
// schedule is not owned by schedule window ...
// ... thus we can set this schedule
cnv->set_schedule(fpl);
// otherwise the schedule window will reset it
}
}
}
}
}
// next, check lines serving old_halt (no owner check needed for own lines ...
vector_tpl<linehandle_t>lines;
sp->simlinemgmt.get_lines(simline_t::line,&lines);
FOR(vector_tpl<linehandle_t>, const line, lines) {
schedule_t *fpl = line->get_schedule();
// check waytype
if(fpl->ist_halt_erlaubt(bd)) {
bool updated = false;
FOR(minivec_tpl<linieneintrag_t>, & k, fpl->eintrag) {
// ok!
if ((catch_all_halt && haltestelle_t::get_halt(welt, k.pos, line->get_besitzer()) == last_halt) ||
old_platform.is_contained(k.pos)) {
k.pos = pos;
updated = true;
}
}
// update line
if(updated) {
fpl->cleanup();
// remove line from old stop is needed at here
if(last_halt.is_bound()) {
last_halt->remove_line(line);
}
sp->simlinemgmt.update_line(line);
}
}
}
}
// since factory connections may have changed
// Modified by : Knightly
path_explorer_t::refresh_all_categories(true);
}
return NULL;
}
It could be related to this extension request (http://forum.simutrans.com/index.php?topic=10480), but it should be basically the same tool. I really wish someone could enlight us.