Commit Graph

2730 Commits (193d105a3fde2ab0d0063d8c32e1bc5eb5ba38a7)

Author SHA1 Message Date
MrSimbax 193d105a3f Refactor CBotUT.TestSaveStateIoFunctions
Split the test into several parametrised tests for each data type.

Add more tests with different values.

Fix the ReadBinary() function in order to fix the ReadDouble() function
for negative values (the sign bit was being lost).
2021-12-09 20:44:31 +01:00
MrSimbax 9fd935770a Fix CBotUT.TestSaveStateIOFunctions
Fail occurred due to wrong read of min double.
`unsigned long` has been changed in Write/ReadDouble functions to
`uint64_t`.
`unsigned int` has been changed in Write/ReadFloat functions to
`uint32_t`.

According to the standard
`int` is at least 16-bit so it might be too small for 32-bit `float`,
`long` is at least 32-bit so it might be too small for 64-bit `double`,
and `long long` is at least 64-bit.
2021-12-05 16:51:51 +01:00
Mateusz Przybył ae179d9005
Merge pull request #1440 from melex750/dev-insect-from-egg
Fix saving/loading programs for insects from AlienEgg
2021-12-04 10:04:49 +01:00
Mateusz Przybył 96fece4e6d
Merge pull request #1464 from nipsufn/master
fix SatCom content offset on screens with high resolution / small font size
2021-12-04 10:01:53 +01:00
nipsufn 117c72ba72 fix SatCom content offset on high resolution / small font size 2021-09-29 15:26:19 +02:00
MrSimbax 80f074e2ba Update license headers 2021-09-11 15:53:59 +02:00
MrSimbax c9dca4cebd Rename SystemDialogType::ERROR to ERROR_MSG
Unfortunately, the ERROR name collides with
a preprocessor definition in windows.h
2021-09-11 13:40:22 +02:00
MrSimbax a69b88e09a Move time related functions out of CSystemUtils
GetCurrentTimeStamp() has not been moved because of
CApplication unit tests.
2021-09-11 13:26:38 +02:00
MrSimbax 5daaba6e64 Fixes after merge
Fix mistakes after previous merge and make it compile.

Rewrite the function interpolating between time stamps as it was
written after the original pull request was created. Add unit tests
for it.

I couldn't help myself and also changed some enums to enum classes and
did some renames.
2021-09-11 12:44:26 +02:00
MrSimbax 2b107736e2 Merge branch 'platform-independent' of https://github.com/AbigailBuccaneer/colobot into AbigailBuccaneer-platform-independent 2021-09-11 10:47:39 +02:00
Mateusz Przybył 37f82acff0
Merge pull request #1457 from vieux/master
system_macosx.cpp: fix typo
2021-09-05 14:40:32 +02:00
MrSimbax d39f1999e7 Remove support for MXE 2021-09-04 21:52:58 +02:00
MrSimbax bbf5c806d8 Fix MSVC compilation due to macros in Windows API headers
There exists `CreateDirectory` `#define` somewhere and it results in
failed compilation of `resourcemanager.cpp`.
Similarly for `RemoveDirectory`. See
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createdirectorya

Rename the two methods to remove the conflict.

The fail occurs at least when using Visual Studio 2022 Preview.
2021-09-04 20:34:02 +02:00
MrSimbax 65e12621ff Link brotli since freetype can now depend on it
The fixes are from PR #1371
2021-09-04 20:31:22 +02:00
MrSimbax 5e37f84bc7 Merge branch 'dev' into dev-modern 2021-09-04 19:11:24 +02:00
Victor Vieux 11047ecd53 system_macosx.cpp: fix typo 2021-08-24 15:48:31 -07:00
Fiftytwo a5d9bae052 Fix missing AmphibiousTrainer in drive_type 2021-08-20 18:17:36 +02:00
Emxx52 efad9a4dae
Merge pull request #1438 from melex750/dev-cbot-fix-leaks
CBOT bug fixes and improved performance
2021-08-14 20:15:58 +02:00
melex750 55d6c431f2 Fix a bug in WriteStream and ReadStream
Added a unit test to confirm reliability of I/O
functions used by SaveState and RestoreState.
2021-06-25 18:50:15 -04:00
melex750 ce450d1c00 Fix save/load programs for insects from AlienEgg
fixes #1370
2021-06-25 18:47:25 -04:00
melex750 9f5ee21bbe Restore repeat(n) instruction
fixes #1403
2021-06-11 23:28:53 -04:00
melex750 27466a4223 Make all CBotStack data members non-static 2021-06-11 22:48:50 -04:00
melex750 a279541198 Make all CBotCStack data members non-static 2021-06-11 22:47:33 -04:00
melex750 309f80b25f Fix some bugs and memory leaks in CBOT
* Added CBotStack::StackOver() calls where it was possible
  to go out-of-bounds when calling CBotStack::AddStack().
