New map features

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

cirdan wrote:I'll try to look into this.
:bow:
Hafting
Engineer
Engineer
Posts: 106
Joined: 13 Feb 2014 11:22

Re: New map features

Post by Hafting »

Crash when trying to upgrade newgrfs.

openttd -s null
Make sure language is set to "Norwegian (Bokmal)", because it won't crash with english!
"Check online content" (Se etter innhold på nett)
"Select upgrades" (Velg oppgraderinger)
Scroll to "FIRS 2" which is selected for upgrade - I have an older version
Click on "FIRS 2" hoping to see some info text - but the game crashes. Log below.

I can work around the crash by switching to english language before downloading newgrfs. Playing the game works with Norwegian.

I have choosen a large font that is more pleasant for my eyes. Text often spills outside of boxes and is drawn onto the game area (instead of proper line breaking / horizontal scrolling in the box). I don't know if that may have anything to do with the crash. During gameplay it is a bit annoying with garbage text remnants on the game - but I haven't seen it crash.
My font settings from openttd.cfg, in case this matters:

Code: Select all

small_font = DejaVu Sans, bold
medium_font = DejaVu Sans, bold
large_font = DejaVu Sans, bold
mono_font = DejaVu Sans
small_size = 12
medium_size = 16
large_size = 22
mono_size = 16
small_aa = false
medium_aa = false
large_aa = false
mono_aa = false
The crash log:

Code: Select all

