MCPcopy Create free account
hub / github.com/NetHack/NetHack / mapfrag_fromstr

Function mapfrag_fromstr

src/sp_lev.c:226–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226struct mapfragment *
227mapfrag_fromstr(char *str)
228{
229 struct mapfragment *mf = (struct mapfragment *) alloc(sizeof *mf);
230
231 char *tmps;
232
233 mf->data = dupstr(str);
234
235 (void) stripdigits(mf->data);
236 mf->wid = str_lines_maxlen(mf->data);
237 mf->hei = 0;
238 tmps = mf->data;
239 while (tmps && *tmps) {
240 char *s1 = strchr(tmps, '\n');
241
242 if (mf->hei > MAP_Y_LIM) {
243 free(mf->data);
244 free(mf);
245 return NULL;
246 }
247 if (s1)
248 s1++;
249 tmps = s1;
250 mf->hei++;
251 }
252 return mf;
253}
254
255void
256mapfrag_free(struct mapfragment **mf)

Callers 3

l_selection_matchFunction · 0.85
lspo_replace_terrainFunction · 0.85
lspo_mapFunction · 0.85

Calls 4

dupstrFunction · 0.85
stripdigitsFunction · 0.85
str_lines_maxlenFunction · 0.85
allocFunction · 0.70

Tested by

no test coverage detected