Plugin vector variable changes
#1

First of all Why I am posting here is because at other forums they woule be asking, what is AMX_Getarrd , what is this what is that.. everything related to the samp SDK.

*To mods: If you delete my topic at least let me know so I can try ASAP other methods of help!

Now the problem is that in my GPS plugin the function which stores an array to an vector works good when ran, but then immidiately after the function finishes (or a bit later) the first 43 variables change (at least that is what I see every time, every time the same numbers!)

Those numbers:
pawn Code:
//GetRouteFromTo(...);
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[0]: 47
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[1]: 103
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[2]: 101
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[3]: 116
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[4]: 97
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[5]: 114
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[6]: 114
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[7]: 97
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[8]: 121
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[9]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[10]: 1
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[11]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[12]: 101
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[13]: 116
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[14]: 97
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[15]: 114
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[16]: 114
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[17]: 97
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[18]: 121
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[19]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[20]: 71
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[21]: 101
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[22]: 116
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[23]: 97
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[24]: 114
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[25]: 114
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[26]: 97
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[27]: 121
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[28]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[29]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[30]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[31]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[32]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[33]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[34]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[35]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[36]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[37]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[38]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[39]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[40]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[41]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[42]: 0
[21:49:13] [System CMD: getarray] - Getting Route Array - node_id_array[43]: 0
I've checked it multiple times, the same result on Linux and on Windows, It's not the script.
The 43 vars are always the same , everything after that results in a good variable, the one the pawn script set.
I'm working on it already a few weeks but I can't manage to fix it.
Here's the last thing I've done:
pawn Code:
//see "static cell AMX_NATIVE_CALL n_StoreArray( AMX* amx, cell* params )"
struct RouteData
{
    cell * Paths;
    int amount_of_nodes;
    int id;
    RouteData(cell *Paths_,int amount_of_nodes_, int id_)
    {
        Paths = NULL;
        amount_of_nodes = NULL;
        id = NULL;
        Paths = Paths_;
        amount_of_nodes = amount_of_nodes_;
        id = id_;
    }
};

vector          <RouteData>                     RouteVector;
vector          <int>                           RouteID;

static cell AMX_NATIVE_CALL n_StoreArray( AMX* amx, cell* params )
{
    int IDcounter = 0;
    for(int i = 0,j = RouteID.size(); i < j; ++i)
    {
        if(RouteID.at(i) == IDcounter)
        {
            i = 0;
            IDcounter++;
        }
    }
    cell *dest = NULL;
    amx_GetAddr(amx,params[2],&dest);
    int amount_of_nodes = params[1];
    RouteID.push_back(IDcounter);
    RouteVector.push_back(RouteData(dest,amount_of_nodes,IDcounter));
    //Tried this to fix it:
    for(int i = 0, j = amount_of_nodes; i < j; ++i)//doesn't fix it? :S <--- this
    {
        cout << i << "|" << RouteVector.back().Paths[i] << "|" << dest[i] << "\r\n";
        RouteVector.back().Paths[i] = dest[i];
        cout << i << "|" << RouteVector.back().Paths[i] << "|" << dest[i] << "\r\n";

    }
    //
    return IDcounter;
}
If anybody would like to help well.. the full source code is available at gpb.googlecode.com,
if you need it, the other prints I did use:
pawn Code:
static cell AMX_NATIVE_CALL n_ReturnArray( AMX* amx, cell* params )
{
    for(int i = 0, j = RouteVector.size(); i < j; ++i)
    {
        if(RouteVector.at(i).id == params[1])
        {
            cell *dest = NULL;
            amx_GetAddr(amx,params[2],&dest);
            cout << "n_ReturnArray --> params[1] == " << params[1] << " params[2] == " << params[2] << " params[3] == " << params[3] << " AMX Addr: " << dest << "|" << *dest << "\r\n";
            for(int a = 0, b = params[3]; a < b; ++a)
            {
                cout << RouteVector.at(i).Paths[a] << "\r\n";
                dest[a] = RouteVector.at(i).Paths[a];
            }
            return RouteVector.at(i).amount_of_nodes;
        }
    }
    return 0;
}

