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
romazoon
Tycoon
Tycoon
Posts: 1291
Joined: 20 Jun 2010 23:16

Re: New map features

Post by romazoon »

cirdan wrote:Does this match your experience?
yeap mostly, i just tried again, and i watched closely on flat grounds what happens, i effectively notice no "big" boost for the "overtaken" vehicles, but still, a small boost of a few kilometer per hours have happened somehow. (screenies)

i used hungarian trucks grf, one of them that have top speed 140km/h, but when loaded with heavy material (60tons), the truck canno't go beyond 97km/h ( only because it is too heavy/not powerfull enough) after a long strech of flat road... I also setted it s max speed via timetable to 105km/h to avoid (Faster but not having max speed over 140) other vehicule to stay locked behind.(i used your newmapfeature to test this time, no trunk test))

now i see the truck going 97km/h, it get overtaken , and i can read 105km/h after being overtaken...but it was not able to reach over 97km/h by it s own force just before ! (the truck is then not able to keep the 105km/h and decrease slowly its speed)

so i know this truck can go beyond 97km/h in two situation, the first is normal and expected given physics rules (slope going down), the other is debatable, but physics may explain it too finally (less though, but we may simply claim that the drag resistance is lower and allow the truck to go faster)

i totally can live with that little "boost" and use it to my advantage, i thought it might be problematic at first because i was sure both vehicule had a "big" boost (which might lead to some cheating, because if used well you could have made your "heavy vehicule" goes faster than they should be able to naturally, simply by making them being often overtaken by faster vehicles).
I also thought simply to mention it to you because you were working on road controllers and thought those little details might be handy to know( and i believe i was a bit right to do so, as those things apparently appears nowhere in the code).
of course, you might tell me " it s a bug, and every bug need to be fixed", but i won t be nitpicking on such a litte detail and say that it should be fixed ;) this is dev's and/or your call ;)

I tried with both Articulated and non articulated vehicles, and both act the same (the overtaken get a boost in speed at the very end of the overtaking pattern)

And now, of course, thank you for the last fixes ;) merry christmas and all
Attachments
San Fransisco Transport, 29 Oct 2055.png
this truck got overtaken by the flat bed truck in front, it then reached 105km/h. then the white truck arrived a bit after the overtaken truck started to looses speed, after the white will be done, the articulated truck was going 105km/h again...
(119.18 KiB) Downloaded 8 times
San Fransisco Transport, 23 Nov 2055.png
this is a little bit after being overtaken, truck looses speed (after it reached 105km/h), showing that it can t go faster when loaded naturally.
(200.64 KiB) Downloaded 8 times
San Fransisco Transport, 4 Fév 2056.png
This one show especially well the boost ;)
here i even spot for a microsecond a faster speed on the articulated truck than it is supposed to be able to go (speed limited at 105)
(460.64 KiB) Downloaded 8 times
TrueSatan
Transport Coordinator
Transport Coordinator
Posts: 291
Joined: 16 Jul 2003 18:33

Re: New map features

Post by TrueSatan »

And a new Ubuntu Version.

Thanks Santa Cirdan :D
Attachments
openttd-custom-gb1a61287-UNIX.tar.xz
Version: gb1a61287
Ubuntu 14.04 64 bit
(4.62 MiB) Downloaded 20 times
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 just pushed an update to the repository
... and I have just waylaid some guy in a red suit headed North in a sleigh pulled by a herd of antlered critters. He said his bag was almost empty but I could have what was left.
I accepted and compiled the stuff looking to get some Christmas cake and candy.
Instead, I got this:
OpenTTD-gb1a61287-Win32.7z
(5.43 MiB) Downloaded 27 times
No guarantees ... Enjoy.

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

Re: New map features

Post by wallyweb »

