Old and new terrain codes

The place to post your WML questions and answers.

Moderator: Forum Moderators

Forum rules
  • Please use [code] BBCode tags in your posts for embedding WML snippets.
  • To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
Post Reply
Daravel
Posts: 310
Joined: August 30th, 2008, 10:39 pm
Location: England

Old and new terrain codes

Post by Daravel »

Hey,

I have a bunch of maps I made many years ago, when I try to open them in the editor it tells me that some of the terrain codes aren't recognised. But I can open them as part of the campaign without any issues. I can see that one of the issues is an embellishment, I had a quick look at the editor and I can't see that particular embellishment as an option - but it is clearly still in the game as the map loads. I've attached a pic of it.

Easy option is to just remove it and add something else in, but when I deleted its code 'Imb' from the file, it then told me another terrain wasn't recognised. To save me the pain of having to go through 18 maps and removing codes one by one - does anyone a) know what the issue is? b) is there a quick way to solve it?

Edit: went and had a shower - good time to think. I should just be able to lift the png from the core folder into my add-on folder and then define it somewhere, right? What would I need to do to get that to work? I haven't touched WML in 6 years!
Attachments
map.png
map.png (97.82 KiB) Viewed 1678 times
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Old and new terrain codes

Post by octalot »

I assume you've got some custom terrains that are described in your WML.

In your _main.cfg, you need an #ifdef EDITOR section to include those terrains' descriptions, because the main CAMPAIGN_BLAH_BLAH define won't be defined. See EditorWML.
Daravel
Posts: 310
Joined: August 30th, 2008, 10:39 pm
Location: England

Re: Old and new terrain codes

Post by Daravel »

octalot wrote: January 29th, 2019, 6:27 pm I assume you've got some custom terrains that are described in your WML.

In your _main.cfg, you need an #ifdef EDITOR section to include those terrains' descriptions, because the main CAMPAIGN_BLAH_BLAH define won't be defined. See EditorWML.
I'm not sure - I've found the image I'm using in core, it's monolith2.png - which explains why it loads in the campaign. It's obviously not in the editor's available images.

Forgive me, but I'm not sure how putting something in the main.cfg will work. I'm opening the .map file (from within my add-on folder) from the editor - so the main.cfg isn't used. The map loads fine when run as part of the campaign, it's just in the editor itself it won't work.

I've attached the file in question, it's the Gs^Imb that doesn't work (though, if I remove the three instances of that, something else doesn't work). Worth noting, I made all these maps in the editor originally, so I've done nothing funky when it comes to making them.
Attachments
Prologue.map
(16.98 KiB) Downloaded 216 times
User avatar
octalot
General Code Maintainer
Posts: 786
Joined: July 17th, 2010, 7:40 pm
Location: Austria

Re: Old and new terrain codes

Post by octalot »

The problem is a missing mapping of (terrain code) to (terrain definition). The mapping of (terrain definition) to (png file) comes later; I haven't tried but expect you'd just get the "image not found" image if the .png was the problem.

I guess you've copied code out of the 1.12 version of Delfador's Memoir's. I'm expecting there's something like the following somewhere in your WML:
https://github.com/wesnoth/wesnoth/blob ... errain.cfg

When playing your campaign, that WML will be active. In the editor it won't, but the #ifdef EDITOR parts of all add-ons' _main.cfg will be active, so the custom terrains from all add-ons can show up in the editor.
Daravel
Posts: 310
Joined: August 30th, 2008, 10:39 pm
Location: England

Re: Old and new terrain codes

Post by Daravel »

octalot wrote: January 29th, 2019, 7:09 pm The problem is a missing mapping of (terrain code) to (terrain definition). The mapping of (terrain definition) to (png file) comes later; I haven't tried but expect you'd just get the "image not found" image if the .png was the problem.

I guess you've copied code out of the 1.12 version of Delfador's Memoir's. I'm expecting there's something like the following somewhere in your WML:
https://github.com/wesnoth/wesnoth/blob ... errain.cfg

When playing your campaign, that WML will be active. In the editor it won't, but the #ifdef EDITOR parts of all add-ons' _main.cfg will be active, so the custom terrains from all add-ons can show up in the editor.
Aha, yes, got it.

I think what confused me is that I made these maps in the editor, so didn't think there were any custom terrains and didn't make sense why it couldn't pull the image from core. I think Elvish_Hunter must have inserted those images into the maps, because I have no recollection of the terrain.cfg file being made.

Anyway, all fixed. Thanks!
Post Reply