From 920a7e91fe0f73476fa4af2e50668e2bdc2a1cc0 Mon Sep 17 00:00:00 2001 From: Yona-TYT Date: Tue, 24 Mar 2026 02:13:22 -0400 Subject: [PATCH] Fix is_stop_allowed_ex --- class/class_basic_chapter.nut | 55 +++++++++++++++-------------------- class/class_chapter_04.nut | 10 ++++--- 2 files changed, 30 insertions(+), 35 deletions(-) diff --git a/class/class_basic_chapter.nut b/class/class_basic_chapter.nut index 301623e..b31d29e 100644 --- a/class/class_basic_chapter.nut +++ b/class/class_basic_chapter.nut @@ -2256,7 +2256,7 @@ class basic_chapter function is_stop_allowed_ex(tile, list, pos, wt) { local result = get_tile_message(3, tile) - local t_list = is_water_entry(list) + local c2d = "coord" local t = tile_x(pos.x, pos.y, pos.z) local buil = t.find_object(mo_building) local is_wt = buil ? buil.get_waytype():null @@ -2271,24 +2271,19 @@ class basic_chapter local get_cl = square_x(pos.x, pos.y).get_climate() local st_count = 0 for ( local j = 0; j < list.len(); j++ ) { - if ( glsw[j] == 1 ) + if ( tmpsw[j] == 1 ) st_count++ } - if ( st_count < list.len() ) { - local j = 0 - local c2d = "coord" - foreach(t in t_list){ - local c = list[j] + if ( st_count < list.len() ) { + local c = list[st_count] local type = typeof(c) local st_t = type == c2d ? my_tile(c) : tile_x(c.x, c.y, c.z) local halt = st_t.get_halt() local tile_list = halt.get_tile_list() local max = tile_list.len() - //local c_lim_list = {a = tile_list[0], b = tile_list[max-1]} - //gui.add_message(""+j+" :: "+tmpsw[j]) - if(tmpsw[j] == 0){ - //if(max == 1 && t.is_water()) return check_water_tile(result, tile_list[0], pos, j) + if(tmpsw[st_count] == 0){ + //Water weather checker or wt_water if(wt == wt_water && t.is_water()){ local area = get_tiles_near_stations(tile_list) for( local i = 0; i < area.len(); i++ ) { @@ -2297,40 +2292,38 @@ class basic_chapter //gui.add_message(""+t_water.x+","+t_water.y+"") if (pos.x == t_water.x && pos.y == t_water.y){ if ( t_water.is_water() ) { - tmpsw[j] = 1 - tmpcoor.push(t) + tmpsw[st_count] = 1 + tmpcoor.push(pos) result = null break } else - result = format(translate("Select station No.%d"),j+1)+" ("+c.tostring()+")." + result = format(translate("Select station No.%d"),st_count+1)+" ("+c.tostring()+")." } else - result = format(translate("Select station No.%d"),j+1)+" ("+c.tostring()+")." + result = format(translate("Select station No.%d"),st_count+1)+" ("+c.tostring()+")." } return result } - foreach(tile in tile_list){ - if (pos.x == tile.x && pos.y == tile.y && pos.z == tile.z){ - if(has_way && wt == is_wt){ - tmpsw[j] = 1 - tmpcoor.push(st_t) - return null - } - else - return format(translate("Select station No.%d"),j+1)+" ("+c.tostring()+")." + + //If they are land vehicles + foreach(tile in tile_list){ + if (pos.x == tile.x && pos.y == tile.y && pos.z == tile.z){ + if(has_way && wt == is_wt){ + tmpsw[st_count] = 1 + tmpcoor.push(pos) + return null } + else + return format(translate("Select station No.%d"),st_count+1)+" ("+c.tostring()+")." } - return format(translate("Select station No.%d"),j+1)+" ("+c.tostring()+")." } - j++ - if (j == t_list.len()) - return result + return format(translate("Select station No.%d"),st_count+1)+" ("+c.tostring()+")." } } - - return 0 + return result } + function get_c_key(c, i){ local res = ("coord_" + c.x + "_" + c.y + "_" + c.z +"_"+i).toalnum() gui.add_message(""+res) @@ -3777,4 +3770,4 @@ function select_cube(tile_a, tile_b, obj = "") { return cube } -// END OF FILE \ No newline at end of file +// END OF FILE diff --git a/class/class_chapter_04.nut b/class/class_chapter_04.nut index 4f9fb39..15a69ed 100644 --- a/class/class_chapter_04.nut +++ b/class/class_chapter_04.nut @@ -84,12 +84,14 @@ class tutorial.chapter_04 extends basic_chapter d1_cnr = get_dep_cov_nr(ch4_cov_lim1.a,ch4_cov_lim1.b) d2_cnr = get_dep_cov_nr(ch4_cov_lim2.a,ch4_cov_lim2.b) - /*local pl = 0 + //Schedule list form current convoy + local pl = 0 if(this.step == 7){ local c_dep = this.my_tile(ship_depot) local c_list = ch4_schedule_line3 //sch_list3 start_sch_tmpsw(pl, c_dep, c_list) - }*/ + } + return 0 } @@ -404,7 +406,7 @@ class tutorial.chapter_04 extends basic_chapter case 7: local c_dep = this.my_tile(ship_depot) - local line_name = line1_name + local line_name = line3_name set_convoy_schedule(pl, c_dep, gl_wt, line_name) if(current_cov == ch4_cov_lim3.b){ this.next_step() @@ -608,7 +610,7 @@ class tutorial.chapter_04 extends basic_chapter local c_list = ch4_schedule_line3 //sch_list3 return compare_schedule(result, pl, schedule, selc, load, time, c_list, true) if(result == null){ - local line_name = line1_name + local line_name = line3_name update_convoy_schedule(pl, gl_wt, line_name, schedule) } return result