openttd updated to 1.5.0-beta2

--HG--
branch : openttd
This commit is contained in:
Pavel Stupnikov
2015-03-01 00:30:53 +03:00
parent 0abb47ce90
commit d201932121
682 changed files with 26103 additions and 16553 deletions
+16 -5
View File
@@ -1,4 +1,4 @@
/* $Id: network_content_gui.cpp 26167 2013-12-20 18:29:53Z frosch $ */
/* $Id: network_content_gui.cpp 26921 2014-09-25 19:27:07Z peter1138 $ */
/*
* This file is part of OpenTTD.
@@ -29,6 +29,8 @@
#include "table/strings.h"
#include "../table/sprites.h"
#include "../safeguards.h"
/** Whether the user accepted to enter external websites during this session. */
static bool _accepted_external_search = false;
@@ -295,6 +297,7 @@ class NetworkContentListWindow : public Window, ContentCallback {
bool auto_select; ///< Automatically select all content when the meta-data becomes available
StringFilter string_filter; ///< Filter for content list
QueryString filter_editbox; ///< Filter editbox;
Dimension checkbox_size; ///< Size of checkbox/"blot" sprite
const ContentInfo *selected; ///< The selected content info
int list_pos; ///< Our position in the list
@@ -479,6 +482,8 @@ public:
selected(NULL),
list_pos(0)
{
this->checkbox_size = maxdim(maxdim(GetSpriteSize(SPR_BOX_EMPTY), GetSpriteSize(SPR_BOX_CHECKED)), GetSpriteSize(SPR_BLOT));
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_NCL_SCROLLBAR);
this->FinishInitNested(WN_NETWORK_WINDOW_CONTENT_LIST);
@@ -514,6 +519,10 @@ public:
*size = maxdim(*size, GetStringBoundingBox(STR_CONTENT_FILTER_TITLE));
break;
case WID_NCL_CHECKBOX:
size->width = this->checkbox_size.width + WD_MATRIX_RIGHT + WD_MATRIX_LEFT;
break;
case WID_NCL_TYPE: {
Dimension d = *size;
for (int i = CONTENT_TYPE_BEGIN; i < CONTENT_TYPE_END; i++) {
@@ -524,7 +533,7 @@ public:
}
case WID_NCL_MATRIX:
resize->height = FONT_HEIGHT_NORMAL + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
resize->height = max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL) + WD_MATRIX_TOP + WD_MATRIX_BOTTOM;
size->height = 10 * resize->height;
break;
}
@@ -575,9 +584,11 @@ public:
const NWidgetBase *nwi_name = this->GetWidget<NWidgetBase>(WID_NCL_NAME);
const NWidgetBase *nwi_type = this->GetWidget<NWidgetBase>(WID_NCL_TYPE);
int line_height = max(this->checkbox_size.height, (uint)FONT_HEIGHT_NORMAL);
/* Fill the matrix with the information */
int sprite_y_offset = WD_MATRIX_TOP + (FONT_HEIGHT_NORMAL - 10) / 2;
int sprite_y_offset = WD_MATRIX_TOP + (line_height - this->checkbox_size.height) / 2 - 1;
int text_y_offset = WD_MATRIX_TOP + (line_height - FONT_HEIGHT_NORMAL) / 2;
uint y = r.top;
int cnt = 0;
for (ConstContentIterator iter = this->content.Get(this->vscroll->GetPosition()); iter != this->content.End() && cnt < this->vscroll->GetCapacity(); iter++, cnt++) {
@@ -598,9 +609,9 @@ public:
DrawSprite(sprite, pal, nwi_checkbox->pos_x + (pal == PAL_NONE ? 2 : 3), y + sprite_y_offset + (pal == PAL_NONE ? 1 : 0));
StringID str = STR_CONTENT_TYPE_BASE_GRAPHICS + ci->type - CONTENT_TYPE_BASE_GRAPHICS;
DrawString(nwi_type->pos_x, nwi_type->pos_x + nwi_type->current_x - 1, y + WD_MATRIX_TOP, str, TC_BLACK, SA_HOR_CENTER);
DrawString(nwi_type->pos_x, nwi_type->pos_x + nwi_type->current_x - 1, y + text_y_offset, str, TC_BLACK, SA_HOR_CENTER);
DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, y + WD_MATRIX_TOP, ci->name, TC_BLACK);
DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, y + text_y_offset, ci->name, TC_BLACK);
y += this->resize.step_height;
}
}