romazoon wrote:so i know this truck can go beyond 97km/h in two situation, the first is normal and expected given physics rules (slope going down), the other is debatable, but physics may explain it too finally (less though, but we may simply claim that the drag resistance is lower and allow the truck to go faster)
...
I tried with both Articulated and non articulated vehicles, and both act the same (the overtaken get a boost in speed at the very end of the overtaking pattern
This is actually a very real occurrence. It is called drafting and truck drivers often use it to reduce fuel consumption. One would think that there is a cost to the lead truck, but this is not the case. If the following truck is close enough to the lead truck, it disturbs the drag on the lead truck while the drag on the following truck remains constant. Both trucks can then reduce fuel consumption while maintaining their previous speed, or they can both maintain fuel consumption while increasing speed. The savings can be quite remarkable with several trucks in a convoy. Note that this can be a danger to a car trying to pass a convoy. If an oncoming vehicle should appear, there may be insufficient room to pull in between trucks, a heart stopping event that often results in disaster headlines in the next day's news reports.
User avatar
romazoon
Tycoon
Tycoon
Posts: 1291
Joined: 20 Jun 2010 23:16

Re: New map features

Post by romazoon »

I think i found a bug, i can't rebuild over (to change graphics) a waypoint when there is a different one in the tile next to it ?

from memory, i remember it s no problem in the stable or in trunck.

Oh, while writing, i realised that waypoint are almost like stations, and so i tried the same things with stations, and the bug is there too. ( i can t buildover the tiles that are touching another stations)
Attachments
Bordeaux Transport, 12 Jul 1878.png
those two way points are different, i simpy want now to replace an existing one to show different graphics. it should be possible to do that without demolishing the way point..
(212.37 KiB) Downloaded 7 times
Bordeaux Transport, 28 Oct 1878.sav
a savegame showing the "bug" ?
(764.71 KiB) Downloaded 36 times
Hafting
Engineer
Engineer
Posts: 106
Joined: 13 Feb 2014 11:22

Re: New map features

Post by Hafting »

romazoon wrote: now i see the truck going 97km/h, it get overtaken , and i can read 105km/h after being overtaken...but it was not able to reach over 97km/h by it s own force just before ! (the truck is then not able to keep the 105km/h and decrease slowly its speed)
At least the realism is there. When you overtake someone, they make every effort to speed up a little. . .
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

Re: New map features

Post by Supercheese »

Hafting wrote:
romazoon wrote: now i see the truck going 97km/h, it get overtaken , and i can read 105km/h after being overtaken...but it was not able to reach over 97km/h by it s own force just before ! (the truck is then not able to keep the 105km/h and decrease slowly its speed)
At least the realism is there. When you overtake someone, they make every effort to speed up a little. . .
So, so true :lol:
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

romazoon wrote:I think i found a bug, i can't rebuild over (to change graphics) a waypoint when there is a different one in the tile next to it ?

from memory, i remember it s no problem in the stable or in trunck.

Oh, while writing, i realised that waypoint are almost like stations, and so i tried the same things with stations, and the bug is there too. ( i can t buildover the tiles that are touching another stations)
Oops, good catch. Apparently, I introduced this bug when allowing to choose which station to join when distant join is disabled and there are several adjacent stations. I have just pushed a fix for this.
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 just pushed a fix for this.
And I have just compiled a Windows Binary (Unguaranteed) for this:
OpenTTD-gb3ef7105-Win32.7z
(5.43 MiB) Downloaded 29 times
Enjoy.
:D
User avatar
romazoon
Tycoon
Tycoon
Posts: 1291
Joined: 20 Jun 2010 23:16

Re: New map features

Post by romazoon »

thanks for the fix ! and thanks for the compile , here is one more bug, with crash ;)
crash.png
(165.78 KiB) Downloaded 6 times
i made a mistake while building the one way road, the truck surely would be stucked no matter what, but crashing is not nice :) i was going to fix the road asap, but truck came right after my mistake ;).

*** OpenTTD Crash Report ***

Crash at: Sun Dec 28 01:18:02 2014
In game date: 2064-11-08 (68)

Crash reason:
Exception: E1212012
Location: 767EC42D
Message: Assertion failed at line 1739 of C:/MinGW/msys/1.0/home/Adminguy/gb3ef710/src/roadveh_cmd.cpp: GetRoadBits (v->tile, v->roadtype) == DiagDirToRoadBits (enterdir)

Binary:
Version: gb3ef7105 (0)
NewGRF ver: 150064d0
Build date: Dec 27 2014 17:05:32
Flags: 32-bit little-endian

Registers:
EAX: 0028B1C4 EBX: 00000016 ECX: 00000000 EDX: 0008E3C8
ESI: 76013180 EDI: 00000000 EBP: 0028B214 ESP: 0028B1C4
EIP: 767EC42D EFLAGS: 00000246

