This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
void | map_load_bits (FILE *f, MAP *map) |
void | map_save_bits (FILE *f, MAP *map, mapobj *obj) |
void | set_hex_enterable (MAP *map, int x, int y) |
void | set_hex_mine (MAP *map, int x, int y) |
void | unset_hex_enterable (MAP *map, int x, int y) |
void | unset_hex_mine (MAP *map, int x, int y) |
int | is_mine_hex (MAP *map, int x, int y) |
int | is_hangar_hex (MAP *map, int x, int y) |
void | clear_hex_bits (MAP *map, int bits) |
int | bit_size (MAP *map) |
int bit_size | ( | MAP * | map | ) |
Definition at line 212 of file map.bits.c.
References grab_us_an_array(), MAP::map_height, MAP::map_width, MAP::mapobj, realnum, and TYPE_BITS.
Referenced by debug_check_stuff().
00213 { 00214 int xs = map->map_width; 00215 int ys = map->map_height; 00216 int i, s = 0; 00217 unsigned char **foo; 00218 00219 if(!map->mapobj[TYPE_BITS]) 00220 return 0; 00221 foo = grab_us_an_array(map); 00222 for(i = 0; i < ys; i++) 00223 if(foo[i]) 00224 s += realnum(xs); 00225 return s; 00226 }
void clear_hex_bits | ( | MAP * | map, | |
int | bits | |||
) |
Definition at line 183 of file map.bits.c.
References btissetbit, btunsetbit, grab_us_an_array(), MAP::map_height, MAP::map_width, MAP::mapobj, and TYPE_BITS.
Referenced by recalculate_minefields(), and recursively_updatelinks().
00184 { 00185 int xs = map->map_width; 00186 int ys = map->map_height; 00187 int i, j; 00188 unsigned char **foo; 00189 00190 if(!map->mapobj[TYPE_BITS]) 00191 return; 00192 foo = grab_us_an_array(map); 00193 for(i = 0; i < ys; i++) 00194 if(foo[i]) 00195 for(j = 0; j < xs; j++) { 00196 switch (bits) { 00197 case 1: 00198 case 2: 00199 if(btissetbit(foo, j, i, bits)) 00200 btunsetbit(foo, j, i, bits); 00201 break; 00202 case 0: 00203 if(btissetbit(foo, j, i, 1)) 00204 btunsetbit(foo, j, i, 1); 00205 if(btissetbit(foo, j, i, 2)) 00206 btunsetbit(foo, j, i, 2); 00207 break; 00208 } 00209 } 00210 }
int is_hangar_hex | ( | MAP * | map, | |
int | x, | |||
int | y | |||
) |
Definition at line 169 of file map.bits.c.
References BIT_HANGAR, btissetbit, grab_us_an_array(), MAP::mapobj, TYPE_BITS, and y.
Referenced by steppable_base_check().
00170 { 00171 unsigned char **foo; 00172 00173 if(!map) 00174 return 0; 00175 if(!map->mapobj[TYPE_BITS]) 00176 return 0; 00177 foo = grab_us_an_array(map); 00178 if(!foo[y]) 00179 return 0; 00180 return (btissetbit(foo, x, y, BIT_HANGAR)); 00181 }
int is_mine_hex | ( | MAP * | map, | |
int | x, | |||
int | y | |||
) |
Definition at line 155 of file map.bits.c.
References BIT_MINE, btissetbit, grab_us_an_array(), MAP::mapobj, TYPE_BITS, and y.
Referenced by add_mine(), possible_mine_poof(), possibly_remove_mines(), and show_mines_in_hex().
00156 { 00157 unsigned char **foo; 00158 00159 if(!map) 00160 return 0; 00161 if(!map->mapobj[TYPE_BITS]) 00162 return 0; 00163 foo = grab_us_an_array(map); 00164 if(!foo[y]) 00165 return 0; 00166 return (btissetbit(foo, x, y, BIT_MINE)); 00167 }
void map_load_bits | ( | FILE * | f, | |
MAP * | map | |||
) |
Definition at line 45 of file map.bits.c.
References CHELO, Create, MAP::map_height, MAP::map_width, and realnum.
Referenced by load_mapobjs().
00046 { 00047 int xs = map->map_width; 00048 int ys = map->map_height; 00049 unsigned char **foo; 00050 int tmp, i; 00051 00052 Create(foo, unsigned char *, ys); 00053 CHELO(foo, sizeof(unsigned char *), ys, f); 00054 00055 for(i = 0; i < ys; i++) 00056 if(foo[i]) { 00057 Create(foo[i], unsigned char, realnum(xs)); 00058 CHELO(foo[i], sizeof(unsigned char), realnum(xs), f); 00059 } 00060 }
Definition at line 62 of file map.bits.c.
References c, CHESA, mapobj_struct::datai, MAP::map_height, MAP::map_width, outbyte, realnum, and TYPE_BITS.
Referenced by save_mapobjs().
00063 { 00064 int tmp; 00065 int i, j, c, tc = 0; 00066 unsigned char **foo; 00067 int xs = map->map_width; 00068 int ys = map->map_height; 00069 unsigned char tmpb; 00070 00071 #define outbyte(a) tmpb=(a);fwrite(&tmpb, 1, 1, f); 00072 foo = (unsigned char **) ((void *) obj->datai); 00073 /* First, we clean up our act */ 00074 for(i = 0; i < ys; i++) { 00075 c = 0; 00076 if(foo[i]) { 00077 for(j = 0; j < realnum(xs); j++) 00078 if(foo[i][j]) 00079 c++; 00080 if(!c) { 00081 free((void *) foo[i]); 00082 foo[i] = NULL; 00083 } else 00084 tc += c; 00085 } 00086 } 00087 if(!tc) { 00088 /* We don't want to save worthless shit */ 00089 /* On other hand, cleaning us out of memory would take too 00090 much trouble compared to the worth. Therefore, during next 00091 cleanup (reboot), this structure does a disappearance act. */ 00092 return; 00093 } 00094 outbyte(TYPE_BITS + 1); 00095 CHESA(foo, sizeof(unsigned char *), ys, f); 00096 00097 for(i = 0; i < ys; i++) 00098 if(foo[i]) 00099 CHESA(foo[i], sizeof(unsigned char), realnum(xs), f); 00100 }
void set_hex_enterable | ( | MAP * | map, | |
int | x, | |||
int | y | |||
) |
Definition at line 123 of file map.bits.c.
References BIT_HANGAR, btsetbit, and grab_us_an_array().
Referenced by add_links().
00124 { 00125 unsigned char **foo; 00126 00127 foo = grab_us_an_array(map); 00128 btsetbit(foo, x, y, BIT_HANGAR); 00129 }
void set_hex_mine | ( | MAP * | map, | |
int | x, | |||
int | y | |||
) |
Definition at line 131 of file map.bits.c.
References BIT_MINE, btsetbit, and grab_us_an_array().
Referenced by add_mine_on_map().
00132 { 00133 unsigned char **foo; 00134 00135 foo = grab_us_an_array(map); 00136 btsetbit(foo, x, y, BIT_MINE); 00137 }
void unset_hex_enterable | ( | MAP * | map, | |
int | x, | |||
int | y | |||
) |
Definition at line 139 of file map.bits.c.
References BIT_HANGAR, btunsetbit, and grab_us_an_array().
00140 { 00141 unsigned char **foo; 00142 00143 foo = grab_us_an_array(map); 00144 btunsetbit(foo, x, y, BIT_HANGAR); 00145 }
void unset_hex_mine | ( | MAP * | map, | |
int | x, | |||
int | y | |||
) |
Definition at line 147 of file map.bits.c.
References BIT_MINE, btunsetbit, and grab_us_an_array().
Referenced by make_mine_explode().
00148 { 00149 unsigned char **foo; 00150 00151 foo = grab_us_an_array(map); 00152 btunsetbit(foo, x, y, BIT_MINE); 00153 }