Roadblox.dat

From GTAMods Wiki
Revision as of 13:37, 23 August 2014 by Gta.bullet (talk | contribs) (cat)
Jump to navigation Jump to search

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);
}