The International Simutrans Forum

 

Author Topic: command_x causes Simutrans to crash.  (Read 740 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1822
    • Simutrans-BLOG
  • Languages: ES
command_x causes Simutrans to crash.
« on: March 28, 2020, 12:03:14 AM »

When using script text tag with "command_x" to build a road section, simutrans stops working and the terminal shows this: "sim: boden/wege/weg.cc:87: static weg_t* weg_t::alloc(waytype_t): Assertion `0' failed."
This is not present in older reviews, so I am assuming something has broken recently.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4944
  • Languages: EN, DE, AT
Re: command_x causes Simutrans to crash.
« Reply #1 on: March 28, 2020, 10:46:34 AM »
Can you post the script text that triggers the error? Is this related to building of powerlines?
« Last Edit: March 28, 2020, 11:00:24 AM by Dwachs »

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1822
    • Simutrans-BLOG
  • Languages: ES
Re: command_x causes Simutrans to crash.
« Reply #2 on: March 28, 2020, 11:31:04 AM »
Script:
https://www.mediafire.com/file/bvwsl0i5y1jec6m/tutorial_pak128-error-test.zip/file

Savegame:
https://www.mediafire.com/file/6a9oz6vt1lv5u8n/tutorial_pak128-error-test.sve/file

Click on the link "go to next step", this will execute the following code block:

file "class/class_chapter_02.nut" line 1234
Code: [Select]
switch (this.step) {
            case 1:
                delay_mark_tile(coordb, coordb,0, true)
                //Para la carretera
                local t1 = command_x(tool_remover)
                local err1 = t1.work(player_x(0), square_x(coordb.x, coordb.y).get_ground_tile(), "")
                local t2 = command_x(tool_build_way)           
                local err2 = t2.work(player_x(0), square_x( coorda.x, coorda.y ).get_ground_tile(), square_x(coordb.x, coordb.y).get_ground_tile(),"Road_070")
                return null
                break;

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4944
  • Languages: EN, DE, AT
Re: command_x causes Simutrans to crash.
« Reply #3 on: March 28, 2020, 12:24:23 PM »
Will check.

Please use command_x::build_way for this purpose:

http://dwachs.github.io/simutrans-sqapi-doc/classcommand__x.html#a1881d81fa6116af1227429b1c7f7699c

It has more parameter checks than command_x::work

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4944
  • Languages: EN, DE, AT
Re: command_x causes Simutrans to crash.
« Reply #4 on: March 28, 2020, 02:40:32 PM »
should work with r8981 again.