static cell AMX_NATIVE_CALL n_GetRouteAtPos( AMX* amx, cell* params )
{
    for(int i = 0, j = RouteVector.size(); i < j; ++i)
    {
        if(RouteVector.at(i).id == params[1])
        {
            if(RouteVector.at(i).amount_of_nodes > i)
            {
                cell *dest = NULL;
                amx_GetAddr(amx,params[3],&dest);
                cout << "n_GetRouteAtPos --> params[1] == " << params[1] << " params[2] == " << params[2] << " params[3] == " << params[3] << " AMX Addr: " << dest << "|" << *dest << "\r\n";
                *dest = RouteVector.at(i).amount_of_nodes;
                cout << "n_GetRouteAtPos(2) --> AMX Addr: " << dest << "|" << *dest << "\r\n";
                return RouteVector.at(i).Paths[params[2]];
            }
        }
    }
    return 0;
}

static cell AMX_NATIVE_CALL n_GetRouteFromTo( AMX* amx, cell* params )
{
    for(int i = 0, j = RouteVector.size(); i < j; ++i)
    {
        if(RouteVector.at(i).id == params[1])
        {
            cell *dest = NULL;
            amx_GetAddr(amx,params[4],&dest);
            cout << "n_GetRouteFromTo --> params[1] == " << params[1] << " params[2] == " << params[2] << " params[3] == " << params[3] << " params[4] == " << params[4] << " AMX Addr: " << dest << "|" << *dest << "\r\n";
            int c = -1;
            for(int a = params[2], b = params[3]; a < b; ++a)
            {
                c++;
                if(c == params[5])
                {
                    return c;
                }
                dest[c] = RouteVector.at(i).Paths[a];
                cout << a << "|" << dest[c] << "|" << RouteVector.at(i).Paths[a] << "\r\n";
            }
            return c;
        }
    }
    return 0;
}
(btw sometimes they don't change immediately but a bit later or just not at all... but it happens often. at least on Kar's LVCNR. I would like to blame the script (that were my first thoughts) but it's really the plugin...
Reply
#2

It also changes when you alt-tab and unpause! don't forget that one (yes, I know it's pretty weird)
Reply
#3

Looks interesting! (:
Reply
#4

Quote:
Originally Posted by Kar
View Post
It also changes when you alt-tab and unpause! don't forget that one (yes, I know it's pretty weird)
It just changed even when you don't do that....
It's just a 'random' 'wrong' discovery mismatch.

Well I planned to make
GetNextRoutePoint etc, so it will be easier for users to make GPS systems, all variable handling would be done by the gps.. so you won't have to save where the user already was and where not.

But with this issue at the moment I cannot continue doing that.
(Well I can make it, but it would be useless due to this issue)
Reply
#5

Code:
cell *dest = NULL;
amx_GetAddr(amx,params[2],&dest);
int amount_of_nodes = params[1];
RouteID.push_back(IDcounter);
RouteVector.push_back(RouteData(dest,amount_of_nodes,IDcounter));
amx_GetAddr only returns the address to the cell array stored by the interpreter. After your function and the PAWN function(s) that called it return, the array gets freed in most cases, so you cannot just use this reference, but you have to allocate new memory, copy the values there and free the memory when you no longer need it (usually when you remove it from the list).
Reply
#6

Quote:
Originally Posted by Fabsch
View Post
Code:
cell *dest = NULL;
amx_GetAddr(amx,params[2],&dest);
int amount_of_nodes = params[1];
RouteID.push_back(IDcounter);
RouteVector.push_back(RouteData(dest,amount_of_nodes,IDcounter));
amx_GetAddr only returns the address to the cell array stored by the interpreter. After your function and the PAWN function(s) that called it return, the array gets freed in most cases, so you cannot just use this reference, but you have to allocate new memory, copy the values there and free the memory when you no longer need it (usually when you remove it from the list).
then how does it come that everything above 43 saves good?
but so.. if I do
cell * paths
paths = dest , it doesn't copy the content of dest to paths? then how would I do it? can I use memcpy?

Why I ask it...
pawn Code:
struct RouteData
{
    cell * Paths;
    int amount_of_nodes;
    int id;
    RouteData(cell *Paths_,int amount_of_nodes_, int id_)
    {
        memcpy(Paths,Paths_,amount_of_nodes);// <- This crashes the server

//edit: this too doesn't work:
        memcpy(&Paths,Paths_,(amount_of_nodes-1));
//end of edit
        //Paths = Paths_;
        amount_of_nodes = amount_of_nodes_;
        id = id_;
    }
};
Reply
#7

