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

Method save

outdated/win/Qt3/tileedit.cpp:74–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

72}
73
74bool TilePickerTab::save()
75{
76 if ( !fopen_text_file(filename.latin1(), WRTMODE) ) {
77 // XXX handle better
78 exit(1);
79 }
80 pixel p[TILE_Y][TILE_X];
81 for ( int index=0; index < num; index++ ) {
82 int ox = (index%TILES_ACROSS)*TILE_X;
83 int oy = (index/TILES_ACROSS)*TILE_Y;
84 for ( int y=0; y<TILE_Y; y++ ) {
85 uchar* c = image.scanLine(oy+y) + ox;
86 for ( int x=0; x<TILE_X; x++ ) {
87 QRgb rgb = image.color(*c++);
88 p[y][x].r = qRed(rgb);
89 p[y][x].g = qGreen(rgb);
90 p[y][x].b = qBlue(rgb);
91 }
92 }
93 write_text_tile(p);
94 }
95 fclose_text_file();
96}
97
98void TilePickerTab::mousePressEvent(QMouseEvent* e)
99{

Callers

nothing calls this directly

Calls 3

fopen_text_fileFunction · 0.85
write_text_tileFunction · 0.85
fclose_text_fileFunction · 0.85

Tested by

no test coverage detected