Difference between revisions of "Roadblox.dat"

From GTAMods Wiki
Jump to navigation Jump to search
m (cat)
Line 36: Line 36:
 
     fclose(dat);
 
     fclose(dat);
 
}</source>
 
}</source>
 +
 +
{{N|SA}}
  
 
[[Category: File Formats]]
 
[[Category: File Formats]]

Revision as of 21:58, 5 February 2015

Roadblox.dat file stores an information about creation of police roadblocks on the map in GTA SA.

Format

The file begins with the parameter - count of used roadblocks. It is followed with information about these roadblocks. Details of one such roadblock includes path area id, and path id in this area.

struct NodeInfo
{
    signed __int16 areaId;
    unsigned __int16 nodeId;
};
struct _RoadBloxFile
{
    signed __int32 count;
    NodeInfo places[325];
};

Editing

The file can be edited, but its size should not be smaller than the original. Parameter "count" can be set to "-1" (in this case, information on the roadblocks will be ignored).

Example of file reading

void main()
{
    NodeInfo info;
    signed int count;
    char line[32];
    FILE * dat = fopen("data\\paths\\roadblox.dat", "rb");
    FILE * txt = fopen("data\\paths\\roadblox.txt", "wt");
    fread(&count, 4, 1, dat);
    sprintf(line, "count: %d\n", count);
    fputs(line, txt);
    for(int i = 1; i < 326; i++)
    {
        fread(&info, 4, 1, dat);
        sprintf(line, "  %3d area: %2d node: %3d\n", i, info.areaId, info.nodeId);
        fputs(line, txt);
    }
    fclose(txt);
    fclose(dat);
}