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

Function merge_colormap

win/share/tiletext.c:357–381  ·  view source on GitHub ↗

merge new colors from ColorMap into MainColorMap */

Source from the content-addressed store, hash-verified

355
356/* merge new colors from ColorMap into MainColorMap */
357void
358merge_colormap(void)
359{
360 int i, j;
361
362 for (i = 0; i < colorsinmap; i++) {
363 for (j = 0; j < colorsinmainmap; j++) {
364 if (MainColorMap[CM_RED][j] == ColorMap[CM_RED][i]
365 && MainColorMap[CM_GREEN][j] == ColorMap[CM_GREEN][i]
366 && MainColorMap[CM_BLUE][j] == ColorMap[CM_BLUE][i])
367 break;
368 }
369 if (j >= colorsinmainmap) { /* new color */
370 if (colorsinmainmap >= MAXCOLORMAPSIZE) {
371 Fprintf(stderr,
372 "Too many colors to merge -- excess ignored.\n");
373 }
374 j = colorsinmainmap;
375 MainColorMap[CM_RED][j] = ColorMap[CM_RED][i];
376 MainColorMap[CM_GREEN][j] = ColorMap[CM_GREEN][i];
377 MainColorMap[CM_BLUE][j] = ColorMap[CM_BLUE][i];
378 colorsinmainmap++;
379 }
380 }
381}
382
383boolean
384fopen_text_file(const char *filename, const char *type)

Callers 1

fopen_text_fileFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected