Add button to watch companies to online players window

This commit is contained in:
dP
2021-11-05 06:20:20 +03:00
parent 632e1e21dc
commit b5aa96696f
5 changed files with 12 additions and 3 deletions

Binary file not shown.

View File

@@ -14,9 +14,11 @@ gen.add_sprite(grf.FileSprite(toolbar_png, 0, 0, 20, 14, yofs=4),
sprite = lambda *args, **kw: gen.add_sprite(grf.FileSprite(toolbar_png, *args, **kw))
sprite2 = lambda x, y, w, h, x2, y2: gen.add_sprite(grf.FileSprite(toolbar_png, x, y, w, h), grf.FileSprite(toolbar_png, x2, y2, w * 2, h * 2, zoom=grf.ZOOM_2X))
sprite( 0, 44, 12, 10) # hq button icon
sprite( 0, 55, 12, 10) # watch button icon
# sprite2(0, 55, 12, 10, 13, 55) # watch button icon
sprite( 45, 67, 10, 10) # host black
sprite( 45, 44, 10, 10) # player black
sprite(45, 67, 10, 10) # host black
sprite(45, 44, 10, 10) # player black
sprite2(85, 67, 11, 11, 97, 67) # host white
sprite2(85, 44, 11, 11, 97, 44) # player white

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -1645,6 +1645,11 @@ private:
else ScrollMainWindowToTile(company->location_of_HQ);
}
static void CMOnClickCompanyWatch(NetworkClientListWindow *w, Point pt, CompanyID company_id)
{
citymania::ShowWatchWindow(company_id, 0);
}
/**
* Part of RebuildList() to create the information for a single company.
* @param company_id The company to build the list for.
@@ -1661,6 +1666,7 @@ private:
ButtonCommon *hq_button = new CompanyButton(CM_SPR_HQ, STR_NETWORK_CLIENT_LIST_CHAT_COMPANY_TOOLTIP, COLOUR_ORANGE, company_id, &NetworkClientListWindow::CMOnClickCompanyHQ);
if (company->location_of_HQ == INVALID_TILE) hq_button->disabled = true;
this->buttons[line_count].emplace_back(hq_button);
this->buttons[line_count].emplace_back(new CompanyButton(CM_SPR_WATCH, STR_NETWORK_CLIENT_LIST_CHAT_COMPANY_TOOLTIP, COLOUR_ORANGE, company_id, &NetworkClientListWindow::CMOnClickCompanyWatch));
}
/* CityMania code end */
this->buttons[line_count].emplace_back(chat_button);

View File

@@ -313,7 +313,8 @@ static const uint16 PALETTE_SPRITE_COUNT = 1;
static const SpriteID CM_SPR_CITYMANIA_BASE = SPR_PALETTE_BASE + PALETTE_SPRITE_COUNT;
static const SpriteID CM_SPR_RAIL_COPY_PASTE = CM_SPR_CITYMANIA_BASE + 2;
static const SpriteID CM_SPR_HQ = CM_SPR_CITYMANIA_BASE + 3;
static const SpriteID CM_SPR_HOST = CM_SPR_CITYMANIA_BASE + 4;
static const SpriteID CM_SPR_WATCH = CM_SPR_CITYMANIA_BASE + 4;
static const SpriteID CM_SPR_HOST = CM_SPR_CITYMANIA_BASE + 5;
static const SpriteID CM_SPR_PLAYER = CM_SPR_HOST + 1;
static const SpriteID CM_SPR_HOST_WHITE = CM_SPR_HOST + 2;
static const SpriteID CM_SPR_PLAYER_WHITE = CM_SPR_HOST + 3;