center towns laels on minimap

This commit is contained in:
Pavel Stupnikov
2015-03-20 20:50:33 +03:00
parent 3e116e19c9
commit e164352e19
4 changed files with 8 additions and 51 deletions

View File

@@ -1,48 +0,0 @@
--- projects/openttd_vs90.vcproj (revision 26379)
+++ projects/openttd_vs90.vcproj (working copy)
@@ -255,38 +268,26 @@
/>
<Tool
Name="VCMIDLTool"
- TargetEnvironment="3"
- TypeLibraryName=".\Release/openttd.tlb"
+ TypeLibraryName=".\Debug/openttd.tlb"
HeaderFileName=""
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
- Optimization="3"
- InlineFunctionExpansion="2"
- EnableIntrinsicFunctions="true"
- FavorSizeOrSpeed="2"
- OmitFramePointers="true"
+ Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
- StringPooling="true"
- ExceptionHandling="1"
- RuntimeLibrary="0"
- StructMemberAlignment="0"
- BufferSecurityCheck="false"
- EnableFunctionLevelLinking="true"
- DefaultCharIsUnsigned="true"
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="1"
UsePrecompiledHeader="0"
- PrecompiledHeaderThrough=""
- PrecompiledHeaderFile=""
- AssemblerOutput="2"
AssemblerListingLocation="$(IntDir)/"
ObjectFile="$(IntDir)/"
ProgramDataBaseFileName="$(IntDir)/$(TargetName).pdb"
WarningLevel="3"
WarnAsError="false"
SuppressStartupBanner="true"
- DebugInformationFormat="3"
+ Detect64BitPortabilityProblems="false"
+ DebugInformationFormat="4"
CallingConvention="1"
CompileAs="0"
/>

View File

@@ -409,7 +409,7 @@ void Town::UpdateVirtCoord()
Point pt = RemapCoords2(TileX(this->xy) * TILE_SIZE, TileY(this->xy) * TILE_SIZE);
SetDParam(0, this->index);
SetDParam(1, this->cache.population);
this->cache.sign.UpdatePosition(pt.x, pt.y - 24 * ZOOM_LVL_BASE, this->Label());
this->cache.sign.UpdatePosition(pt.x, pt.y - 24 * ZOOM_LVL_BASE, this->Label(), this->SmallLabel());
SetWindowDirty(WC_TOWN_VIEW, this->index);
SetWindowDirty(WC_CB_TOWN, this->index);
}

View File

@@ -1365,7 +1365,7 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
* @param top the new top of the sign
* @param str the string to show in the sign
*/
void ViewportSign::UpdatePosition(int center, int top, StringID str)
void ViewportSign::UpdatePosition(int center, int top, StringID str, StringID small_str)
{
if (this->width_normal != 0) this->MarkDirty();
@@ -1378,6 +1378,9 @@ void ViewportSign::UpdatePosition(int center, int top, StringID str)
this->center = center;
/* zoomed out version */
if (small_str != STR_NULL) {
GetString(buffer, small_str, lastof(buffer));
}
this->width_small = VPSM_LEFT + Align(GetStringBoundingBox(buffer, FS_SMALL).width, 2) + VPSM_RIGHT;
this->MarkDirty();

View File

@@ -15,6 +15,8 @@
#include "zoom_type.h"
#include "strings_type.h"
#include "math.h"
#include "table/strings.h"
class LinkGraphOverlay;
@@ -51,7 +53,7 @@ struct ViewportSign {
uint16 width_normal; ///< The width when not zoomed out (normal font)
uint16 width_small; ///< The width when zoomed out (small font)
void UpdatePosition(int center, int top, StringID str);
void UpdatePosition(int center, int top, StringID str, StringID small_str=STR_NULL);
void MarkDirty(ZoomLevel maxzoom = ZOOM_LVL_MAX) const;
};