Difference between revisions of "Roadblox.dat"
Jump to navigation
Jump to search
(Several touches) |
|||
Line 1: | Line 1: | ||
− | Roadblox.dat file stores | + | Roadblox.dat file stores information about creation of police roadblocks on the map in GTA San Andreas. |
==Format== | ==Format== | ||
The file begins with the parameter - count of used roadblocks. | 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. | It is followed with information about these roadblocks. Details of one such roadblock includes path area id, and path id in this area. | ||
− | <source lang=" | + | <source lang="C">typedef struct NodeInfo |
{ | { | ||
− | + | int16_t areaId; | |
− | + | uint16_t nodeId; | |
− | };</source> | + | } NodeInfo;</source> |
− | <source lang=" | + | <source lang="C">typedef struct RoadBloxFile |
{ | { | ||
− | + | int32_t count; | |
− | + | NodeInfo places[325]; | |
− | };</source> | + | } RoadBloxFile;</source> |
==Editing== | ==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). | 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== | ==Example of file reading== | ||
− | <source lang="C"> | + | <source lang="C">int main() |
{ | { | ||
− | + | NodeInfo info; | |
− | + | int32_t count; | |
− | + | FILE * dat = fopen("data/paths/roadblox.dat", "rb"); | |
− | + | FILE * txt = fopen("data/paths/roadblox.txt", "wt"); | |
− | + | fread(&count, 4, 1, dat); | |
− | + | fprintf(txt, "count: %d\n", count); | |
− | + | for(int i = 0; i < count; i++) | |
− | + | { | |
− | + | fread(&info, sizeof(info), 1, dat); | |
− | + | fprintf(txt, " %3d area: %2d node: %3u\n", i+1, info.areaId, info.nodeId); | |
− | + | } | |
− | + | fclose(txt); | |
− | + | fclose(dat); | |
− | + | ||
− | + | return 0; | |
− | |||
}</source> | }</source> | ||
Latest revision as of 22:28, 29 June 2016
Roadblox.dat file stores information about creation of police roadblocks on the map in GTA San Andreas.
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.
typedef struct NodeInfo
{
int16_t areaId;
uint16_t nodeId;
} NodeInfo;
typedef struct RoadBloxFile
{
int32_t count;
NodeInfo places[325];
} RoadBloxFile;
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
int main()
{
NodeInfo info;
int32_t count;
FILE * dat = fopen("data/paths/roadblox.dat", "rb");
FILE * txt = fopen("data/paths/roadblox.txt", "wt");
fread(&count, 4, 1, dat);
fprintf(txt, "count: %d\n", count);
for(int i = 0; i < count; i++)
{
fread(&info, sizeof(info), 1, dat);
fprintf(txt, " %3d area: %2d node: %3u\n", i+1, info.areaId, info.nodeId);
}
fclose(txt);
fclose(dat);
return 0;
}