Industry transcending coastline

Discussions about the technical aspects of graphics development, including NewGRF tools and utilities.

Moderator: Graphics Moderators

Post Reply
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Industry transcending coastline

Post by andythenorth »

I need to implement a fishing harbour that has tiles on both water and the coast.
fishing_harbour_7.png
fishing_harbour_7.png (78.36 KiB) Viewed 1686 times

I have set industry prop 1A bit 2, as I am intending to build this primarily on water.

CB 28 is used to check location permissibility, checking var 8B

Code: Select all

-1 * 0	 02 0A 10 //handle cb 28 (industry location permissibility)
  85 8B 00 FF FF
  \b1
    00 84 \w00 \w01
  01 84 //default
I have the following problems:
- results of checking var 8B seem inconsistent. Alongside a straight, empty coastline, it is possible to build on some water tiles but not others.

- when the industry is constructed, it's tiles are seen by CB 28 var 8B as 'empty land tiles', so it is possible to build contiguous harbours outwards from the coast. Can probably be fixed by checking slopes etc, but seems strange?

EDIT: do I need to use CB 28 for this? Can I use CB 2F instead (custom shape check for tiles)? The aim is simply to get the industry built in a suitable piece of terrain....

cheers,

Andy
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Industry transcending coastline

Post by andythenorth »

For those still tuned to this exciting thread, the answer is:

- ignore cb 28, it's not necessary
- set the industry to build on water
- use tile cb 2F (custom shape check) to determine if a tile can be built
- use varaction 2 var 60 to check that the tile (a) doesn't have water on it (b) has appropriate height slope. I found it particularly helpful to have someone else write this bit :D

Here's a paste of the code...there's some other stuff here to do with cargos and foundations...not necessary for the shape check.

Code: Select all

//Tiles varaction 2 chain
-1 * 0	 02 09 F0 //handle cb 2F (custom shape check for tiles)
  89 60 00 00 1F 02 FF 00 // check tile contents
  \b1
    01 84 \dx0000 \dx0200
  00 84 //default

-1 * 0 02 09 C1 //industry tile cargo acceptance depending on waiting cargo
    86 40 00 FF FF
    \b1 //range
     00 80 \w200 FF FF //lookup cb 2B in wiki for what the returned value means 
   08 80
   
-1 * 0 02 09 C0 //Handle callbacks
	81 0C 00 FF //no shift, no mask
	\b3 //range
          C1 00 2B 2B //cargo acceptance cb 2B
	  F0 00 2F 2F //custom shape check cb 2F
	  01 80 30 30 //disable drawing default foundations cb30  
  A0 00 //default
User avatar
George
Tycoon
Tycoon
Posts: 4363
Joined: 16 Apr 2003 16:09
Skype: george-vb
Location: Varna, Bulgaria
Contact:

Re: Industry transcending coastline

Post by George »

If you are looking for an example, have a look at Neu Schwanstein Castle of ECS Town vector. It can be build on both the shore and on land.
Image Image Image Image
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 20 guests