News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

Add a label to the objects but without reserving the tile/quadrant.

Started by Yona-TYT, April 09, 2017, 05:21:46 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

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.

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

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).


Yona-TYT

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:


I apologize for the double post.