* Fixed some bugs in CBotExternalCallClass
2021-06-11 22:46:23 -04:00
melex750 993a6adf6e Fix inherited data members not being saved
* Removed erroneous 'parent instance' from CBotVarClass.
* Fixed output of CBVarClass::GetValString()
2021-06-11 22:44:20 -04:00
Fiftytwo 8647deafc8 Merge branch dev into dev-gameplus 2021-03-21 22:30:23 +01:00
Mateusz Przybył 52446c1049
Merge pull request #1371 from jaladreips/dev-cmake
Fix MSVC building issues by correcting CMakeLists.txt
2021-02-22 20:49:27 +01:00
MrSimbax 404d2dbeb1 Fix segfault in CApp UT
I moved m_engine creation to the constructor.
However, it is not complete until after calling m_engine->Create().
The UT segfault because the pointer is not null and destructor calls
m_engine->Destroy() on an incomplete object.
(Yes, UTs test incomplete SUT.)

So I moved back the m_engine creation to CApp::Create() but before
the SDL initialization as m_engine holds the flag for vsync.
2021-02-07 13:38:29 +01:00
MrSimbax 9a04685101 Fix compile error 2021-02-07 13:03:12 +01:00
MrSimbax a7aaa07356 Update vsync list after user interaction
The vsync may immediately fallback to another option after change from
the user so the UI should reflect that.

Todo: show a popup in UI informing the user why their desired vsync
option couldn't be set. Right now the error message is visible only from
the logs.
2021-02-07 12:50:13 +01:00
MrSimbax 71ff89a803 Remove vsync disable/enable loop (fix #1383)
Also a small refactor due to repeated code.
The vsync flag in m_engine is now synchronized with the SDL state
during initial configuration of CApp.
2021-02-07 12:47:32 +01:00
jakac c336a67afa Fix MSVC building issues by correcting CMakeLists.txt 2021-01-03 15:46:01 +01:00
Fiftytwo 10ec454f6b Fix Target research() executing in ResearchCenter 2020-12-31 05:00:33 +01:00
MrSimbax 05de2baef5 Fix crashes in SatCom on some \button characters
The issue is that the \button fragments in SatCom are replaced with
invalid UTF-8 bytes, hence those bytes need to be handled as a special
case when checking for UTF-8 character length.

When the text is processed e.g. in `Gfx::CText::Justify`, there are
generally two arrays: `text` and `format`. The second one is interpreted
as a font for a given character, e.g. `text[i]` has font `format[i]`.

Now, in the loops the index for `text` is increased by the length of
the character, e.g. 1 to 4 bytes, whereas index for `format` is
only incremented. It seems there's an assumption that `format` treats
multibyte characters as one byte, which doesn't seem to be true by
looking at the process of filling up the `format` array. This can result
in using wrong font e.g. FONT_SATCOM for the \button character which
should be FONT_BUTTON, hence the `StrUtils::Utf8CharSizeAt` method
complains about unexpected continuation byte via exception, causing
the crash.

Incrementing the index by the UTF-8 length seems to have fixed the
issue. However, I am not sure if I haven't broken anything else by this
and if I analyzed the intended behaviour correctly.
Gfx::CText needs a major refactor IMHO.
2020-09-20 21:22:05 +02:00
Jeff Law ad2e3db92f Fix more dynamic casts for gcc-11
Signed-off-by: suve <veg@svgames.pl>
Jeff's patch was written for the 0.1.12 stable release.
Adapted to work with the "dev" branch (as of commit 13098ee).
2020-09-15 10:20:24 +02:00
Jeff Law 8c6ac4cd16 Fix dynamic casts to avoid gcc-11 diagnostics 2020-09-04 11:16:45 +02:00
tomangelo 2685a1eb60
Add cell capacity parameters (#1348) 2020-08-31 13:37:45 +02:00
tomangelo2 f08c67bef9 Fix warning regarding mismatched parameter types 2020-08-27 00:28:03 +02:00
Emxx52 1c9f5f3f64
Merge branch 'dev' into dev-mod-manager 2020-08-21 18:21:08 +02:00
tomangelo d7ec891ab8
Merge pull request #1346 from melex750/dev-cbot-fix-delete
Fix CBOT script hanging at delete()
2020-08-20 22:09:37 +02:00
tomangelo dbc13bad20
Merge pull request #1345 from melex750/dev-cbot-fix-abs
Fix abs() only working on floats
2020-08-17 19:28:35 +02:00
melex750 8d5cafecb3
Fix CBOT script hanging at delete() 2020-08-15 09:41:31 -04:00
melex750 d0961a517a
Fix abs() only working on floats 2020-08-15 09:29:45 -04:00
Fiftytwo 4c1d3eecd1 Add flag() and deflag() CBOT functions 2020-08-15 03:31:17 +02:00
Fiftytwo 56c99e741e Make Vault buildable 2020-08-08 20:51:56 +02:00
tomangelo2 4bb6f9f1b3 Remove unnecessary warning if there is no fonts.ini file 2020-08-08 15:41:07 +02:00
Fiftytwo b9305dfd45 Fix Mushroom SatCom links 2020-08-08 14:34:21 +02:00
Tomasz Kapuściński 4c14050b27 Fixed mipmaps being outdates after texture update. 2020-07-31 22:04:47 +02:00
Tomasz Kapuściński 33b7c893cb Allow length of the light direction vector to influence strength of the light source.
This fixes the issue with objects and terrain being darker than they should be. As it turns out, most levels have not normalized light direction which happens to make light brighter and this is the expected result. To keep in line with GL14 engine, newer engines should use the length of the vector to make light brighter.
2020-07-31 22:01:33 +02:00
Fiftytwo 2023756023 Fix factory() being able to produce non-bot units 2020-07-30 11:11:51 +02:00