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

Function shuffle_tiles

src/o_init.c:34–50  ·  view source on GitHub ↗

Shuffle tile assignments to match descriptions, so a red potion isn't * displayed with a blue tile and so on. * * Tile assignments are not saved, and shouldn't be so that a game can * be resumed on an otherwise identical non-tile-using binary, so we have * to reshuffle the assignments from oc_descr_idx information when a game * is restored. So might as well do that the first time instead of

Source from the content-addressed store, hash-verified

32 * another routine.
33 */
34staticfn void
35shuffle_tiles(void)
36{
37 int i;
38 short tmp_tilemap[2][NUM_OBJECTS];
39
40 for (i = 0; i < NUM_OBJECTS; i++) {
41 tmp_tilemap[0][i] = glyphmap[objects[i].oc_descr_idx
42 + GLYPH_OBJ_OFF].tileidx;
43 tmp_tilemap[1][i] = glyphmap[objects[i].oc_descr_idx
44 + GLYPH_OBJ_PILETOP_OFF].tileidx;
45 }
46 for (i = 0; i < NUM_OBJECTS; i++) {
47 glyphmap[i + GLYPH_OBJ_OFF].tileidx = tmp_tilemap[0][i];
48 glyphmap[i + GLYPH_OBJ_PILETOP_OFF].tileidx = tmp_tilemap[1][i];
49 }
50}
51#endif /* TILES_IN_GLYPHMAP */
52
53staticfn void

Callers 2

init_objectsFunction · 0.85
restnamesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected