The International Simutrans Forum

Development => Extension Requests => Topic started by: Yona-TYT on June 07, 2016, 04:06:09 AM

Title: Create rectangles on the minimap using script.
Post by: Yona-TYT on June 07, 2016, 04:06:09 AM

This is necessary to map divided into regions... http://forum.simutrans.com/index.php?topic=15388.msg151671#msg151671 (http://forum.simutrans.com/index.php?topic=15388.msg151671#msg151671)


But it can also be useful if you need to delimit regions of the map in any scenario.
Playing around with the code i made this:
(https://www.mediafire.com/convkey/10fc/ekcxw7ni08g8hbv6g.jpg)


I did not find how to rotate the map, always mantien a fixed position.
Also not i found as turn this into a function  of script scenario.


      koord tt[4];
      int x1,x2, y1=512, y2, sizx = 168, sizy = 125;
      for(int vv=0;vv<4;vv++) {
         if(vv!=0)y1-=sizy+3;
         x1=0;
         x2=0;
         y2=0;
         for(int cc=0;cc<3;cc++) {
            if(x1!=0)x1=x2+1;
            else x1+=1;
         
            x2 = x1+sizx+1;
            if(vv==0)y2 = y1-sizy-3;
            else y2 = y1-sizy-3;
            koord tt0(x1-1,y1);
            koord tt2(x2,y2);
            tt[1]=koord(tt0.x, tt2.y);
            tt[3]=koord(tt2.x, tt0.y);
            tt[0]=koord(tt0.x, tt0.y);
            tt[2]=koord(tt2.x, tt2.y);
            scr_coord yona[4];


            for(uint i=0; i<lengthof(yona); i++) {
               yona[i]= karte_to_screen(tt[i])+pos;
            }
               
            display_direct_line_dotted( yona[0].x,yona[0].y, yona[1].x, yona[1].y, 5, 5, COL_YELLOW );
            display_direct_line_dotted( yona[1].x,yona[1].y, yona[2].x, yona[2].y, 5, 5, COL_YELLOW );
            display_direct_line_dotted( yona[2].x,yona[2].y, yona[3].x, yona[3].y, 5, 5, COL_YELLOW );
            display_direct_line_dotted( yona[3].x,yona[3].y, yona[0].x, yona[0].y, 5, 5, COL_YELLOW );
            }


         }
Title: Re: Create rectangles on the minimap using script.
Post by: Tjoeker on June 07, 2016, 02:23:55 PM
I'd love to be able to divide the map into regions/countries. However, I'd like to draw lines instead of rectangles... (or making multiple rectangles 1 region).
In a normal Simutrans game, this could be optional and is purely visual. and if you could script things for regions in scenarios this would be a huge +1! (as I'm planning a scenario with countries as well :) )

I know borders has been requested before, but I hope this gets reconsideration as this doesn't change gameplay in 'sandbox' mode, but opens up many possibilities for scenarios.
Title: Re: Create rectangles on the minimap using script.
Post by: prissi on June 07, 2016, 09:18:15 PM
Drawing lines between coordinates is be easy, the same is done to show for instance industry connections. I think the interface to scenarios would be more difficult.
Title: Re: Create rectangles on the minimap using script.
Post by: Yona-TYT on June 08, 2016, 01:54:26 AM
In that case, you could implement a function to mark rectangles directly on the minimap and then send to a "savegame". This might work  ;D .


Then you can use a script so that only the public service can use it.  ;)
Title: Re: Create rectangles on the minimap using script.
Post by: Yona-TYT on June 08, 2016, 02:46:27 AM
Quote from: Tjoeker on June 07, 2016, 02:23:55 PM
I'd love to be able to divide the map into regions/countries. However, I'd like to draw lines instead of rectangles... (or making multiple rectangles 1 region).
In a normal Simutrans game, this could be optional and is purely visual. and if you could script things for regions in scenarios this would be a huge +1! (as I'm planning a scenario with countries as well ☺ )

I know borders has been requested before, but I hope this gets reconsideration as this doesn't change gameplay in 'sandbox' mode, but opens up many possibilities for scenarios.



I'm glad your interest in these scenarios  ☺ .
Here the work of map divided into regions and scores of dwachs.
regions.zip (http://www.mediafire.com/download/8yczgmw34fagybk/regions.zip)
Title: Re: Create rectangles on the minimap using script.
Post by: Dwachs on June 08, 2016, 06:27:39 AM
Quote from: Yona-TYT on June 08, 2016, 01:54:26 AM
In that case, you could implement a function to mark rectangles directly on the minimap and then send to a "savegame". This might work  ;D .
I am thinking about a possible implementation. The main problem is to broadcast such information to all clients.
Title: Re: Create rectangles on the minimap using script.
Post by: Yona-TYT on June 08, 2016, 07:57:26 PM
You can also use a placeholder to enter the coordinates and a name for the rectangle, this seems easier I think.
(https://www.mediafire.com/convkey/fae7/ic18gnsqseh465d6g.jpg)

Edit.
It would also be good to enter the coordinates with a selection tool, which would be more practical I think.
(https://www.mediafire.com/convkey/4135/imp688vckukg3wa6g.jpg)