The online racing simulator
Searching in All forums
(233 results)
Modifed CInsim
denis-takumi
S3 licensed
i was:
0. include insim v5
1. change send_mtc
size =len + (4 - len%4) Reason : see below

2. add "swith case" in send_packet to detect ISP_BTN and ISP_MTC and do functions.

3. change return type to bool

4. you can call send_packet(&pack, errmsg) or send_packet(&pack)

PS. i do for me, if MaKaKaZo likes it, he can correct the mistakes and put this code
Last edited by denis-takumi, .
denis-takumi
S3 licensed
MadCatX
(1+((126-1)/4))*4 + 4 = 132

makakazo was right

MaKaKaZo sorry my fail
btw i was copy and edit send_button function
but error protection is good idea
Last edited by denis-takumi, .
denis-takumi
S3 licensed
Quote from MadCatX :Shouldn't

text2send = text_len + 4 - text_len%4; // 4, 8 ,12, ..., 128

actually be?

byte remd = text_len % 4
if(remd > 0)
text2send = text_len + (4 - remd);
else
text2send = text_len;

Haven't tried it myself, but your code adds 4 to the text2send if it already is multiple of 4.

i tried it but lfs said what last byte must be zero, and i used this code
and i wrote what have problems if len > 123 chars (program is down)
denis-takumi
S3 licensed
Scawen, its work BUT

in folder i have "^C^3Вараскева Пладислав.ply"
but in game its looks like (attach) and can't load this


PS Win 7
Last edited by denis-takumi, .
denis-takumi
S3 licensed
in insim 5 IS_MTC was modifed and i add this code in my CInsim class


struct IS_MTC // Msg To Connection - hosts only - send to a connection / a player / all
{
byte Size; // 8 + TEXT_SIZE (TEXT_SIZE = 4, 8, 12... 128)
byte Type; // ISP_MTC
byte ReqI; // 0
byte Sound; // sound effect (see Message Sounds below)

byte UCID; // connection's unique id (0 = host / 255 = all)
byte PLID; // player's unique id (if zero, use UCID)
byte Sp2;
byte Sp3;

// char Text[TEXT_SIZE]; // up to 128 characters of text - last byte must be zero
};

function with error protection
but a have problems if strlen > 123


/**
* Send a variable sized message to connect
*/
bool CInsim::send_mtc(void* s_mst, char *errmsg)
{
struct IS_MTC *pack_mtc = (struct IS_MTC*)s_mst;

int text_len = strlen(pack_mtc->Msg);
int text2send;

if (text_len == 0)
{
strcpy(errmsg,"strlen == 0");
return false;
}
else if (text_len > 127)
{
strcpy(errmsg,"strlen > 127");
return false;
}

text2send = text_len + 4 - text_len%4; // 4, 8 ,12, ..., 128

pack_mtc->Size = 8 + text2send;

pthread_mutex_lock (&ismutex);
if (send(sock, (const char *)pack_mtc, pack_mtc->Size, 0) < 0)
{
pthread_mutex_unlock (&ismutex);
strcpy(errmsg,"can't send mtc");
return false;
}
pthread_mutex_unlock (&ismutex);
return true;
}

Last edited by denis-takumi, .
denis-takumi
S3 licensed
Quote from repeat83 :bad idea. insim packet for text have small lenght.

^CПривет - 8 byte (Now)
Привет - 12 byte (utf8)

in game i set drivername like た-ぼかたつむりさん (10 chars)
in ".ply" file i see ^J^7‚Ѕ°‚Ы‚©‚Ѕ‚В‚Ю‚и‚і‚с (19 chars + 4)

i was input chars from "in game char table" with mouse ckick, because when i try input this from keybord + IME i see "?-????????"
denis-takumi
S3 licensed
Quote from Scawen :When did I say that?

May be it said Victor, i dont not.
Last edited by denis-takumi, .
denis-takumi
S3 licensed
Quote from [Audi TT] :What's wrong?

In Russian: В чем ошибка?

i'm reload attach. look at red square
denis-takumi
S3 licensed
Autocross editor overlay bug
Last edited by denis-takumi, .
denis-takumi
S3 licensed
Scawen, some idea

Quote from Crazy_Fox [UA] :Hi all!
May be better to call tracks like ASX, but not AS1X? It seems more logical, because configuration is based on the entire AS, and not based on AS1.