Well, if all above element 43 aren't changed, then this is because that memory is not used after it was freed, because you don't allocate that much memory again. You can try adding a bigger array (in PAWN) in another function (which is called anywhere after the function where you call StoreArray has returned) to see if then more values are changed (you should of course remove them again after that).

paths = dest only sets the pointer of "paths", so then "paths" would point to the same location as "dest".
Before using memcpy you first need to allocate some memory to write to:
Code:
Paths = (cell*)malloc(amount_of_nodes_);
memcpy(Paths, Paths_, amount_of_nodes);
And when removing that struct from the vector you have to free that memory:
Code:
free(RouteVector[x].Paths);
Reply
#8

Quote:
Originally Posted by Fabsch
View Post
Well, if all above element 43 aren't changed, then this is because that memory is not used after it was freed, because you don't allocate that much memory again. You can try adding a bigger array (in PAWN) in another function (which is called anywhere after the function where you call StoreArray has returned) to see if then more values are changed (you should of course remove them again after that).

paths = dest only sets the pointer of "paths", so then "paths" would point to the same location as "dest".
Before using memcpy you first need to allocate some memory to write to:
Code:
Paths = (cell*)malloc(amount_of_nodes_);
memcpy(Paths, Paths_, amount_of_nodes);
And when removing that struct from the vector you have to free that memory:
Code:
free(RouteVector[x].Paths);
Let's say I made a test script, the GOOD results should be:
pawn Code:
Console input: reloadfs c
[19:12:49]   Filter script 'c.amx' unloaded.
[19:12:49]   Filterscript 'c.amx' loaded.
[19:12:49] outc()--begin--
[19:12:49]  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[19:12:49]  ID:0
[19:12:49]  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[19:12:49] GetRouteArray(id,goodarr)::25
[19:12:49]  goodarr:  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[19:12:49] GetRouteArray(id,minarr)::25
[19:12:49]  minarr:  0 1 2 3 4 5 6 7 8 9
[19:12:49] GetRouteArray(id,secarr)::25
[19:12:49]  secarr:  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 0 0 1 2 3
[19:12:49]  ArrSize: 25
[19:12:49] GetRouteArrayFromTo(id,0,25,fromtoarr)::24
[19:12:49]  fromtoarr:  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[19:12:49] GetRouteArrayFromTo(id,10,22,frx)::11
[19:12:49]  frx:  10 11 12 13 14 15 16 17 18 19 20 21
[19:12:49] outc()--end--//Timer set...
[19:13:00] delayed()--begin--
[19:13:00]  ID:0
[19:13:00]  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[19:13:00] GetRouteArray(id,goodarr)::25
[19:13:00]  goodarr:  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[19:13:00] GetRouteArray(id,minarr)::25
[19:13:00]  minarr:  0 1 2 3 4 5 6 7 8 9
[19:13:00] GetRouteArray(id,secarr)::25
[19:13:00]  secarr:  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 0 0 1 2 3
[19:13:00]  ArrSize: 25
[19:13:00] GetRouteArrayFromTo(id,0,25,fromtoarr)::24
[19:13:00]  fromtoarr:  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[19:13:00] GetRouteArrayFromTo(id,10,22,frx)::11
[19:13:00]  frx:  10 11 12 13 14 15 16 17 18 19 20 21
[19:13:00]  Delete:1
[19:13:00] delayed()--end--
the script:
pawn Code:
#include <a_samp>
#include <routeConnector>

public OnFilterScriptInit()
{
    SetTimer("outc",0,0);
    return 1;
}
/*Testing this functions:
GetRouteArray(ID,destination[],size = sizeof(destination));
GetRouteAtPos(ID,Array_Pos,&amount_of_nodes=0);
StoreRouteArray(amount_of_nodes,array[]);
DeleteArray(ID);
GetRouteArrayFromTo(ID,From,To,dest[],size=sizeof(dest));
GetRouteArraySize(ID);
*/

new string[256];
new array[25] =
    {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24};
new id;
new secarr[30];
new minarr[10];
new goodarr[25];
new fromtoarr[25];
new frx[12];

