Some questions on limits of industry NewGRF

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

Moderator: Graphics Moderators

ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

I have one more questions about industry NewGRFs which concerns the definition of the different colors, for example
item(FEAT_INDUSTRIES, Clay_Pit, 08) {
property {
substitute: 0;
override: 0;
map_colour: 123;
Is there somewhere a definition that one could "recycle" like
BLUE = 123
or whatever color no. 123 really is to refer to a name instead of a numerical code? For those extensively familiar with NewGRF graphics it possibly does no matter because they will know at least the most common color IDs but for those who are not - like me - a "color name" definition list would be extremely helpful if one could instead use
item(FEAT_INDUSTRIES, Clay_Pit, 08) {
property {
substitute: 0;
override: 0;
map_colour: BLUE;
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Some questions on limits of industry NewGRF

Post by andythenorth »

ebla71 wrote: 18 Sep 2023 22:58 I have one more questions about industry NewGRFs which concerns the definition of the different colors, for example
There's nothing native in nml, but for those using some additional compile steps (python or similar with templating), then these could be defined as constants.

Not the question you asked, but some other things that might be of use:

- FIRS docs show the industry map colours https://grf.farm/firs/4.15.1/html/code_ ... industries
- there was some work done to find the best contrast ratios for industry colour, vs the available map backgrounds (2 colours of green, 1 of purple): https://grf.farm/misc/industry_map_colours.html
- this is more applicable to vehicle grfs, but the company colours are documented here: https://grf.farm/misc/company_colour_indexes.html
- as a reference source, you can get a large sized palette example with index numbers from the repo for most of my grfs: https://github.com/andythenorth/firs/bl ... te_key.png
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

andythenorth wrote: 19 Sep 2023 13:17
ebla71 wrote: 18 Sep 2023 22:58 I have one more questions about industry NewGRFs which concerns the definition of the different colors, for example
Not the question you asked, but some other things that might be of use:

- FIRS docs show the industry map colours https://grf.farm/firs/4.15.1/html/code_ ... industries
- there was some work done to find the best contrast ratios for industry colour, vs the available map backgrounds (2 colours of green, 1 of purple): https://grf.farm/misc/industry_map_colours.html
- this is more applicable to vehicle grfs, but the company colours are documented here: https://grf.farm/misc/company_colour_indexes.html
- as a reference source, you can get a large sized palette example with index numbers from the repo for most of my grfs: https://github.com/andythenorth/firs/bl ... te_key.png
Super-helpful - thank you very much!!!
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

Questions, questions, questions 8)

On top of trying to design a new industry NewGRF I also decided today to give a very first try on graphics and create an additional cargoicon for the "pharmaceuticals" cargo that I want to include.

Most simple choice, that even somebody like me can draw, was a "red cross". So I used the cargoicons.png from OTIS and naively assumed I could just draw the addition icon to one of the blue fields not used at the bottom (row 6, column 3).

But when I run nmlc it gives an error message
nmlc ERROR: Image file "gfx/other/cargoicons.png": 8bpp image does not have a palette
Included from: "yais.nml", line 268
For the editing, I used Paint as provided with Windows 10 - what's wrong here?

Well, obviously something with the choice of color, but what precisely did I do wrong and how can I make it work?
Attachments
cargoicons new no palette.png
cargoicons new no palette.png (18.88 KiB) Viewed 6680 times
Brickblock1
Engineer
Engineer
Posts: 117
Joined: 04 Apr 2022 12:44
Location: The openttd discord server

Re: Some questions on limits of industry NewGRF

Post by Brickblock1 »

ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

Brickblock1 wrote: 21 Sep 2023 16:32 Have a look at this:
https://www.tt-wiki.net/wiki/Save_paletted_image_files
Thank you very much.

So, in other words, this means Paint is not the proper tool for such work, right?
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

Questions^3 8)

In my yet very limited knowledge of NML, I would have expected the following lines to prevent an industry be built on the 8 tiles directly adjacent to an existing industry, but that does not work, I can build both a similar as well as different industry directly next to one already there. What's wrong? Code fragment taken from OTIS
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_tile_1_lc_1,
(nearby_tile_class( 1, 1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 1, 0) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 1, -1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 0, -1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class(-1, -1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class(-1, 0) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class(-1, 1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 0, 1) == TILE_CLASS_INDUSTRY)) {
1: return CB_RESULT_LOCATION_DISALLOW;
return CB_RESULT_LOCATION_ALLOW;
}
Brickblock1
Engineer
Engineer
Posts: 117
Joined: 04 Apr 2022 12:44
Location: The openttd discord server

Re: Some questions on limits of industry NewGRF

Post by Brickblock1 »

That seems like it should work I am not 100 % sure tho. Are you sure the switch is actually being called?
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

Brickblock1 wrote: 21 Sep 2023 21:24 That seems like it should work I am not 100 % sure tho. Are you sure the switch is actually being called?
That is also one of the things I suspect since the code is copied from OTIS and looks the same also in other examples I found (but I tried OTIS and it also does not work there).

Full industry definition below:
/* ******************************************************************
* Road_Vehicle_Maintenance_Depot
* ******************************************************************/

spriteset(Road_Vehicle_Maintenance_Depot_spriteset_2_0) { [0, 0, 64, 64, -31, -33, ANIM | NOCROP, "gfx/Utility_Comp.png"] }
spriteset(Road_Vehicle_Maintenance_Depot_spriteset_2_0_snow) { [0, 0, 64, 64, -31, -33, ANIM | NOCROP, "gfx/Utility_Comp_SNOW.png"] }
spritelayout Road_Vehicle_Maintenance_Depot_spritelayout {
childsprite {
sprite: GROUNDSPRITE_NORMAL;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
hide_sprite: (LOAD_TEMP(13));
always_draw: 1;
}
childsprite {
sprite: GROUNDSPRITE_NORMAL;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
hide_sprite: (!LOAD_TEMP(13));
always_draw: 1;
}
building {
sprite: Road_Vehicle_Maintenance_Depot_spriteset_2_0(0);
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
xoffset: 0;
yoffset: 0;
zoffset: 0;
xextent: 16;
yextent: 16;
zextent: 16;
always_draw: 0;
hide_sprite: (LOAD_TEMP(55));
}
building {
sprite: Road_Vehicle_Maintenance_Depot_spriteset_2_0_snow(0);
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
xoffset: 0;
yoffset: 0;
zoffset: 0;
xextent: 16;
yextent: 16;
zextent: 16;
always_draw: 0;
hide_sprite: (LOAD_TEMP(45));
}
}
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_industry_layout_graphics_switch, relative_pos) {
relative_coord(0, 0): Road_Vehicle_Maintenance_Depot_spritelayout;
return 0; // a default is needed, but should never be reached, layout definitions are explicit
}
switch(FEAT_INDUSTRYTILES, PARENT, Road_Vehicle_Maintenance_Depot_industry_graphics_switch_layouts, layout_num) {
1: Road_Vehicle_Maintenance_Depot_industry_layout_graphics_switch;
Road_Vehicle_Maintenance_Depot_industry_layout_graphics_switch; // default
}
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_industry_construction_state_graphics_switch, construction_state) {
0..2: spritelayout_default_construction_states;
Road_Vehicle_Maintenance_Depot_industry_graphics_switch_layouts; // default
}
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_store_temp_vars,
[STORE_TEMP(random_bits, 14),
STORE_TEMP(terrain_type == TILETYPE_SNOW, 13) , STORE_TEMP(0, 55),
STORE_TEMP(construction_state != 3 ? 1 : LOAD_TEMP(55), 55),
STORE_TEMP(LOAD_TEMP(13) == 0 ? 1 : LOAD_TEMP(55), 45),
STORE_TEMP(LOAD_TEMP(13) == 1 ? 1 : LOAD_TEMP(55), 55)]) {
Road_Vehicle_Maintenance_Depot_industry_construction_state_graphics_switch; // default
}
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_switch_graphics, [switch_tile_fences(), switch_terrain_sprite()]) {
Road_Vehicle_Maintenance_Depot_store_temp_vars;
}
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_tile_1_lc_1,
(nearby_tile_class( 1, 1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 1, 0) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 1, -1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 0, -1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class(-1, -1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class(-1, 0) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class(-1, 1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 0, 1) == TILE_CLASS_INDUSTRY)) {
1: return CB_RESULT_LOCATION_DISALLOW;
return CB_RESULT_LOCATION_ALLOW;
}
switch (FEAT_INDUSTRYTILES, PARENT, Road_Vehicle_Maintenance_Depot_tile_1_lc_0, (
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_FUND) ||
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_PROSPECT)) ) {
1: return CB_RESULT_LOCATION_ALLOW;
Road_Vehicle_Maintenance_Depot_tile_1_lc_1;
}
item(FEAT_INDUSTRYTILES, Road_Vehicle_Maintenance_Depot_tile_1, 127) {
property {
substitute: 0;
land_shape_flags: bitmask(LSF_ONLY_ON_FLAT_LAND);
special_flags: bitmask(INDTILE_FLAG_ACCEPT_ALL);
animation_triggers: bitmask();
}
graphics {
tile_check: Road_Vehicle_Maintenance_Depot_tile_1_lc_0;
Road_Vehicle_Maintenance_Depot_switch_graphics;
}
}

