Author Topic: How to find a tiles name?  (Read 3423 times)

0 Members and 1 Guest are viewing this topic.


  • Community Member
  • **
  • Posts: 9
    • View Profile
How to find a tiles name?
« on: November 24, 2010, 06:34:27 AM »

I wonder how to find a tiles name in the doOutput function?

Where has a tiles name info?


  • Author
  • World Machine Guru
  • *****
  • Posts: 2320
    • View Profile
Re: How to find a tiles name?
« Reply #1 on: November 24, 2010, 06:08:43 PM »
Good question.

The current method is very hack-y and is quite likely to change soon.

At the moment, a tiled data packet carries its tile name in its nametag, retrievable by WMPacket::GetNameTag().

Thus during a tiled build, you can follow the current user-specified tile naming convention by creating your output filename with a printf-style formatting string as follows:

const char *filetitle = "myfiletitle"; // filename without extension
const char *fileext = ".hf";
const char *tilename = hf->GetNameTag();
sprintf( final_name,  "%s%s.%s", filetitle , tilename , fileext );

The tilename specified in GetNameTag() has already been filled out with the proper information (X,Y location, resolution, etc)

-- Stephen Schmitt
- Creator of World Machine