Bytes at instruction pointer:
C9 C2 10 00 CC CC CC CC CC 8B FF 55 8B EC 56 8B 75 08 83 FE F4 72 18 83

Stack trace:
E1212012 00000000 00000000 767EC42D 00000000 0028B1F8 765FFCF1 005F0382
760164A8 75FC03E0 00012010 00000000 FFFFFFFF 0028B214 765FFD36 005F0382
7704FAEA 77071092 FFFFFFFF 00000024 0028B234 00547CFA E1212012 00000000
00000000 00000000 76010290 0028B280 0028B280 75FD5E8F 00000016 13576754
000000C0 00000000 0028B5D0 7704FAEA 77069DEC 00000000 00000024 00547CD0
00000001 0028B240 0028ABEC 0028FFC4 75F98CD5 66828B6C FFFFFFFE 0028B5B8
75FD8EA2 00000016 00000000 001C05F6 01485FB8 014849A0 00070022 0000007C
00000000 0100024C 00000000 000003E0 01010000 0028B1F0 765CCF5C 0028FFC4
770A71F5 138F8885 FFFFFFFE 770638AA 770634A2 00000000 014861C8 00010003
00000000 0028B4FC 014861C0 0028B398 765FF774 01420000 00000000 014861C8
00000001 0028B4FC 00000001 0000001F 0000000D 00000000 00DDCEA0 00000010
005F0382 00992848 00000006 00000000 00000000 00000556 00000300 00000000
0000013E 0028B4FC 000001DB 00000000 00007F01 00000000 00000001 00000034
50022080 00000032 00000020 00000000 00000000 000001A0 0052FDC2 014861C8
011C11D8 00000000 0148622C 011C1244 0000012D 0028B4F0 765FFA18 00000010
000000C0 00000000 765FFA50 00000001 0126E858 0028B418 005303C1 0B1339F0
00000000 011C0E04 0B213B30 00000001 0B26E828 00000000 00000000 765FFA6C
00000000 00000001 0B213B30 0B213B30 0B26E828 0028B458 00000000 7FFFFFFF
00983D85 0028B438 75F8AA42 00341B5D 00983D85 00000016 00000016 7FFFFFFF
00000000 0B4B4670 003414B8 75F7A53A 00000000 0028B468 75F8A8C1 00341B5D
00983D85 00000016 0028B458 7FFFFFFF 00000000 0B4B4670 003414B8 003407D0
00000000 0028B498 75F8A9C8 00341B5D 00983D85 00000016 00000000 0000000A
00000001 00000001 00000001 003407D0 0B26E801 0028B4B0 0028B4C4 00000000
00000001 0028B4C0 006ECFED 00000001 0000007F 0028B5D0 00DDCEA0 00000200

Operating system:
Name: Windows
Release: 6.1.7601 (Service Pack 1)
Compiler: GCC 4.8.1 "4.8.1"

Configuration:
Blitter: 32bpp-anim
Graphics set: original_windows (0)
Language: C:\Users\andylu\Desktop\Spiel\OTTD Newmapfeature\OpenTTD-gb3ef7105-Win32\lang\french.lng
Music driver: win32
Music set: Modern Motion (1)
Network: server
Sound driver: win32
Sound set: NoSound (2)
Video driver: win32

Fonts:
Small: Arial
Medium: Arial
Large: Arial
Mono: sprite

AI Configuration (local: 0):
0: Human
GS: Neighbours are important (v16)

Libraries:
FreeType: 2.4.10
LZMA: 5.0.4
LZO: 2.06
PNG: 1.5.16
Zlib: 1.2.8