openttd: /usr/src/fttd/src/gfx_layout.cpp:602: virtual void FallbackParagraphLayout::build(ParagraphBuilder::LineVector*, int, bool): Assertion `iter != this->runs.end()' failed.
Crash encountered, generating crash log...
*** OpenTTD Crash Report ***

Crash at: Wed Apr 19 09:19:31 2017
In game date: 2051-05-09 (27)

Crash reason:
 Signal:  Aborted (6)
 Message: <none>

Binary:
 Version:    g174edb7a (0)
 NewGRF ver: 17006c20
 Build date: Apr  3 2017 14:36:57
 Flags:      64-bit little-endian

Stacktrace:
 [00] openttd(_ZNK12CrashLogUnix13LogStacktraceEP7stringb+0x69) [0x704819]
 [01] openttd(_ZNK8CrashLog12FillCrashLogEP7stringb+0x122) [0x5fb372]
 [02] openttd(_ZNK8CrashLog12MakeCrashLogEv+0xa4) [0x5fbd64]
 [03] openttd() [0x704742]
 [04] /usr/lib/libc.so.6(+0x33a90) [0x7fb82bacda90]
 [05] /usr/lib/libc.so.6(gsignal+0x110) [0x7fb82bacda10]
 [06] /usr/lib/libc.so.6(abort+0x17a) [0x7fb82bacf13a]
 [07] /usr/lib/libc.so.6(+0x2c607) [0x7fb82bac6607]
 [08] /usr/lib/libc.so.6(+0x2c6b2) [0x7fb82bac66b2]
 [09] openttd(_ZN23FallbackParagraphLayout5buildEPSt6vectorISt10unique_ptrIKN17ParagraphLayouter4LineESt14default_deleteIS4_EESaIS7_EEib+0x4cf) [0x6418ef]
 [10] openttd(_ZN8LayouterC2EPKci10TextColour8FontSize+0x31f) [0x6420af]
 [11] openttd(_Z19DrawStringMultiLineP8BlitAreaiiiiPKc10TextColour15StringAlignmentb8FontSize+0x4d) [0x64076d]
 [12] openttd(_Z19DrawStringMultiLineP8BlitAreaiiiit10TextColour15StringAlignmentb8FontSize+0x8d) [0x6409dd]
 [13] openttd(_ZNK24NetworkContentListWindow11DrawDetailsEP8BlitAreaRK4Rect+0x5c4) [0x6a0b04]
 [14] openttd(_ZN17NWidgetBackground4DrawEP8BlitAreaPK6Window+0x3c6) [0x8425e6]
 [15] openttd(_ZN19NWidgetPIPContainer4DrawEP8BlitAreaPK6Window+0x27) [0x8401e7]
 [16] openttd(_ZN19NWidgetPIPContainer4DrawEP8BlitAreaPK6Window+0x27) [0x8401e7]
 [17] openttd(_ZN19NWidgetPIPContainer4DrawEP8BlitAreaPK6Window+0x27) [0x8401e7]
 [18] openttd(_ZN17NWidgetBackground4DrawEP8BlitAreaPK6Window+0x134) [0x842354]
 [19] openttd(_ZN19NWidgetPIPContainer4DrawEP8BlitAreaPK6Window+0x27) [0x8401e7]
 [20] openttd(_ZNK6Window11DrawWidgetsEP8BlitArea+0x22) [0x843362]
 [21] openttd(_ZN24NetworkContentListWindow7OnPaintEP8BlitArea+0x2a) [0x6a04ba]
 [22] openttd(_Z26DrawOverlappedWindowForAlliiii+0x85) [0x849c55]
 [23] openttd(_Z16RedrawScreenRectiiii+0x52) [0x63fb22]
 [24] openttd(_Z15DrawDirtyBlocksv+0x11e) [0x63fd2e]
 [25] openttd(_Z13UpdateWindowsv+0xe3) [0x84ba33]
 [26] openttd(_ZN15VideoDriver_SDL8MainLoopEv+0x1f9) [0x832219]
 [27] openttd(_Z12openttd_mainiPPc+0x130e) [0x6f71de]
 [28] /usr/lib/libc.so.6(__libc_start_main+0xf1) [0x7fb82baba511]
 [29] openttd(_start+0x2a) [0x55da9a]

Operating system:
 Name:     Linux
 Release:  4.10.6-1-ARCH
 Version:  #1 SMP PREEMPT Mon Mar 27 08:28:22 CEST 2017
 Machine:  x86_64
 Compiler: GCC 6.3.1 "6.3.1 20170306"

Configuration:
 Blitter:      32bpp-sse4-anim
 Graphics set: aBase (5981)
 Language:     /usr/local/share/games/openttd/lang/norwegian_bokmal.lng
 Music driver: extmidi
 Music set:    NoMusic (0)
 Network:      no
 Sound driver: null
 Sound set:    NoSound (2)
 Video driver: sdl

Fonts:
 Small:  DejaVu Sans
 Medium: DejaVu Sans
 Large:  DejaVu Sans
 Mono:   sprite

AI Configuration (local: 0):
  0: Human

Libraries:
 FontConfig: 2.12.1
 FreeType:   2.7.1
 ICU i18n:   58.2
 LZMA:       5.2.3
 LZO:        2.10
 PNG:        1.6.29
 SDL:        1.2.15
 Zlib:       1.2.11

---- gamelog start ----
Tick 62675: Load game
    Conversion from OTTD savegame without gamelog, version 0, 1
    Revision text changed to g174edb7a, savegame version 24, not modified, newgrf version 0x17006c20
    New game mode 0, landscape 1
    Added NewGRF: GRF ID F1250006, checksum D30B7D445FCF33F3FA16232376E2B073, filename: firs.grf (md5sum matches)
    Added NewGRF: GRF ID 52571201, checksum 9548AAA21E5B7E8168B3B19EF8290A83, filename: grvts32.grf (md5sum matches)
    Added NewGRF: GRF ID 44440A01, checksum FCEEC76CF44EC23E7FE9C88048CF11CC, filename: av8_aviators_aircraft_set-2.21/pb_av8w.grf (md5sum matches)
    Added NewGRF: GRF ID 48530101, checksum EC17E22A38C037D156BD22A96F4A8523, filename: reduced_passenger_payment.1.0/reducedpassengerpayment.grf (md5sum matches)
    Added NewGRF: GRF ID 54670901, checksum F3699B81A7B2BB59EABD49164AE53796, filename: TGrandom.grf (md5sum matches)
    Added NewGRF: GRF ID 44440000, checksum 31B0CA7C9CBB983F6BDD88E66FC45048, filename: pineapple_trains-1.3/pb_trains_10cc.grf (md5sum matches)
    Added NewGRF: GRF ID 4A430002, checksum 332F5EE83BB1A8F7C1766E610B48A222, filename: indstatr_32.grf (md5sum matches)
    Added NewGRF: GRF ID 4D4E0103, checksum 0727CAF0B249F0D3BD08E6140657FC27, filename: modified_bridge_properties.0.3/bridgeprop.grf (md5sum matches)
    Added NewGRF: GRF ID 49430101, checksum 610AF54AE23E75ED0F6BD2058144A4C0, filename: varivar_townhouses.grf (md5sum matches)
    Added NewGRF: GRF ID 4D470305, checksum 2E96B9AB2BEA686BFF94961AD433A701, filename: basecosts-5.0/basecosts.grf (md5sum matches)
    Added NewGRF: GRF ID 414E0201, checksum 0DA3A80B986BC3C17C20CA4CE9CA26AA, filename: fish_2-2.0.3/fish.grf (md5sum matches)
    Game loaded
---- gamelog end ----

*** End of OpenTTD Crash Report ***

Attachments
Crash png
Crash png
crash.png (328.85 KiB) Viewed 510 times
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

The function that triggered the assertion was a mess, so I have rewritten it. Can you try the attached patch? It may or may not solve your problem but, even if it does not, the error message should be more informative.
Attachments
fix.diff
(10.49 KiB) Downloaded 58 times
Hafting
Engineer
Engineer
Posts: 106
Joined: 13 Feb 2014 11:22

Re: New map features

Post by Hafting »

cirdan wrote:The function that triggered the assertion was a mess, so I have rewritten it. Can you try the attached patch? It may or may not solve your problem but, even if it does not, the error message should be more informative.
Tried the patch. It makes a lot of difference, but the crash is still possible.
The big difference is that text no longer prints outside its window, with the largish font I use. Instead, the text either gets broken into lines, or shortened with "...". Much better than the mess I had, and it seems there is improvement for all game windows. I can now see all the cargoes a station accepts, instead of having some of the cargoes printed outside the window and then have the text wiped out by a passing train.

The "newgrf info window" can still crash, but it is harder to crash now. If I look at the information about the "FIRS 2" newgrf, it doesn't crash immediately. Also, the display is much improved with long strings shortened to "..." instead of messing up. Still, I can crash the game if I grab the window resize control and moves the mouse back and forth. The window is then resized big-small-big-small-big-small with text being re-broken continously to fit the varying size. Suddenly it crashes, like this:

Code: Select all

*** OpenTTD Crash Report ***

Crash at: Sat Apr 22 14:45:51 2017
In game date: 2051-05-09 (27)

Crash reason:
 Signal:  Aborted (6)
 Message: <none>

Binary:
 Version:    g174edb7aM (2)
 NewGRF ver: 17006c20
 Build date: Apr 22 2017 15:28:53
 Flags:      64-bit little-endian

Stacktrace:
 [00] openttd() [0x6dc77c]
 [01] openttd() [0x7857f3]
 [02] openttd() [0x6dc74a]
 [03] /usr/lib/libc.so.6(+0x33a90) [0x7f437e08aa90]
 [04] /usr/lib/libc.so.6(gsignal+0x110) [0x7f437e08aa10]
 [05] /usr/lib/libc.so.6(abort+0x17a) [0x7f437e08c13a]
 [06] /usr/lib/libc.so.6(+0x2c607) [0x7f437e083607]
 [07] /usr/lib/libc.so.6(+0x2c6b2) [0x7f437e0836b2]
 [08] openttd() [0x543250]
 [09] openttd() [0x553d3f]
 [10] openttd() [0x55652a]
 [11] openttd() [0x7a66c2]
 [12] openttd() [0x56161f]
 [13] openttd() [0x724804]
 [14] openttd() [0x71b08f]
 [15] openttd() [0x71b08f]
 [16] openttd() [0x71b08f]
 [17] openttd() [0x724819]
 [18] openttd() [0x71b08f]
 [19] openttd() [0x723e82]
 [20] openttd() [0x567f6a]
 [21] openttd() [0x5548a3]
 [22] openttd() [0x554a4e]
 [23] openttd() [0x6ffa9b]
 [24] openttd() [0x735a22]
 [25] openttd() [0x5ef907]
 [26] /usr/lib/libc.so.6(__libc_start_main+0xf1) [0x7f437e077511]
 [27] openttd(_start+0x2a) [0x4a246a]

Operating system:
 Name:     Linux
 Release:  4.10.4-1-ARCH
 Version:  #1 SMP PREEMPT Sat Mar 18 19:39:18 CET 2017
 Machine:  x86_64
 Compiler: GCC 6.3.1 "6.3.1 20170306"

Configuration:
 Blitter:      32bpp-sse4-anim
 Graphics set: aBase (5981)
 Language:     /usr/local/share/games/openttd/lang/norwegian_bokmal.lng
 Music driver: extmidi
 Music set:    NoMusic (0)
 Network:      no
 Sound driver: null
 Sound set:    OpenSFX (87)
 Video driver: sdl

Fonts:
 Small:  DejaVu Sans
 Medium: DejaVu Sans
 Large:  DejaVu Sans
 Mono:   sprite

AI Configuration (local: 0):
  0: Human

Libraries:
 FontConfig: 2.12.1
 FreeType:   2.7.1
 ICU i18n:   58.2
 LZMA:       5.2.3
 LZO:        2.10
 PNG:        1.6.29
 SDL:        1.2.15
 Zlib:       1.2.11

---- gamelog start ----
Tick 62675: Load game
    Conversion from OTTD savegame without gamelog, version 0, 1
    Revision text changed to g174edb7aM, savegame version 24, modified, newgrf version 0x17006c20
    New game mode 0, landscape 1
    Added NewGRF: GRF ID F1250006, checksum 3B24D72836131418F01716ED2B6797E0, filename: firs.grf (md5sum matches)
    Added NewGRF: GRF ID 54670901, checksum F3699B81A7B2BB59EABD49164AE53796, filename: TGrandom.grf (md5sum matches)
    Added NewGRF: GRF ID FBFB9905, checksum F747797A14AAA646402DC4E16DE5E82C, filename: longer_girder__steel_bridge.1/longergirdersteelbridge.grf (md5sum matches)
    Added NewGRF: GRF ID 48530101, checksum EC17E22A38C037D156BD22A96F4A8523, filename: reduced_passenger_payment.1.0/reducedpassengerpayment.grf (md5sum matches)
    Added NewGRF: GRF ID 52571201, checksum 9548AAA21E5B7E8168B3B19EF8290A83, filename: grvts32.grf (md5sum matches)
    Added NewGRF: GRF ID 44440A01, checksum FCEEC76CF44EC23E7FE9C88048CF11CC, filename: av8_aviators_aircraft_set-2.21/pb_av8w.grf (md5sum matches)
    Added NewGRF: GRF ID 4A430002, checksum 332F5EE83BB1A8F7C1766E610B48A222, filename: indstatr_32.grf (md5sum matches)
    Added NewGRF: GRF ID 44440000, checksum 31B0CA7C9CBB983F6BDD88E66FC45048, filename: pineapple_trains-1.3/pb_trains_10cc.grf (md5sum matches)
    Added NewGRF: GRF ID 4D4E0103, checksum 0727CAF0B249F0D3BD08E6140657FC27, filename: modified_bridge_properties.0.3/bridgeprop.grf (md5sum matches)
    Added NewGRF: GRF ID 414E0201, checksum 536506BDDDBD8644815FC2E7E6A80D7A, filename: fish_2-2.0.2/fish.grf (md5sum matches)
    Game loaded
---- gamelog end ----

*** End of OpenTTD Crash Report ***
The stack trace is a bit minimalistic - I though --enable-debug was supposed to help with that? I re-ran in gdb, the crash being easy enough to reproduce:

Code: Select all

$ gdb /usr/local/games/openttd
GNU gdb (GDB) 7.12.1
Copyright (C) 2017 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/games/openttd...done.
(gdb) run -s null
Starting program: /usr/local/games/openttd -s null
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffd017b700 (LWP 23702)]
[Thread 0x7fffd017b700 (LWP 23702) exited]
[New Thread 0x7fffd017b700 (LWP 23708)]
[New Thread 0x7fffcf97a700 (LWP 23709)]
[Thread 0x7fffd017b700 (LWP 23708) exited]
[New Thread 0x7fffd017b700 (LWP 24260)]
[Thread 0x7fffd017b700 (LWP 24260) exited]
openttd: /usr/src/cirdan/src/gfx_layout.cpp:632: virtual void FallbackParagraphLayout::build(ParagraphBuilder::LineVector*, int, bool): Assertion `last_space >= begin' failed.

Thread 1 "openttd" received signal SIGABRT, Aborted.
0x00007ffff3a51a10 in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff3a51a10 in raise () from /usr/lib/libc.so.6
#1  0x00007ffff3a5313a in abort () from /usr/lib/libc.so.6
#2  0x00007ffff3a4a607 in __assert_fail_base () from /usr/lib/libc.so.6
#3  0x00007ffff3a4a6b2 in __assert_fail () from /usr/lib/libc.so.6
#4  0x0000000000543250 in FallbackParagraphLayout::build (this=0x135f740, v=0x7fffffffa370, 
    max_width=506) at /usr/src/cirdan/src/gfx_layout.cpp:632
#5  0x0000000000553d3f in Layouter::Layouter (this=0x7fffffffa370, str=<optimized out>, maxw=506, 
    colour=<optimized out>, fontsize=<optimized out>) at /usr/src/cirdan/src/gfx_layout.cpp:901
#6  0x000000000055652a in DrawStringMultiLine (dpi=0x7fffffffb690, left=537, right=1042, top=417, 
    bottom=583, str=<optimized out>, colour=TC_BEGIN, align=SA_LEFT, underline=false, 
    fontsize=FS_NORMAL) at /usr/src/cirdan/src/gfx.cpp:611
#7  0x00000000007a66c2 in DrawStringMultiLine(BlitArea*, int, int, int, int, unsigned short, TextColour, StringAlignment, bool, FontSize) [clone .constprop.1672] (dpi=0x7fffffffb690, left=537, 
    right=1042, top=417, bottom=583, str=<optimized out>, align=SA_LEFT, fontsize=FS_NORMAL, 
    underline=false, colour=TC_BEGIN) at /usr/src/cirdan/src/gfx.cpp:671
