src/industry_gui.cpp
changeset 7928 63e18de69e50
parent 7922 a7e266f966d9
child 7954 57b51c69c072
equal deleted inserted replaced
7927:3a3289a049f9 7928:63e18de69e50
   212 			DrawStringTruncated(x_str, y_str, str, TC_FROMSTRING, max_width);
   212 			DrawStringTruncated(x_str, y_str, str, TC_FROMSTRING, max_width);
   213 			y_str += 11;
   213 			y_str += 11;
   214 
   214 
   215 			/* Get the additional purchase info text, if it has not already been */
   215 			/* Get the additional purchase info text, if it has not already been */
   216 			if (_fund_gui.text[WP(w, fnd_d).index] == STR_NULL) {   // Have i been called already?
   216 			if (_fund_gui.text[WP(w, fnd_d).index] == STR_NULL) {   // Have i been called already?
   217 				if (HASBIT(indsp->callback_flags, CBM_IND_FUND_MORE_TEXT)) {          // No. Can it be called?
   217 				if (HasBit(indsp->callback_flags, CBM_IND_FUND_MORE_TEXT)) {          // No. Can it be called?
   218 					uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_FUND_MORE_TEXT, 0, 0, NULL, WP(w, fnd_d).select, INVALID_TILE);
   218 					uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_FUND_MORE_TEXT, 0, 0, NULL, WP(w, fnd_d).select, INVALID_TILE);
   219 					if (callback_res != CALLBACK_FAILED) {  // Did it failed?
   219 					if (callback_res != CALLBACK_FAILED) {  // Did it failed?
   220 						StringID newtxt = GetGRFStringID(indsp->grf_prop.grffile->grfid, 0xD000 + callback_res);  // No. here's the new string
   220 						StringID newtxt = GetGRFStringID(indsp->grf_prop.grffile->grfid, 0xD000 + callback_res);  // No. here's the new string
   221 						_fund_gui.text[WP(w, fnd_d).index] = newtxt;   // Store it for further usage
   221 						_fund_gui.text[WP(w, fnd_d).index] = newtxt;   // Store it for further usage
   222 					}
   222 					}
   404 		const IndustrySpec *ind = GetIndustrySpec(i->type);
   404 		const IndustrySpec *ind = GetIndustrySpec(i->type);
   405 		int lines = -3;
   405 		int lines = -3;
   406 		bool first = true;
   406 		bool first = true;
   407 		bool has_accept = false;
   407 		bool has_accept = false;
   408 
   408 
   409 		if (HASBIT(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HASBIT(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
   409 		if (HasBit(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
   410 			for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
   410 			for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
   411 				if (i->accepts_cargo[j] == CT_INVALID) continue;
   411 				if (i->accepts_cargo[j] == CT_INVALID) continue;
   412 				has_accept = true;
   412 				has_accept = true;
   413 				if (first) {
   413 				if (first) {
   414 					lines++;
   414 					lines++;
   434 				first = false;
   434 				first = false;
   435 			}
   435 			}
   436 			lines++;
   436 			lines++;
   437 		}
   437 		}
   438 
   438 
   439 		if (HASBIT(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) lines += 2;
   439 		if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) lines += 2;
   440 
   440 
   441 		for (byte j = 5; j <= 7; j++) {
   441 		for (byte j = 5; j <= 7; j++) {
   442 			if (j != 5) w->widget[j].top += lines * 10;
   442 			if (j != 5) w->widget[j].top += lines * 10;
   443 			w->widget[j].bottom += lines * 10;
   443 			w->widget[j].bottom += lines * 10;
   444 		}
   444 		}
   453 		bool has_accept = false;
   453 		bool has_accept = false;
   454 
   454 
   455 		SetDParam(0, w->window_number);
   455 		SetDParam(0, w->window_number);
   456 		DrawWindowWidgets(w);
   456 		DrawWindowWidgets(w);
   457 
   457 
   458 		if (HASBIT(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HASBIT(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
   458 		if (HasBit(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
   459 			for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
   459 			for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
   460 				if (i->accepts_cargo[j] == CT_INVALID) continue;
   460 				if (i->accepts_cargo[j] == CT_INVALID) continue;
   461 				has_accept = true;
   461 				has_accept = true;
   462 				if (first) {
   462 				if (first) {
   463 					DrawString(2, y, STR_INDUSTRY_WINDOW_WAITING_FOR_PROCESSING, TC_FROMSTRING);
   463 					DrawString(2, y, STR_INDUSTRY_WINDOW_WAITING_FOR_PROCESSING, TC_FROMSTRING);
   507 			}
   507 			}
   508 			y += 10;
   508 			y += 10;
   509 		}
   509 		}
   510 
   510 
   511 		/* Get the extra message for the GUI */
   511 		/* Get the extra message for the GUI */
   512 		if (HASBIT(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) {
   512 		if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) {
   513 			uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_WINDOW_MORE_TEXT, 0, 0, i, i->type, i->xy);
   513 			uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_WINDOW_MORE_TEXT, 0, 0, i, i->type, i->xy);
   514 			if (callback_res != CALLBACK_FAILED) {
   514 			if (callback_res != CALLBACK_FAILED) {
   515 				StringID message = GetGRFStringID(ind->grf_prop.grffile->grfid, 0xD000 + callback_res);
   515 				StringID message = GetGRFStringID(ind->grf_prop.grffile->grfid, 0xD000 + callback_res);
   516 				if (message != STR_NULL && message != STR_UNDEFINED) {
   516 				if (message != STR_NULL && message != STR_UNDEFINED) {
   517 					y += 10;
   517 					y += 10;