Page 1 of 1

Lock/water string errors

Posted: 02 Aug 2013 14:19
by WWTBAM
Is the lock tool supposed to be like that as I get the error Object in the way. When I drag it. I may have a look at it myself to try and disable it if t is not mean't to be dragable.

Re: Dragable lock tool

Posted: 02 Aug 2013 16:21
by wallyweb
I never knew that the lock tool was dragable. Indeed it is ... adding canals when dragging more than 3 tiles. Similarly, dragging the canal tool over a slope adds a lock. I did not see any errors or warnings.

Re: Dragable lock tool

Posted: 02 Aug 2013 16:24
by WWTBAM
What about over say 4+ tiles. Are you trying in the game or scenario editor?

Re: Dragable lock tool

Posted: 02 Aug 2013 16:35
by wallyweb
roboboy wrote:What about over say 4+ tiles.
8
I also was able to drag two locks in sequence, with the second one rising to the next level as intended.
Are you trying in the game or scenario editor?
both. 8)

Re: Dragable lock tool

Posted: 02 Aug 2013 16:45
by OzTrans
To be able to build a lock or two, you need 3 tiles that are 'flat/slope/flat' or a multiple of them with maybe some flat sections in between. If that is not the case you do get the message (with the incorrect text). No big drama.

Re: Dragable lock tool

Posted: 02 Aug 2013 17:14
by WWTBAM
Is there a standard string we can use or do we want to define a new one?

Re: Dragable lock tool

Posted: 02 Aug 2013 17:28
by OzTrans
roboboy wrote:Is there a standard string we can use or do we want to define a new one?
You could use an existing one in the General Strings section :

Code: Select all

0x0239 "\94...site unsuitable"

Re: Dragable lock tool

Posted: 03 Aug 2013 09:26
by WWTBAM
So far from what I can tell, it looks harder (for me) than I thought to fix as I think I will have to write an error handler for lock building.

Re: Dragable lock tool

Posted: 03 Aug 2013 09:46
by OzTrans
roboboy wrote:So far from what I can tell, it looks harder (for me) than I thought to fix as I think I will have to write an error handler for lock building.
There is already an error handler. Look in water.asm, lines 1498/99. It just uses the wrong text id 0x5800, which is 'Object in the way' instead of something more appropriate.

Re: Dragable lock tool

Posted: 03 Aug 2013 09:47
by WWTBAM
I was expecting it to be with the rest of them in watergui.asm

Edit: fixed. I will post a Diff and possibly an exe soon.

Edit again: here are said files. If the exe crashes for you. Delete your TTDLOADW.OVL.

Re: Lock/water string errors

Posted: 03 Aug 2013 10:42
by WWTBAM
I found another bug. When I attempt to build a lock with out enough money, the error popup says Can't clear land rather than can't build lock. It only happens if I try to build the lock on a the slope in between two flat tiles. Do we consider that a bug?

Edit:

OpenTTD deals with the error of building a lock on flat or double slopped land with the error "Land sloped in wrong direction" and only allows for a lock to be built by clicking on a valid slope.

Re: Lock/water string errors

Posted: 04 Aug 2013 04:42
by WWTBAM
I am looking for

Code: Select all

00B5 \94Can't clear this area....
but can't find it's text id in either water.asm or waztergui.asm. I get that error when trying to build a lock without enough money but only when I click the slope tile, if I click on the flat tiles either side without enough money for a canal, I get the correct can't build canal/lock here. Any ideas which other files to look in. I ran:

Code: Select all

grep 00B5 *.asm
on the patches directory. The only place it found was in enhgui.asm for something unrelated.

Re: Lock/water string errors

Posted: 04 Aug 2013 11:07
by OzTrans
roboboy wrote:I found another bug. When I attempt to build a lock with out enough money, the error popup says Can't clear land rather than can't build lock. It only happens if I try to build the lock on a the slope in between two flat tiles. Do we consider that a bug?
Normally, when constructing anything, clearing of the land happens first, followed by the construction of the 'object'. Most probably, you did not have enough money to clear the land first. If you did, then, should you not have enough further funds to construct the lock, you get the correct message. I don't think it is a serious bug, not enough funds is indicated either way.
OpenTTD deals with the error of building a lock on flat or double slopped land with the error "Land sloped in wrong direction" and only allows for a lock to be built by clicking on a valid slope.
OpenTTD has seperate tools for canals and locks, whereas TTDPatch uses the same tool. You cannot really compare the two here.
... 'Can't clear this area ...
Clearing the area, before building the 'shiplift' !! happens in procedure cleararea in enhgui,asm line 1659 and there is your error too, in case something happened that prevented the clearing. This is a global procedure, most probably used by many construction events. I wouldn't touch it.

Re: Lock/water string errors

Posted: 04 Aug 2013 12:23
by WWTBAM
OzTrans wrote:
roboboy wrote:I found another bug. When I attempt to build a lock with out enough money, the error popup says Can't clear land rather than can't build lock. It only happens if I try to build the lock on a the slope in between two flat tiles. Do we consider that a bug?
Normally, when constructing anything, clearing of the land happens first, followed by the construction of the 'object'. Most probably, you did not have enough money to clear the land first. If you did, then, should you not have enough further funds to construct the lock, you get the correct message. I don't think it is a serious bug, not enough funds is indicated either way.
OpenTTD deals with the error of building a lock on flat or double slopped land with the error "Land sloped in wrong direction" and only allows for a lock to be built by clicking on a valid slope.
OpenTTD has seperate tools for canals and locks, whereas TTDPatch uses the same tool. You cannot really compare the two here.
... 'Can't clear this area ...
Clearing the area, before building the 'shiplift' !! happens in procedure cleararea in enhgui,asm line 1659 and there is your error too, in case something happened that prevented the clearing. This is a global procedure, most probably used by many construction events. I wouldn't touch it.
I wouldn't touch enhgui.asm either. If I cleared the three tiles for my lock first, the price didn't go down, but I am happy to leave it at that and just supply the patch to change the error when you have the money available.