forward outc();
public outc()
{
    print("outc()--begin--");
    string[0] = 0;
    for(new i = 0; i < 25; ++i)
    {
        format(string,256,"%s %d",string,array[i]);
    }
    print(string);
    id = StoreRouteArray(sizeof(array),array);
    printf(" ID:%d",id);
    string[0] = 0;
    for(new i = 0; i < 25; ++i)
    {
        format(string,256,"%s %d",string,GetRouteAtPos(id,i));
    }
    print(string);
//
    printf("GetRouteArray(id,goodarr)::%d",GetRouteArray(id,goodarr));
    string[0] = 0;
    for(new i = 0; i < sizeof(goodarr); ++i)
    {
        format(string,256,"%s %d",string,goodarr[i]);
    }
    printf(" goodarr: %s",string);
//
    printf("GetRouteArray(id,minarr)::%d",GetRouteArray(id,minarr));
    string[0] = 0;
    for(new i = 0; i < sizeof(minarr); ++i)
    {
        format(string,256,"%s %d",string,minarr[i]);
    }
    printf(" minarr: %s",string);
//
    printf("GetRouteArray(id,secarr)::%d",GetRouteArray(id,secarr));
    string[0] = 0;
    for(new i = 0; i < sizeof(secarr); ++i)
    {
        format(string,256,"%s %d",string,secarr[i]);
    }
    printf(" secarr: %s",string);
//
    printf(" ArrSize: %d",GetRouteArraySize(id));
//
    printf("GetRouteArrayFromTo(id,0,25,fromtoarr)::%d",GetRouteArrayFromTo(id,0,25,fromtoarr));
    string[0] = 0;
    for(new i = 0; i < sizeof(fromtoarr); ++i)
    {
        format(string,256,"%s %d",string,fromtoarr[i]);
    }
    printf(" fromtoarr: %s",string);
//
    printf("GetRouteArrayFromTo(id,10,22,frx)::%d",GetRouteArrayFromTo(id,10,22,frx));
    string[0] = 0;
    for(new i = 0; i < sizeof(frx); ++i)
    {
        format(string,256,"%s %d",string,frx[i]);
    }
    printf(" frx: %s",string);
//

   
    SetTimer("delayed",5000,0);
    print("outc()--end--");
    return 1;
}

forward delayed();
public delayed()
{
    print("delayed()--begin--");
    printf(" ID:%d",id);
    string[0] = 0;
    for(new i = 0; i < 25; ++i)
    {
        format(string,256,"%s %d",string,GetRouteAtPos(id,i));
    }
    print(string);
//
    printf("GetRouteArray(id,goodarr)::%d",GetRouteArray(id,goodarr));
    string[0] = 0;
    for(new i = 0; i < sizeof(goodarr); ++i)
    {
        format(string,256,"%s %d",string,goodarr[i]);
    }
    printf(" goodarr: %s",string);
//
    printf("GetRouteArray(id,minarr)::%d",GetRouteArray(id,minarr));
    string[0] = 0;
    for(new i = 0; i < sizeof(minarr); ++i)
    {
        format(string,256,"%s %d",string,minarr[i]);
    }
    printf(" minarr: %s",string);
//
    printf("GetRouteArray(id,secarr)::%d",GetRouteArray(id,secarr));
    string[0] = 0;
    for(new i = 0; i < sizeof(secarr); ++i)
    {
        format(string,256,"%s %d",string,secarr[i]);
    }
    printf(" secarr: %s",string);
//
    printf(" ArrSize: %d",GetRouteArraySize(id));
//
    printf("GetRouteArrayFromTo(id,0,25,fromtoarr)::%d",GetRouteArrayFromTo(id,0,25,fromtoarr));
    string[0] = 0;
    for(new i = 0; i < sizeof(fromtoarr); ++i)
    {
        format(string,256,"%s %d",string,fromtoarr[i]);
    }
    printf(" fromtoarr: %s",string);
//
    printf("GetRouteArrayFromTo(id,10,22,frx)::%d",GetRouteArrayFromTo(id,10,22,frx));
    string[0] = 0;
    for(new i = 0; i < sizeof(frx); ++i)
    {
        format(string,256,"%s %d",string,frx[i]);
    }
    printf(" frx: %s",string);
//
    printf(" Delete:%d",DeleteArray(id));
    print("delayed()--end--");
    return 1;
}