Module information:
C:\Users\andylu\Desktop\Spiel\OTTD Newmapfeature\OpenTTD-gb3ef7105-Win32\openttd.exe handle: 00400000 size: 11178743 crc: C5907A05 date: 2014-12-27 21:13:52
C:\Windows\SysWOW64\ntdll.dll handle: 77030000 size: 1292192 crc: 87C3B42F date: 2013-08-29 01:50:30
C:\Windows\syswow64\kernel32.dll handle: 74c80000 size: 1114112 crc: 8F4ED6D1 date: 2014-03-04 09:16:17
C:\Windows\syswow64\KERNELBASE.dll handle: 767e0000 size: 274944 crc: D5B7EFFE date: 2014-03-04 09:16:18
C:\Windows\syswow64\ADVAPI32.DLL handle: 764f0000 size: 640512 crc: 939A0B41 date: 2013-08-29 01:48:17
C:\Windows\syswow64\msvcrt.dll handle: 75f70000 size: 690688 crc: DAB48B3A date: 2011-12-16 07:52:58
C:\Windows\SysWOW64\sechost.dll handle: 74a20000 size: 92160 crc: B624B29A date: 2009-07-14 01:16:13
C:\Windows\syswow64\RPCRT4.dll handle: 76870000 size: 664064 crc: 358EDEDF date: 2014-07-14 01:40:58
C:\Windows\syswow64\SspiCli.dll handle: 749c0000 size: 96768 crc: 32853E06 date: 2014-10-14 01:49:38
C:\Windows\syswow64\CRYPTBASE.dll handle: 749b0000 size: 36864 crc: 00308E17 date: 2009-07-14 01:15:07
C:\Windows\syswow64\GDI32.dll handle: 75180000 size: 311808 crc: 8EF3EF88 date: 2014-08-23 01:45:55
C:\Windows\syswow64\USER32.dll handle: 76590000 size: 833024 crc: 9EFE504D date: 2010-11-20 12:08:58
C:\Windows\syswow64\LPK.dll handle: 76830000 size: 25600 crc: 3A7246AE date: 2013-06-06 04:57:01
C:\Windows\syswow64\USP10.dll handle: 763b0000 size: 626688 crc: 7CF1A954 date: 2014-04-25 02:06:17
C:\Windows\syswow64\IMM32.DLL handle: 76960000 size: 119808 crc: 38DB5163 date: 2010-11-20 12:08:52
C:\Windows\syswow64\MSCTF.dll handle: 76b60000 size: 828928 crc: DFE09EEB date: 2009-07-14 01:15:43
C:\Windows\syswow64\SHELL32.DLL handle: 75320000 size: 12874240 crc: C247DBF4 date: 2014-06-25 01:41:30
C:\Windows\syswow64\SHLWAPI.dll handle: 75040000 size: 350208 crc: 23E05F73 date: 2010-11-20 12:21:20
C:\Windows\system32\WINMM.DLL handle: 72a90000 size: 194048 crc: 849223C7 date: 2010-11-20 12:21:38
C:\Windows\syswow64\WS2_32.dll handle: 752e0000 size: 206848 crc: FD00A753 date: 2010-11-20 12:21:40
C:\Windows\syswow64\NSI.dll handle: 752d0000 size: 8704 crc: 2ACE9671 date: 2009-07-14 01:16:11
C:\Windows\SysWOW64\nvinit.dll handle: 74850000 size: 146480 crc: 174445EB date: 2014-07-02 20:48:32
C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\detoured.dll handle: 0f000000 size: 13272 crc: 3596E0E8 date: 2014-07-02 20:48:32
C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvd3d9wrap.dll handle: 72ae0000 size: 164496 crc: 26D29F6C date: 2014-07-02 20:48:32
C:\Windows\syswow64\SETUPAPI.dll handle: 769c0000 size: 1667584 crc: 1D0104E8 date: 2010-11-20 12:21:16
C:\Windows\syswow64\CFGMGR32.dll handle: 750a0000 size: 145920 crc: 377B5190 date: 2011-10-19 03:07:08
C:\Windows\syswow64\OLEAUT32.dll handle: 761b0000 size: 571904 crc: B0969304 date: 2014-10-18 01:33:18
C:\Windows\syswow64\ole32.dll handle: 76020000 size: 1414144 crc: 74A1E844 date: 2010-11-20 12:20:50
C:\Windows\syswow64\DEVOBJ.dll handle: 76390000 size: 64512 crc: 66B02A5A date: 2011-10-19 03:07:08
C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvdxgiwrap.dll handle: 729d0000 size: 113008 crc: A54B2121 date: 2014-07-02 20:48:32
C:\Windows\system32\mswsock.dll handle: 705a0000 size: 231424 crc: 2A2905A9 date: 2013-09-08 02:03:58
C:\Windows\System32\wshtcpip.dll handle: 70590000 size: 9216 crc: BA963A19 date: 2009-07-14 01:16:20
C:\Windows\system32\MMDevAPI.DLL handle: 72840000 size: 213504 crc: 93C0AA4F date: 2010-11-20 12:19:40
C:\Windows\system32\PROPSYS.dll handle: 71940000 size: 988160 crc: 888D0BCB date: 2010-11-20 12:20:58
C:\Windows\system32\wdmaud.drv handle: 6f7b0000 size: 172032 crc: D5B9F5FA date: 2010-11-20 12:16:52
C:\Windows\system32\ksuser.dll handle: 72060000 size: 4608 crc: EBE07232 date: 2009-07-14 01:15:35
C:\Windows\system32\AVRT.dll handle: 71fc0000 size: 14336 crc: 9818237B date: 2009-07-14 01:14:58
C:\Windows\system32\AUDIOSES.DLL handle: 727e0000 size: 195584 crc: 60F541E3 date: 2014-10-03 01:44:26
C:\Windows\system32\msacm32.drv handle: 718c0000 size: 20992 crc: 73923147 date: 2009-07-14 01:14:08
C:\Windows\system32\MSACM32.dll handle: 718a0000 size: 72192 crc: ABA25814 date: 2009-07-14 01:15:42
C:\Windows\system32\midimap.dll handle: 71840000 size: 16896 crc: C000494C date: 2009-07-14 01:15:40
C:\Windows\syswow64\CLBCatQ.DLL handle: 750f0000 size: 522240 crc: 6C130B8A date: 2009-07-14 01:15:03
C:\Windows\System32\wship6.dll handle: 704a0000 size: 10752 crc: 99DFC9DA date: 2009-07-14 01:16:20
C:\Windows\system32\DNSAPI.dll handle: 705e0000 size: 270336 crc: 93875418 date: 2011-10-19 02:49:31
C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live\WLIDNSP.DLL handle: 6f230000 size: 145280 crc: DBDF337A date: 2011-03-29 03:31:14
C:\Windows\syswow64\PSAPI.DLL handle: 77000000 size: 6144 crc: 25B988F9 date: 2009-07-14 01:16:12
C:\Windows\system32\IPHLPAPI.DLL handle: 71b70000 size: 103936 crc: E8D425A2 date: 2010-11-20 12:19:24
C:\Windows\system32\WINNSI.DLL handle: 71b60000 size: 16896 crc: 484CAF17 date: 2009-07-14 01:16:19
C:\Windows\System32\fwpuclnt.dll handle: 6e630000 size: 216576 crc: 881C7EC0 date: 2013-10-12 02:01:25
C:\Windows\system32\rasadhlp.dll handle: 6f220000 size: 11776 crc: C799823B date: 2009-07-14 01:16:12
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