#8  0x000000000056161f in DrawDetails (this=<optimized out>, dpi=0x7fffffffb690, r=...)
    at /usr/src/cirdan/src/network/network_content_gui.cpp:768
#9  0x0000000000724804 in Draw (this=0x1227a70, dpi=0x7fffffffb690, w=0x12268e0)
    at /usr/src/cirdan/src/widget.cpp:1757
#10 0x000000000071b08f in Draw (this=<optimized out>, dpi=0x7fffffffb690, w=0x12268e0)
    at /usr/src/cirdan/src/widget.cpp:1011
#11 0x000000000071b08f in Draw (this=<optimized out>, dpi=0x7fffffffb690, w=0x12268e0)
    at /usr/src/cirdan/src/widget.cpp:1011
#12 0x000000000071b08f in Draw (this=<optimized out>, dpi=0x7fffffffb690, w=0x12268e0)
    at /usr/src/cirdan/src/widget.cpp:1011
#13 0x0000000000724819 in Draw (this=0x1225770, dpi=0x7fffffffb690, w=0x12268e0)
    at /usr/src/cirdan/src/widget.cpp:1758
#14 0x000000000071b08f in Draw (this=<optimized out>, dpi=0x7fffffffb690, w=0x12268e0)
    at /usr/src/cirdan/src/widget.cpp:1011