The output with your code:
pawn Code:
//your code...
//thanks to fabsch for helping fixing the array bug
struct RouteData
{
    cell * Paths;
    int amount_of_nodes;
    int id;
    RouteData(cell *Paths_,int amount_of_nodes_, int id_)
    {
        Paths = (cell*)malloc(amount_of_nodes_);
        memcpy(Paths, Paths_, amount_of_nodes_);
        //Paths = Paths_;
        amount_of_nodes = amount_of_nodes_;
        id = id_;
    }
};
//
static cell AMX_NATIVE_CALL n_DeleteArray( AMX* amx, cell* params )
{
    for(int i = 0, j = RouteVector.size(); i < j; ++i)
    {
        if(RouteVector.at(i).id == params[1])
        {
            RouteID.erase(RouteID.begin()+i);
            free(RouteVector[i].Paths);
            RouteVector.erase(RouteVector.begin()+i);
            return 1;
        }
    }
    return 0;
}
result:
pawn Code:
[17:25:06] outc()--begin--
[17:25:06]  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
[17:25:06]  ID:0
[17:25:06]  0 1 2 3 4 5 6 0 648060458 -- 22 0 0 0 0 0 0 0 648060471 -- 27 0 0 0 0
[17:25:06] GetRouteArray(id,goodarr)::25
[17:25:06]  goodarr:  0 1 2 3 4 5 6 0 648060458 -- 22 0 0 0 0 0 0 0 648060471 -- 27 0 0 0 0
[17:25:06] GetRouteArray(id,minarr)::25
[17:25:06]  minarr:  0 1 2 3 4 5 6 0 648060458 --
[17:25:06] GetRouteArray(id,secarr)::25
[17:25:06]  secarr:  0 1 2 3 4 5 6 0 648060458 -- 22 0 0 0 0 0 0 0 648060471 -- 27 0 0 0 0 0 0 0 648060464 --
[17:25:06]  ArrSize: 25
[17:25:06] GetRouteArrayFromTo(id,0,25,fromtoarr)::24
[17:25:06]  fromtoarr:  0 1 2 3 4 5 6 0 648060458 -- 22 0 0 0 0 0 0 0 648060471 -- 27 0 0 0 0
[17:25:06] GetRouteArrayFromTo(id,10,22,frx)::11
[17:25:06]  frx:  22 0 0 0 0 0 0 0 648060471 -- 27 0
[17:25:06] outc()--end--
[17:25:33] delayed()--begin--
[17:25:33]  ID:0
[17:25:33]  0 1 2 3 4 5 6 0 648060458 -- 1701969942 1667584869 1415868015 1919249769 1862300672 1684368754 0 0 648060471 -- 27 0 0 0 0
[17:25:33] GetRouteArray(id,goodarr)::25
[17:25:33]  goodarr:  0 1 2 3 4 5 6 0 648060458 -- 1701969942 1667584869 1415868015 1919249769 1862300672 1684368754 0 0 648060471 -- 27 0 0 0 0
[17:25:33] GetRouteArray(id,minarr)::25
[17:25:33]  minarr:  0 1 2 3 4 5 6 0 648060458 --
[17:25:33] GetRouteArray(id,secarr)::25
[17:25:33]  secarr:  0 1 2 3 4 5 6 0 648060458 -- 1701969942 1667584869 1415868015 1919249769 1862300672 1684368754 0 0 648060471 -- 27 0 0 0 0 0 0 0 648060464 --
[17:25:33]  ArrSize: 25
[17:25:33] GetRouteArrayFromTo(id,0,25,fromtoarr)::24
[17:25:33]  fromtoarr:  0 1 2 3 4 5 6 0 648060458 -- 1701969942 1667584869 1415868015 1919249769 1862300672 1684368754 0 0 648060471 -- 27 0 0 0 0
[17:25:33] GetRouteArrayFromTo(id,10,22,frx)::11
[17:25:33]  frx:  1701969942 1667584869 1415868015 1919249769 1862300672 1684368754 0 0 648060471 -- 27 0
[17:25:33]  Delete:1
[17:25:33] delayed()--end--
Not really the expected output :O
Reply
#9

Right, I forgot multiplying the node count with the size of a cell, should be something like:
Code:
Paths = (cell*)malloc(amount_of_nodes_ * sizeof(cell));
memcpy(Paths, Paths_, amount_of_nodes_ * sizeof(cell));
Reply
#10

It works, ok going to work on more features :P
Thank you very much, from me - and from all users of the GPS Plugin.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)