/* *************************************************
* Definition of the industry
* *************************************************/

tilelayout Road_Vehicle_Maintenance_Depot_industry_layout_tilelayout {
0, 0: Road_Vehicle_Maintenance_Depot_tile_1;
}
switch (FEAT_INDUSTRIES, SELF, Road_Vehicle_Maintenance_Depot_cargo_subtype_display, 1) {
return 0x3800 + string(STR_EMPTY);
}
item(FEAT_INDUSTRIES, Road_Vehicle_Maintenance_Depot, 127) {
property {
substitute: 0;
override: 0;
map_colour: 207;
life_type: IND_LIFE_TYPE_BLACK_HOLE;
min_cargo_distr: 1;
layouts: [Road_Vehicle_Maintenance_Depot_industry_layout_tilelayout];
spec_flags: bitmask(IND_FLAG_LONG_CARGO_TYPE_LISTS);
conflicting_ind_types: [];
random_sound_effects: [];
name: string(STR_IND_Road_Vehicle_Maintenance_Depot);
prob_map_gen: 0;
prob_in_game: 0;
prospect_chance: 0.75;
fund_cost_multiplier: 1;
remove_cost_multiplier: 0;
remove_cost_multiplier: 0;
cargo_types: [accept_cargo("VEHI"),accept_cargo("TYRE")];
nearby_station_name: string(STR_STATION, string(STR_TOWN), string(STR_STATION_Road_Vehicle_Maintenance_Depot));
}
}
item(FEAT_INDUSTRIES, Road_Vehicle_Maintenance_Depot, 127) {
graphics {
build_prod_change: randomise_primary_production_on_build;
extra_text_industry: return string(STR_EXTRA_Road_Vehicle_Maintenance_Depot);
cargo_subtype_display: Road_Vehicle_Maintenance_Depot_cargo_subtype_display;
}
}

