All pastes #680157 Raw Edit

Untitled

public cpp v1 · immutable
#680157 ·published 2007-09-03 17:55 UTC
rendered paste body
void ChangeZoningLegend(EvaluationMode ev, StringID *strings){	memset(strings, INVALID_STRING_ID, sizeof(strings));			switch(ev) {		/* Snip */		case CHECKACCEPTGOODS: //This is the only case where the act is different		case CHECKPRODUCEGOODS://between outer and inner.			for(CargoID i = 0; ((i < NUM_CARGO) || (i < ZONING_COLOURS)); i++)				strings[(int)i] = GetCargo(i)->name;			break;		default:			break; 	}}static void ZoningToolbWndProc(Window *w, WindowEvent *e){	/* Snip */	char buffer[512];	if(!_outer_legends[0])		memset(_outer_legends, INVALID_STRING_ID, sizeof(_outer_legends));	if(!_inner_legends[0])		memset(_inner_legends, INVALID_STRING_ID, sizeof(_inner_legends));		switch(e->event) {		case WE_PAINT:			/* Snip */			//Legends:			for(int i = 0, y = 4; i<ZONING_COLOURS; i++) {				DrawString(y, 31, _outer_legends[i], GetColourByPosition(i));				if(_outer_legends[i]!=INVALID_STRING_ID) {					printf("o%d  ", (int)_outer_legends[i]);					// This crashes when CHECKPRODUCEGOODS/CEHCKACCEPTANCEGOODS					// is selected by the inner thing below.					GetString(buffer, _outer_legends[i], lastof(buffer));					y += GetStringBoundingBox(buffer).width + 4;				}			}			for(int i = 0, y = 4; i<ZONING_COLOURS; i++) {				DrawString(y, 75, _inner_legends[i], GetColourByPosition(i));				if(_inner_legends[i]!=INVALID_STRING_ID) {					printf("i%d  ", (int)_inner_legends[i]);					GetString(buffer, _inner_legends[i], lastof(buffer));					y += GetStringBoundingBox(buffer).width + 4;				}			}			break;		/* Snip */	}}