train_gui.c
changeset 2113 f228b399da01
parent 2103 9266bb2ac29d
child 2147 42efdf5020d1
equal deleted inserted replaced
2112:b94d4c1a0ab9 2113:f228b399da01
   415 			i = 0;
   415 			i = 0;
   416 			u = v;
   416 			u = v;
   417 			do {
   417 			do {
   418 				i += u->u.rail.cached_veh_length + 1;
   418 				i += u->u.rail.cached_veh_length + 1;
   419 			} while ( (u=u->next) != NULL);			//Determine length of train
   419 			} while ( (u=u->next) != NULL);			//Determine length of train
   420 			SetDParam(0, (i+8) / 9);			//Set the counter
   420 
   421 			i = (w->hscroll.cap * 29) + (x + 26);		//Calculate position of text according to window size
   421 			SetDParam(0, (i + 8) / 9);			//Set the counter
   422 			DrawStringCentered(i, y+5, STR_TINY_BLACK, 0);	//Draw the counter
   422 			DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0);	//Draw the counter
   423 
   423 
   424 			/* Draw the pretty flag */
   424 			/* Draw the pretty flag */
   425 			DrawSprite(v->vehstatus&VS_STOPPED ? 0xC12 : 0xC13, x+15, y);
   425 			DrawSprite(v->vehstatus&VS_STOPPED ? 0xC12 : 0xC13, x+15, y);
   426 
   426 
   427 			y += 14;
   427 			y += 14;
   439 			/*Draw the train counter */
   439 			/*Draw the train counter */
   440 			i = 0;
   440 			i = 0;
   441 			u = v;
   441 			u = v;
   442 			do i++; while ( (u=u->next) != NULL);		//Determine length of train
   442 			do i++; while ( (u=u->next) != NULL);		//Determine length of train
   443 			SetDParam(0, i);				//Set the counter
   443 			SetDParam(0, i);				//Set the counter
   444 			i = (w->hscroll.cap * 29) + (x + 26);		//Calculate position of text according to window size
   444 			DrawStringRightAligned(w->widget[6].right - 1, y + 4, STR_TINY_BLACK, 0);	//Draw the counter
   445 			DrawStringCentered(i, y+5, STR_TINY_BLACK, 0);	//Draw the counter
       
   446 			y += 14;
   445 			y += 14;
   447 		}
   446 		}
   448 	}
   447 	}
   449 }
   448 }
   450 
   449 
   881 				break;
   880 				break;
   882 			}
   881 			}
   883 		}
   882 		}
   884 
   883 
   885 		/* draw the flag plus orders */
   884 		/* draw the flag plus orders */
   886 		{	int w_width = w->widget[5].right - w->widget[5].left;
   885 		DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
   887 			DrawSprite(v->vehstatus & VS_STOPPED ? 0xC12 : 0xC13, 2, w->widget[5].top + 1);
   886 		DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
   888 			DrawStringCenteredTruncated(w_width / 2 + 6, w->widget[5].top + 1, str, 0, w_width - 8);
       
   889 		}
       
   890 		DrawWindowViewport(w);
   887 		DrawWindowViewport(w);
   891 	}	break;
   888 	}	break;
   892 
   889 
   893 	case WE_CLICK: {
   890 	case WE_CLICK: {
   894 		int wid = e->click.widget;
   891 		int wid = e->click.widget;