/*****************************************************
END Road_Vehicle_Maintenance_Depot
******************************************************/
Eddi
Tycoon
Tycoon
Posts: 8272
Joined: 17 Jan 2007 00:14

Re: Some questions on limits of industry NewGRF

Post by Eddi »

ebla71 wrote: 21 Sep 2023 19:32
Brickblock1 wrote: 21 Sep 2023 16:32 Have a look at this:
https://www.tt-wiki.net/wiki/Save_paletted_image_files
Thank you very much.

So, in other words, this means Paint is not the proper tool for such work, right?
i don't know about the abilities of paint nowdays, but what you have to make sure is that it does not alter the palette in any way (like, not removing unused colours)
User avatar
OzTrans
Tycoon
Tycoon
Posts: 1680
Joined: 04 Mar 2005 01:07

Re: Some questions on limits of industry NewGRF

Post by OzTrans »

ebla71 wrote: 21 Sep 2023 19:32 So, in other words, this means Paint is not the proper tool for such work, right?
You can use 'i.Mage', easy to use and much better than 'Paint' and by far not as difficult to use than 'Gimp' or 'Photoshop'.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Some questions on limits of industry NewGRF

Post by PikkaBird »

ebla71 wrote: 21 Sep 2023 21:39 switch (FEAT_INDUSTRYTILES, PARENT, Road_Vehicle_Maintenance_Depot_tile_1_lc_0, (
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_FUND) ||
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_PROSPECT)) ) {
1: return CB_RESULT_LOCATION_ALLOW;
Road_Vehicle_Maintenance_Depot_tile_1_lc_1;
}
Putting aside the question of "why '& 0xFF00) >> 8'?", I suspect your problem lies with this switch. What does it do? :)
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

PikkaBird wrote: 22 Sep 2023 01:23
ebla71 wrote: 21 Sep 2023 21:39 switch (FEAT_INDUSTRYTILES, PARENT, Road_Vehicle_Maintenance_Depot_tile_1_lc_0, (
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_FUND) ||
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_PROSPECT)) ) {
1: return CB_RESULT_LOCATION_ALLOW;
Road_Vehicle_Maintenance_Depot_tile_1_lc_1;
}
Putting aside the question of "why '& 0xFF00) >> 8'?", I suspect your problem lies with this switch. What does it do? :)
Well, as I said, I just copied this code from the OTIS *.nml as a template, since I am (not yet) very familiar with NML.

