industry_gui.c
changeset 2952 58522ed8f0f1
parent 2951 2de6d3a59743
child 2989 916f9443345f
equal deleted inserted replaced
2951:2de6d3a59743 2952:58522ed8f0f1
   330 		break;
   330 		break;
   331 
   331 
   332 	case WE_CLICK: {
   332 	case WE_CLICK: {
   333 		Industry *i;
   333 		Industry *i;
   334 
   334 
   335 		switch(e->click.widget) {
   335 		switch (e->click.widget) {
   336 		case 5: {
   336 		case 5: {
   337 			int line;
   337 			int line;
   338 			int x;
   338 			int x;
   339 			byte b;
   339 			byte b;
   340 
   340 
   548 	_industry_sort = realloc(_industry_sort, GetIndustryPoolSize() * sizeof(_industry_sort[0]));
   548 	_industry_sort = realloc(_industry_sort, GetIndustryPoolSize() * sizeof(_industry_sort[0]));
   549 	if (_industry_sort == NULL)
   549 	if (_industry_sort == NULL)
   550 		error("Could not allocate memory for the industry-sorting-list");
   550 		error("Could not allocate memory for the industry-sorting-list");
   551 
   551 
   552 	FOR_ALL_INDUSTRIES(i) {
   552 	FOR_ALL_INDUSTRIES(i) {
   553 		if(i->xy)
   553 		if (i->xy)
   554 			_industry_sort[n++] = i->index;
   554 			_industry_sort[n++] = i->index;
   555 	}
   555 	}
   556 	_num_industry_sort = n;
   556 	_num_industry_sort = n;
   557 	_last_industry_idx = 0xFFFF; // used for "cache"
   557 	_last_industry_idx = 0xFFFF; // used for "cache"
   558 
   558 
   608 			if (++n == w->vscroll.cap) break;
   608 			if (++n == w->vscroll.cap) break;
   609 		}
   609 		}
   610 	} break;
   610 	} break;
   611 
   611 
   612 	case WE_CLICK:
   612 	case WE_CLICK:
   613 		switch(e->click.widget) {
   613 		switch (e->click.widget) {
   614 		case 3: {
   614 		case 3: {
   615 			_industry_sort_order = _industry_sort_order==0 ? 1 : 0;
   615 			_industry_sort_order = _industry_sort_order==0 ? 1 : 0;
   616 			_industry_sort_dirty = true;
   616 			_industry_sort_dirty = true;
   617 			SetWindowDirty(w);
   617 			SetWindowDirty(w);
   618 		} break;
   618 		} break;