#15 0x0000000000723e82 in Window::DrawWidgets(BlitArea*) const (this=<optimized out>, 
    dpi=<optimized out>, dpi=<optimized out>, this=<optimized out>)
    at /usr/src/cirdan/src/widget.cpp:504
#16 0x0000000000567f6a in NetworkContentListWindow::OnPaint(BlitArea*) (this=0x12268e0, 
    dpi=0x7fffffffb690) at /usr/src/cirdan/src/network/network_content_gui.cpp:665
#17 0x00000000005548a3 in DrawOverlappedWindowForAll (bottom=991, right=1152, top=280, left=960)
    at /usr/src/cirdan/src/window.cpp:931
#18 RedrawScreenRect (left=960, top=280, right=1152, bottom=991) at /usr/src/cirdan/src/gfx.cpp:1182
#19 0x0000000000554a4e in DrawDirtyBlocks () at /usr/src/cirdan/src/gfx.cpp:1274
#20 0x00000000006ffa9b in UpdateWindows () at /usr/src/cirdan/src/window.cpp:3008
#21 0x0000000000735a22 in VideoDriver_SDL::MainLoop (this=0x10afa20)
    at /usr/src/cirdan/src/video/sdl_v.cpp:773
#22 0x00000000005ef907 in openttd_main (argc=<optimized out>, argv=<optimized out>)
    at /usr/src/cirdan/src/openttd.cpp:882
