settings_gui.c
changeset 2766 7658ddad65b9
parent 2749 46aba09ca365
child 2767 3282c77ffc27
equal deleted inserted replaced
2765:b00f2d3d7964 2766:7658ddad65b9
  1219 
  1219 
  1220 			if (y >= w->vscroll.cap) return; // click out of bounds
  1220 			if (y >= w->vscroll.cap) return; // click out of bounds
  1221 
  1221 
  1222 			y += w->vscroll.pos;
  1222 			y += w->vscroll.pos;
  1223 
  1223 
  1224 			if (y >= _grffile_count) return;
  1224 			if (y >= w->vscroll.count) return;
  1225 
  1225 
  1226 			_sel_grffile = _first_grffile;
  1226 			_sel_grffile = _first_grffile;
  1227 			// get selected grf-file
  1227 			// get selected grf-file
  1228 			while (y-- != 0) _sel_grffile = _sel_grffile->next;
  1228 			while (y-- != 0) _sel_grffile = _sel_grffile->next;
  1229 
  1229 
  1279 	NewgrfWndProc,
  1279 	NewgrfWndProc,
  1280 };
  1280 };
  1281 
  1281 
  1282 void ShowNewgrf(void)
  1282 void ShowNewgrf(void)
  1283 {
  1283 {
       
  1284 	const GRFFile* c;
  1284 	Window *w;
  1285 	Window *w;
       
  1286 	uint count;
       
  1287 
  1285 	DeleteWindowById(WC_GAME_OPTIONS, 0);
  1288 	DeleteWindowById(WC_GAME_OPTIONS, 0);
  1286 	w = AllocateWindowDesc(&_newgrf_desc);
  1289 	w = AllocateWindowDesc(&_newgrf_desc);
  1287 
  1290 
  1288 	{ // little helper function to calculate _grffile_count
  1291 	count = 0;
  1289 	  // should be REMOVED once _grffile_count is calculated at loading
  1292 	for (c = _first_grffile; c != NULL; c = c->next) count++;
  1290 		const GRFFile* c;
       
  1291 
       
  1292 		_grffile_count = 0;
       
  1293 		for (c = _first_grffile; c != NULL; c = c->next) _grffile_count++;
       
  1294 	}
       
  1295 
  1293 
  1296 	w->vscroll.cap = 12;
  1294 	w->vscroll.cap = 12;
  1297 	w->vscroll.count = _grffile_count;
  1295 	w->vscroll.count = count;
  1298 	w->vscroll.pos = 0;
  1296 	w->vscroll.pos = 0;
  1299 	w->disabled_state = (1 << 5) | (1 << 6) | (1 << 7);
  1297 	w->disabled_state = (1 << 5) | (1 << 6) | (1 << 7);
  1300 }
  1298 }
  1301 
  1299 
  1302 /* state: 0 = none clicked, 0x01 = first clicked, 0x02 = second clicked */
  1300 /* state: 0 = none clicked, 0x01 = first clicked, 0x02 = second clicked */