romazoon wrote:i made a mistake while building the one way road, the truck surely would be stucked no matter what, but crashing is not nice :) i was going to fix the road asap, but truck came right after my mistake ;).
Thanks for your bug report. A crash is a bug, no matter what; reliable programs do not crash. I am working on a fix, but I will not be able to push it until next week; in the meanwhile, just try not to do that. ;-)
aantono
Traffic Manager
Traffic Manager
Posts: 211
Joined: 15 Apr 2010 21:01
Location: Midwest, US

Re: New map features

Post by aantono »

cirdan wrote:
aantono wrote:Got a different error:

Code: Select all

[SRC] DEP CHECK (all files)
[SRC] Compiling 3rdparty/md5/md5.cpp
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
make[1]: *** [3rdparty/md5/md5.o] Error 1
make: *** [all] Error 1
Is there something somewhere that sets the requirement for OS to be of a specific backwards compatibility?
I'm using OS X 10.9.5, so clearly have a later version than the error is saying.
Note that the new error you get is provided by the compiler (clang), so it seems that, for whatever reason, it does not believe it is running on the right OS version. Strictly speaking, it mentions "deployment target", which could mean that it is set to compile for a different version than it is running on. You are forcing "-stdlib=libc++" in your LDFLAGS. Perhaps you could try removing that? Otherwise, you may have to tell your compiler to target a different version.
Any idea how to do that via ./configure arguments?
The reason I'm forcing the libc++ is to get the compiler to recognize the std::unique_ptr directive, which using the regular config throws me an error:

Code: Select all

src/ai/../script/api/../../widgets/../textfile.h:52:7: error: no type named 'unique_ptr' in namespace
      'std'
        std::unique_ptr <char, delete_free> path; ///< Textfile path
        ~~~~~^
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: New map features

Post by Alberth »

std::unique_ptr is C++11. For g++, one needs to add "-std=c++11" for recognizing c++11 features, maybe that is lacking?
Being a retired OpenTTD developer does not mean I know what I am doing.
aantono
Traffic Manager
Traffic Manager
Posts: 211
Joined: 15 Apr 2010 21:01
Location: Midwest, US

Re: New map features

Post by aantono »

After battling the settings and config flags for a while, I managed to get the c++11 to work by increasing the mmacosx-version-min value to 10.8.

With that setting, I was able to advance further using the following config

Code: Select all

./configure  LDFLAGS="-stdlib=libc++ -std=c++11" CFLAGS="-stdlib=libc++ -std=c++11" CC=/usr/bin/clang++ CXX=/usr/bin/clang++
only to be stopped by the following error:

Code: Select all

src/gfx.cpp:591:37: error: non-constant-expression cannot be narrowed from type 'int' to 'uint'
      (aka 'unsigned int') in initializer list [-Wc++11-narrowing]
        Dimension box = {suggestion.width, GetStringHeight(str, suggestion.width)};
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/gfx.cpp:591:37: note: override this message by inserting an explicit cast
        Dimension box = {suggestion.width, GetStringHeight(str, suggestion.width)};
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                           static_cast<uint>(                    )
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

It seems that your compiler has a very particular idea of "narrowing", but that compilation error is easy to fix anyway. Take line 591 in src/gfx.cpp and insert

Code: Select all

(uint)
right before "GetStringHeight" and you should be able to go on.

This problem affects openttd trunk as well, so you may want to file a bug report at their bug tracker. If they commit a fix, I will cherry-pick it into my branch, which I prefer to solving it on my own, because I do not want the code bases to diverge unnecessarily.
aantono
Traffic Manager
Traffic Manager
Posts: 211
Joined: 15 Apr 2010 21:01
Location: Midwest, US

Re: New map features

Post by aantono »

I kinda figured out based on the compiler error output that this would be the fix. What makes me wonder is why does the original trunk compiles just fine on the old version of gcc (without setting it to c++11), but when doing c++11, the unique_ptr works, but all the casts start to break?
aantono
Traffic Manager
Traffic Manager
Posts: 211
Joined: 15 Apr 2010 21:01
Location: Midwest, US

Re: New map features

Post by aantono »

cirdan wrote:It seems that your compiler has a very particular idea of "narrowing", but that compilation error is easy to fix anyway. Take line 591 in src/gfx.cpp and insert

Code: Select all

(uint)
right before "GetStringHeight" and you should be able to go on.

This problem affects openttd trunk as well, so you may want to file a bug report at their bug tracker. If they commit a fix, I will cherry-pick it into my branch, which I prefer to solving it on my own, because I do not want the code bases to diverge unnecessarily.
I'm working on trying to fix the cast errors, and stumbled onto this one that I am not sure what the fix should be:

Code: Select all

