The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on April 09, 2017, 05:21:46 PM

Title: Add a label to the objects but without reserving the tile/quadrant.
Post by: Yona-TYT on April 09, 2017, 05:21:46 PM
I currently have to use "text labels" to label objects, but that is not a good solution.

I would like to implement this:

// place text to objects
void_t create_text_object(grund_t *gr,  const char* text)
{
    gr->set_text(text);
    return void_t();
}

// remover text in objects
void_t remover_text_object(grund_t *gr)
{
    const char* text=NULL;
    gr->set_text(text);
    return void_t();
}

    /**
     * Creates a text tag for objects.
     */
    register_method(vm, &create_text_object, "text_object", true);

    /**
     * Delete text tag on objects.
     */
    register_method(vm, &remover_text_object, "remover_text", true);


I already tried it and it does not seem to have side effects.
Title: Re: Add a label to the objects but without reserving the tile/quadrant.
Post by: Dwachs on April 11, 2017, 08:26:10 AM
Why not using public player (pl==1) or the human player (pl==0) as owner?

Calling set_text directly may also remove station and city labels.
Title: Re: Add a label to the objects but without reserving the tile/quadrant.
Post by: Yona-TYT on April 11, 2017, 12:21:05 PM
Quote from: Dwachs on April 11, 2017, 08:26:10 AM
Why not using public player (pl==1) or the human player (pl==0) as owner?

Calling set_text directly may also remove station and city labels.
The label text gives me some problems.
This also gives me the freedom to place texts anywhere and at no cost.

Quote from: Dwachs on April 11, 2017, 08:26:10 AM
Calling set_text directly may also remove station and city labels.
That's no problem (You only have to know how and where to use), and you can even get a chance (to change the name of the station).

Title: Re: Add a label to the objects but without reserving the tile/quadrant.
Post by: Yona-TYT on April 11, 2017, 03:55:55 PM
Quote from: Dwachs on April 11, 2017, 08:26:10 AM
Why not using public player (pl==1) or the human player (pl==0) as owner?
Currently it is impossible to do this:
(https://www.mediafire.com/convkey/3b35/peo9ds1dsu5iafr6g.jpg)

I apologize for the double post.