My guess is that with the = IND_CREATION_FUND and = IND_CREATION_PROSPECT it is supposed to control how industries can be generated in game?

Where the first part extra_callback_info2 & 0xFF00 does come from and what does it do I have absolutely no clue. At least it causes no issues with nmlc :)

Furthermore, I wonder where the last part of Road_Vehicle_Maintenance_Depot_tile_1_lc_0 does come from (everything beyond ...tile_1) - I guess it is the order of the switches, but does it get added automatically?

But will try to play with this section and possibly remove it to see what happens.
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

PikkaBird wrote: 22 Sep 2023 01:23
ebla71 wrote: 21 Sep 2023 21:39 switch (FEAT_INDUSTRYTILES, PARENT, Road_Vehicle_Maintenance_Depot_tile_1_lc_0, (
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_FUND) ||
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_PROSPECT)) ) {
1: return CB_RESULT_LOCATION_ALLOW;
Road_Vehicle_Maintenance_Depot_tile_1_lc_1;
}
Putting aside the question of "why '& 0xFF00) >> 8'?", I suspect your problem lies with this switch. What does it do? :)
Could it be that it always goes via option 1 to return CB_RESULT_LOCATION_ALLOW and never gets to explore the following line which does the other checks? Not completely sure about these control structures, only "speak" Python.
User avatar
PikkaBird
Graphics Moderator
Graphics Moderator
Posts: 5602
Joined: 13 Sep 2004 13:21
Location: The Moon

Re: Some questions on limits of industry NewGRF

Post by PikkaBird »

ebla71 wrote: 22 Sep 2023 07:32 Could it be that it always goes via option 1 to return CB_RESULT_LOCATION_ALLOW and never gets to explore the following line which does the other checks? Not completely sure about these control structures, only "speak" Python.
That's about it. My interpretation is that this switch is intended to always allow the player to build the industry anywhere, and only go on to the tile check during natural generation. Except for some reason we have "& 0xFF00) >> 8'", which would read the second, instead of first, byte of extra_callback_info2 - which in theory should always == 0.

In any case, you probably don't want this switch. Definitely see how you go with removing it and pointing the callback check straight to 1_lc_1.
User avatar
andythenorth
Tycoon
Tycoon
Posts: 5658
Joined: 31 Mar 2007 14:23
Location: Lost in Music

Re: Some questions on limits of industry NewGRF

Post by andythenorth »

Not completely sure about these control structures, only "speak" Python.
You might be better off with the FIRS compile, which has a set of python classes, that are templated into nml. OTIS and other sets are derived from FIRS, but often using the FIRS nml, which is then sometimes edited.

Notably, GarryG sets are great and Garry produces a lot of great contributions, but Garry isn't a programmer and has a physical brain injury, so I wouldn't base your set on nml from OTIS or Auz Industries :)
Argus
Tycoon
Tycoon
Posts: 1204
Joined: 16 Oct 2018 08:31
Location: Heart of the Highlands. Not Scottish. Czech.

Re: Some questions on limits of industry NewGRF

Post by Argus »

Auz industries contain a number of errors, I have already learned that not always what the industry requires according to the description is really required. Otis could then be called the eyecandy industry. What is imported has no real effect on the production of the industry. The same goes for Auzind. Yes, you can still have a lot of fun with it, but a serious industrial set should still have certain qualities.
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

Argus wrote: 22 Sep 2023 20:56 Auz industries contain a number of errors, I have already learned that not always what the industry requires according to the description is really required. Otis could then be called the eyecandy industry. What is imported has no real effect on the production of the industry. The same goes for Auzind. Yes, you can still have a lot of fun with it, but a serious industrial set should still have certain qualities.
Still, I like the general concept of OTIS a lot, since it allows you to add the industry buildings yourself from graphics.

Give me another couple of weeks and there might be something to coming up ...
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

andythenorth wrote: 22 Sep 2023 18:12 You might be better off with the FIRS compile, which has a set of python classes, that are templated into nml. OTIS and other sets are derived from FIRS, but often using the FIRS nml, which is then sometimes edited.
Definitely thought of writing some Python code to generate the *.nml file, since a good part of the NML code is very repetitive from cargo to cargo and industry to industry.

