|
@@ -133,49 +133,49 @@ static void MakeSortedStationList(byte o
|
|
|
}
|
|
|
|
|
|
static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
|
|
{
|
|
|
switch(e->event) {
|
|
|
case WE_PAINT: {
|
|
|
uint32 i;
|
|
|
const byte window_number = (byte)w->window_number;
|
|
|
|
|
|
// resort station window if stations have been added/removed
|
|
|
if (_global_station_sort_dirty)
|
|
|
GlobalSortStationList();
|
|
|
|
|
|
if (_station_sort_dirty[window_number]) { // resort in case of a station rename.
|
|
|
MakeSortedStationList(window_number);
|
|
|
}
|
|
|
|
|
|
// stations are stored as a cummulative index, eg 25, 41, 43. This means
|
|
|
// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2 stations
|
|
|
i = (window_number == 0) ? 0 : _num_station_sort[window_number-1];
|
|
|
SetVScrollCount(w, _num_station_sort[window_number] - i);
|
|
|
|
|
|
/* draw widgets, with player's name in the caption */
|
|
|
{
|
|
|
Player *p = DEREF_PLAYER(window_number);
|
|
|
Player *p = GetPlayer(window_number);
|
|
|
SetDParam(0, p->name_1);
|
|
|
SetDParam(1, p->name_2);
|
|
|
SetDParam(2, w->vscroll.count);
|
|
|
DrawWindowWidgets(w);
|
|
|
}
|
|
|
|
|
|
{
|
|
|
byte p = 0;
|
|
|
Station *st;
|
|
|
int x,xb = 2;
|
|
|
int y = 16; // offset from top of widget
|
|
|
int j;
|
|
|
|
|
|
if (w->vscroll.count == 0) { // player has no stations
|
|
|
DrawString(xb, y, STR_304A_NONE, 0);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
i += w->vscroll.pos; // offset from sorted station list of current player
|
|
|
assert(i < _num_station_sort[window_number]); // at least one station must exist
|
|
|
|
|
|
while (i < _num_station_sort[window_number]) { // do until max number of stations of owner
|
|
|
st = GetStation(_station_sort[i].index);
|
|
|
|