AS1X - not good.
ASX - good.

ASX, BLX, FEX, SOX, - use first pitlane

ASY, FEY - use second pitlane

without "press CTRL + click X or Y" just add a row "[Opened X]" when user press CTRL if posible select second pit rename row to "[Opened Y]"
denis-takumi
S3 licensed
Scawen, some bug... i was go to z28 server like admin. when i edit layout i see ramps in objects sections. when i put ramp, i had OSS:OBJS error
denis-takumi
S3 licensed
Scawen : FIXED IN Z33

SeiShin,Kova.
Befor post your bugs read previous posts!

ADD: SO4X
near side street
Last edited by Scawen, .
denis-takumi
S3 licensed
Scawen : FIXED IN Z33

Fe
Last edited by Scawen, .
denis-takumi
S3 licensed
Scawen : WILL NOT BE FIXED

AU3+4
Last edited by Scawen, .
denis-takumi
S3 licensed
BL1X rally sector

AU1 corner
Last edited by denis-takumi, .
denis-takumi
S3 licensed
Scawen, but what if you use UTF-8?

because we can write everything without ^J ^B ...

русский
日本語
Last edited by denis-takumi, .
denis-takumi
S3 licensed
hmm, i found bug.. convert js_coordinates to game_coordinates.
fixed
denis-takumi
S3 licensed
skywatcher122, use ctrl + mouse_scroll
denis-takumi
S3 licensed
i think.... just dont use this =)
denis-takumi
S3 licensed
Scawen, what about that?
denis-takumi
S3 licensed
i'm begin new thread for this tools.
http://www.lfsforum.net/showthread.php?p=1579556
LFS Polygon Draw (html+js)
denis-takumi
S3 licensed
Use LFS Polygon Draw to identify new areas (streets) without the use of nodes on opened track like FEX FEY (LFS Z30 or higher)
used jsDraw2D - http://jsdraw2d.jsfiction.com/
use FireFox, Chrome

Update:
add: json style output
add: multipoligon drawing

Site where u can draw polygons

GitHub

C++ code to find point in polygon


<?php 
x
,curent position

polyX
[] - array of X polygon points
polyY
[] - array of Y polygon points

polySides 
count of points

bool checkPosition
(int polySides,int polyX[],int polyY[],int x,int y)
{

    
int    ij=polySides-;
    
bool  oddNodes=false     ;

    for (
i=0i<polySidesi++)
    {
        if (
polyY[i]<&& polyY[j]>=y
                
||  polyY[j]<&& polyY[i]>=y)
        {
            if (
polyX[i]+(y-polyY[i])/(polyY[j]-polyY[i])*(polyX[j]-polyX[i])<x)
            {
                
oddNodes=!oddNodes;
            }
        }
        
j=i;
    }
    return 
oddNodes;
}
?>

Last edited by denis-takumi, . Reason : http://turbosnail.github.io/lfspolygon/
denis-takumi
S3 licensed
Quote from DarkKostas :This one gets Mouse position, so if you keep your mouse stable and scroll up/down/left/right coords will be still the same.

i write fats script for firefox and this work right.

if u want to work with it on IE or Safari fix it
denis-takumi
S3 licensed
Quote from PoVo :Very good script! Thank you!

Just a question. How can I find the X/Y coordinates from the TIF track files?

http://denisbatya.narod2.ru/ <== exsample for SO

i'll use it today to generate streets on cruise with polygons

look sourse code
denis-takumi
S3 licensed
in my programm i use polygon system with funcrion for detect point in this polygon


int polySides = 14;
int polyX[polySides ] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};
int polyY[polySides ] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0};


bool Check_Pos(int polySides,int polyX[],int polyY[],float x,float y)
{

int i, j=polySides-1 ;
bool oddNodes=false ;

for (i=0; i<polySides; i++)
{
if (polyY[i]<y && polyY[j]>=y
|| polyY[j]<y && polyY[i]>=y)
{
if (polyX[i]+(y-polyY[i])/(polyY[j]-polyY[i])*(polyX[j]-polyX[i])<x)
{
oddNodes=!oddNodes;
}
}
j=i;
}
return oddNodes;
}


to quickly create a polygon i use html+js(create line)+Track.jpg
FGED GREDG RDFGDR GSFDG