But now I'm already that far with what I want that doing that would possibly take even more time :lol:

And also, by directly looking at and playing with the NML code, a lot more to be learnt (and one layer of complexicty = source of errors less)
ebla71
Transport Coordinator
Transport Coordinator
Posts: 346
Joined: 14 Apr 2021 21:48
Location: Earth

Re: Some questions on limits of industry NewGRF

Post by ebla71 »

PikkaBird wrote: 22 Sep 2023 13:19 That's about it. My interpretation is that this switch is intended to always allow the player to build the industry anywhere, and only go on to the tile check during natural generation. Except for some reason we have "& 0xFF00) >> 8'", which would read the second, instead of first, byte of extra_callback_info2 - which in theory should always == 0.

In any case, you probably don't want this switch. Definitely see how you go with removing it and pointing the callback check straight to 1_lc_1.
Indeed, directly going to the other switch that way got me the intended behaviour and furthermore, with the code attached below, can now ensure that this industry can only be built next to a road but not if there is already another industry (same or other type) on an adjacent tile.

Not a big step for mankind nor OTTD in general, but I'm quite proud of that achievement and a good way to end the day :D
/* ******************************************************************
* Road_Vehicle_Maintenance_Depot
* ******************************************************************/

spriteset(Road_Vehicle_Maintenance_Depot_spriteset_2_0) { [0, 0, 64, 64, -31, -33, ANIM | NOCROP, "gfx/Utility_Comp.png"] }
spriteset(Road_Vehicle_Maintenance_Depot_spriteset_2_0_snow) { [0, 0, 64, 64, -31, -33, ANIM | NOCROP, "gfx/Utility_Comp_SNOW.png"] }
spritelayout Road_Vehicle_Maintenance_Depot_spritelayout {
childsprite {
sprite: GROUNDSPRITE_NORMAL;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
hide_sprite: (LOAD_TEMP(13));
always_draw: 1;
}
childsprite {
sprite: GROUNDSPRITE_NORMAL;
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
hide_sprite: (!LOAD_TEMP(13));
always_draw: 1;
}
building {
sprite: Road_Vehicle_Maintenance_Depot_spriteset_2_0(0);
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
xoffset: 0;
yoffset: 0;
zoffset: 0;
xextent: 16;
yextent: 16;
zextent: 16;
always_draw: 0;
hide_sprite: (LOAD_TEMP(55));
}
building {
sprite: Road_Vehicle_Maintenance_Depot_spriteset_2_0_snow(0);
recolour_mode: RECOLOUR_REMAP;
palette: PALETTE_USE_DEFAULT;
xoffset: 0;
yoffset: 0;
zoffset: 0;
xextent: 16;
yextent: 16;
zextent: 16;
always_draw: 0;
hide_sprite: (LOAD_TEMP(45));
}
}
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_industry_layout_graphics_switch, relative_pos) {
relative_coord(0, 0): Road_Vehicle_Maintenance_Depot_spritelayout;
return 0; // a default is needed, but should never be reached, layout definitions are explicit
}
switch(FEAT_INDUSTRYTILES, PARENT, Road_Vehicle_Maintenance_Depot_industry_graphics_switch_layouts, layout_num) {
1: Road_Vehicle_Maintenance_Depot_industry_layout_graphics_switch;
Road_Vehicle_Maintenance_Depot_industry_layout_graphics_switch; // default
}
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_industry_construction_state_graphics_switch, construction_state) {
0..2: spritelayout_default_construction_states;
Road_Vehicle_Maintenance_Depot_industry_graphics_switch_layouts; // default
}
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_store_temp_vars,
[STORE_TEMP(random_bits, 14),
STORE_TEMP(terrain_type == TILETYPE_SNOW, 13) , STORE_TEMP(0, 55),
STORE_TEMP(construction_state != 3 ? 1 : LOAD_TEMP(55), 55),
STORE_TEMP(LOAD_TEMP(13) == 0 ? 1 : LOAD_TEMP(55), 45),
STORE_TEMP(LOAD_TEMP(13) == 1 ? 1 : LOAD_TEMP(55), 55)]) {
Road_Vehicle_Maintenance_Depot_industry_construction_state_graphics_switch; // default
}
switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_switch_graphics, [switch_tile_fences(), switch_terrain_sprite()]) {
Road_Vehicle_Maintenance_Depot_store_temp_vars;
}

switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_tile_1_lc_1,
(nearby_tile_class( 1, 1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 1, 0) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 1, -1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 0, -1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class(-1, -1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class(-1, 0) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class(-1, 1) == TILE_CLASS_INDUSTRY) |
(nearby_tile_class( 0, 1) == TILE_CLASS_INDUSTRY)) {
1: return CB_RESULT_LOCATION_DISALLOW;
return CB_RESULT_LOCATION_ALLOW;
}

switch(FEAT_INDUSTRYTILES, SELF, Road_Vehicle_Maintenance_Depot_tile_1_lc_2,
(nearby_tile_class( 1, 1) == TILE_CLASS_ROAD) |
(nearby_tile_class( 1, 0) == TILE_CLASS_ROAD) |
(nearby_tile_class( 1, -1) == TILE_CLASS_ROAD) |
(nearby_tile_class( 0, -1) == TILE_CLASS_ROAD) |
(nearby_tile_class(-1, -1) == TILE_CLASS_ROAD) |
(nearby_tile_class(-1, 0) == TILE_CLASS_ROAD) |
(nearby_tile_class(-1, 1) == TILE_CLASS_ROAD) |
(nearby_tile_class( 0, 1) == TILE_CLASS_ROAD)) {
0: return CB_RESULT_LOCATION_DISALLOW;
Road_Vehicle_Maintenance_Depot_tile_1_lc_1;
}

switch (FEAT_INDUSTRYTILES, PARENT, Road_Vehicle_Maintenance_Depot_tile_1_lc_0, (
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_FUND) ||
(((extra_callback_info2 & 0xFF00) >> 8 ) == IND_CREATION_PROSPECT)) ) {
1: return CB_RESULT_LOCATION_ALLOW;
Road_Vehicle_Maintenance_Depot_tile_1_lc_1;
}
item(FEAT_INDUSTRYTILES, Road_Vehicle_Maintenance_Depot_tile_1, 127) {
property {
substitute: 0;
land_shape_flags: bitmask(LSF_ONLY_ON_FLAT_LAND);
special_flags: bitmask(INDTILE_FLAG_ACCEPT_ALL);
animation_triggers: bitmask();
}
graphics {
// tile_check: Road_Vehicle_Maintenance_Depot_tile_1_lc_0;
tile_check: Road_Vehicle_Maintenance_Depot_tile_1_lc_2;
Road_Vehicle_Maintenance_Depot_switch_graphics;
}
}

/* *************************************************
* Definition of the industry
* *************************************************/

tilelayout Road_Vehicle_Maintenance_Depot_industry_layout_tilelayout {
0, 0: Road_Vehicle_Maintenance_Depot_tile_1;
}
switch (FEAT_INDUSTRIES, SELF, Road_Vehicle_Maintenance_Depot_cargo_subtype_display, 1) {
return 0x3800 + string(STR_EMPTY);
}
item(FEAT_INDUSTRIES, Road_Vehicle_Maintenance_Depot, 127) {
property {
substitute: 0;
override: 0;
map_colour: 207;
life_type: IND_LIFE_TYPE_BLACK_HOLE;
min_cargo_distr: 1;
layouts: [Road_Vehicle_Maintenance_Depot_industry_layout_tilelayout];
spec_flags: bitmask(IND_FLAG_LONG_CARGO_TYPE_LISTS);
conflicting_ind_types: [];
random_sound_effects: [];
name: string(STR_IND_Road_Vehicle_Maintenance_Depot);
prob_map_gen: 0;
prob_in_game: 0;
prospect_chance: 0.75;
fund_cost_multiplier: 1;
remove_cost_multiplier: 0;
remove_cost_multiplier: 0;
cargo_types: [accept_cargo("VEHI"), accept_cargo("TYRE")];
nearby_station_name: string(STR_STATION, string(STR_TOWN), string(STR_STATION_Road_Vehicle_Maintenance_Depot));
}
}
item(FEAT_INDUSTRIES, Road_Vehicle_Maintenance_Depot, 127) {
graphics {
build_prod_change: randomise_primary_production_on_build;
extra_text_industry: return string(STR_EXTRA_Road_Vehicle_Maintenance_Depot);
cargo_subtype_display: Road_Vehicle_Maintenance_Depot_cargo_subtype_display;
}
}

/*****************************************************
END Road_Vehicle_Maintenance_Depot
******************************************************/
Post Reply

Return to “NewGRF Technical Discussions”

Who is online

Users browsing this forum: No registered users and 13 guests