Commit Graph

59 Commits

Author SHA1 Message Date
Peter Nelson a1a01e21cf
Change: Use std::make_unique instead of passing new() (#12539) 2024-04-20 11:20:49 +01:00
Peter Nelson 7572cfd103 Codechange: Redefine ZOOM_LVL so that ZOOM_LVL_NORMAL is 1x zoom.
This matches expectations of what normal zoom means.
2024-04-04 22:27:03 +01:00
Peter Nelson 3c94e81665 Codechange: Use ZOOM_LVL_MIN to refer to first zoom level.
Many uses of ZOOM_LVL_NORMAL actually just want the first zoom level slot, so use ZOOM_LVL_MIN to make this clearer.
2024-04-04 22:27:03 +01:00
Patric Stout a3cfd23cf9
Codechange: rename byte to uint8_t (#12308) 2024-03-16 23:59:32 +01:00
Peter Nelson b85ecf9ac2
Codechange: Replace pointer to Sprite array with reference to SpriteCollection. (#11580)
Add `SpriteLoader::SpriteCollection` type which is an array of `SpriteLoad::Sprite`.

This removes the ambiguity of what `SpriteLoader::Sprite *` is pointing to,
and cleans up mismatches using both dereference -> and array access [] for the
same object.
2023-12-20 20:38:21 +00:00
Rubidium eaae0bb5e7 Codechange: automatic adding of _t to (u)int types, and WChar to char32_t
for i in `find src -type f|grep -v 3rdparty/fmt|grep -v 3rdparty/catch2|grep -v 3rdparty/opengl|grep -v stdafx.h`; do sed 's/uint16& /uint16 \&/g;s/int8\([ >*),;[]\)/int8_t\1/g;s/int16\([ >*),;[]\)/int16_t\1/g;s/int32\([ >*),;[]\)/int32_t\1/g;s/int64\([ >*),;[]\)/int64_t\1/g;s/ uint32(/ uint32_t(/g;s/_uint8_t/_uint8/;s/Uint8_t/Uint8/;s/ft_int64_t/ft_int64/g;s/uint64$/uint64_t/;s/WChar/char32_t/g;s/char32_t char32_t/char32_t WChar/' -i $i; done
2023-07-19 19:30:14 +02:00
Rubidium 4a5a9f57c4 Fix: conversion to smaller type warnings 2023-05-06 21:26:13 +02:00
PeterN db573c8742
Fix #10660: Sprite Font scale affected by viewport zoom level limits. (#10668) 2023-04-17 00:14:03 +02:00
PeterN e97bf271dc
Codechange: Make SpriteType, CargoSortType, SourceType and ScriptType enum classes. (#10663)
This avoids a (soft) namespace conflict between the four ST_* enums.
2023-04-16 20:00:55 +01:00
Rubidium 51049946d1 Fix: prevent corrupted GRF files to allocate stupid amounts of memory 2023-01-05 20:11:59 +01:00
Patric Stout 1fb101eabb
Codechange: address CodeQL issue "Multiplication result converted to larger type" (#10306)
Most are very unlikely to ever be triggered in our codebase; two
stand out: linkgraph and money cheat. Those, potentially, could
wrap earlier than expected.
2023-01-02 20:30:02 +00:00
Jonathan G Rennison 5e413c9dcd
Fix #9804: Only apply sprite_zoom_min setting when sprites available (#9988)
Only discard sprite zoom levels when a suitable higher zoom level is
defined in the same colour mode

This is to avoid placeholder or empty sprites being used, causing
visual artefacts
2022-09-21 12:37:11 +02:00
rubidium42 55a11710a6 Codechange: convert printf DEBUG statements to fmt Debug statements 2021-06-13 12:45:45 +02:00
rubidium42 e588923bff Codechange: add std::string accepting SetDParamStr to ErrorMessageData 2021-06-13 10:26:58 +02:00
Rubidium fdc11a9f94 Codechange: introduce SpriteFile to be used by the sprite loader instead of the global FIO slot functionality 2021-05-08 12:39:34 +02:00
Matt Kimber bcb3313e13
Feature: allow setting maximum zoom level at which sprites are drawn (#8604) 2021-03-13 10:00:53 +01:00
Michael Lutz 70aa3b4011 Codechange: Give sprite encoders a hint which colour components of a sprite are filled with useful information. 2021-02-22 22:16:07 +01:00
Charles Pigott 9b800a96ed
Codechange: Remove min/max functions in favour of STL variants (#8502) 2021-01-08 11:16:18 +01:00
S. D. Cloudt 13cc8a0cee Cleanup: Removed SVN headers 2019-11-10 17:59:20 +00:00
Michael Lutz 38729297f9 Codechange: No need for AutoFreePtr if there's std::unique_ptr. 2019-04-15 22:52:50 +01:00
peter1138 1088ad48fc (svn r27004) -Codechange: Make GUI size apply to (sprite-font) text as well. 2014-10-12 20:43:25 +00:00
rubidium 0463dbdc9e (svn r26482) -Codechange: add an include that allows us to undefine/redefine "unsafe" functions to prevent them from being used, and thus having to care about certain aspects of their return values 2014-04-23 20:13:33 +00:00
rubidium 70b2093ddb (svn r26132) -Fix-ish: prevent issues due to overflowing multiplications by limiting the size of full zoom sprites to about 32kix32ki 2013-11-26 22:03:56 +00:00
michi_cc 2c3bca6ad9 (svn r23897) -Feature: [NewGRF] 32bpp sprites in GRFs. 2012-02-04 22:18:57 +00:00
michi_cc c9e664d4cb (svn r23894) -Fix (r23893): Use the right variable, not the one that's always going to be 0. 2012-02-04 20:12:06 +00:00
michi_cc 4702924f6e (svn r23893) -Change: [NewGRF] Extended chunked sprite encoding to work for bigger sprites. 2012-02-04 19:21:32 +00:00
michi_cc 5c1cc27b03 (svn r23890) -Add: [NewGRF] Support for RealSprites with multiple zoom levels. 2012-02-04 13:29:18 +00:00
michi_cc e85d5b5d31 (svn r23889) -Codechange: Centralise sprite resizing in one place. (peter1138) 2012-02-04 13:29:13 +00:00
michi_cc 6db39410a1 (svn r23887) -Feature: [NewGRF] Support for container version 2. 2012-02-04 13:29:04 +00:00
michi_cc 5af68295b0 (svn r23881) -Codechange: Move GRF sprite decoding into a separate function. 2012-02-04 13:28:40 +00:00
rubidium 58423b26d1 (svn r23474) -Codechange: move the declaration error related functions to error.h 2011-12-10 13:54:10 +00:00
peter1138 8be8d5e843 (svn r23324) -Fix (r15555): Don't free reusable buffer. 2011-11-25 11:45:46 +00:00
peter1138 81598273e9 (svn r23316) -Feature: Add ability to zoom in to 2x and 4x level. 2011-11-24 12:38:48 +00:00
frosch bbcd2bab5d (svn r22419) -Change: Always use the DOS palette for drawing.
-Remove: the '-i' option for palette selection.
2011-05-04 17:12:37 +00:00
rubidium 7eba2bf4d3 (svn r21890) -Cleanup: remove some unneeded includes 2011-01-22 14:52:20 +00:00
alberth be6c058424 (svn r20211) -Codechange: Indented code should have curly braces around it. 2010-07-24 10:14:39 +00:00
smatz f051066bc4 (svn r19224) -Codechange: change parameters passed to ShowErrorMessage() a bit 2010-02-24 14:46:15 +00:00
rubidium b2e9b5d612 (svn r18683) -Fix: it's not an other 2010-01-01 18:45:40 +00:00
frosch 169141433a (svn r18391) -Fix (r0): (Invalid) GRFs could trigger invalid reads. 2009-12-03 15:27:33 +00:00
alberth 44aacfc59f (svn r17928) -Codechange: ShowErrorMessage() now takes the summary string before the details string.
Gentlemen, swap your string parameters.
2009-10-31 19:46:51 +00:00
rubidium d6cded5380 (svn r17693) -Cleanup: remove some unneeded includes 2009-10-04 17:16:41 +00:00
rubidium 7fbc33dae1 (svn r17248) -Fix: add GPL license notice where appropriate 2009-08-21 20:21:05 +00:00
rubidium 0c1b8ea602 (svn r15555) -Codechange: remove the mallocs + frees for temporary data from loading sprites. 2009-02-23 10:50:25 +00:00
rubidium c0a8d09ca7 (svn r15428) -Codechange: consistently use colour instead of having both color and colour. 2009-02-09 02:57:15 +00:00
rubidium 2277a1ff9c (svn r14610) -Fix [FS#2415]: possible stack corruption when reading corrupted sprites.
-Change: harden the sprite reading routine against corrupt sprites.
2008-11-23 13:42:05 +00:00
rubidium fc216aeeb8 (svn r14229) -Feature: allow overriding the palette of the base GRFs. This way you can play with NewGRFs made for the Windows palette with the DOS palettes base GRFs (and vice versa). Note that for this to work correctly ALL NewGRFs must use the same palette; mix and match is not yet supported. 2008-09-02 18:45:15 +00:00
rubidium c8e8911ef6 (svn r14223) -Codechange: make GetSprite aware of the 4 different types of sprites: fonts, recolour, mapgen and normal sprites. 2008-09-02 15:20:38 +00:00
rubidium ea1f180a55 (svn r14199) -Codechange: split fileio.h into fileio_type.h and fileio_func.h so not everything that includes saveload.h needs to include everything else too. 2008-08-31 10:50:05 +00:00
rubidium e06c21426e (svn r14190) -Codechange: use alloc instead of malloc+free when the allocated memory shouldn't be used after the function ended. 2008-08-30 09:43:07 +00:00
rubidium 5c5ee7eb57 (svn r13301) -Fix [FS#1997]: resolve more MSVC 9 x64 warnings. 2008-05-27 21:41:00 +00:00