#23 0x00007ffff3a3e511 in __libc_start_main () from /usr/lib/libc.so.6
#24 0x00000000004a246a in _start ()
I hope this helps.


There have been another problem for some time too. It doesn't affect gameplay, but everytime I leave the game, it writes a crash log as if the game crashed. But I merely used exit "back to unix".
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

Hafting wrote:Tried the patch. It makes a lot of difference, but the crash is still possible. The big difference is that text no longer prints outside its window, with the largish font I use. Instead, the text either gets broken into lines, or shortened with "...". Much better than the mess I had, and it seems there is improvement for all game windows. I can now see all the cargoes a station accepts, instead of having some of the cargoes printed outside the window and then have the text wiped out by a passing train.
That is what happens when you report bugs: they get fixed. :-)
Hafting wrote:The "newgrf info window" can still crash, but it is harder to crash now.
Slight oversight on my part. The attached patch should work better.
Hafting wrote:The stack trace is a bit minimalistic - I though --enable-debug was supposed to help with that?
Yes, it does not look like a stack trace from a debug build.
Hafting wrote:There have been another problem for some time too. It doesn't affect gameplay, but everytime I leave the game, it writes a crash log as if the game crashed. But I merely used exit "back to unix".
The attached patch should fix this as well.
Attachments
fix2.diff
(10.79 KiB) Downloaded 54 times
Hafting
Engineer
Engineer
Posts: 106
Joined: 13 Feb 2014 11:22

Re: New map features

Post by Hafting »

This is perfect. I can no longer crash using the newgrf info window, and quitting a game no longer results in a crash report. The text breaks nicely too. Thanks!

Helge Hafting
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