src/table/object_land.h:139:2: error: constant expression evaluates to 4294967295 which cannot be
      narrowed to type 'Date' (aka 'int') [-Wc++11-narrowing]
  ...M(STR_LAI_OBJECT_DESCRIPTION_TRANSMITTER,          0x11,   0,   0, 10, T|A|S  , 15, OBJECT_FLAG_CANNOT_REMOVE | OBJECT_FLAG_ONLY_IN_SCENEDIT),
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/table/object_land.h:126:222: note: expanded from macro 'M'
  ...{ GRFFilePropsBase<2>(), INVALID_OBJECT_CLASS, name, climate, size, build_cost_multiplier, clear_cost_multiplier, 0, 0xFFFFFFFF, flags, {0...
                                                                                                                          ^~~~~~~~~~
src/table/object_land.h:139:2: note: override this message by inserting an explicit cast
  ...M(STR_LAI_OBJECT_DESCRIPTION_TRANSMITTER,          0x11,   0,   0, 10, T|A|S  , 15, OBJECT_FLAG_CANNOT_REMOVE | OBJECT_FLAG_ONLY_IN_SCENEDIT),
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/table/object_land.h:126:222: note: expanded from macro 'M'
  ...{ GRFFilePropsBase<2>(), INVALID_OBJECT_CLASS, name, climate, size, build_cost_multiplier, clear_cost_multiplier, 0, 0xFFFFFFFF, flags, {0...
                                                                                                                          ^~~~~~~~~~
aantono
Traffic Manager
Traffic Manager
Posts: 211
Joined: 15 Apr 2010 21:01
Location: Midwest, US

Re: New map features

Post by aantono »

Managed to "silence" lots of errors by using "-Wno-narrowing", but can't figure out the following:

Code: Select all

src/saveload/saveload_filter.cpp:250:19: error: assigning to 'Bytef *' (aka 'unsigned char *') from
      incompatible type 'const byte *' (aka 'const unsigned char *')
                this->z.next_in = p;
                                ^ ~
This is what my configure command looks like now:

Code: Select all

./configure --enable-static  LDFLAGS="-stdlib=libc++ -std=c++11 -Wno-narrowing" CFLAGS="-stdlib=libc++ -std=c++11 -Wno-narrowing" CC=/usr/bin/clang++ CXX=/usr/bin/clang++
aantono
Traffic Manager
Traffic Manager
Posts: 211
Joined: 15 Apr 2010 21:01
Location: Midwest, US

Re: New map features

Post by aantono »

Fixed the previous error by doing

Code: Select all

this->z.next_in = const_cast<byte *>(p);
But only to run into the following:

Code: Select all

In file included from src/industry.h:19:
src/map/tileset.h:149:14: error: reference to non-static member function must be called
                return set.find_any<metric> (tile, threshold);
                       ~~~~^~~~~~~~
src/town_cmd.cpp:1556:12: note: in instantiation of function template specialization
      'TileSetObject<Town, &get_town_tile>::find_any<&DistanceManhattan>' requested here
        if (Town::find_any<DistanceManhattan> (tile, 19)) {
                  ^
src/map/tileset.h:230:7: note: possible target for call
        bool find_any (TileIndex tile, uint threshold)
             ^
src/map/tileset.h:156:14: error: reference to non-static member function must be called
                return set.find_closest<metric> (tile, threshold);
                       ~~~~^~~~~~~~~~~~
src/town_cmd.cpp:3121:96: note: in instantiation of function template specialization
      'TileSetObject<Town, &get_town_tile>::find_closest<&DistanceManhattan>' requested here
                        if (_generating_world) return threshold == UINT_MAX ? CalcClosestTownFromTile(tile) : Town::find_closest<DistanceMan...
                                                                                                                    ^
src/map/tileset.h:240:5: note: possible target for call
        T *find_closest (TileIndex tile, uint threshold)
           ^
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

aantono wrote:I kinda figured out based on the compiler error output that this would be the fix. What makes me wonder is why does the original trunk compiles just fine on the old version of gcc (without setting it to c++11), but when doing c++11, the unique_ptr works, but all the casts start to break?
My guess is that your compiler is stricter about casts when in c++11 mode, but I have never used clang. On the other hand, the fact that GetStringHeight returns a signed int could perhaps be reconsidered.
aantono wrote:Managed to "silence" lots of errors by using "-Wno-narrowing",
I see that liberal use of casts is helping you make progress. I think that disabling narrowing warnings was a good decision.
aantono wrote:but can't figure out the following:

Code: Select all

src/saveload/saveload_filter.cpp:250:19: error: assigning to 'Bytef *' (aka 'unsigned char *') from
      incompatible type 'const byte *' (aka 'const unsigned char *')
                this->z.next_in = p;
                                ^ ~
This one should not happen. I explicitly set ZLIB_CONST before including <zlib.h>, to make the zlib headers const-aware, so you should not get this error unless there is something strange in your zlib installation.
aantono wrote:Fixed the previous error by doing

Code: Select all

this->z.next_in = const_cast<byte *>(p);
Yes, this is the workaround.
aantono wrote:But only to run into the following:

Code: Select all

...
Could you try editing file map/tileset.h to replace

Code: Select all

set.find_any
by

Code: Select all

set.template find_any
at line 149 and

Code: Select all

set.find_closest
by

Code: Select all

set.template find_closest
at line 156, and tell me if it works?
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 4 guests