diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp index 6e63c59c77..eb50165848 100644 --- a/src/blitter/32bpp_anim.cpp +++ b/src/blitter/32bpp_anim.cpp @@ -621,9 +621,9 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int left, int top, int width, Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y); } -int Blitter_32bppAnim::BufferSize(int width, int height) +size_t Blitter_32bppAnim::BufferSize(uint width, uint height) { - return width * height * (sizeof(uint32) + sizeof(uint16)); + return (sizeof(uint32) + sizeof(uint16)) * width * height; } void Blitter_32bppAnim::PaletteAnimate(const Palette &palette) diff --git a/src/blitter/32bpp_anim.hpp b/src/blitter/32bpp_anim.hpp index accf02a210..b9322b924b 100644 --- a/src/blitter/32bpp_anim.hpp +++ b/src/blitter/32bpp_anim.hpp @@ -46,7 +46,7 @@ public: void CopyFromBuffer(void *video, const void *src, int width, int height) override; void CopyToBuffer(const void *video, void *dst, int width, int height) override; void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override; - int BufferSize(int width, int height) override; + size_t BufferSize(uint width, uint height) override; void PaletteAnimate(const Palette &palette) override; Blitter::PaletteAnimation UsePaletteAnimation() override; diff --git a/src/blitter/32bpp_base.cpp b/src/blitter/32bpp_base.cpp index 6a087cd274..bd2b0d9fc4 100644 --- a/src/blitter/32bpp_base.cpp +++ b/src/blitter/32bpp_base.cpp @@ -170,9 +170,9 @@ void Blitter_32bppBase::ScrollBuffer(void *video, int left, int top, int width, } } -int Blitter_32bppBase::BufferSize(int width, int height) +size_t Blitter_32bppBase::BufferSize(uint width, uint height) { - return width * height * sizeof(uint32); + return sizeof(uint32) * width * height; } void Blitter_32bppBase::PaletteAnimate(const Palette &palette) diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp index 86fc913115..5cb1fe38b7 100644 --- a/src/blitter/32bpp_base.hpp +++ b/src/blitter/32bpp_base.hpp @@ -30,7 +30,7 @@ public: void CopyToBuffer(const void *video, void *dst, int width, int height) override; void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override; void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override; - int BufferSize(int width, int height) override; + size_t BufferSize(uint width, uint height) override; void PaletteAnimate(const Palette &palette) override; Blitter::PaletteAnimation UsePaletteAnimation() override; int GetBytesPerPixel() override { return 4; } diff --git a/src/blitter/40bpp_anim.cpp b/src/blitter/40bpp_anim.cpp index 3394aaebc0..d39c746862 100644 --- a/src/blitter/40bpp_anim.cpp +++ b/src/blitter/40bpp_anim.cpp @@ -31,9 +31,10 @@ void Blitter_40bppAnim::SetPixel(void *video, int x, int y, uint8 colour) if (_screen_disable_anim) { Blitter_32bppOptimized::SetPixel(video, x, y, colour); } else { - *((Colour *)video + x + y * _screen.pitch) = _black_colour; + size_t y_offset = static_cast(y) * _screen.pitch; + *((Colour *)video + x + y_offset) = _black_colour; - VideoDriver::GetInstance()->GetAnimBuffer()[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * _screen.pitch] = colour; + VideoDriver::GetInstance()->GetAnimBuffer()[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y_offset] = colour; } } @@ -571,9 +572,9 @@ void Blitter_40bppAnim::ScrollBuffer(void *video, int left, int top, int width, Blitter_32bppBase::ScrollBuffer(video, left, top, width, height, scroll_x, scroll_y); } -int Blitter_40bppAnim::BufferSize(int width, int height) +size_t Blitter_40bppAnim::BufferSize(uint width, uint height) { - return width * height * (sizeof(uint32) + sizeof(uint8)); + return (sizeof(uint32) + sizeof(uint8)) * width * height; } Blitter::PaletteAnimation Blitter_40bppAnim::UsePaletteAnimation() diff --git a/src/blitter/40bpp_anim.hpp b/src/blitter/40bpp_anim.hpp index bda0489f29..189ad310fa 100644 --- a/src/blitter/40bpp_anim.hpp +++ b/src/blitter/40bpp_anim.hpp @@ -32,7 +32,7 @@ public: void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom) override; void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal) override; Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) override; - int BufferSize(int width, int height) override; + size_t BufferSize(uint width, uint height) override; Blitter::PaletteAnimation UsePaletteAnimation() override; bool NeedsAnimationBuffer() override; diff --git a/src/blitter/8bpp_base.cpp b/src/blitter/8bpp_base.cpp index d3a967b26c..450eb09aa4 100644 --- a/src/blitter/8bpp_base.cpp +++ b/src/blitter/8bpp_base.cpp @@ -159,9 +159,9 @@ void Blitter_8bppBase::ScrollBuffer(void *video, int left, int top, int width, i } } -int Blitter_8bppBase::BufferSize(int width, int height) +size_t Blitter_8bppBase::BufferSize(uint width, uint height) { - return width * height; + return static_cast(width) * height; } void Blitter_8bppBase::PaletteAnimate(const Palette &palette) diff --git a/src/blitter/8bpp_base.hpp b/src/blitter/8bpp_base.hpp index fa52848196..cfdd7723eb 100644 --- a/src/blitter/8bpp_base.hpp +++ b/src/blitter/8bpp_base.hpp @@ -27,7 +27,7 @@ public: void CopyToBuffer(const void *video, void *dst, int width, int height) override; void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override; void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override; - int BufferSize(int width, int height) override; + size_t BufferSize(uint width, uint height) override; void PaletteAnimate(const Palette &palette) override; Blitter::PaletteAnimation UsePaletteAnimation() override; int GetBytesPerPixel() override { return 1; } diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp index 0ff1acd52c..242fbbb435 100644 --- a/src/blitter/base.hpp +++ b/src/blitter/base.hpp @@ -224,7 +224,7 @@ public: * @param height The height of the buffer-to-be. * @return The size needed for the buffer. */ - virtual int BufferSize(int width, int height) = 0; + virtual size_t BufferSize(uint width, uint height) = 0; /** * Called when the 8bpp palette is changed; you should redraw all pixels on the screen that diff --git a/src/blitter/null.hpp b/src/blitter/null.hpp index 19be8a1d57..5f1282bb0e 100644 --- a/src/blitter/null.hpp +++ b/src/blitter/null.hpp @@ -30,7 +30,7 @@ public: void CopyToBuffer(const void *video, void *dst, int width, int height) override {}; void CopyImageToBuffer(const void *video, void *dst, int width, int height, int dst_pitch) override {}; void ScrollBuffer(void *video, int left, int top, int width, int height, int scroll_x, int scroll_y) override {}; - int BufferSize(int width, int height) override { return 0; }; + size_t BufferSize(uint width, uint height) override { return 0; }; void PaletteAnimate(const Palette &palette) override { }; Blitter::PaletteAnimation UsePaletteAnimation() override { return Blitter::PALETTE_ANIMATION_NONE; }; diff --git a/src/bmp.cpp b/src/bmp.cpp index 2877d01470..493d9445ac 100644 --- a/src/bmp.cpp +++ b/src/bmp.cpp @@ -390,7 +390,7 @@ bool BmpReadBitmap(BmpBuffer *buffer, BmpInfo *info, BmpData *data) { assert(info != nullptr && data != nullptr); - data->bitmap = CallocT(info->width * info->height * ((info->bpp == 24) ? 3 : 1)); + data->bitmap = CallocT(static_cast(info->width) * info->height * ((info->bpp == 24) ? 3 : 1)); /* Load image */ SetStreamOffset(buffer, info->offset); diff --git a/src/fontcache/freetypefontcache.cpp b/src/fontcache/freetypefontcache.cpp index b114252138..023367e8f7 100644 --- a/src/fontcache/freetypefontcache.cpp +++ b/src/fontcache/freetypefontcache.cpp @@ -242,7 +242,7 @@ const Sprite *FreeTypeFontCache::InternalGetGlyph(GlyphID key, bool aa) /* FreeType has rendered the glyph, now we allocate a sprite and copy the image into it */ SpriteLoader::Sprite sprite; - sprite.AllocateData(ZOOM_LVL_NORMAL, width * height); + sprite.AllocateData(ZOOM_LVL_NORMAL, static_cast(width) * height); sprite.type = ST_FONT; sprite.colours = (aa ? SCC_PAL | SCC_ALPHA : SCC_PAL); sprite.width = width; diff --git a/src/gfx.cpp b/src/gfx.cpp index d675f5e198..8a864651b5 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -1281,9 +1281,10 @@ std::unique_ptr DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel zo const SpriteID real_sprite = GB(spriteId, 0, SPRITE_WIDTH); const Sprite *sprite = GetSprite(real_sprite, ST_NORMAL); Dimension dim = GetSpriteSize(real_sprite, nullptr, zoom); - std::unique_ptr result(new uint32[dim.width * dim.height]); + size_t dim_size = static_cast(dim.width) * dim.height; + std::unique_ptr result(new uint32[dim_size]); /* Set buffer to fully transparent. */ - MemSetT(result.get(), 0, dim.width * dim.height); + MemSetT(result.get(), 0, dim_size); /* Prepare new DrawPixelInfo - Normally this would be the screen but we want to draw to another buffer here. * Normally, pitch would be scaled screen width, but in our case our "screen" is only the sprite width wide. */ @@ -1296,11 +1297,13 @@ std::unique_ptr DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel zo dpi.height = dim.height; dpi.zoom = zoom; + dim_size = static_cast(dim.width) * dim.height; + /* If the current blitter is a paletted blitter, we have to render to an extra buffer and resolve the palette later. */ std::unique_ptr pal_buffer{}; if (blitter->GetScreenDepth() == 8) { - pal_buffer.reset(new byte[dim.width * dim.height]); - MemSetT(pal_buffer.get(), 0, dim.width * dim.height); + pal_buffer.reset(new byte[dim_size]); + MemSetT(pal_buffer.get(), 0, dim_size); dpi.dst_ptr = pal_buffer.get(); } @@ -1315,7 +1318,7 @@ std::unique_ptr DrawSpriteToRgbaBuffer(SpriteID spriteId, ZoomLevel zo /* Resolve palette. */ uint32 *dst = result.get(); const byte *src = pal_buffer.get(); - for (size_t i = 0; i < dim.height * dim.width; ++i) { + for (size_t i = 0; i < dim_size; ++i) { *dst++ = _cur_palette.palette[*src++].data; } } diff --git a/src/ground_vehicle.cpp b/src/ground_vehicle.cpp index 8bc2ae05a5..3ab8722ceb 100644 --- a/src/ground_vehicle.cpp +++ b/src/ground_vehicle.cpp @@ -185,7 +185,7 @@ GroundVehicleAcceleration GroundVehicle::GetAcceleration() } /* Air drag; the air drag coefficient is in an arbitrary NewGRF-unit, * so we need some magic conversion factor. */ - resistance += (area * this->gcache.cached_air_drag * speed * speed) / 1000; + resistance += static_cast(area) * this->gcache.cached_air_drag * speed * speed / 1000; resistance += this->GetSlopeResistance(); diff --git a/src/heightmap.cpp b/src/heightmap.cpp index f3cd9640ff..a665d630ac 100644 --- a/src/heightmap.cpp +++ b/src/heightmap.cpp @@ -188,7 +188,7 @@ static bool ReadHeightmapPNG(const char *filename, uint *x, uint *y, byte **map) } if (map != nullptr) { - *map = MallocT(width * height); + *map = MallocT(static_cast(width) * height); ReadHeightmapPNGImageData(*map, png_ptr, info_ptr); } @@ -303,7 +303,7 @@ static bool ReadHeightmapBMP(const char *filename, uint *x, uint *y, byte **map) return false; } - *map = MallocT(info.width * info.height); + *map = MallocT(static_cast(info.width) * info.height); ReadHeightmapBMPImageData(*map, &info, &data); } diff --git a/src/lang/dutch.txt b/src/lang/dutch.txt index 71ce6f844c..16ed5739f9 100644 --- a/src/lang/dutch.txt +++ b/src/lang/dutch.txt @@ -2865,6 +2865,8 @@ STR_FOUND_TOWN_RANDOM_TOWN_BUTTON :{BLACK}Willekeu STR_FOUND_TOWN_RANDOM_TOWN_TOOLTIP :{BLACK}Hiermee sticht je een stad op een willekeurige locatie STR_FOUND_TOWN_MANY_RANDOM_TOWNS :{BLACK}Veel willekeurige steden STR_FOUND_TOWN_RANDOM_TOWNS_TOOLTIP :{BLACK}Verspreid willekeurig geplaatste steden over de kaart +STR_FOUND_TOWN_EXPAND_ALL_TOWNS :{BLACK}Alle steden uitbreiden +STR_FOUND_TOWN_EXPAND_ALL_TOWNS_TOOLTIP :{BLACK}Laat alle steden een klein beetje groeien STR_FOUND_TOWN_NAME_TITLE :{YELLOW}Plaatsnaam: STR_FOUND_TOWN_NAME_EDITOR_TITLE :{BLACK}Plaatsnaam invoeren @@ -4530,22 +4532,22 @@ STR_TIMETABLE_STARTING_DATE :{BLACK}Startdat STR_TIMETABLE_STARTING_DATE_TOOLTIP :{BLACK}Selecteer een datum als startpunt voor deze dienstregeling. Ctrl+klik verdeelt alle voertuigen die deze orders delen gelijkmatig vanaf deze datum op basis van hun relatieve volgorde, als de order volledig is ingeroosterd STR_TIMETABLE_CHANGE_TIME :{BLACK}Tijd wijzigen -STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Verander de tijdsduur die de geselecteerde order mag duren +STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Verander de tijdsduur die de geselecteerde order mag duren. Met Ctrl+klik stel je de tijd voor alle orders in STR_TIMETABLE_CLEAR_TIME :{BLACK}Tijd wissen -STR_TIMETABLE_CLEAR_TIME_TOOLTIP :{BLACK}Verwijder de tijdsduur die de geselecteerde order mag duren +STR_TIMETABLE_CLEAR_TIME_TOOLTIP :{BLACK}Verwijder de tijdsduur die de geselecteerde order mag duren. Met Ctrl+klik wis je de tijd voor alle orders STR_TIMETABLE_CHANGE_SPEED :{BLACK}Maximumsnelheid wijzigen -STR_TIMETABLE_CHANGE_SPEED_TOOLTIP :{BLACK}Wijzig de maximumsnelheid voor de gekozen order +STR_TIMETABLE_CHANGE_SPEED_TOOLTIP :{BLACK}Wijzig de maximumsnelheid voor de gekozen order. Met Ctrl+klik stel je de snelheid voor alle orders in STR_TIMETABLE_CLEAR_SPEED :{BLACK}Snelheidslimiet wissen -STR_TIMETABLE_CLEAR_SPEED_TOOLTIP :{BLACK}Verwijder de maximumsnelheid van de gekozen order +STR_TIMETABLE_CLEAR_SPEED_TOOLTIP :{BLACK}Verwijder de maximumsnelheid van de gekozen order. Met Ctrl+klik wis je de snelheid voor alle orders STR_TIMETABLE_RESET_LATENESS :{BLACK}Vertragingsteller terugstellen STR_TIMETABLE_RESET_LATENESS_TOOLTIP :{BLACK}Stel de vertragingsteller terug zodat het voertuig op tijd is STR_TIMETABLE_AUTOFILL :{BLACK}Automatisch vullen -STR_TIMETABLE_AUTOFILL_TOOLTIP :{BLACK}Vul de dienstregeling automatisch in aan de hand van de volgende reis (Ctrl+klik om te proberen om wachttijden te bewaren) +STR_TIMETABLE_AUTOFILL_TOOLTIP :{BLACK}Vul de dienstregeling automatisch in aan de hand van de volgende reis. Ctrl+klik om te proberen om wachttijden te bewaren STR_TIMETABLE_EXPECTED :{BLACK}Verwacht STR_TIMETABLE_SCHEDULED :{BLACK}Volgens dienstregeling @@ -4801,6 +4803,7 @@ STR_ERROR_TOO_MANY_INDUSTRIES :{WHITE}... te v STR_ERROR_CAN_T_GENERATE_INDUSTRIES :{WHITE}Kan geen industrieën genereren... STR_ERROR_CAN_T_BUILD_HERE :{WHITE}Kan {STRING} hier niet bouwen... STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY :{WHITE}Kan dit type industrie hier niet bouwen... +STR_ERROR_CAN_T_PROSPECT_INDUSTRY :{WHITE}Kan industrie niet onderzoeken... STR_ERROR_INDUSTRY_TOO_CLOSE :{WHITE}... te dicht bij een andere industrie STR_ERROR_MUST_FOUND_TOWN_FIRST :{WHITE}... moet eerst dorp bouwen STR_ERROR_ONLY_ONE_ALLOWED_PER_TOWN :{WHITE}... slechts één per stad toegestaan @@ -4815,6 +4818,8 @@ STR_ERROR_FOREST_CAN_ONLY_BE_PLANTED :{WHITE}... boss STR_ERROR_CAN_ONLY_BE_BUILT_ABOVE_SNOW_LINE :{WHITE}... kan alleen boven de sneeuwlijn gebouwd worden STR_ERROR_CAN_ONLY_BE_BUILT_BELOW_SNOW_LINE :{WHITE}... kan alleen onder de sneeuwlijn gebouwd worden +STR_ERROR_PROSPECTING_WAS_UNLUCKY :{WHITE}De financiering is mislukt vanwege domme pech. Probeer het opnieuw. +STR_ERROR_NO_SUITABLE_PLACES_FOR_PROSPECTING :{WHITE}Er was geen geschikte plek voor onderzoek voor deze industrie STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES :{WHITE}Er waren geen geschikte locaties voor {STRING}-industrieën STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES_EXPLANATION :{WHITE}Wijzig de instellingen van wereldontwikkeling om een betere kaart te krijgen diff --git a/src/lang/polish.txt b/src/lang/polish.txt index d978a7043f..e812b38df3 100644 --- a/src/lang/polish.txt +++ b/src/lang/polish.txt @@ -2304,7 +2304,7 @@ STR_CONFIG_SETTING_TOWN_GROWTH_FAST :duża STR_CONFIG_SETTING_TOWN_GROWTH_VERY_FAST :bardzo duża STR_CONFIG_SETTING_LARGER_TOWNS :Proporcje miast, które będą metropoliami: {STRING} -STR_CONFIG_SETTING_LARGER_TOWNS_HELPTEXT :Liczba miast, które staną się metropoliami - czyli miastami, które na początku są większe i szybciej się rozwijają +STR_CONFIG_SETTING_LARGER_TOWNS_HELPTEXT :Liczba miast, które staną się metropoliami - czyli miastami, które od początku są większe i szybciej się rozwijają STR_CONFIG_SETTING_LARGER_TOWNS_VALUE :1 z {COMMA} ###setting-zero-is-special STR_CONFIG_SETTING_LARGER_TOWNS_DISABLED :Żadne @@ -3245,6 +3245,8 @@ STR_FOUND_TOWN_RANDOM_TOWN_BUTTON :{BLACK}Losowe m STR_FOUND_TOWN_RANDOM_TOWN_TOOLTIP :{BLACK}Budowa miasta w losowym miejscu STR_FOUND_TOWN_MANY_RANDOM_TOWNS :{BLACK}Wiele losowych miast STR_FOUND_TOWN_RANDOM_TOWNS_TOOLTIP :{BLACK}Pokryj mapę losowo położonymi miastami +STR_FOUND_TOWN_EXPAND_ALL_TOWNS :{BLACK}Rozszerz wszystkie miasta +STR_FOUND_TOWN_EXPAND_ALL_TOWNS_TOOLTIP :{BLACK}Zwiększ trochę rozmiar wszystkich miast STR_FOUND_TOWN_NAME_TITLE :{YELLOW}Nazwa miasta: STR_FOUND_TOWN_NAME_EDITOR_TITLE :{BLACK}Wprowadź nazwę miasta @@ -3714,27 +3716,30 @@ STR_NEWGRF_INSPECT_CAPTION_OBJECT_AT_RAIL_TYPE :Typ szyn STR_NEWGRF_INSPECT_QUERY_CAPTION :{WHITE}NewGFR zmienna 60+parametr x (heksadecymalnie) # Sprite aligner window -STR_SPRITE_ALIGNER_CAPTION :{WHITE}Dostosowanie obrazka {COMMA} ({STRING}) -STR_SPRITE_ALIGNER_NEXT_BUTTON :{BLACK}Następny obrazek -STR_SPRITE_ALIGNER_NEXT_TOOLTIP :{BLACK}Idź do następnego normalnego obrazka, pomijając jakiekolwiek pseudo/kolorowe/znakowe obrazki i zawijaj je od ostatniego do pierwszego -STR_SPRITE_ALIGNER_GOTO_BUTTON :{BLACK}Idź do obrazka -STR_SPRITE_ALIGNER_GOTO_TOOLTIP :{BLACK}Idź do danego obrazka. Jeśli dany obrazek nie jest normalnym obrazkiem, idź do następnego normalnego obrazka -STR_SPRITE_ALIGNER_PREVIOUS_BUTTON :{BLACK}Poprzedni obrazek -STR_SPRITE_ALIGNER_PREVIOUS_TOOLTIP :{BLACK}Idź do poprzedniego normalnego obrazka, pomijając jakiekolwiek pseudo/kolorowe/znakowe obrazki i zawijaj je od pierwszego do ostatniego -STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}Przedstawienie wybranego orbazka. Dostosowanie jest ignorowane podczas rysowania tego obrazka -STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}Poruszaj obrazkiem, zmieniając przesunięcia X i Y. Ctrl+klik aby przesunąć o 8 jednostek na raz. +STR_SPRITE_ALIGNER_CAPTION :{WHITE}Wyrównywanie sprite'a {COMMA} ({STRING}) +STR_SPRITE_ALIGNER_NEXT_BUTTON :{BLACK}Następny sprite +STR_SPRITE_ALIGNER_NEXT_TOOLTIP :{BLACK}Idź do następnego normalnego sprite'a, pomijając jakiekolwiek pseudo/przekolorowane/czcionkowe sprite'y i ewentualnie przewiń od ostatniego do pierwszego +STR_SPRITE_ALIGNER_GOTO_BUTTON :{BLACK}Idź do sprite'a +STR_SPRITE_ALIGNER_GOTO_TOOLTIP :{BLACK}Idź do danego sprite'a. Jeśli dany sprite nie jest normalnym spritem, przejdź do następnego normalnego sprite'a +STR_SPRITE_ALIGNER_PREVIOUS_BUTTON :{BLACK}Poprzedni sprite +STR_SPRITE_ALIGNER_PREVIOUS_TOOLTIP :{BLACK}Idź do poprzedniego normalnego sprite'a, pomijając jakiekolwiek pseudo/przekolorowane/czcionkowe sprite'y i ewentualnie przewiń od pierwszego do ostatniego +STR_SPRITE_ALIGNER_SPRITE_TOOLTIP :{BLACK}Prezentacja wybranego sprite'a. Wyrównanie jest ignorowane podczas rysowania tego sprite'a +STR_SPRITE_ALIGNER_MOVE_TOOLTIP :{BLACK}Poruszaj spritem, zmieniając przesunięcia X i Y. Ctrl+klik aby przesunąć o 8 jednostek na raz ###length 2 +STR_SPRITE_ALIGNER_CENTRE_OFFSET :{BLACK}Wyśrodkowanie przesunięcia +STR_SPRITE_ALIGNER_CENTRE_SPRITE :{BLACK}Wyśrodkowanie sprite'a +STR_SPRITE_ALIGNER_CROSSHAIR :{BLACK}Prowadnice -STR_SPRITE_ALIGNER_RESET_BUTTON :{BLACK}Resetuj zależność -STR_SPRITE_ALIGNER_RESET_TOOLTIP :{BLACK}Resetuj aktualne offsety zależne -STR_SPRITE_ALIGNER_OFFSETS_ABS :{BLACK}X offset: {NUM}, Y offset: {NUM} (Całkowity) -STR_SPRITE_ALIGNER_OFFSETS_REL :{BLACK}X offset: {NUM}, Y offset: {NUM} (Zależny) -STR_SPRITE_ALIGNER_PICKER_BUTTON :{BLACK}Wybierz obrazek -STR_SPRITE_ALIGNER_PICKER_TOOLTIP :{BLACK}Wybierz obrazek z dowolnego miejsca na ekranie +STR_SPRITE_ALIGNER_RESET_BUTTON :{BLACK}Wyzeruj względność +STR_SPRITE_ALIGNER_RESET_TOOLTIP :{BLACK}Wyzeruj aktualne względne przesunięcia +STR_SPRITE_ALIGNER_OFFSETS_ABS :{BLACK}Przesunięcie X: {NUM}, przesunięcie Y: {NUM} (bezwzględne) +STR_SPRITE_ALIGNER_OFFSETS_REL :{BLACK}Przesunięcie X: {NUM}, przesunięcie Y: {NUM} (względne) +STR_SPRITE_ALIGNER_PICKER_BUTTON :{BLACK}Wybierz sprite'a +STR_SPRITE_ALIGNER_PICKER_TOOLTIP :{BLACK}Wybierz sprite'a z dowolnego miejsca na ekranie -STR_SPRITE_ALIGNER_GOTO_CAPTION :{WHITE}Idź do obrazka +STR_SPRITE_ALIGNER_GOTO_CAPTION :{WHITE}Idź do sprite'a # NewGRF (self) generated warnings/errors STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING} @@ -4796,14 +4801,14 @@ STR_ORDERS_DELETE_BUTTON :{BLACK}Usuń STR_ORDERS_DELETE_TOOLTIP :{BLACK}Usuń podświetlone polecenie STR_ORDERS_DELETE_ALL_TOOLTIP :{BLACK}Usuń wszystkie polecenia STR_ORDERS_STOP_SHARING_BUTTON :{BLACK}Przestań dzielić -STR_ORDERS_STOP_SHARING_TOOLTIP :{BLACK}Przestań dzielić listę poleceń. Ctrl+Klik dodatkowo usuwa wszystkie polecenia tego pojazdu +STR_ORDERS_STOP_SHARING_TOOLTIP :{BLACK}Przestań współdzielić listę poleceń. Ctrl+klik dodatkowo usuwa wszystkie polecenia tego pojazdu STR_ORDERS_GO_TO_BUTTON :{BLACK}Idź do STR_ORDER_GO_TO_NEAREST_DEPOT :Idź do najbliższego serwisu STR_ORDER_GO_TO_NEAREST_HANGAR :Leć do najbliższego hangaru STR_ORDER_CONDITIONAL :Warunkowy skok poleceń STR_ORDER_SHARE :Współdzielenie poleceń -STR_ORDERS_GO_TO_TOOLTIP :{BLACK}Wstaw nowe polecenie na końcu listy lub przed zaznaczonym poleceniem. Ctrl ustawi polecenie stacji na 'pełny załadunek dowolnego towaru', pkt. orientacyjnego na 'bez zatrzymywania się', a zajezdni na 'serwisuj'. Kliknięcie innego pojazdu kopiuje jego polecenia, ctrl+klik (lub 'Współdzielenie poleceń') pozwala na dzielenie z nim poleceń. Polecenie zajezdni wyłącza automatyczne serwisowanie pojazdu +STR_ORDERS_GO_TO_TOOLTIP :{BLACK}Dodaj nowe polecenie na końcu listy lub przed zaznaczonym poleceniem. Ctrl ustawi polecenie stacji na „pełny załadunek któregoś z towarów”, posterunku na „bez zatrzymywania się”, a zajezdni na „serwisuj”. Kliknięcie innego pojazdu kopiuje jego polecenia. „Współdzielenie poleceń” lub Ctrl+klik pozwala na współdzielenie z nim poleceń. Polecenie zajezdni wyłącza automatyczne serwisowanie tego pojazdu STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP :{BLACK}Pokaż wszystkie pojazdy współdzielące te polecenia @@ -4913,22 +4918,22 @@ STR_TIMETABLE_STARTING_DATE :{BLACK}Data poc STR_TIMETABLE_STARTING_DATE_TOOLTIP :{BLACK}Wybierz początkową datę rozkładu jazdy. Ctrl+klik rozłoży równomierne wszystkie pojazdy współdzielące ten rozkład, począwszy od podanej daty, zgodnie z ich kolejnością, o ile rozkład ten jest kompletny STR_TIMETABLE_CHANGE_TIME :{BLACK}Zmień czas -STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Zmień ilość czasu którą zaznaczone zadanie powinno zająć +STR_TIMETABLE_WAIT_TIME_TOOLTIP :{BLACK}Zmień ilość czasu, jaką powinno zająć zaznaczone polecenie. Ctrl+klik ustala czas dla wszystkich poleceń STR_TIMETABLE_CLEAR_TIME :{BLACK}Usuń czas -STR_TIMETABLE_CLEAR_TIME_TOOLTIP :{BLACK}Usuń ilość czasu przeznaczoną na zaznaczone zadanie +STR_TIMETABLE_CLEAR_TIME_TOOLTIP :{BLACK}Wyczyść ilość czasu w zaznaczonym poleceniu. Ctrl+klik wyczyści czas we wszystkich poleceniach STR_TIMETABLE_CHANGE_SPEED :{BLACK}Zmień limit prędkości -STR_TIMETABLE_CHANGE_SPEED_TOOLTIP :{BLACK}Zmień maksymalną prędkość podróży w zaznaczonym poleceniu +STR_TIMETABLE_CHANGE_SPEED_TOOLTIP :{BLACK}Zmień maksymalną prędkość przejazdu w zaznaczonym poleceniu. Ctrl+klik zmieni prędkość we wszystkich poleceniach STR_TIMETABLE_CLEAR_SPEED :{BLACK}Wyczyść limit prędkości -STR_TIMETABLE_CLEAR_SPEED_TOOLTIP :{BLACK}Wyczyść maksymalną prędkość podróży w zaznaczonym poleceniu +STR_TIMETABLE_CLEAR_SPEED_TOOLTIP :{BLACK}Wyczyść maksymalną prędkość przejazdu w zaznaczonym poleceniu. Ctrl+klik wyczyści prędkość we wszystkich poleceniach STR_TIMETABLE_RESET_LATENESS :{BLACK}Wyzeruj spóźnienia STR_TIMETABLE_RESET_LATENESS_TOOLTIP :{BLACK}Wyzeruj licznik spóźnienia, aby pojazd podróżował zgodnie z rozkładem jazdy STR_TIMETABLE_AUTOFILL :{BLACK}Automat. wypełnienie -STR_TIMETABLE_AUTOFILL_TOOLTIP :{BLACK}Wypełnij automatycznie rozkład jazdy wartościami z następnego przejazdu (Ctrl+klik, aby spróbować utrzymać czasy oczekiwania) +STR_TIMETABLE_AUTOFILL_TOOLTIP :{BLACK}Wypełnij automatycznie rozkład jazdy wartościami z następnego przejazdu. Ctrl+klik, aby spróbować utrzymać czasy oczekiwania STR_TIMETABLE_EXPECTED :{BLACK}Wymagany STR_TIMETABLE_SCHEDULED :{BLACK}Zaplanowany @@ -5184,6 +5189,7 @@ STR_ERROR_TOO_MANY_INDUSTRIES :{WHITE}... zbyt STR_ERROR_CAN_T_GENERATE_INDUSTRIES :{WHITE}Nie można stworzyć przedsiębiorstw... STR_ERROR_CAN_T_BUILD_HERE :{WHITE}Nie można tutaj wybudować: {STRING}... STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY :{WHITE}Nie można tutaj wybudować tego przedsiębiorstwa... +STR_ERROR_CAN_T_PROSPECT_INDUSTRY :{WHITE}Nie można znaleźć przedsiębiorstwa... STR_ERROR_INDUSTRY_TOO_CLOSE :{WHITE}... zbyt blisko innego przedsiębiorstwa STR_ERROR_MUST_FOUND_TOWN_FIRST :{WHITE}... należy najpierw wybudować miasto STR_ERROR_ONLY_ONE_ALLOWED_PER_TOWN :{WHITE}... dozwolone jedno na miasto @@ -5198,7 +5204,9 @@ STR_ERROR_FOREST_CAN_ONLY_BE_PLANTED :{WHITE}... las STR_ERROR_CAN_ONLY_BE_BUILT_ABOVE_SNOW_LINE :{WHITE}... można zbudować tylko powyżej linii śniegu STR_ERROR_CAN_ONLY_BE_BUILT_BELOW_SNOW_LINE :{WHITE}... można zbudować tylko poniżej linii śniegu -STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES :{WHITE}Nie ma odpowiednich miejsc dla przedsiębiorstw '{STRING}' +STR_ERROR_PROSPECTING_WAS_UNLUCKY :{WHITE}Ufundowanie pechowo nie powiodło się; spróbuj ponownie +STR_ERROR_NO_SUITABLE_PLACES_FOR_PROSPECTING :{WHITE}Nie ma odpowiednich miejsc do poszukiwań takiego przedsiębiorstwa +STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES :{WHITE}Nie ma odpowiednich miejsc dla przedsiębiorstw „{STRING}” STR_ERROR_NO_SUITABLE_PLACES_FOR_INDUSTRIES_EXPLANATION :{WHITE}Zmień parametry tworzenia map, żeby uzyskać lepsze mapy # Station construction related errors diff --git a/src/linkgraph/linkgraph.cpp b/src/linkgraph/linkgraph.cpp index ea2e416f59..e3109ed29d 100644 --- a/src/linkgraph/linkgraph.cpp +++ b/src/linkgraph/linkgraph.cpp @@ -171,7 +171,7 @@ static void AddEdge(LinkGraph::BaseEdge &edge, uint capacity, uint usage, uint32 { edge.capacity = capacity; edge.usage = usage; - edge.travel_time_sum = travel_time * capacity; + edge.travel_time_sum = static_cast(travel_time) * capacity; if (mode & EUM_UNRESTRICTED) edge.last_unrestricted_update = _date; if (mode & EUM_RESTRICTED) edge.last_restricted_update = _date; if (mode & EUM_AIRCRAFT) edge.last_aircraft_update = _date; @@ -227,11 +227,11 @@ void LinkGraph::Edge::Update(uint capacity, uint usage, uint32 travel_time, Edge if (mode & EUM_INCREASE) { if (edge.travel_time_sum == 0) { - edge.travel_time_sum = (edge.capacity + capacity) * travel_time; + edge.travel_time_sum = static_cast(edge.capacity + capacity) * travel_time; } else if (travel_time == 0) { edge.travel_time_sum += (edge.travel_time_sum / edge.capacity) * capacity; } else { - edge.travel_time_sum += travel_time * capacity; + edge.travel_time_sum += static_cast(travel_time) * capacity; } edge.capacity += capacity; edge.usage += usage; @@ -240,13 +240,13 @@ void LinkGraph::Edge::Update(uint capacity, uint usage, uint32 travel_time, Edge * the capacity increase. */ if (capacity > edge.capacity) { if (travel_time == 0) { - edge.travel_time_sum = (edge.travel_time_sum / edge.capacity) * capacity; + edge.travel_time_sum = static_cast(edge.travel_time_sum / edge.capacity) * capacity; } else { - edge.travel_time_sum += (capacity - edge.capacity) * travel_time; + edge.travel_time_sum += static_cast(capacity - edge.capacity) * travel_time; } edge.capacity = capacity; } else if (edge.travel_time_sum == 0) { - edge.travel_time_sum = travel_time * edge.capacity; + edge.travel_time_sum = static_cast(travel_time) * edge.capacity; } edge.usage = std::max(edge.usage, usage); } diff --git a/src/network/network_chat_gui.cpp b/src/network/network_chat_gui.cpp index 82c8e6015d..81230648f9 100644 --- a/src/network/network_chat_gui.cpp +++ b/src/network/network_chat_gui.cpp @@ -108,7 +108,7 @@ void NetworkReInitChatBoxSize() { _chatmsg_box.y = 3 * FONT_HEIGHT_NORMAL; _chatmsg_box.height = MAX_CHAT_MESSAGES * (FONT_HEIGHT_NORMAL + ScaleGUITrad(NETWORK_CHAT_LINE_SPACING)) + ScaleGUITrad(4); - _chatmessage_backup = ReallocT(_chatmessage_backup, _chatmsg_box.width * _chatmsg_box.height * BlitterFactory::GetCurrentBlitter()->GetBytesPerPixel()); + _chatmessage_backup = ReallocT(_chatmessage_backup, static_cast(_chatmsg_box.width) * _chatmsg_box.height * BlitterFactory::GetCurrentBlitter()->GetBytesPerPixel()); } /** Initialize all buffers of the chat visualisation. */ @@ -214,7 +214,7 @@ void NetworkDrawChatMessage() } if (width <= 0 || height <= 0) return; - assert(blitter->BufferSize(width, height) <= (int)(_chatmsg_box.width * _chatmsg_box.height * blitter->GetBytesPerPixel())); + assert(blitter->BufferSize(width, height) <= static_cast(_chatmsg_box.width) * _chatmsg_box.height * blitter->GetBytesPerPixel()); /* Make a copy of the screen as it is before painting (for undraw) */ blitter->CopyToBuffer(blitter->MoveTo(_screen.dst_ptr, x, y), _chatmessage_backup, width, height); diff --git a/src/screenshot.cpp b/src/screenshot.cpp index 786928c232..1f519877e8 100644 --- a/src/screenshot.cpp +++ b/src/screenshot.cpp @@ -149,7 +149,7 @@ static bool MakeBMPImage(const char *name, ScreenshotCallback *callb, void *user /* Setup the file header */ BitmapFileHeader bfh; bfh.type = TO_LE16('MB'); - bfh.size = TO_LE32(sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader) + pal_size + bytewidth * h); + bfh.size = TO_LE32(sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader) + pal_size + static_cast(bytewidth) * h); bfh.reserved = 0; bfh.off_bits = TO_LE32(sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader) + pal_size); @@ -392,7 +392,7 @@ static bool MakePNGImage(const char *name, ScreenshotCallback *callb, void *user maxlines = Clamp(65536 / w, 16, 128); /* now generate the bitmap bits */ - void *buff = CallocT(w * maxlines * bpp); // by default generate 128 lines at a time. + void *buff = CallocT(static_cast(w) * maxlines * bpp); // by default generate 128 lines at a time. y = 0; do { @@ -499,7 +499,7 @@ static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *user maxlines = Clamp(65536 / w, 16, 128); /* now generate the bitmap bits */ - uint8 *buff = CallocT(w * maxlines); // by default generate 128 lines at a time. + uint8 *buff = CallocT(static_cast(w) * maxlines); // by default generate 128 lines at a time. y = 0; do { diff --git a/src/spritecache.cpp b/src/spritecache.cpp index 92c5427c5b..a7ba2bc5a1 100644 --- a/src/spritecache.cpp +++ b/src/spritecache.cpp @@ -284,7 +284,7 @@ static bool ResizeSpriteIn(SpriteLoader::Sprite *sprite, ZoomLevel src, ZoomLeve sprite[tgt].y_offs = sprite[src].y_offs * scaled_1; sprite[tgt].colours = sprite[src].colours; - sprite[tgt].AllocateData(tgt, sprite[tgt].width * sprite[tgt].height); + sprite[tgt].AllocateData(tgt, static_cast(sprite[tgt].width) * sprite[tgt].height); SpriteLoader::CommonPixel *dst = sprite[tgt].data; for (int y = 0; y < sprite[tgt].height; y++) { @@ -307,7 +307,7 @@ static void ResizeSpriteOut(SpriteLoader::Sprite *sprite, ZoomLevel zoom) sprite[zoom].y_offs = UnScaleByZoom(sprite[ZOOM_LVL_NORMAL].y_offs, zoom); sprite[zoom].colours = sprite[ZOOM_LVL_NORMAL].colours; - sprite[zoom].AllocateData(zoom, sprite[zoom].height * sprite[zoom].width); + sprite[zoom].AllocateData(zoom, static_cast(sprite[zoom].height) * sprite[zoom].width); SpriteLoader::CommonPixel *dst = sprite[zoom].data; const SpriteLoader::CommonPixel *src = sprite[zoom - 1].data; @@ -338,9 +338,10 @@ static bool PadSingleSprite(SpriteLoader::Sprite *sprite, ZoomLevel zoom, uint p if (width > UINT16_MAX || height > UINT16_MAX) return false; /* Copy source data and reallocate sprite memory. */ - SpriteLoader::CommonPixel *src_data = MallocT(sprite->width * sprite->height); - MemCpyT(src_data, sprite->data, sprite->width * sprite->height); - sprite->AllocateData(zoom, width * height); + size_t sprite_size = static_cast(sprite->width) * sprite->height; + SpriteLoader::CommonPixel *src_data = MallocT(sprite_size); + MemCpyT(src_data, sprite->data, sprite_size); + sprite->AllocateData(zoom, static_cast(width) * height); /* Copy with padding to destination. */ SpriteLoader::CommonPixel *src = src_data; diff --git a/src/spriteloader/grf.cpp b/src/spriteloader/grf.cpp index a8f1d80ad9..a609e03d51 100644 --- a/src/spriteloader/grf.cpp +++ b/src/spriteloader/grf.cpp @@ -92,7 +92,7 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f if (num != 0) return WarnCorruptSprite(file, file_pos, __LINE__); - sprite->AllocateData(zoom_lvl, sprite->width * sprite->height); + sprite->AllocateData(zoom_lvl, static_cast(sprite->width) * sprite->height); /* Convert colour depth to pixel size. */ int bpp = 0; @@ -168,13 +168,14 @@ bool DecodeSingleSprite(SpriteLoader::Sprite *sprite, SpriteFile &file, size_t f } while (!last_item); } } else { - if (dest_size < sprite->width * sprite->height * bpp) { + int64 sprite_size = static_cast(sprite->width) * sprite->height * bpp; + if (dest_size < sprite_size) { return WarnCorruptSprite(file, file_pos, __LINE__); } - if (dest_size > sprite->width * sprite->height * bpp) { + if (dest_size > sprite_size) { static byte warning_level = 0; - DEBUG(sprite, warning_level, "Ignoring " OTTD_PRINTF64 " unused extra bytes from the sprite from %s at position %i", dest_size - sprite->width * sprite->height * bpp, file.GetSimplifiedFilename().c_str(), (int)file_pos); + DEBUG(sprite, warning_level, "Ignoring " OTTD_PRINTF64 " unused extra bytes from the sprite from %s at position %i", dest_size - sprite_size, file.GetSimplifiedFilename().c_str(), (int)file_pos); warning_level = 6; } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 48973e43ad..9e3252d6aa 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1324,7 +1324,7 @@ void GetStationLayout(byte *layout, uint numtracks, uint plat_len, const Station !statspec->layouts[plat_len - 1][numtracks - 1].empty()) { /* Custom layout defined, follow it. */ memcpy(layout, statspec->layouts[plat_len - 1][numtracks - 1].data(), - plat_len * numtracks); + static_cast(plat_len) * numtracks); return; } @@ -2162,7 +2162,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin if (ret.Failed()) return ret; /* Check if this number of road stops can be allocated. */ - if (!RoadStop::CanAllocateItem(roadstop_area.w * roadstop_area.h)) return_cmd_error(type ? STR_ERROR_TOO_MANY_TRUCK_STOPS : STR_ERROR_TOO_MANY_BUS_STOPS); + if (!RoadStop::CanAllocateItem(static_cast(roadstop_area.w) * roadstop_area.h)) return_cmd_error(type ? STR_ERROR_TOO_MANY_TRUCK_STOPS : STR_ERROR_TOO_MANY_BUS_STOPS); ret = BuildStationPart(&st, flags, reuse, roadstop_area, STATIONNAMING_ROAD); if (ret.Failed()) return ret; diff --git a/src/tgp.cpp b/src/tgp.cpp index 7f6082e84a..c73759b43e 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -327,7 +327,7 @@ static inline bool AllocHeightMap() _height_map.size_y = MapSizeY(); /* Allocate memory block for height map row pointers */ - size_t total_size = (_height_map.size_x + 1) * (_height_map.size_y + 1); + size_t total_size = static_cast(_height_map.size_x + 1) * (_height_map.size_y + 1); _height_map.dim_x = _height_map.size_x + 1; _height_map.h.resize(total_size); @@ -581,7 +581,7 @@ static void HeightMapCurves(uint level) float factor = sqrt((float)_height_map.size_x / (float)_height_map.size_y); uint sx = Clamp((int)(((1 << level) * factor) + 0.5), 1, 128); uint sy = Clamp((int)(((1 << level) / factor) + 0.5), 1, 128); - byte *c = AllocaM(byte, sx * sy); + byte *c = AllocaM(byte, static_cast(sx) * sy); for (uint i = 0; i < sx * sy; i++) { c[i] = Random() % lengthof(curve_maps); diff --git a/src/video/allegro_v.cpp b/src/video/allegro_v.cpp index 7c20f45e82..0f5fb06666 100644 --- a/src/video/allegro_v.cpp +++ b/src/video/allegro_v.cpp @@ -204,7 +204,7 @@ static bool CreateMainSurface(uint w, uint h) _screen.dst_ptr = _allegro_screen->line[0]; /* Initialise the screen so we don't blit garbage to the screen */ - memset(_screen.dst_ptr, 0, _screen.height * _screen.pitch); + memset(_screen.dst_ptr, 0, static_cast(_screen.height) * _screen.pitch); /* Set the mouse at the place where we expect it */ poll_mouse(); diff --git a/src/video/dedicated_v.cpp b/src/video/dedicated_v.cpp index f91844bda1..d41ab35ffb 100644 --- a/src/video/dedicated_v.cpp +++ b/src/video/dedicated_v.cpp @@ -140,7 +140,7 @@ const char *VideoDriver_Dedicated::Start(const StringList &parm) this->UpdateAutoResolution(); int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); - _dedicated_video_mem = (bpp == 0) ? nullptr : MallocT(_cur_resolution.width * _cur_resolution.height * (bpp / 8)); + _dedicated_video_mem = (bpp == 0) ? nullptr : MallocT(static_cast(_cur_resolution.width) * _cur_resolution.height * (bpp / 8)); _screen.width = _screen.pitch = _cur_resolution.width; _screen.height = _cur_resolution.height; diff --git a/src/video/opengl.cpp b/src/video/opengl.cpp index dfba56930d..34b15388fb 100644 --- a/src/video/opengl.cpp +++ b/src/video/opengl.cpp @@ -918,6 +918,7 @@ bool OpenGLBackend::Resize(int w, int h, bool force) int bpp = BlitterFactory::GetCurrentBlitter()->GetScreenDepth(); int pitch = Align(w, 4); + size_t line_pixel_count = static_cast(pitch) * h; _glViewport(0, 0, w, h); @@ -928,27 +929,27 @@ bool OpenGLBackend::Resize(int w, int h, bool force) _glDeleteBuffers(1, &this->vid_pbo); _glGenBuffers(1, &this->vid_pbo); _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->vid_pbo); - _glBufferStorage(GL_PIXEL_UNPACK_BUFFER, pitch * h * bpp / 8, nullptr, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT | GL_CLIENT_STORAGE_BIT); + _glBufferStorage(GL_PIXEL_UNPACK_BUFFER, line_pixel_count * bpp / 8, nullptr, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT | GL_CLIENT_STORAGE_BIT); } else { /* Re-allocate video buffer texture and backing store. */ _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->vid_pbo); - _glBufferData(GL_PIXEL_UNPACK_BUFFER, pitch * h * bpp / 8, nullptr, GL_DYNAMIC_DRAW); + _glBufferData(GL_PIXEL_UNPACK_BUFFER, line_pixel_count * bpp / 8, nullptr, GL_DYNAMIC_DRAW); } if (bpp == 32) { /* Initialize backing store alpha to opaque for 32bpp modes. */ Colour black(0, 0, 0); if (_glClearBufferSubData != nullptr) { - _glClearBufferSubData(GL_PIXEL_UNPACK_BUFFER, GL_RGBA8, 0, pitch * h * bpp / 8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, &black.data); + _glClearBufferSubData(GL_PIXEL_UNPACK_BUFFER, GL_RGBA8, 0, line_pixel_count * bpp / 8, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, &black.data); } else { - ClearPixelBuffer(pitch * h, black.data); + ClearPixelBuffer(line_pixel_count, black.data); } } else if (bpp == 8) { if (_glClearBufferSubData != nullptr) { byte b = 0; - _glClearBufferSubData(GL_PIXEL_UNPACK_BUFFER, GL_R8, 0, pitch * h, GL_RED, GL_UNSIGNED_BYTE, &b); + _glClearBufferSubData(GL_PIXEL_UNPACK_BUFFER, GL_R8, 0, line_pixel_count, GL_RED, GL_UNSIGNED_BYTE, &b); } else { - ClearPixelBuffer(pitch * h, 0); + ClearPixelBuffer(line_pixel_count, 0); } } @@ -972,18 +973,18 @@ bool OpenGLBackend::Resize(int w, int h, bool force) _glDeleteBuffers(1, &this->anim_pbo); _glGenBuffers(1, &this->anim_pbo); _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->anim_pbo); - _glBufferStorage(GL_PIXEL_UNPACK_BUFFER, pitch * h, nullptr, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT | GL_CLIENT_STORAGE_BIT); + _glBufferStorage(GL_PIXEL_UNPACK_BUFFER, line_pixel_count, nullptr, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT | GL_CLIENT_STORAGE_BIT); } else { _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->anim_pbo); - _glBufferData(GL_PIXEL_UNPACK_BUFFER, pitch * h, nullptr, GL_DYNAMIC_DRAW); + _glBufferData(GL_PIXEL_UNPACK_BUFFER, line_pixel_count, nullptr, GL_DYNAMIC_DRAW); } /* Initialize buffer as 0 == no remap. */ if (_glClearBufferSubData != nullptr) { byte b = 0; - _glClearBufferSubData(GL_PIXEL_UNPACK_BUFFER, GL_R8, 0, pitch * h, GL_RED, GL_UNSIGNED_BYTE, &b); + _glClearBufferSubData(GL_PIXEL_UNPACK_BUFFER, GL_R8, 0, line_pixel_count, GL_RED, GL_UNSIGNED_BYTE, &b); } else { - ClearPixelBuffer(pitch * h, 0); + ClearPixelBuffer(line_pixel_count, 0); } _glBindTexture(GL_TEXTURE_2D, this->anim_texture); @@ -1191,7 +1192,7 @@ uint8 *OpenGLBackend::GetAnimBuffer() this->anim_buffer = _glMapBuffer(GL_PIXEL_UNPACK_BUFFER, GL_READ_WRITE); } else if (this->anim_buffer == nullptr) { _glBindBuffer(GL_PIXEL_UNPACK_BUFFER, this->anim_pbo); - this->anim_buffer = _glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, _screen.pitch * _screen.height, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); + this->anim_buffer = _glMapBufferRange(GL_PIXEL_UNPACK_BUFFER, 0, static_cast(_screen.pitch) * _screen.height, GL_MAP_READ_BIT | GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); } return (uint8 *)this->anim_buffer; @@ -1491,8 +1492,9 @@ void OpenGLSprite::Update(uint width, uint height, uint level, const SpriteLoade if (this->tex[TEX_RGBA] != 0) { /* Unpack pixel data */ - Colour *rgba = buf_rgba.Allocate(width * height); - for (size_t i = 0; i < width * height; i++) { + size_t size = static_cast(width) * height; + Colour *rgba = buf_rgba.Allocate(size); + for (size_t i = 0; i < size; i++) { rgba[i].r = data[i].r; rgba[i].g = data[i].g; rgba[i].b = data[i].b; @@ -1505,7 +1507,7 @@ void OpenGLSprite::Update(uint width, uint height, uint level, const SpriteLoade if (this->tex[TEX_REMAP] != 0) { /* Unpack and align pixel data. */ - int pitch = Align(width, 4); + size_t pitch = Align(width, 4); uint8 *pal = buf_pal.Allocate(pitch * height); const SpriteLoader::CommonPixel *row = data;