I have updated the repository with the fix (and three months' worth of other commits). These are the most noticeable user-visible changes:
  • Both rail types are now shown in the land query window for tiles having tracks of different types. This was a long-standing bug that was not fixed earlier due to lack of string translations.
  • Trains with a full load order will now try to load all wagons in parallel as cargo comes in, instead of sequentially.
  • NewGRF rail continuation did not handle custom bridge heads correctly.
  • Fixed a crash that could happen when a paragraph had to be broken into lines and a break happened at a text colour change (reported by Hafting).
  • Fixed a miscomputation of text widths that could cause text to overflow their windows (also reported by Hafting).
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

cirdan wrote:I have updated the repository with the fix (and three months' worth of other commits).
:bow:

Compile failed:

Code: Select all

[SRC] Compiling script/script_instance.cpp
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/script_instance.cpp: In member function 'virtual void ScriptInstance::RegisterAPI()':
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/script_instance.cpp:145:67: error: 'min<SQInteger>' is not a valid template argument for type 'SQ
Integer (*)(long long int, long long int) {aka long long int (*)(long long int, long long int)}' because function 'T min(T, T) [with T = long long int]' has not
 external linkage
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/script_instance.cpp:145:67: error: no matching function for call to 'ScriptInstance::AddMethod(const char [4], <unresolved overloaded function type>, int, const char [4])'
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/script_instance.cpp:145:67: note: candidate is:
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/../script/squirrel.hpp:96:7: note: void Squirrel::AddMethod(const char*, SQFUNCTION, uint, const char*, void*, int)
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/../script/squirrel.hpp:96:7: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to 'SQFUNCTION {aka long long int (*)(SQVM*)}'
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/script_instance.cpp:146:67: error: 'max<SQInteger>' is not a valid template argument for type 'SQ Integer (*)(long long int, long long int) {aka long long int (*)(long long int, long long int)}' because function 'T max(T, T) [with T = long long int]' has not external linkage
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/script_instance.cpp:146:67: error: no matching function for call to 'ScriptInstance::AddMethod(const char [4], <unresolved overloaded function type>, int, const char [4])'
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/script_instance.cpp:146:67: note: candidate is:
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/../script/squirrel.hpp:96:7: note: void Squirrel::AddMethod(const char*, SQFUNCTION, uint, const char*, void*, int)
C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g5ac53560/src/script/../script/squirrel.hpp:96:7: note:   no known conversion for argument 2 from '<unresolved overloaded function type>' to 'SQFUNCTION {aka long long int (*)(SQVM*)}'
make[1]: *** [script/script_instance.o] Error 1
make[1]: Leaving directory `/usr/home/AdminGuy/2_Compile/g5ac53560/objs/release'

make: *** [all] Error 1
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

I think I'm having a déjà vu. What compiler are you using?
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

cirdan wrote:I think I'm having a déjà vu. What compiler are you using?
MinGW/MSYS with GCC = :oops: 4.6.2
Might be time for an upgrade. I forgot to check that when I had to resurrect my antique Dell Optiplex single core WindowsXP box. :P
I'll get back to you on this. Thanks.
Hafting
Engineer
Engineer
Posts: 106
Joined: 13 Feb 2014 11:22

Re: New map features

Post by Hafting »

cirdan wrote:I have updated the repository with the fix (and three months' worth of other commits).
Failed to compile after git pull:

Code: Select all

[SRC] Compiling game/game_text.cpp
/usr/src/cirdan/src/fileio.cpp: In function ‘void DeterminePaths(const char*)’:
/usr/src/cirdan/src/fileio.cpp:1181:42: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
    char *xdg_config_home = xdgConfigHome (NULL);
                            ~~~~~~~~~~~~~~^~~~~~
Seems like 'const' is dropped, and gcc 6.3.1 does not accept that. (Not merely a warning, the compile breaks.)

Putting a "const" there to get "const char *xdg_config_home = ..." allows the compile to proceed.
TrueSatan
Transport Coordinator
Transport Coordinator
Posts: 291
Joined: 16 Jul 2003 18:33

Re: New map features

Post by TrueSatan »

Ha as I thought after reading Haftings crash report, we have a shiny new version.
Compiled fine on my Ubuntu 14.04. But gave me some new warnings.

Code: Select all

/nmf/src/gfx_layout.cpp: In member function ‘virtual void FallbackParagraphLayout::build(ParagraphBuilder::LineVector*, int, bool)’:
r/nmf/src/gfx_layout.cpp:826:23: warning: ‘width’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    width += char_width;
                       ^
/nmf/src/gfx_layout.cpp:842:24: warning: ‘last_space’ may be used uninitialized in this function [-Wmaybe-uninitialized]
      p = last_space + 1;
                        ^
and

Code: Select all

/nmf/src/newgrf_text.cpp: In function ‘void TranslateStringCodes(stringb*, const char*, uint32, uint8, bool, StringControlCode)’:
/nmf/src/newgrf_text.cpp:186:36: warning: ‘mapping_offset’ may be used uninitialized in this function [-Wmaybe-uninitialized]
  buf->append ((char)(offset - 0x80));
                                    ^
/nmf/src/newgrf_text.cpp:323:6: note: ‘mapping_offset’ was declared here
  int mapping_offset;
      ^
jgrs will follow as soon as its updated.

Thanks and cheers
Attachments
openttd-custom-g5ac53560-UNIX.tar.xz
Version: g5ac53560
Ubuntu 14.04 64bit
(4.64 MiB) Downloaded 47 times
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

Hafting wrote:Seems like 'const' is dropped, and gcc 6.3.1 does not accept that. (Not merely a warning, the compile breaks.)

Putting a "const" there to get "const char *xdg_config_home = ..." allows the compile to proceed.
Oops, it seems that I broke xdg builds nearly two years ago (!). I have pushed a fix.
TrueSatan wrote:Compiled fine on my Ubuntu 14.04. But gave me some new warnings.
Those are known false positives. I do not think that there is a way to tell the compiler not to warn about a particular variable (you can disable the warning for a whole function, but that is too wide a hammer).
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

wallyweb wrote:
cirdan wrote:I think I'm having a déjà vu. What compiler are you using?
MinGW/MSYS with GCC = :oops: 4.6.2
Might be time for an upgrade. I forgot to check that when I had to resurrect my antique Dell Optiplex single core WindowsXP box. :P
I'll get back to you on this. Thanks.
I got my GCC and G++ up to 4.8.1
Did I break something?
Now I get ...

Code: Select all

AdminGuy@XPBOX ~/2_Compile/g865a1a52
$ make bundle
make[1]: Entering directory `/usr/home/AdminGuy/2_Compile/g865a1a52/objs/lang'
[LANG] Compiling and Linking endian_check.exe
In file included from C:/MinGW/msys/1.0/home/AdminGuy/2_Compile/g865a1a52/src/endian_check.cpp:21:0:
c:\mingw\include\stdio.h:26:20: fatal error: stddef.h: No such file or directory

 #include <stddef.h>
                    ^
compilation terminated.
make[1]: *** [endian_check.exe] Error 1
make[1]: Leaving directory `/usr/home/AdminGuy/2_Compile/g865a1a52/objs/lang'
make: *** [all] Error 1
Oops #2 ...
Pyoro wrote:Removing static made no difference, but gcc was still at 4.8.1. I've updated that to 4.9.3-1 now, and it compiled just fine.
Back to the drawing board. This might take a while. :P
User avatar
Pyoro
Tycoon
Tycoon
Posts: 2558
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: New map features

Post by Pyoro »

wallyweb wrote:Back to the drawing board. This might take a while. :P
I might only muddy the waters, but in my vague memories it took a bit of manually fiddling around to get everything running again. I think the problem was that the updater was too outdated to update the newer stuff, so updating some dependencies failed, which caused other updates to fail. Or something like that. It might actually be faster just starting with a fresh installation.

Good luck either way ;)
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: New map features

Post by wallyweb »

Pyoro wrote:It might actually be faster just starting with a fresh installation.

Good luck either way ;)
Oh darn! You just revealed my secret plan. :lol:
Thanks. :D
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

Here is the add-on patch with infrastructure sharing and routing restrictions. Only smoke-tested, so handle with care. The patch applies on top of my current published branch tip, and you have to drop JGR's tracerestrict.grf in a baseset directory where it will be found.
Attachments
addon-865a1a52.diff
(568.88 KiB) Downloaded 52 times
Hafting
Engineer
Engineer
Posts: 106
Joined: 13 Feb 2014 11:22

Re: New map features

Post by Hafting »

Compiled today, and saw a new problem.
Not a crash this time, but trains that don't wait for cargo.

I have a coastal station. No industry there, but ships come in and dump scrap metal, bauxite ore and pyrrite ore there.
Trains come in. They have order to refit to all these cargoes, and to wait till at least one category is full.

Now, if a train fill up a couple of cars, it will wait till some ship comes in and provide more cargo - as it should.

But the station may be empty. In that case, the train leaves with zero cargo instead of waiting for the next ship(s). I saw this first when the station was new. The shipping had not yet started, so obviously no cargo. But the train could not be made to wait! Not even and order to wait for all cargoes could stop it. Very strange, and the game didn't use to be like that.

But I got the ships going, and overwhelmed my railroad. Trains filled up and there was always more cargo - so the bug didn't show. After some time, I could afford enough trains to clear out the backlog. Eventually, a train cleared the station and sat there with 82%, waiting to fill up. Then another train comes in. It stops - there is nothing at all to load, so I expect that train too to stay and wait for shipping. But no, the empty train leaves even though the order is to wait until at least one kind of cargo is full. (And to re-fit to available types too.)

I don't know when this started, but it looks like empty trains are considered full now. Only a half-full train is not full :-/
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

Can you try if this patch helps?
Attachments
full-load-fix.diff
(424 Bytes) Downloaded 46 times
Hafting
Engineer
Engineer
Posts: 106
Joined: 13 Feb 2014 11:22

Re: New map features

Post by Hafting »

cirdan wrote:Can you try if this patch helps?
Worked fine in a test game. Train 1 rolled into an empty station and waited as it should. Then, it filled up as ships came in.

Trains sometimes "leave early", but openttd has had that little oddity for years. It goes like this:
1. Train come into a station with (multiple) refit orders. Perhaps all wagons are empty and currently fit for "building materials".
2. Train pick up 12t of sand (half a car) and 50t of gravel/rocks (exactly two full cars). A few empty wagons (still fit for building materials) remains.
3. Train has orders to wait for one full load, and decides that this goal is met because the only two cars fit for gravel are completely full. This is wrong, because the train has empty wagons that can be refit for more gravel. So the train leaves with lots of empty cars.

In practice, this is not a big problem. Some more cargo piles up at the station, so the train is likely to be fuller the next time. The chance for early exit is 1/25 or 1/30 for each car in the train. It only happens if the cars needs a re-fit. I think it only happnes for a multiple-refit order. A refit to a single cargo is done as the train stops, so they see that "there are more empty gravel cars, and so the train is not considered full".
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 19 guests