Compare commits

...

554 Commits

Author SHA1 Message Date
immibis 3a8f75bd02 string_view is not a drop-in replacement for char[]
Fixes crash on startup - when logging FULL_NAME with %s - on Linux.
2023-10-11 06:04:18 +02:00
immibis 32fed5af73 Fix build - static library used in shared library must have position-independent code 2023-10-11 05:16:06 +02:00
Emxx52 f07b7a1b60
Merge pull request #1612 from colobot/dev-fix-links
Update doc links in README
2023-08-28 23:59:33 +02:00
Fiftytwo 0a95289f9f Update doc links in README 2023-08-28 23:31:44 +02:00
Ceeee 7d75b9cc14
Update German translation (#1607) 2023-08-24 23:32:11 +02:00
tomangelo 909a2b2d2e
Update checkout and upload-artifact actions to node16 (#1610)
* Updated checkout actions

* Updated upload-artifact actions

* Remove now unnecessary gcc-9 step
2023-08-24 23:25:32 +02:00
Emxx52 7d22b607cc
Merge pull request #1609 from colobot/1608-strutilsremovecomments-breaks-some-levels
Fix RemoveComments()
2023-08-24 20:33:02 +02:00
Tomasz Kapuściński 2f80292176 Fix RemoveComments() 2023-08-24 18:45:16 +02:00
Emxx52 53b3062bee
Merge pull request #1606 from colobot/1605-improve-level-loading-time
Improve level loading time
2023-08-23 20:19:17 +02:00
Tomasz Kapuściński 8e128ff08c Added StrUtils::RemoveComments() and used it instead of std::regex in parsing level commands 2023-08-23 16:56:15 +02:00
Emxx52 3c4b9f6d01
Merge pull request #1604 from colobot/dev-graphics-overhaul
Graphics overhaul
2023-08-23 02:06:58 +02:00
Tomasz Kapuściński 9d5f88f07c Merge branch 'dev' into dev-graphics-overhaul 2023-08-22 23:51:12 +02:00
Tomasz Kapuściński b9c8d36d8b Fixed links 2023-08-22 23:29:08 +02:00
Tomasz Kapuściński ff340fda92 Moved docimg to docs/images 2023-08-22 22:52:55 +02:00
Tomasz Kapuściński c0d568241b Moved some documentation files to docs directory 2023-08-22 22:42:40 +02:00
Tomasz Kapuściński d879fa5fc9 Cleanup in unit tests 2023-08-22 22:19:46 +02:00
Tomasz Kapuściński 510fe6804a Extracted CBot tools 2023-08-22 22:01:24 +02:00
Tomasz Kapuściński 2b84da8a77 Removed model converter 2023-08-22 21:50:18 +02:00
Tomasz Kapuściński 670cedd967 Renamed directory tools to scripts 2023-08-22 21:45:11 +02:00
Tomasz Kapuściński 5a52c66b1f Renamed target colobot_ut to Colobot-UnitTests 2023-08-22 21:39:55 +02:00
Tomasz Kapuściński 434bd0bd3a Renamed src to colobot-base and colobotbase target to Colobot-Base 2023-08-22 21:19:03 +02:00
Emxx52 5f854da5fc
Merge pull request #1602 from colobot/dev-upgrade-physfs
Replace deprecated PHYSFS functions with their modern counterparts
2023-08-22 21:01:10 +02:00
tomangelo2 86c2b2f0dc Replace deprecated PHYSFS functions with their modern counterparts 2023-08-17 23:38:02 +02:00
Tomasz Kapuściński 7fe75e20ad Fixed wrong text selection color 2023-08-15 20:32:33 +02:00
Tomasz Kapuściński 261eaa78e4 A fix for Windows stupidity 2023-08-15 19:22:10 +02:00
Tomasz Kapuściński 4d11040dba Split string encoding functionality to Windows and generic implementations 2023-08-15 18:57:34 +02:00
Tomasz Kapuściński 97ea5cc895 Added missing include 2023-08-15 14:34:51 +02:00
Tomasz Kapuściński fe36b0fe29 Build CBot as static library instead 2023-08-15 14:11:05 +02:00
Tomasz Kapuściński 8fab817118 Ensure position-independent code generation 2023-08-15 13:48:02 +02:00
Tomasz Kapuściński 8601066761 Fix for compilation error 2023-08-15 13:41:39 +02:00
Tomasz Kapuściński 9586474fa8 Removed remaining dependency on boost 2023-08-15 12:47:27 +02:00
Tomasz Kapuściński 5b79a4eb38 Extracted StrUtils to a separate target and replaced remaining boost code 2023-08-15 12:25:14 +02:00
Tomasz Kapuściński 1034c2e45c Rewritten config to use JSON instead of INI 2023-08-15 12:02:51 +02:00
Tomasz Kapuściński fde2b901bd Rewritten loading of font config file 2023-08-15 11:16:51 +02:00
Tomasz Kapuściński 3e06584956 Removed unused boost includes 2023-08-15 02:55:33 +02:00
Tomasz Kapuściński 0ab9ae4b6e Replaced boost::adaptor::reverse with reverse iterators
Changes based on f0f6f61cab
2023-08-15 02:51:28 +02:00
Tomasz Kapuściński b296ee4d47 Added StrUtils::Split() and replaced boost::split() 2023-08-15 02:41:40 +02:00
Tomasz Kapuściński dccacd6352 Rewritten UnicodeStringToUtf8() and increased buffer size 2023-08-14 22:26:00 +02:00
Tomasz Kapuściński b3c6e667f5 Rewritten UTF-8 implementation using standard library 2023-08-14 21:46:05 +02:00
Tomasz Kapuściński a48f13fb35 Fix for missing setlocale() 2023-08-14 00:11:15 +02:00
Tomasz Kapuściński 7db69f5d53 Changed include 2023-08-13 23:46:00 +02:00
Tomasz Kapuściński ae5e5b3874 Added missing includes 2023-08-13 23:31:12 +02:00
Tomasz Kapuściński b5b3f81840 Added ToLower() and ToUpper() 2023-08-13 23:22:22 +02:00
Tomasz Kapuściński fd81641cf7 Updated CI pipeline build for MacOS 2023-08-13 22:36:13 +02:00
Tomasz Kapuściński 840ded7e61 Renamed colobot to colobot-app 2023-08-13 21:20:37 +02:00
Tomasz Kapuściński 4c7e7280dd Added missing build preset 2023-08-13 20:44:51 +02:00
Tomasz Kapuściński af1abfe41e Updated CI pipeline build for Linux 2023-08-13 20:22:52 +02:00
Tomasz Kapuściński 8e950e5145 Updated CI pipeline build for Windows 2023-08-13 19:51:57 +02:00
Tomasz Kapuściński e807e7c984 Added missing include 2023-08-13 18:48:30 +02:00
Tomasz Kapuściński d9d401e636 Removed extra semicolon 2023-08-13 17:56:16 +02:00
Tomasz Kapuściński 9a14d0c837 Added missing include 2023-08-13 17:40:40 +02:00
Tomasz Kapuściński ee9f9d875d Replaced remaining MakeUnique 2023-08-13 17:39:12 +02:00
Tomasz Kapuściński b12e5ad7cd Replaced boost::replace_all with StrUtils::Replace
Also fixed a bug in it and added tests for it.
Changes based on f0f6f61cab
2023-08-09 21:43:15 +02:00
Tomasz Kapuściński ecb789d059 Replaced boost::trim functions with new Trim functions
Changes based on f0f6f61cab
2023-08-09 20:11:08 +02:00
Tomasz Kapuściński 32fb105bca Replaced boost::algorithm::join with standard algorithms
Changes based on f0f6f61cab
2023-08-09 19:52:44 +02:00
Tomasz Kapuściński 7d3e3c91e8 Replaced boost::tokenizer with std::istringstream
Changes based on f0f6f61cab
2023-08-09 19:40:54 +02:00
Tomasz Kapuściński 1b69589302 Replaced boost::lexical_cast with other implementations
Changes based on f0f6f61cab
2023-08-09 19:32:59 +02:00
Tomasz Kapuściński f7a33bbeb0 Replaced boost::optional and boost::regex with STL implementations
Changes based on f0f6f61cab
2023-08-09 17:58:48 +02:00
Tomasz Kapuściński 0ef77132a0 Replaced boost::filesystem with std::filesystem
Changes based on f0f6f61cab
2023-08-09 17:04:09 +02:00
Tomasz Kapuściński 550193e570 Added Version::DEVELOPMENT_BUILD to check for development build 2023-08-09 16:40:18 +02:00
Tomasz Kapuściński beb29333d5 Replaced boost::bimap with std::map
Code extracted from f0f6f61cab
2023-08-09 16:25:18 +02:00
Tomasz Kapuściński f9714c35f7 Replaced version macrodefinitions with constexpr variables 2023-08-09 15:59:12 +02:00
Tomasz Kapuściński 26598c4247 Rewritten project version specification 2023-08-09 15:27:23 +02:00
Tomasz Kapuściński 1ee0790785 Extracted Colobot executable target to a separate directory 2023-08-09 14:42:24 +02:00
Tomasz Kapuściński 6f05280ccb Extracted CBot library to a separate directory 2023-08-09 13:47:55 +02:00
Tomasz Kapuściński 63b6bcf38d Improved shadow quality
* Default shadow texture is 2048
* Worse shadows use single region
* Always use object shadowing
2023-08-09 12:41:01 +02:00
Tomasz Kapuściński 83b9ded0dc Merge branch 'dev' into dev-graphics-overhaul 2023-08-08 01:01:57 +02:00
Tomasz Kapuściński 84ac0d3ba8 Post-release 0.2.1-alpha 2023-08-08 00:43:51 +02:00
Tomasz Kapuściński acc3c5ae5e Release 0.2.1-alpha: Bump version 2023-08-07 22:47:21 +02:00
tomangelo ec0e735a3f
Merge pull request #1600 from colobot/dev-update-license-headers
Updated license headers
2023-08-06 23:51:44 +02:00
Tomasz Kapuściński a16771425a Updated license headers 2023-08-06 23:15:48 +02:00
Tomasz Kapuściński 4fcd989e72
Merge pull request #1599 from colobot/dev-fix-appimage
Fix AppImage generation
2023-07-22 22:20:15 +02:00
tomangelo2 882672c0b5 Another fix for Appimage generator 2023-07-22 21:31:49 +02:00
tomangelo2 b152bd5dea Fix Appimage generation script 2023-07-22 21:23:13 +02:00
Emxx52 59600ae5c7
Merge pull request #1598 from colobot/dev-readme
Update README files
2023-07-22 11:03:48 +02:00
Fiftytwo 11f5073a3f Replace outdated links in README-dev.md 2023-07-21 23:14:09 +02:00
Fiftytwo cfa9a00024 Replace outdated links in CONTRIBUTING.md 2023-07-21 22:47:40 +02:00
Fiftytwo 9e1248e459 Rewrite README.md 2023-07-21 22:09:33 +02:00
Marcin Puc 9ccc514a67
Add reference to the Void Linux package (#1539) 2023-07-21 22:01:26 +02:00
Tomasz Kapuściński 63ad09b615 Post-merge fixes 2023-07-04 20:35:52 +02:00
Your Name 1376d8b16d Fix planets getting distorted when changing window aspect ratio. 2023-07-04 20:35:52 +02:00
Tomasz Kapuściński a04dcd8014 Fix windows build failure (#1595)
* Added version override for libiconv

* Updated vcpkg baseline, forced PhysFS version 3.0.2

* Updated vcpkg git commit
2023-07-04 20:35:52 +02:00
tomangelo2 9c8a8f4cf4 Better fix for #1587 2023-07-04 20:35:52 +02:00
tomangelo2 dfac4209ef Add slot for Wasps (fix for #1587) 2023-07-04 20:35:52 +02:00
Emxx52 793ef3d0a4 Update Russian translation (#1557)
* Update Russian translation (#1470)

* Update Russian translation

Co-authored-by: X64E <X64E@users.noreply.github.com>
Co-authored-by: Anton-V-K <Anton-V-K@users.noreply.github.com>

* Update data submodule

---------

Co-authored-by: zvladru <30793959+zvladru@users.noreply.github.com>
Co-authored-by: X64E <X64E@users.noreply.github.com>
Co-authored-by: Anton-V-K <Anton-V-K@users.noreply.github.com>
2023-07-04 20:35:52 +02:00
lolbot-iichan 0d57ac43bb UI: Fix scribbler's green button color 2023-07-04 20:35:52 +02:00
Tomasz Kapuściński 3baf2bbb10 Fixed wasp not having a valid cargo slot 2023-07-04 20:35:52 +02:00
Fiftytwo 7c95855d4f Update data submodule 2023-07-04 20:35:52 +02:00
Fiftytwo dd2fbd2675 Add unlocking Phazer research in plus and free 2023-07-04 20:35:52 +02:00
Fiftytwo 8eaebb8c84 Fix missing done research icons on level load 2023-07-04 20:35:52 +02:00
Tomasz Kapuściński 172e1fbff0
Merge pull request #1593 from immibis/fix-squashed-planets
Fix squashed planets when window isn't 4:3
2023-07-03 20:45:13 +02:00
Tomasz Kapuściński 461f1e2240
Fix windows build failure (#1595)
* Added version override for libiconv

* Updated vcpkg baseline, forced PhysFS version 3.0.2

* Updated vcpkg git commit
2023-06-28 23:52:01 +02:00
Emxx52 7c40c10b7a
Merge pull request #1590 from colobot/dev-fix-1587
Change the slot for AlienWasp
2023-06-28 23:50:25 +02:00
Your Name 017a1571f7 Fix planets getting distorted when changing window aspect ratio. 2023-06-28 19:15:51 +02:00
tomangelo2 f672e89201 Better fix for #1587 2023-06-22 23:32:02 +02:00
tomangelo2 9417b916da Add slot for Wasps (fix for #1587) 2023-06-19 00:31:15 +02:00
Emxx52 4f0854068c
Update Russian translation (#1557)
* Update Russian translation (#1470)

* Update Russian translation

Co-authored-by: X64E <X64E@users.noreply.github.com>
Co-authored-by: Anton-V-K <Anton-V-K@users.noreply.github.com>

* Update data submodule

---------

Co-authored-by: zvladru <30793959+zvladru@users.noreply.github.com>
Co-authored-by: X64E <X64E@users.noreply.github.com>
Co-authored-by: Anton-V-K <Anton-V-K@users.noreply.github.com>
2023-05-27 00:47:45 +02:00
Emxx52 3171dc4a89
Merge pull request #1582 from lolbot-iichan/dev-scribbler-ui-fix
UI: Fix scribbler's green button color
2023-05-26 21:35:26 +02:00
Emxx52 10b89e36f9
Merge pull request #1581 from colobot/1580-wasp-grabbing-behavior-broken
Fixed wasp not having a valid cargo slot
2023-05-26 21:12:56 +02:00
Tomasz Kapuściński 080c46daa1 Fixed inverted coordinates 2023-05-15 23:00:50 +02:00
lolbot-iichan b3d19a9e8d
UI: Fix scribbler's green button color 2023-05-15 19:20:56 +03:00
Tomasz Kapuściński 1bb918ce23 Rewritten vertex attribute processing 2023-05-09 02:23:56 +02:00
Tomasz Kapuściński 160a4a4f75 Fixed wasp not having a valid cargo slot 2023-05-07 20:43:43 +02:00
Emxx52 71e3e78644
Merge pull request #1579 from colobot/dev-plus-research
Add unlocking Phazer research after completing missions chapter 9 and fix missing research icons
2023-05-07 16:56:18 +02:00
Fiftytwo 6e7dee74cf Update data submodule 2023-05-07 16:00:02 +02:00
Fiftytwo 8f11fc0126 Add unlocking Phazer research in plus and free 2023-05-07 15:33:17 +02:00
Fiftytwo 5f9b14f43d Fix missing done research icons on level load 2023-05-07 08:42:21 +02:00
Tomasz Kapuściński b66ea8bcee Fixed a couple of warnings 2023-04-15 02:45:33 +02:00
Tomasz Kapuściński 37b403c46d Replaced sprintf() with snprintf() 2023-04-15 02:05:12 +02:00
Tomasz Kapuściński 2e7bf2a7a6 Fixed invalid parameter 2023-04-15 01:06:58 +02:00
Tomasz Kapuściński 4b1b20ec5f Checkout json submodule in Mac build 2023-04-15 00:29:07 +02:00
Tomasz Kapuściński d24a6b37a4 Added glm to installed dependencies 2023-04-15 00:16:56 +02:00
Tomasz Kapuściński 4531dc432e Merge branch 'dev' into dev-graphics-overhaul 2023-04-14 23:41:28 +02:00
Tomasz Kapuściński 06bf44da38
Merge pull request #1575 from colobot/1571-optimize-windows-builds-with-vcpkg
Optimize Windows builds with vcpkg
2023-04-14 18:58:20 +02:00
Tomasz Kapuściński 9dd0159585 Added useless comment for testing 2023-04-10 23:22:23 +02:00
Tomasz Kapuściński 158901ff02 Fixed cached path 2023-04-10 22:36:52 +02:00
Tomasz Kapuściński 9a01408eda Added CMakeUserPresets.json to .gitignore 2023-04-10 21:37:55 +02:00
Tomasz Kapuściński 7c0dbd914f Cache vcpkg dependencies 2023-04-10 20:55:39 +02:00
Tomasz Kapuściński b990ee81ff
Merge pull request #1570 from colobot/1569-remove-ubuntu-1804-actions
Removed Ubuntu 18.04 actions
2023-04-08 21:29:41 +02:00
Tomasz Kapuściński bfd9dae533 Removed Ubuntu 18.04 actions 2023-04-08 20:43:26 +02:00
Tomasz Kapuściński cbfcbae7ab
Merge pull request #1560 from lolbot-iichan/dev-fix-multi-team-ant-legs
ENGINE: Fix operator < for COldModelManager::FileInfo
2023-04-08 19:46:20 +02:00
Tomasz Kapuściński 2e95aeac9b
Merge pull request #1501 from colobot/dev-fix-macos-compilation
Fix compilation under MacOS
2023-04-08 19:11:43 +02:00
Tomasz Kapuściński efbd296fc3 Merge branch 'dev' into dev-fix-macos-compilation 2023-04-08 17:55:03 +02:00
Tomasz Kapuściński 9c5d9d8f17
Merge pull request #1568 from colobot/dev-vcpkg-fixes
vcpkg fixes
2023-04-08 17:49:04 +02:00
Tomasz Kapuściński 0b978f7dbc Use newer version of vcpkg to fix broken link 2023-04-03 00:51:27 +02:00
Tomasz Kapuściński 4634461c1d Added vcpkg manifest file 2023-04-03 00:01:30 +02:00
Tomasz Kapuściński 1c9c0929da
Merge pull request #1559 from suve/add-missing-cstdint-includes
Add missing <cstdint> includes
2023-03-11 11:53:05 +01:00
Tomasz Kapuściński 24622e6a75
Merge pull request #1562 from olokos/dev
Fix For MSVC2022 and Background Pause blur
2023-03-11 11:39:59 +01:00
olokos f60c62f05d Graphics - Engine - Fix pause blur for new SDL 2023-02-06 17:53:56 +01:00
olokos ec9607784c Remove redundant " from CMakeLists.txt 2023-02-06 17:22:05 +01:00
Tomasz Kapuściński 5efd8342ec Updated SDL2 and SDL2_image library names 2023-02-06 17:07:02 +01:00
lolbot-iichan 0618174b2b
ENGINE: Fix operator < for COldModelManager::FileInfo
There was a rare case when Old Model Manager's model base object list was not working correctly.

Testcase:
CreateObject pos=10;0 dir=1.5 type=LeggedTrainer selectable=1 team=1
CreateObject pos=-10;0 dir=0.25 type=LeggedTrainer selectable=1 team=2

Expected result (after fix): models are displayed correctly
Actual result (before fix): some legs are missing, instead of them giant surfaces are floating high above the model

The reason was is failing to find the element that was just created and added with `m_models.find(FileInfo(fileName, mirrored, team))`
This happened for objects that had mirrored body parts (at least Ants, Wasps and all Legged units were affected) in case they were assigned to several teams.
Everyone were missing some legs since the `modelManager->AddModelReference("ant6.mod", true, rank, m_object->GetTeam())`
Wasps were also usually missing some wings.
2023-02-05 16:34:55 +03:00
suve d47e265863 Add missing <cstdint> includes
Some parts of the code used the fixed-size type uint32_t,
which is defined in stdint.h / cstdint - without including said
header file. With GCC13, the inter-header dependencies seem
to have changed and the file is no longer included transitively,
requiring an explicit include.
2023-01-19 10:34:55 +01:00
Tomasz Kapuściński 436c316a4a Updated SDL2 and SDL2_image library names 2022-11-26 20:04:44 +01:00
Tomasz Kapuściński 1d8e06c7ba Revert "Fix for SDL on Windows"
This reverts commit 21b6572b5b.
2022-11-26 20:00:44 +01:00
Tomasz Kapuściński 21b6572b5b Fix for SDL on Windows 2022-11-26 17:42:34 +01:00
Tomasz Kapuściński 3b3cdb9961 Fix for config.h? 2022-11-26 16:15:53 +01:00
Tomasz Kapuściński bedd24801c Better fix? 2022-11-26 15:49:39 +01:00
Tomasz Kapuściński 983a9a6e03 Another fix for SDL 2022-11-26 15:32:56 +01:00
Tomasz Kapuściński 2f50470591 Fix for linking to SDL 2022-11-26 14:52:39 +01:00
Tomasz Kapuściński 5feffc70df Updated vcpkg version 2022-11-26 12:31:54 +01:00
Tomasz Kapuściński e3ba33a508 Rewritten CModelMesh to use separate vertex attributes 2022-11-12 18:52:21 +01:00
Emxx52 b7cb26822b
Update build.yml 2022-11-06 04:12:02 +01:00
tomangelo2 0e53336d61 Merge branch 'dev' into dev-fix-macos-compilation 2022-11-05 19:27:52 +01:00
tomangelo 0df78e7fa6
Merge pull request #1529 from colobot/dev-fix-space
undefined
2022-09-15 02:13:19 +02:00
tomangelo2 789c8b2292 Fix compilation with gcc 2022-09-15 01:14:29 +02:00
tomangelo c0669a591b
Update INSTALL-MacOSX.md 2022-09-15 00:12:54 +02:00
tomangelo 708d3cfd46
Enable building tests
Making .dmg package needs `data` directory, while `make install` does weird stuff with path, for now I'll skip that.
2022-09-14 23:58:42 +02:00
tomangelo 6cc58b872f
Let's try to get tests instead
Making .dmg package needs `data` directory, while `make install` does weird stuff with path, for now I'll skip that.
2022-09-14 23:25:16 +02:00
tomangelo 4c767953ea
Fix path 2022-09-13 21:58:35 +02:00
tomangelo 4ec0083cd8
Try to move binary to separate directory 2022-09-13 21:48:43 +02:00
tomangelo 87ad81f891
Don't try to make package for now 2022-09-13 21:21:49 +02:00
tomangelo afbf687255
Try to fix packaging 2022-09-13 21:03:14 +02:00
tomangelo2 0693aa5e1e Fix OpenAL library path 2022-09-13 20:45:07 +02:00
tomangelo2 2a91d6bf35 Temporarily remove tests 2022-09-13 20:14:47 +02:00
tomangelo2 b09977a503 Merge branch 'dev-fix-macos-compilation' of https://github.com/colobot/colobot into dev-fix-macos-compilation 2022-09-13 20:01:50 +02:00
tomangelo2 438e4bba62 First attempt to run MacOS build on Github Actions 2022-09-13 19:58:11 +02:00
Krzysztof Rewak a74adb5f59
Missing PL translation (#1512)
* missing PL translation

* update po.pl
2022-08-24 20:25:25 +02:00
Tomasz Kapuściński 8632c7404d Refactored NaN implementation
strfind() now returns -1 instead of NaN when substring can't be found
added isnan() as an alternative way of checking if a value is NaN
2022-08-15 00:09:24 +02:00
Tomasz Kapuściński 2ea94244e9 Fixed const-correctness of getters 2022-08-14 23:47:47 +02:00
Tomasz Kapuściński 3c98af04b5 Fixed passing bool to message() 2022-08-13 17:18:14 +02:00
Tomasz Kapuściński b5e27c9f19 space() now returns a point with NaNs instead of the original position when it can't find free space 2022-07-09 16:48:59 +02:00
Tomasz Kapuściński ec425c768b Use the Y floor coordinate from topo() so it doesn't ignore spaceship's modified floor height 2022-07-09 16:47:59 +02:00
Tomasz Kapuściński 3fd9815138
Merge pull request #1507 from rasmusgo/find-space-on-spaceship
Find space on spaceship
2022-07-09 16:38:58 +02:00
Tomasz Kapuściński 3805851255 Made recolor a separate material attribute and added more color types 2022-07-09 12:23:50 +02:00
Tomasz Kapuściński a88d9cdd39 Implemented shader-side recoloring in HSV and added more material tags 2022-06-18 22:18:25 +02:00
Tomasz Kapuściński 7d31b1e55d Added missing include 2022-05-08 18:31:48 +02:00
Tomasz Kapuściński 56e0c915b5 Cleanup in texture structures and enums, added wrap mode to TextureCreateParams and fixed wrap mode in foreground texture (lens flare effect) 2022-05-08 18:23:37 +02:00
Tomasz Kapuściński a25ce2d5df Rewritten particle rendering, now uses its own vertex type for optimization 2022-05-08 16:22:20 +02:00
Tomasz Kapuściński cac34e259b Cleanup to reduce includes of device.h header file 2022-05-02 20:59:44 +02:00
Tomasz Kapuściński 2a529ae07f More cleanup 2022-05-02 19:22:50 +02:00
Tomasz Kapuściński a1e4e4b97c Minor cleanup 2022-05-02 19:10:26 +02:00
Tomasz Kapuściński 3b4c2f3049 Cleanup in OpenGL implementation
* Changed main directory to opengl33
* Put all remaining renderer classes into separate files
* Added missing license headers
2022-05-02 11:08:33 +02:00
Tomasz Kapuściński f2cc131ff7 Merge branch 'dev' into dev-graphics-overhaul
# Conflicts:
#	.github/workflows/build.yml
2022-05-02 09:24:05 +02:00
Tomasz Kapuściński b6f2a9e544
Fix for invisible batteries (code by melex750) (#1520)
* Fix for invisible batteries (code by melex750)

* Updated vcpkg

* A workaround for sprintf define

* Added mpg123 to dependencies due to newer version of SndFile

* Removed CONFIG

* Another fix for dependencies

* Made additional dependencies optional
2022-04-29 00:02:04 +02:00
Tomasz Kapuściński daa9419557 Merge branch 'dev' into dev-graphics-overhaul
# Conflicts:
#	src/level/player_profile.cpp
#	src/object/task/taskgoto.cpp
#	src/object/task/taskgoto.h
#	src/ui/mainui.cpp
2022-04-23 11:48:09 +02:00
Tomasz Kapuściński 0882b69ec8 Switch to gcc-9 for Ubuntu 18.04 builds for proper support of C++17 with filesystem 2022-04-23 11:34:15 +02:00
Tomasz Kapuściński 013d3cccf4 Changed team recolor to replace material albedo color instead of multiply by it for design convenience 2022-04-23 10:53:25 +02:00
Tomasz Kapuściński 8f710a24c8 Added proper conversion from sRGB to linear space and added a temporary fix for Blender bug with vertex colors in sRGB 2022-04-23 10:50:53 +02:00
Tomasz Kapuściński 7135a6660b Replaced error messages with Logger 2022-04-23 10:48:35 +02:00
Tomasz Kapuściński 7664594b8e Added constructor and conversion between linear space and sRGB 2022-04-23 10:46:38 +02:00
Tomasz Kapuściński 07541d0bbb
Merge pull request #1517 from SpaceManiac/patch/gitmodules-https
Use https URLs for git submodules
2022-04-23 10:35:04 +02:00
Tad Hardesty 8fb0f76f6f Use https URLs for git submodules 2022-04-08 19:22:39 -07:00
Tomasz Kapuściński 640cde1653 Various improvements and fixes
* Added strength parameter for ambient occlusion
* Added proper support for material and emissive textures
* Added team-based recoloring, uses "team" tag
* Changed shadow ranges to make close-up shadows much better
* Fixed background coloring
* Added proper defaulting for glTF values
* Fixed parsing of emissive values
* Added normalization of normals in vertex shaders of object and terrain renderers
2022-04-07 01:11:23 +02:00
Tomasz Kapuściński 4b1b1763df Removed extensions from model filenames to let the game load alternatives when available 2022-03-12 23:34:46 +01:00
Tomasz Kapuściński 829c5fb42f Added support for glTF 2.0 model format 2022-03-12 23:31:32 +01:00
Tomasz Kapuściński fd3c2af358 A proper fix? 2022-03-11 23:33:21 +01:00
Tomasz Kapuściński 5c2c52ad31 Fix for missing <filesystem>? 2022-03-11 23:16:50 +01:00
Tomasz Kapuściński aa3efd5841 Simplified model I/O, uses filename extensions to figure out format 2022-03-11 22:40:50 +01:00
Tomasz Kapuściński 920a4c3fc8 Split model I/O to separate files based on model format and removed new binary format 2022-03-11 21:06:40 +01:00
Tomasz Kapuściński d57370578f Disabled convert_model tool 2022-03-11 20:48:55 +01:00
Tomasz Kapuściński 4a16ee76a1 Partially refactored model and mesh structures 2022-03-11 19:49:03 +01:00
Tomasz Kapuściński 7af32caec2 Changed path type from std::string to std::filesystem::path in CInputStream, CInputStreamBuffer, COutputStream and COutputStreamBuffer 2022-03-11 17:46:24 +01:00
Tomasz Kapuściński 2d9db9c90a Refactored lighting in terrain renderer and rewritten drawing terrain to include all PBR properties 2022-03-09 20:47:44 +01:00
Tomasz Kapuściński d7a22bf74c Removed explicit from Color constructor 2022-03-09 17:08:51 +01:00
Tomasz Kapuściński 1a7346b845 A couple of fixes for rendering states 2022-03-09 16:59:23 +01:00
Tomasz Kapuściński 8c40b7c753 Force buffer orphaning to fix initial buffer binding 2022-03-09 16:56:03 +01:00
Rasmus Brönnegård fdc1792932 Let space() find points on the spaceship 2022-03-07 00:02:08 +01:00
Rasmus Brönnegård 483a855848 Add DistanceSquared to vector.h 2022-03-07 00:00:19 +01:00
tomangelo 4541db7f21
Merge pull request #1498 from rasmusgo/dev-loadgame-arg
Load game from command line
2022-03-06 23:05:04 +01:00
tomangelo 86d8ee4c38
Merge pull request #1496 from rasmusgo/fix-spelling
Fix spelling
2022-03-04 16:28:32 +01:00
MrSimbax 73db861cc6 Update data submodule 2022-03-01 17:35:57 +01:00
tomangelo 061ef44def
Merge pull request #1499 from rasmusgo/dev-better-goto
Better goto
2022-02-28 22:16:37 +01:00
Tomasz Kapuściński dffb988798 Added checkout submodule for docs 2022-02-26 22:32:00 +01:00
Tomasz Kapuściński d09c5da493 Checkout json submodule 2022-02-26 21:47:22 +01:00
Tomasz Kapuściński c011e49112 Another fix 2022-02-26 21:42:09 +01:00
Tomasz Kapuściński 628567701a Added nlohmann json as submodule 2022-02-26 21:12:40 +01:00
Tomasz Kapuściński 38990e283b Another fix 2022-02-26 20:04:13 +01:00
Tomasz Kapuściński fa5e229015 Fixed forward declaration of enums 2022-02-26 19:44:49 +01:00
Tomasz Kapuściński 05163c09a1 Fix for dependencies 2022-02-26 19:04:04 +01:00
Tomasz Kapuściński 8533be8d5c Replaced MakeUnique and MakeUniqueArray with std::make_unique 2022-02-26 18:48:51 +01:00
Tomasz Kapuściński 89551c83cf Merge branch 'dev' into dev-graphics-overhaul
# Conflicts:
#	src/graphics/engine/text.cpp
#	src/graphics/engine/text.h
#	src/script/scriptfunc.cpp
2022-02-26 04:43:56 +01:00
Tomasz Kapuściński 3001927576 Removed engine.h from includes in header files, replaced by forward declarations and includes in source files 2022-02-26 03:53:39 +01:00
Tomasz Kapuściński baa616050a Some refactors to reduce extensive recompilation cascades
Renamed AlphaMode::OPAQUE to AlphaMode::NONE due to clash with preprocessor define
Moved Gfx::EngineTriangle to a separate file
2022-02-26 02:39:13 +01:00
Tomasz Kapuściński e839f0dec7 Extended Material structure with PBR material attributes and added some of them to object renderer
Moved PBR lighting calculations to a separate shader source file
Removed some unused stuff
2022-02-26 01:16:36 +01:00
Tomasz Kapuściński 3168bf4350 Small cleanup 2022-02-25 21:07:01 +01:00
Tomasz Kapuściński 6447304531 Added nlohmann-json library to dependencies 2022-02-25 20:41:45 +01:00
Mateusz Przybył 6aebf60300
Merge pull request #1487 from pestoffne/fix/editor-input-utf8
Fixed input of long UTF-8 symbols in editor (#1423)
2022-02-25 17:09:27 +01:00
Rasmus Brönnegård 0829cd84fe goto: Remove unused BEAM_ACCURACY 2022-02-17 23:58:32 +01:00
Rasmus Brönnegård 8af600692e goto: Reduce NB_ITER back to 200 2022-02-17 23:40:07 +01:00
Rasmus Brönnegård 3478ee322b goto: Find a more exact end of path wrt goalRadius
The last segment of the path is shortened to avoid going too close
and risk bumping into the object that it was meant to approach.

The same position could also be found by finding the roots of a second
order polynomial analytically but this solution is simple and sufficient.
2022-02-15 22:46:30 +01:00
Evgeny Pestov 550d0f915b Use std::out_of_range in Utf8CharSizeAt 2022-02-14 18:33:41 +07:00
Evgeny Pestov d9e26c2516 Use std::invalid_argument in Utf8CharSizeAt 2022-02-14 18:23:44 +07:00
Evgeny Pestov 4bce63e38d Use 0b instead of 0x and check 1-byte prefix first in Utf8CharSizeAt
1-byte symbols is more common then 4-bytes symbols.
So checking 1-byte prefix first is more efficient.
2022-02-14 18:09:08 +07:00
Evgeny Pestov ec8a09e4a9 Merge commit '3405c03' into fix/editor-input-utf8 2022-02-14 17:57:30 +07:00
Evgeny Pestov 05b68a4b80 Refactor: Create function isUtf8ContinuationByte 2022-02-14 17:56:34 +07:00
Tomasz Kapuściński c378009128 Feature-breaking refactors
* Partially filled Material structure, currently only base attributes
* Removed recoloring of textures and team variants
* Removed one base object tier in engine structures
* Removed EngineRenderState
* Rewritten some code to better coding style
2022-02-13 00:03:46 +01:00
Rasmus Brönnegård 2d794d1a32 goto: Handle oversized costs with a special bucket
This is a bit redundant because the current usage of goto
does not trigger it. It can be triggered by:
* increasing goalRadius
* decreasing NUMQUEUEBUCKETS
* decreasing BM_DIM_STEP
* increasing edge costs
2022-02-12 23:35:58 +01:00
Rasmus Brönnegård e38835cfd4 goto with A-star (with bucket queue) 2022-02-12 23:35:58 +01:00
tomangelo2 e3ba1a1840 Fix compilation errors on MacOS 2022-02-10 19:46:50 +01:00
tomangelo2 08f6c32551 Update Homebrew installation command 2022-02-09 20:43:35 +01:00
Rasmus Brönnegård 2b8d580355 goto with Dial's algo (Dijkstra's + bucket sort) 2022-02-08 21:14:17 +01:00
Rasmus Brönnegård ee390bc270 LoadFinishedLevels if needed in LoadScene 2022-02-08 20:02:56 +01:00
Rasmus Brönnegård 14e7cd0e52 Rename loadgame to loadsave 2022-02-08 14:17:11 +01:00
tomangelo 6d8a52eb15
Merge pull request #1458 from lolbot-iichan/produce_teams
Add optional team parameter to produce() function
2022-02-07 16:34:19 +01:00
tomangelo 951db17d53
Merge pull request #1488 from colobot/dev-refactor-fonts-cache
Refactor fonts reloading
2022-02-07 15:24:10 +01:00
Tomasz Kapuściński 0d612b9928 Optimized text rendering 2022-02-05 21:07:25 +01:00
Tomasz Kapuściński aacc2d0596 Moved non-CRenderer-specific functionality back to CDevice and refactored some of the state change methods
Rewritten control rendering code to use improved way of sending geometry to GPU memory
2022-02-05 19:07:46 +01:00
Tomasz Kapuściński 074706e7ec Removed Vertex and VertexCol structures 2022-02-04 01:22:27 +01:00
Tomasz Kapuściński 1631b9587f Removed all DrawPrimitive*() methods from CDevice 2022-02-04 01:06:37 +01:00
Tomasz Kapuściński 750a470b9a Minor color refactors, added DrawPrimitives, rewritten remaining effect rendering 2022-02-04 01:00:18 +01:00
Tomasz Kapuściński 37bdc8665f Removed remaining rendering code from CGL33Device and fixed some issues 2022-02-03 20:53:53 +01:00
Tomasz Kapuściński cbf661f69f Disabled tests for light manager as it needs future refactoring 2022-02-03 19:35:30 +01:00
Tomasz Kapuściński d16144eee4 Added missing include and removed debugging calls 2022-02-03 18:55:46 +01:00
Tomasz Kapuściński 1a190b7f6f Partial refactor of UI rendering to improve performance and fix transparency issues
Disabled rendering via CDevice
2022-02-03 18:40:58 +01:00
Rasmus Brönnegård a7b294025e Rename BeamSearch to PathFindingSearch etc 2022-02-02 20:26:05 +01:00
Rasmus Brönnegård e2d4dd6995 Use ray tracing algorithm in BitmapTestLine 2022-02-02 20:26:05 +01:00
Rasmus Brönnegård d9f3078396 Replace beam search with breadth-first search 2022-02-02 20:26:05 +01:00
Tomasz Kapuściński 0908e10ff6 Removed material, lighting, fog and shadowing code from CDevice 2022-02-02 19:09:38 +01:00
Tomasz Kapuściński 7d9badb542 Added UV transform and rewritten animated texture mapping code to use it 2022-02-02 18:13:21 +01:00
Tomasz Kapuściński 3bd4fee844 Merge branch 'dev' into dev-graphics-overhaul
# Conflicts:
#	src/graphics/engine/camera.cpp
#	src/object/auto/autonuclearplant.cpp
#	src/object/auto/autopowerplant.cpp
#	src/object/interface/powered_object.h
#	src/object/motion/motionvehicle.cpp
#	src/object/old_object.cpp
#	src/object/old_object.h
#	src/object/task/taskmanip.cpp
#	src/object/task/taskmanip.h
#	src/object/task/tasktake.cpp
2022-02-02 18:11:06 +01:00
tomangelo 3405c038c9
Merge pull request #1495 from rasmusgo/numpad
Add workaround for numpad home/end keys etc
2022-02-02 16:45:14 +01:00
Rasmus Brönnegård 3400a0fab0 Add -loadgame argument to load game on start 2022-02-02 11:01:57 +01:00
Emxx52 85dc3f68e7
Merge pull request #1497 from colobot/dev-fix-recharging
Fix assert fail after PR#1444
2022-01-30 21:21:16 +01:00
tomangelo2 eff8e885d5 Fix assert fail after PR#1444 2022-01-30 20:40:04 +01:00
tomangelo cbc07c04a5
Merge pull request #1444 from immibis/slotted-object
Slotted object interface
2022-01-29 17:20:36 +01:00
tomangelo2 0003494c9e Merge PR #1444 2022-01-29 17:16:57 +01:00
Tomasz Kapuściński 741d5c75ba Refactored shadow framebuffer creation and binding 2022-01-24 23:16:22 +01:00
Tomasz Kapuściński 2ff722eee6 Refactored or removed some of the unused CDevice features 2022-01-24 22:29:39 +01:00
Tomasz Kapuściński 39b6621463 Renamed transparency to ghost mode 2022-01-24 21:57:56 +01:00
Tomasz Kapuściński 9a07c1d858 Refactored background, cloud and planet rendering, fixed shadow settings 2022-01-24 21:50:45 +01:00
Rasmus Brönnegård 19ae57c9ad Fix spelling of appearance 2022-01-24 19:56:47 +01:00
Rasmus Brönnegård 6e0207ca5e Fix spelling in app and main 2022-01-24 19:47:07 +01:00
Rasmus Brönnegård be8d37241a Add workaround for numpad home/end keys etc 2022-01-23 13:16:13 +01:00
Tomasz Kapuściński e76c00c7f4 Fixed the Z coordinate not working in particle renderer 2022-01-22 01:50:10 +01:00
Tomasz Kapuściński cba70fc912 Added DrawPrimitive() to CObjectRenderer and used it for rendering water 2022-01-22 00:57:00 +01:00
Tomasz Kapuściński 048393f448 Added CParticleRenderer and reimplemented particle rendering code to use it 2022-01-20 21:38:58 +01:00
Tomasz Kapuściński 710f448477 Partially fixed rendering of models in front of the interface (e.g. profile screen) 2022-01-19 23:14:03 +01:00
Tomasz Kapuściński 367dab9c5a Cleanup in vertex structures 2022-01-19 22:22:59 +01:00
Tomasz Kapuściński c280924c0e Removed Gfx::VertexTex2 2022-01-19 21:33:53 +01:00
Tomasz Kapuściński 5dacb82b22 Partial refactor of model I/O
* Mostly removed legacy Gfx::Material usage
* Bake legacy diffuse color to vertex color
* Removed code that writes to old model formats
2022-01-19 19:46:39 +01:00
Tomasz Kapuściński a54a59146d Corrected transparency mode 2022-01-19 17:14:27 +01:00
Tomasz Kapuściński a1ea633a3e Refactored EngineTextureMapping into enum class 2022-01-18 20:14:07 +01:00
Tomasz Kapuściński 68a222e03a Refactored EngineShadowType to enum class 2022-01-18 19:42:19 +01:00
Tomasz Kapuściński 67bd982969 Refactored EngineTriangleType into enum class 2022-01-18 19:29:36 +01:00
Tomasz Kapuściński d9073de251 Removed unnecessary tests and include 2022-01-05 21:08:28 +01:00
Tomasz Kapuściński 754684bfe9 Refactored MatrixVectorMultiply(), added TransformDivide() for cases where perspective divide is needed 2022-01-05 19:22:57 +01:00
Tomasz Kapuściński 9c37f6cbd5 Fully refactored Math::Matrix, removed matrix.h and moved remaining functions to other files 2022-01-05 19:12:35 +01:00
Tomasz Kapuściński 208f142cd2 Made Math::Matrix an alias to glm::mat4, partial refactors 2022-01-05 00:35:41 +01:00
Tomasz Kapuściński e5d8e2b428 Fixed compilation error 2022-01-04 21:45:10 +01:00
Tomasz Kapuściński 0bba168f94 Removed vector.h, refactored redundant functions and moved remaining ones to func.h 2022-01-04 20:43:36 +01:00
Tomasz Kapuściński db3b1d74d1 Refactored unnecessary Normalize, DotProduct, CrossProduct and Clamp functions 2022-01-04 02:10:36 +01:00
Tomasz Kapuściński 50fe905455 Removed Math::Vector alias and refactored remaining uses of it 2022-01-04 01:39:55 +01:00
Tomasz Kapuściński d5e8cfd4ba Refactored Math::Vector to glm::vec3 in object task classes 2022-01-04 01:18:46 +01:00
Tomasz Kapuściński ffe1815ec9 Refactored Math::Vector to glm::vec3 in object motion classes 2022-01-04 01:05:24 +01:00
Tomasz Kapuściński 2690d04f64 Refactored Math::Vector to glm::vec3 in object interface and object subclass classes 2022-01-04 00:52:07 +01:00
Tomasz Kapuściński 3707daf678 Refactored Math::Vector in object implementations 2022-01-04 00:16:59 +01:00
Tomasz Kapuściński 076dce6981 Refactored Math::Vector in CScriptFunctions 2022-01-04 00:11:20 +01:00
Tomasz Kapuściński d6d74f200b Refactored Math::Vector in convert_model tool 2022-01-04 00:03:57 +01:00
Tomasz Kapuściński 1a7ffa693b Refactored Math::Vector in remaining UI classes 2022-01-04 00:01:54 +01:00
Tomasz Kapuściński dbe127569b Refactored Math::Vector in control classes 2022-01-03 23:55:50 +01:00
Tomasz Kapuściński da2471567d Refactored Math::Vector in sound implementation 2022-01-03 23:53:22 +01:00
Tomasz Kapuściński 55f5d25c95 Refactored Math::Vector to glm::vec3 in remaining auto classes 2022-01-03 23:48:38 +01:00
Tomasz Kapuściński 4634564f17 Refactored Math::Vector to glm::vec3 in various auto classes 2022-01-03 23:32:30 +01:00
Tomasz Kapuściński 300a2d8569 Refactored Math::Vector to glm::vec3 in CrashSphere, CObjectFactory, old_object.h, old_object_interface.h 2022-01-03 22:51:36 +01:00
Tomasz Kapuściński b4bfb8b242 Refactored Math::Vector in CLevelParserParam, CObjectCondition and CScoreboard 2021-12-29 02:19:22 +01:00
Tomasz Kapuściński 6277e10b3f Refactored Math::Vector in CParticle, CPlanet, CPyro, CTerrain, CText, CWater, ModelInput and few structures 2021-12-29 01:55:48 +01:00
Tomasz Kapuściński 47ad390f1d Refactored Math::Vector in CCamera, CLightManager, CLightning, CMainMovie, glutil.h and geometry.h 2021-12-29 00:08:02 +01:00
Tomasz Kapuściński d25d6124a9 Changed Math::Vector into alias to glm::vec3 2021-12-28 23:01:30 +01:00
Tomasz Kapuściński 70151279f6 Removed Math::Point and minor refactor 2021-12-24 20:44:54 +01:00
Tomasz Kapuściński 431416d75e Refactored Math::Point in CEngine 2021-12-24 20:25:38 +01:00
Tomasz Kapuściński 77c6f8e54f Refactored Math::Point in CRobotMain, CObjectFactory, CBaseBuilding, CAutoInfo, CScript, CDebugMenu, CDisplayText and CObjectInterface 2021-12-24 20:08:04 +01:00
Tomasz Kapuściński dc99e19ed9 Refactored Math::Point in CPhysics, CDisplayInfo, CFileDialog, CMainDialog, CMainMap, CMainShort and CStudio 2021-12-24 19:02:25 +01:00
Tomasz Kapuściński c659e060c1 Refactored Math::Point in task classes 2021-12-24 18:39:45 +01:00
Tomasz Kapuściński f8f3a64612 Refactored Math::Point in motion classes 2021-12-24 18:32:42 +01:00
Tomasz Kapuściński 7bf37a3999 Refactored Math::Point in screen classes 2021-12-24 03:53:36 +01:00
Tomasz Kapuściński 3fabdad1fe Refactored Math::Point in CSettings, CParticle, CPyro, CInterface, CMainUserInterface and CScreen 2021-12-24 03:45:59 +01:00
Tomasz Kapuściński a806bb2657 Refactored Math::Point in auto classes 2021-12-24 03:26:25 +01:00
Tomasz Kapuściński 91c19bff55 Refactored Math::Point in control classes 2021-12-24 03:18:10 +01:00
Tomasz Kapuściński 9691974b1a Refactored Math::Point in CLighting, CParticle, CParticleGenerator and CText 2021-12-24 02:36:54 +01:00
Tomasz Kapuściński 07d3d79e8d Refactored Math::Point in CPlanet, CTerrain, CWater and CLevelParserParam 2021-12-24 02:04:15 +01:00
Tomasz Kapuściński 498f15cc92 Refactored Math::Point in CApplication, CInput, CCamera, CCloud and Event 2021-12-24 01:38:54 +01:00
Tomasz Kapuściński b36ec266f0 Refactored Math::Point from vertex types 2021-12-24 00:57:04 +01:00
Tomasz Kapuściński c0d067d24b Changed Math::Point into alias to glm::vec2, minor refactors 2021-12-24 00:11:12 +01:00
Tomasz Kapuściński 12c0f41477 Removed unused null renderer files
Null renderer will be rewritten entirely anyway, no need to keep these files in their current form.
2021-12-23 23:40:34 +01:00
Tomasz Kapuściński f7c66741c6 Removed Math::IntPoint 2021-12-23 23:38:26 +01:00
Tomasz Kapuściński 60deb0328a Refactored Math::IntPoint in CInput and CImage 2021-12-23 23:36:30 +01:00
Tomasz Kapuściński 0ef4579da8 Refactored Math::IntPoint in CApplication and various classes 2021-12-23 23:26:08 +01:00
Tomasz Kapuściński 55c692e8bb Refactored Math::IntPoint in CEngine and CParticle 2021-12-23 23:08:56 +01:00
Tomasz Kapuściński 835f84584e Refactored Math::IntPoint in CTerrain 2021-12-23 22:47:44 +01:00
Tomasz Kapuściński bd2ad39f6a Refactored Math::IntPoint in CText 2021-12-23 22:47:15 +01:00
Tomasz Kapuściński 48d2b4a618 Refactored Math::IntPoint in core graphics classes 2021-12-23 22:35:28 +01:00
Tomasz Kapuściński cd6ea1a4c5 Changed Math::IntPoint into alias to glm::ivec2 2021-12-23 22:09:58 +01:00
MrSimbax 4ecfb47f07 Fix MSVC errors 2021-12-21 18:01:42 +01:00
MrSimbax d3dd99c384 Refactor fonts reloading
* Remove hardcoded default font name.
  This means the `fonts/fonts.ini` file is now mandatory
  and must contain definition of all 9 font types.
  Old mods relying on an incomplete `fonts.ini` file might break.
  A separate PR creating the required `fonts/fonts.ini` file
  should be merged before this pull request.
* Simplify `CFontLoader`.
    * Return `std::optional` instead of returning a default.
    * Remove the now unnecessary `std::map`s.
    * Remove the now unnecessary `GetFontType` method.
* Improve Gfx::FontType.
    * Provide `ToString` function for the enum, which is now
      used for logs and by `CFontLoader`.
    * Provide `ToBoldFontType` and `ToItalicFontType` functions.
    * Replace hex literals with binary literals for readability.
* Move font caching related code to a new private class `FontsCache`.
    * Add neccessary changes because of changes made in `CFontLoader`.
    * Add minor code improvements like renames and formatting.
    * Split the code into smaller functions for readability.
    * Simplify the `CText` class.
* Apply the rule of 5 to the `CachedFont` structure.
2021-12-21 00:50:36 +01:00
Evgeny Pestov 69ea470a26 CEdit::MoveChar never moves cursor between bytes of one UTF-8 symbol 2021-12-17 00:54:44 +07:00
Evgeny Pestov 65da4c42c4 CEdit::DeleteOne expands selection to delete integer number of UTF-8 symbols 2021-12-17 00:54:38 +07:00
Evgeny Pestov cd059bd511 Show questions instead of crushing in case of UTF-8 errors 2021-12-17 00:54:30 +07:00
Mateusz Przybył 53053b901f
Merge pull request #1483 from colobot/dev-cbot-io-tests-refactor
Refactor CBotUT.TestSaveStateIoFunctions
2021-12-15 18:00:34 +01:00
Mateusz Przybył 17f68efb81
Merge pull request #1481 from colobot/dev-minor-fixes
Some minor technical fixes
2021-12-15 17:59:54 +01:00
Tomasz Kapuściński 98ad26da3d Changed glm::identity to explicit construction 2021-12-15 00:20:56 +01:00
Tomasz Kapuściński 36ac6d9956 Another fix 2021-12-15 00:09:47 +01:00
Tomasz Kapuściński 1eb17b2fa1 Added includes to fix compilation errors for older versions of glm 2021-12-14 23:56:24 +01:00
Tomasz Kapuściński 33744de372 Add target alias for older versions of glm 2021-12-14 23:42:14 +01:00
Tomasz Kapuściński d651b36eb2 Corrected includes 2021-12-14 23:09:20 +01:00
Tomasz Kapuściński 7e0db31cc1 Merge branch 'dev' into dev-graphics-overhaul 2021-12-14 22:27:43 +01:00
Tomasz Kapuściński c389156499 Added commands for controling triplanar mapping 2021-12-14 21:58:23 +01:00
Tomasz Kapuściński 0207669d61 Added optional triplanar mapping mode for the secondary texture 2021-12-14 21:54:19 +01:00
Tomasz Kapuściński b158318e83 Possibly a fix for most transparency issues 2021-12-14 21:51:29 +01:00
Tomasz Kapuściński 11bfcc6d53 Fix resetting bound textures 2021-12-14 21:50:26 +01:00
Evgeny Pestov 9269a55e8b Fixed input of long UTF-8 symbols in editor (#1423) 2021-12-14 23:06:37 +07:00
Tomasz Kapuściński 2583f6fe36 Removed UIRenderer's DrawPrimitive() via CDevice 2021-12-12 21:17:39 +01:00
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 ea7837b4c6 Remove usage of a CMake 3.17 feature
We currently use CMake 3.16 for compatibility with Ubuntu 18.04 LTS.

The `NAME_MISMATCHED` argument which turns off a CMake warning
when using `FIND_PACKAGE_HANDLE_STANDARD_ARGS`, is not available
in CMake 3.16 and can prevent a successful build.

See
https://github.com/colobot/colobot/pull/1478#issuecomment-986204233
2021-12-08 19:35:30 +01:00
MrSimbax f9c275919e Fix CMake warning about empty GoogleTest version
The warning appeared when GoogleTest is used as a submodule.
2021-12-08 19:25:36 +01:00
MrSimbax 38b9b9be4c Update data, gtest and add options to .gitmodules
Update the `data` and `lib/googletest` submodules.

`git submodule update --remote` command should now
update the data submodule by rebasing on the remote branch named
the same as the current branch.

Changes in the `lib/googletest` submodule should now be ignored
in `git status`.
2021-12-08 19:15:16 +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
Tomasz Kapuściński d1489a1fb1 Removed ShadeModel 2021-12-05 13:01:12 +01:00
Tomasz Kapuściński 0568fcdb81 Refactored FillMode to enum class 2021-12-05 12:53:31 +01:00
Tomasz Kapuściński 39c837d323 Refactored PrimitiveType to enum class 2021-12-05 12:26:34 +01:00
tomangelo 3aa7c3c2e0
Stop handling compilation warnings as errors (#1477)
* Stop handling compilation warnings as errors

* Restore mistakenly removed flag
2021-12-05 11:51:28 +01:00
Tomasz Kapuściński 7a555e19c4 Fix in convert_model tool 2021-12-04 16:04:53 +01:00
Tomasz Kapuściński 26c0d85c66 Updated cache key 2021-12-04 16:02:17 +01:00
Tomasz Kapuściński 613efd7599 Added missing glm library to CI 2021-12-04 15:31:16 +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
Tomasz Kapuściński 9139239f9f Merge branch 'dev' into dev-graphics-overhaul
# Conflicts:
#	src/app/app.cpp
#	src/graphics/opengl/gl14device.cpp
#	src/graphics/opengl/gl14device.h
#	src/graphics/opengl/gl21device.cpp
#	src/graphics/opengl/gl21device.h
2021-12-01 17:27:54 +01:00
Tomasz Kapuściński 57502d2f54 Added object renderer (WIP)
Rewritten shadow rendering logic
Split some shaders into smaller parts
Shadow renderer now has its own framebuffer object
2021-12-01 17:05:20 +01:00
Tomasz Kapuściński ce71f25901 Removed unused shader files 2021-10-25 21:42:19 +02:00
Tomasz Kapuściński fea6b87139 Added fog to terrain renderer and renamed variables 2021-10-17 16:27:29 +02:00
Tomasz Kapuściński 4157604458 Added shadow renderer and removed rendering modes 2021-10-17 16:05:20 +02:00
nipsufn 117c72ba72 fix SatCom content offset on high resolution / small font size 2021-09-29 15:26:19 +02:00
Tomasz Kapuściński 79d4cd9060 Updated TerrainRenderer
* Engine will now use it to render terrain
* Added directional light source
* Added dynamic shadows
* Moved visibility computation to CEngine
* Removed uniform buffers
2021-09-19 20:08:31 +02:00
Mateusz Przybył 1438438937
Merge pull request #1462 from colobot/dev-update-license
Update license headers
2021-09-11 16:10:44 +02:00
MrSimbax 80f074e2ba Update license headers 2021-09-11 15:53:59 +02:00
MrSimbax 171bba1bcd Rewrite the update license script
The old script duplicated license headers for me, instead of
updating them.
2021-09-11 15:53:50 +02:00
Mateusz Przybył 95579bbf1d
Merge pull request #1461 from colobot/AbigailBuccaneer-platform-independent
Merge PR#1141 "Use C++11 threading and timing constructs"
2021-09-11 14:23:09 +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 6aa83c93ac Update data submodule 2021-09-11 13:29:03 +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
Tomasz Kapuściński 30d688c1ec Added and implemented terrain renderer 2021-09-05 16:32:19 +02:00
Tomasz Kapuściński 58c75ce61a Added implicit conversion between Math::Matrix and glm::mat4 2021-09-05 16:32:18 +02:00
Tomasz Kapuściński 100be95113 Added CVertexBuffer and reimplemented vertex buffer management 2021-09-05 16:32:18 +02:00
Tomasz Kapuściński 5c037837f5 Added Vertex3D 2021-09-05 16:32:17 +02:00
Tomasz Kapuściński 12e696bf1c Added color and moved uniform data to uniform buffer block 2021-09-05 16:32:17 +02:00
Tomasz Kapuściński 55513703b2 Removed unused static buffer types 2021-09-05 16:32:16 +02:00
Tomasz Kapuściński f2eafd563e Removed interface rendering mode 2021-09-05 16:32:16 +02:00
Tomasz Kapuściński 16200bbeac Removed all dependency on interface rendering mode 2021-09-05 16:32:16 +02:00
Tomasz Kapuściński 465fe59dfb Added Renderers
Added UI Renderer
Added OpenGL 3.3 UI Renderer
Reimplemented most of UI drawing functionality to use UI Renderer
TODO: fix OpenGL errors
2021-09-05 16:32:15 +02:00
Tomasz Kapuściński 704e3f2f0d Improved code for loading and linking shaders 2021-09-05 16:32:15 +02:00
Tomasz Kapuściński fe02cf3e4b Added Vertex2D 2021-09-05 16:32:14 +02:00
Tomasz Kapuściński 5e7fb5010f Temporarily removed CNullDevice 2021-09-05 16:32:14 +02:00
Tomasz Kapuściński b322ce064b Added dependency on glm
# Conflicts:
#	src/CMakeLists.txt
2021-09-05 16:31:57 +02:00
Tomasz Kapuściński ec21faf15c Removed gl14 and gl21 devices 2021-09-05 16:25:38 +02:00
Mateusz Przybył e0c5ca962f
Merge pull request #1327 from MrJohn10/vscode-instructions
Add instructions for compilation and installation using vscode
2021-09-05 15:17:04 +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
Mateusz Przybył c04d3ef50d
Merge pull request #1341 from colobot/dev-modern
Merge dev-modern into dev
2021-09-05 14:32:13 +02:00
MrSimbax 62b14bcf62 Bump C++ version from 11 to 17 2021-09-04 22:27:06 +02:00
MrSimbax 005f5b5103 Replace ::add-path:: function with appending to $GITHUB_PATH
See https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
2021-09-04 21:59:49 +02:00
MrSimbax bb6c32c897 Update run-vcpkg action from v3 to v7 2021-09-04 21:52:58 +02:00
MrSimbax 8299fe41bc Remove JenkinsFile as it's no longer used 2021-09-04 21:52:58 +02:00
MrSimbax d39f1999e7 Remove support for MXE 2021-09-04 21:52:58 +02:00
MrSimbax d06b7e1456 Update vcpkg version used in CI 2021-09-04 21:52:58 +02:00
MrSimbax 41cf9974f9 Bump CMake version from 3.17 to 3.16
See https://github.com/colobot/colobot/issues/1306#issuecomment-657096265
2021-09-04 21:51:55 +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 8f0b367f9c Find Opus because SndFile now depends on it 2021-09-04 20:33:15 +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 84d23e91ed Fix CMAKE_MSVC_RUNTIME_LIBRARY name for dynamic runtime 2021-09-04 20:29:52 +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
lb_ii 91a290dade Assign team id to Alien eggs created during produce() 2021-08-25 01:09:58 +03:00
lb_ii ea62a449d4 Add optional team parameter to produce() function 2021-08-24 02:21:42 +03:00
Mateusz Przybył faa4eaae20 Release 0.2.0-alpha: Bump version 2021-08-21 22:57:34 +02:00
Mateusz Przybył c039e7e859 Post-release 0.2.0-alpha 2021-08-21 22:57:34 +02:00
Mateusz Przybył d9c966a95b Release 0.2.0-alpha: Merge branch 'dev' 2021-08-21 22:57:33 +02:00
MrSimbax 92f574d2ca Remove Ubuntu 16.04 from CI jobs 2021-08-21 22:48:51 +02:00
MrSimbax decab29555 Remove linter CI jobs
They require Ubuntu 16.04 which is no longer supported.
2021-08-21 22:48:51 +02:00
MrSimbax ecc23dfb3e Update data submodule 2021-08-21 22:18:52 +02:00
Fiftytwo a5d9bae052 Fix missing AmphibiousTrainer in drive_type 2021-08-20 18:17:36 +02:00
tomangelo c04291a55e
Update polish translation (#1407) 2021-08-16 18:01:08 +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
Emxx52 3ab153225a
Merge pull request #1439 from melex750/dev-cbot-repeat
Restore repeat(n) instruction in CBOT
2021-08-14 20:15:00 +02:00
immibis 76314f522f Slotted object interface 2021-07-04 21:50:56 +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
Emxx52 fabbdda964
Merge pull request #1406 from colobot/dev-gameplus
Add Missions+ gamemode, add new CBOT categories and functions, update Sniffers
2021-03-30 21:05:34 +02:00
Fiftytwo cdb63e2a8c Update data submodule 2021-03-30 20:51:17 +02:00
Fiftytwo 8647deafc8 Merge branch dev into dev-gameplus 2021-03-21 22:30:23 +01:00
Fiftytwo dbd9db86a6 Update data submodule 2021-03-21 22:10:42 +01:00
tomangelo b338b18f16
Merge pull request #1405 from colobot/dev-missing-library
Add missing library in MSYS2 instruction
2021-03-21 21:10:34 +01:00
tomangelo2 0b948b655e Add missing library in MSYS2 instruction 2021-03-21 15:17:28 +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
krzys_h fbbe25b25e
Merge pull request #1391 from colobot/dev-gh-actions
Fix uploading linter results from forks to GitHub
2021-02-22 19:09:35 +00:00
krzys-h f5519f8936
Send comment when pull request targets the wrong branch 2021-02-22 12:57:04 +01:00
krzys-h 9f2f7780a4
Safely upload linter results from forks to GitHub
This makes lint results from pull requests appear as GitHub checks
similarly to how pull requests from branches are able to work

Based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests
2021-02-22 12:57:03 +01:00
krzys-h 9c91fd1e52
Replace custom download script with dawidd6/action-download-artifact 2021-02-22 10:44:45 +01:00
Mateusz Przybył 7b237ce9ad
Merge pull request #1387 from colobot/dev-fix-vsync
Remove vsync loop and improve vsync UI
2021-02-07 21:40:24 +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
Mateusz Przybył d71ee4ef68
Merge pull request #1357 from colobot/dev-fix-satcom-crash-again
Fix crashes in SatCom on some \button characters
2020-09-21 16:55:30 +02: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
Mateusz Przybył f64c610fa4
Merge pull request #1354 from suve/gcc11-diagnostics-fix
GCC11 diagnostics fix (round 2)
2020-09-15 16:20:31 +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
Mateusz Przybył 13098ee378
Merge pull request #1351 from suve/gcc11-diagnostics-fix
GCC11 diagnostics fix
2020-09-11 20:37:25 +02:00
MrSimbax 8fdf79958f Merge branch 'master' of https://github.com/ccao001/colobot into dev-add-guix
Fixed merge conflict
2020-09-11 19:16:00 +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
ccao001 a54a117ba4
README: Add Guix
GNU Guix is a transactional package manager and an advanced distribution of the GNU system that respects user freedom. Guix can be used on top of any system running the kernel Linux, or it can be used as a standalone operating system distribution for i686, x86_64, ARMv7, and AArch64 machines.

In addition to standard package management features, Guix supports transactional upgrades and roll-backs, unprivileged package management, per-user profiles, and garbage collection. When used as a standalone GNU/Linux distribution, Guix offers a declarative, stateless approach to operating system configuration management. Guix is highly customizable and hackable through Guile programming interfaces and extensions to the Scheme language.
2020-08-30 00:44:45 -04:00
Emxx52 a4cfe616a8
Merge pull request #1349 from colobot/dev-fix-abs
Fix warning regarding mismatched parameter types
2020-08-27 00:53:45 +02:00
tomangelo2 f08c67bef9 Fix warning regarding mismatched parameter types 2020-08-27 00:28:03 +02:00
Emxx52 b17a4391b0
Merge pull request #1336 from colobot/dev-mod-manager
Add Mod Manager
2020-08-21 18:43:45 +02:00
Emxx52 1c9f5f3f64
Merge branch 'dev' into dev-mod-manager 2020-08-21 18:21:08 +02:00
Fiftytwo 68c254c101 Update data submodule 2020-08-21 18:09:28 +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
tomangelo d2c8888067
Merge pull request #1344 from colobot/dev-suppress-fonts-warning
Remove unnecessary warning if there is no fonts.ini file
2020-08-17 19:27:59 +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
Mateusz Przybył 5749fff377
Merge pull request #1342 from colobot/dev-lighting-fix
Fixes lighting issues and mipmapping
2020-08-03 20:48:15 +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
Fiftytwo a92fa950e2 Make Sniffers able to plant flags 2020-07-30 11:03:12 +02:00
Fiftytwo e63afb3461 Add WayPoint animation in deletemark 2020-07-30 04:21:35 +02:00
Fiftytwo 25a8d7b5b5 Move flatground scan button from Sniffers to Builders 2020-07-30 03:48:31 +02:00
Fiftytwo 4780716c18 Update translation files 2020-07-30 03:27:39 +02:00
MrSimbax 9cb80daedf Improve sound reloading
Also some minor refactoring.

Since realoding may take a lot of time, modman no longer reloads
the whole app on entering/leaving the screen.
2020-07-27 15:59:33 +02:00
Mateusz Przybył aa8122f16f
Merge pull request #1339 from immibis/fix-quicksave-sim-speed-crash
Fix crash when quick-saving with increased game speed
2020-07-26 15:17:17 +02:00
immibis 9e743e86af Fix crash when quick-saving with increased game speed 2020-07-26 14:55:56 +02:00
MrSimbax fd36ff3840 Fix crash when changing text with UTF-8 chars
The code left a byte from the previous text in CEdit UI control if
the new text is shorter than the old one. So an exception was thrown
because it's an invalid UTF-8 byte.
2020-07-25 21:20:19 +02:00
MrSimbax 93f3abee1a Change mod version separator to dot
I don't know why I put comma in there and how I didn't notice this
earlier.
2020-07-24 12:57:45 +02:00
MrSimbax b685d0060c Merge branch 'dev' into dev-mod-manager 2020-07-23 18:19:42 +02:00
MrSimbax 253cca379b List which level subdirectory a mod changes 2020-07-23 18:07:02 +02:00
MrSimbax e6ce4112c6 Update translations 2020-07-23 17:57:25 +02:00
MrSimbax 51668c12d7 Add changes listing to mods
It's just listing directories of a mod for now, but should give some
idea what the mod changes.

Also moved some functionality from pathman to modman.

Mods added with the `-mod` parameter are now managed by modman.
2020-07-23 17:44:38 +02:00
MrSimbax 16795e0d49 Use level parser instead of JSON for manifest 2020-07-22 21:40:13 +02:00
MrSimbax 62b770f7d3 Improve UI of mod manager a little
The arrow buttons are smaller and the up button is now above the down
button. What is more, the width of the back button is now the same as
in other places.
2020-07-22 17:50:19 +02:00
MrSimbax df415880d0 Fix linter issues 2020-07-22 17:26:46 +02:00
MrSimbax 1be69a0a51 Fix compile errors 2020-07-22 17:24:07 +02:00
MrSimbax 2b96eda86d Fix minor issues 2020-07-22 17:13:52 +02:00
MrSimbax f57da76ae8 Add handling of mods manifests
Also add Polish translations for mod manager related strings.
2020-07-22 16:35:47 +02:00
MrSimbax eac74c23ec Fix linter issues 2020-07-21 20:39:00 +02:00
MrSimbax 242477e3ee Major UI change to mod manager
Move the button to the sidebar.

Add reordering option.

General improvements and refactoring.
2020-07-21 20:27:24 +02:00
Fiftytwo 754dfefefd Add Missions+ gamemode 2020-07-20 18:35:31 +02:00
MrSimbax 7e6782a1be Try to improve font reloading 2020-07-19 16:07:27 +02:00
MrSimbax 56a8c5eb48 Fix build error on GCC 2020-07-19 15:16:39 +02:00
MrSimbax 63bf6bed08 Add saving mods list in colobot.ini 2020-07-19 15:02:35 +02:00
MrSimbax 69d2d39c36 Add ability to use arrays in colobot.ini 2020-07-18 18:06:14 +02:00
MrSimbax a0635ae400 Fix linter issues 2020-07-18 15:01:36 +02:00
MrSimbax dc64b95406 Fix build error 2020-07-18 14:47:18 +02:00
MrSimbax 8390d85e46 Refactor the mod manager
Moved list of mods logic to a new CModManager class.

The list of enabled mods is now managed by a flag instead of directory
names of mods.

Mods are now disabled by default.

Also general cleanup, fixing issues from the code review in
https://github.com/colobot/colobot/pull/1191 and fixing linter issues.

Regression: the state of enabled/disabled mods is now not persistent.
The plan is to use some kind of config file for this.
2020-07-18 14:30:50 +02:00
Fiftytwo 95cab790c1 Rename 'freemissions' back to 'free' 2020-07-17 19:33:53 +02:00
Fiftytwo b72bedaf60 Add BrownMushroom and GreenMushroom categories in CBOT 2020-07-17 18:00:36 +02:00
MrSimbax 5f76722ecb Add error dialogs for open path/url buttons 2020-07-17 17:27:09 +02:00
MrSimbax 4905abe30b Merge branch 'dev-mod-manager' of https://github.com/DavivaD/colobot into dev-mod-manager 2020-07-17 11:49:51 +02:00
Fiftytwo ac32e40003 Add Ruin, Bush, GraviPlant, and Crystal categories in CBOT 2020-07-17 03:37:13 +02:00
Mateusz Przybył 52ed8041f7
Merge pull request #1330 from colobot/dev-cmake-targets
Use CMake targets instead of variables
2020-07-15 11:32:33 +02:00
MrSimbax 2fa706a123 Add x86 MSVC build to GH Actions 2020-07-14 21:43:34 +02:00
MrSimbax 73429315a7 Add USE_STATIC_RUNTIME option
Mainly useful for MSVC.
2020-07-14 20:43:42 +02:00
MrSimbax 419bd1cc21 Fix CBOT stack overflow test failing on MSVC
Increased the stack size to the default (?) stack size on Linux.

The failing test name: CBotUT.FunctionRecursionStackOverflow
2020-07-14 14:26:37 +02:00
MrSimbax 167dd01bbe Revert "Fix CBotUT.FunctionRecursionStackOverflow test"
This reverts commit 004c861ba9.
2020-07-14 13:54:32 +02:00
MrSimbax df7cdd4b8e Fix some minor issues after CR 2020-07-14 13:51:07 +02:00
MrSimbax 2143f21828 Fix linter 2020-07-14 13:43:33 +02:00
MrSimbax 17e38bf66c Install PDB file if available 2020-07-13 23:39:11 +02:00
MrSimbax 3ec39047e1 Fix MXE build 2020-07-13 22:46:32 +02:00
MrSimbax a9717206f3 Try to fix linter errors 2020-07-13 22:04:33 +02:00
MrSimbax 634efbcabd Fix GLEW_STATIC redefinition warnings 2020-07-13 21:33:36 +02:00
MrSimbax c15efbad7b Revert "Delete FindGLEW"
This reverts commit 86f595b8ef.
2020-07-13 21:27:56 +02:00
MrSimbax f0ba8ec325 Revert "Fix warnings about redefining GLEW_STATIC"
This reverts commit 9cf30fd9bc.
2020-07-13 21:27:31 +02:00
MrSimbax fde66a9422 Make MSVC Windows build a separate job
Bring back the old file for Linux (with MXE).

Find number of logical processors on Windows by using PowerShell magic.
2020-07-13 21:19:03 +02:00
MrSimbax 17ece36b3e Enable OpenAL in CI MSVC build
The issue with OpenAL not compiling with vcpkg was solved upstream.
2020-07-13 20:43:32 +02:00
MrSimbax 86f595b8ef Delete FindGLEW 2020-07-12 23:18:21 +02:00
MrSimbax cc4cfd2122 Fix linter 2020-07-12 23:18:21 +02:00
MrSimbax c4037a885f Make CI Windows build with MSVC instead of MXE 2020-07-12 23:17:42 +02:00
MrSimbax fa5cf01af0 Mark libraries includes as system includes 2020-07-11 17:21:44 +02:00
MrSimbax 1b9d40d2fb Set C++ standard the modern CMake way 2020-07-11 17:20:41 +02:00
MrSimbax 9e8ebe4595 Checkout Google Test in GH workflow
I hope this works.
2020-07-11 12:41:33 +02:00
MrSimbax e8f9c0292b Handle the case where GTest is not found 2020-07-11 12:26:35 +02:00
MrSimbax 004c861ba9 Fix CBotUT.FunctionRecursionStackOverflow test
On MSVC it throws StackOverflow exception. I reduced the stack size to
make the test pass.
2020-07-11 12:17:20 +02:00
MrSimbax 81ddda4515 Make tests work with targets 2020-07-11 12:16:20 +02:00
MrSimbax 3da26a38ed Replace Google Test with a submodule 2020-07-11 10:54:52 +02:00
MrSimbax 6c3012b8a1 Fix hippomocks target
.h file shouldn't be listed as source to add_library(... INTERFACE)
2020-07-11 10:53:13 +02:00
MrSimbax 9cf30fd9bc Fix warnings about redefining GLEW_STATIC
I guess this flag is now set by CMake somehow so we no longer need
to define it ourselves.
2020-07-10 18:55:47 +02:00
MrSimbax df65862c49 Start using CMake targets instead of variables
Moved most of the variables to targets in the main src.

Made libraries in repo export targets.

Refactor STATIC flags a little and add more.

This commit definitely breaks a lot of things like tests
but the main game builds at least with MSVC.
2020-07-10 18:49:54 +02:00
MrSimbax f2d91cde80 Update Find*.cmake modules
Make them export targets instead of variables.

Some platforms need libintl, abstract it to a Find*.cmake module.

Static linking requires linking to dependencies of dependencies (it is
as horrific as it sounds). This commit handles this only for libsndfile.

SDL2_image and SDL2_ttf probably also have some hidden dependencies.

FindGLEW module is now bundled with CMake, hence it is deleted.

Added Copyright.txt since some modules are taken from CMake.
2020-07-10 18:38:06 +02:00
MrJohn10 db031c7985 Merge branch 'vscode-instructions' of https://github.com/MrJohn10/colobot into vscode-instructions 2020-07-10 15:49:37 +02:00
MrJohn10 a3ceecb21e improve screenshots 2020-07-10 15:48:52 +02:00
MrJohn10 da6c0c66d7
delete dubled file 2020-07-10 15:26:20 +02:00
MrJohn10 767f7f0049 fix discord link 2020-07-10 15:24:19 +02:00
MrJohn10 85f0f88c20 overall improvements 2020-07-10 15:17:34 +02:00
MrJohn10 870d5237bb fixes, add screenshot 2020-07-10 13:18:57 +02:00
MrSimbax 4ae0360640 Remove source grouping temporarily
It's probably not how it should be done with modern CMake, so I'm
removing this for now to focus on other changes first.
2020-07-10 13:03:23 +02:00
Mateusz Przybył 4c02fe9cda
Merge pull request #1323 from colobot/dev-cmake-version-bump
Bump CMake version
2020-07-09 21:47:31 +02:00
MrJohn10 70b7a63b66 fix 2020-07-09 21:32:27 +02:00
MrJohn10 31781f214c fixes 2020-07-09 21:29:31 +02:00
MrJohn10 1b74cc1144 improve link 2020-07-09 21:27:33 +02:00
MrJohn10 535696de28 refactor 2020-07-09 21:25:48 +02:00
MrSimbax b9297cd9f4 Bump CMake version 2020-07-09 21:25:47 +02:00
MrJohn10 a78cc159f8 add cloning instructions, improve links 2020-07-09 21:25:19 +02:00
MrJohn10 fbb45807f1 Create intructions for using vscode 2020-07-09 21:16:03 +02:00
DavivaD 50c3c45ef8 Show only local mods on the list 2019-07-27 17:58:12 +02:00
DavivaD 6f3b14202e Mod Manager i18n 2019-07-27 17:03:33 +02:00
DavivaD 7d30a82747 Move platform-dependent code to system_*.cpp 2019-07-27 16:59:51 +02:00
DavivaD cd140f1384 Move mod loading/unloading stuff to a new class + fix some derps 2019-07-27 03:36:03 +02:00
DavivaD e823c209fa Fix crash while loading mod and blank settings menu while paused game 2018-08-02 17:21:31 +02:00
DavivaD 1b47cf76d3 Implement Mod Manager 2018-08-02 07:38:32 +02:00
AbigailBuccaneer 4119e669d1 Remove central tracking of SystemTimeStamp
SystemTimeStamp used to be an opaque class, as it was provided by
`system_{linux/other/windows}.h`. Because of this, code dealt in
SystemTimeStamp pointers, and getting the current timestamp required a
memory allocation. Now SystemTimeStamp is just a
`std::chrono::time_point`, we can make the code cleaner and faster by
just directly keeping SystemTimeStamp instead of pointers around.
2018-04-20 09:57:10 +01:00
AbigailBuccaneer 285350464f Remove platform-specific handling of times
Now all platforms use std::chrono::high_resolution_clock and
std::this_thread::sleep_for instead of platform-specific timestamp and
sleep methods.
2018-04-20 09:56:57 +01:00
AbigailBuccaneer 2a003a27b1 Use C++11 threads, mutexes and condition variables 2018-04-20 09:56:57 +01:00
842 changed files with 27330 additions and 58004 deletions

View File

@ -3,51 +3,42 @@ name: Build
on: [push, pull_request]
jobs:
build:
build-linux:
runs-on: ${{ matrix.host_os }}
container: ${{ matrix.container }}
strategy:
matrix:
target_os: [linux]
host_os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
host_os: [ubuntu-20.04]
container: ['']
include:
- target_os: windows
host_os: ubuntu-latest
container: krzysh/colobot-build:latest
fail-fast: false
steps:
- name: Install Colobot dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libphysfs-dev gettext git po4a vorbis-tools librsvg2-bin xmlstarlet
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libphysfs-dev gettext git po4a vorbis-tools librsvg2-bin xmlstarlet libglm-dev libmpg123-dev
if: matrix.container == ''
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Checkout the Google Test submodule
run: git submodule update --init -- lib/googletest
- name: Checkout the nlohmann json submodule
run: git submodule update --init -- lib/json
- name: Create build directory
run: cmake -E make_directory build
- name: Run CMake (for Windows using MXE)
working-directory: build
# FIXME: without -lsetupapi linking sdl2 fails
run: /opt/mxe/usr/bin/i686-w64-mingw32.static-cmake -DCMAKE_CXX_STANDARD_LIBRARIES="-lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 -lsetupapi" -DCMAKE_INSTALL_PREFIX=/install -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=0 -DMXE_USE_CCACHE=0 ..
if: matrix.target_os == 'windows'
- name: Run CMake (for Linux)
working-directory: build
run: cmake -DCMAKE_INSTALL_PREFIX=/install -DCMAKE_SKIP_INSTALL_RPATH=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo -DDEV_BUILD=1 -DPORTABLE=1 -DTOOLS=1 -DTESTS=1 -DDESKTOP=1 ..
run: cmake --preset Linux-CI
if: matrix.target_os == 'linux'
- name: Build
working-directory: build
run: make -j `nproc`
run: cmake --build --preset Linux-CI
- name: Install
working-directory: build
run: DESTDIR=. make install
run: cmake --build --preset Linux-CI --target install
- name: Patch library path
working-directory: build
run: patchelf --set-rpath '.' install/colobot
if: matrix.target_os == 'linux'
- name: Upload build
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{matrix.target_os}}-debug
path: build/install
if: matrix.target_os == 'windows' || matrix.host_os == 'ubuntu-18.04'
path: install
if: matrix.host_os == 'ubuntu-20.04'
- name: Create AppImage
working-directory: build
run: |
@ -58,39 +49,155 @@ jobs:
# Create AppImage
NO_STRIP=1 ./squashfs-root/AppRun -e colobot --output appimage --appdir colobot.AppDir -d desktop/colobot.desktop -i ../desktop/colobot.svg
chmod +x Colobot-*-x86_64.AppImage
chmod +x Colobot-x86_64.AppImage
# Prepare folder for zip
mkdir -p appimage
cp -rp install/data appimage/data
cp -rp install/lang appimage/lang
cp -p Colobot-*-x86_64.AppImage appimage/colobot
cp -rp ../install/data appimage/data
cp -rp ../install/lang appimage/lang
cp -p Colobot-x86_64.AppImage appimage/colobot
if: matrix.target_os == 'linux'
- name: Upload AppImage
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{matrix.target_os}}-debug-AppImage
path: build/appimage
if: matrix.target_os == 'linux' && matrix.host_os == 'ubuntu-18.04'
if: matrix.target_os == 'linux' && matrix.host_os == 'ubuntu-20.04'
- name: Run tests
# TODO: Maybe run Windows tests using wine as well?
working-directory: build
run: ./colobot_ut --gtest_output=xml:gtestresults.xml
run: ./Colobot-UnitTests --gtest_output=xml:gtestresults.xml
if: matrix.target_os == 'linux'
- name: Upload test results
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: Test results (${{ matrix.target_os }}, ${{ matrix.host_os }})
path: build/gtestresults.xml
if: matrix.target_os == 'linux'
build-macos:
runs-on: ${{ matrix.host_os }}
container: ${{ matrix.container }}
strategy:
matrix:
target_os: [macos]
host_os: [macos-11, macos-12]
container: ['']
fail-fast: false
steps:
- name: Install Colobot dependencies
run: brew install cmake sdl2 sdl2_image sdl2_ttf glew physfs flac libsndfile libvorbis vorbis-tools gettext libicns librsvg wget xmlstarlet glm
if: matrix.container == ''
- uses: actions/checkout@v3
- name: Checkout the Google Test submodule
run: git submodule update --init -- lib/googletest
- name: Checkout the nlohmann json submodule
run: git submodule update --init -- lib/json
- name: Create build directory
run: cmake -E make_directory build
- name: Run CMake (for Mac)
run: cmake --preset MacOS-CI
if: matrix.target_os == 'macos'
- name: Build
run: cmake --build --preset MacOS-CI
- name: Run tests
# TODO: Maybe run Windows tests using wine as well?
working-directory: build
run: ./Colobot-UnitTests --gtest_output=xml:gtestresults.xml
if: matrix.target_os == 'macos'
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Test results (${{ matrix.target_os }}, ${{ matrix.host_os }})
path: build/gtestresults.xml
if: matrix.target_os == 'macos'
build-windows:
runs-on: windows-2019
strategy:
matrix:
include:
- arch: amd64
vcpkg_triplet: 'x64-windows-static'
- arch: x86
vcpkg_triplet: 'x86-windows-static'
steps:
- uses: actions/checkout@v3
- name: Checkout the Google Test submodule
run: git submodule update --init -- lib/googletest
- name: Checkout the nlohmann json submodule
run: git submodule update --init -- lib/json
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
- name: Setup VS Environment
uses: seanmiddleditch/gha-setup-vsdevenv@master
with:
arch: ${{ matrix.arch }}
- name: Install Colobot dependencies
uses: lukka/run-vcpkg@v7
with:
setupOnly: true
vcpkgGitCommitId: 'f6a5d4e8eb7476b8d7fc12a56dff300c1c986131'
vcpkgTriplet: ${{ matrix.vcpkg_triplet }}
# SHA-256 hash of the vcpkg.json file, recalculated automatically when it changes
appendedCacheKey: ${{ hashFiles( '**/vcpkg.json' ) }}
additionalCachedPaths: ${{ github.workspace }}/build/vcpkg_installed
- name: Install external tools
working-directory: ${{ github.workspace }}
run: |
echo "Downloading gettext..."
(New-Object System.Net.WebClient).DownloadFile("https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.20.2-v1.16/gettext0.20.2-iconv1.16-static-64.zip", "gettext.zip");
echo "Unpacking gettext..."
7z x -ogettext gettext.zip;
echo "Adding gettext to PATH..."
echo "${{ github.workspace }}\gettext\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "Downloading xmlstarlet..."
(New-Object System.Net.WebClient).DownloadFile("https://downloads.sourceforge.net/project/xmlstar/xmlstarlet/1.6.1/xmlstarlet-1.6.1-win32.zip", "xmlstarlet.zip");
echo "Unpacking xmlstarlet..."
7z x -oxmlstarlet xmlstarlet.zip;
echo "Renaming xml.exe to xmlstarlet.exe"
Rename-Item -Path "${{ github.workspace }}\xmlstarlet\xmlstarlet-1.6.1\xml.exe" -NewName "xmlstarlet.exe"
echo "Adding xmlstarlet to PATH..."
echo "${{ github.workspace }}\xmlstarlet\xmlstarlet-1.6.1" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "Downloading rsvg-convert..."
(New-Object System.Net.WebClient).DownloadFile("https://downloads.sourceforge.net/project/tumagcc/rsvg-convert-2.40.20.7z", "rsvg-convert.zip");
echo "Unpacking xmlstarlet..."
7z x -orsvg-convert rsvg-convert.zip;
echo "Adding rsvg-convert to PATH..."
echo "${{ github.workspace }}\rsvg-convert" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
shell: pwsh
- name: Create build directory
run: cmake -E make_directory build
- name: Run CMake (for Windows)
run: cmake --preset Windows-CI -DVCPKG_TARGET_TRIPLET=${{ matrix.vcpkg_triplet }} -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}\scripts\buildsystems\vcpkg.cmake
- name: Build
run: |
$nproc = (Get-CIMInstance -Class 'CIM_Processor').NumberOfLogicalProcessors
cmake --build --preset Windows-CI -j $nproc
shell: pwsh
- name: Install
run: cmake --build --preset Windows-CI --target install
- name: Upload build
uses: actions/upload-artifact@v3
with:
name: windows-msvc-debug-${{ matrix.arch }}
path: install
- name: Run tests
working-directory: build
run: ./Colobot-UnitTests --gtest_output=xml:gtestresults.xml
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: 'Test results (windows, MSVC, ${{ matrix.arch }})'
path: build/gtestresults.xml
doc:
runs-on: ubuntu-latest
steps:
- name: Install Colobot dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libphysfs-dev gettext git po4a vorbis-tools librsvg2-bin xmlstarlet doxygen graphviz
- uses: actions/checkout@v2
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libphysfs-dev gettext git po4a vorbis-tools librsvg2-bin xmlstarlet doxygen graphviz libglm-dev libmpg123-dev
- uses: actions/checkout@v3
- name: Create build directory
run: cmake -E make_directory build
- name: Checkout the nlohmann json submodule
run: git submodule update --init -- lib/json
- name: Run CMake
working-directory: build
run: cmake ..
@ -98,7 +205,7 @@ jobs:
working-directory: build
run: make doc
- name: Upload docs
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: doc
path: build/doc

View File

@ -1,254 +0,0 @@
name: Linter
on: [push, pull_request]
jobs:
lint:
# it's easiest if it matches the version that was used to build colobot-lint, newer versions don't have llvm-3.6-dev in repo...
runs-on: ubuntu-16.04
env:
CC: /usr/lib/llvm-3.6/bin/clang
CXX: /usr/lib/llvm-3.6/bin/clang++
CLANG_PREFIX: /usr/lib/llvm-3.6
steps:
- name: Download Colobot dependencies
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends build-essential cmake libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsndfile1-dev libvorbis-dev libogg-dev libpng-dev libglew-dev libopenal-dev libboost-dev libboost-system-dev libboost-filesystem-dev libboost-regex-dev libphysfs-dev gettext git po4a vorbis-tools librsvg2-bin xmlstarlet
- name: Download colobot-lint dependencies
run: sudo apt-get install -y --no-install-recommends clang-3.6 libtinyxml2.6.2v5
- run: pip install requests
- run: mkdir -p /tmp/colobot-lint
- name: Download colobot-lint
working-directory: /tmp/colobot-lint
shell: python
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_NAME: colobot/colobot-lint
BRANCH_NAME: master
ARTIFACT_NAME: colobot-lint
run: |
import os
import requests
# How there can be no builtin action to download the latest artifact from another repo?!
s = requests.Session()
s.headers.update({
'Authorization': 'token ' + os.environ['GITHUB_TOKEN'],
'Accept': 'application/vnd.github.v3+json'
})
r = s.get("https://api.github.com/repos/" + os.environ['REPO_NAME'] + "/actions/runs", params={'branch': os.environ['BRANCH_NAME'], 'event': 'push', 'status': 'success'})
r.raise_for_status()
# Querying for "dev" returns all branches that have "dev" anywhere in the name... is that a GitHub bug or intended behaviour?
runs = list(filter(lambda x: x['head_branch'] == os.environ['BRANCH_NAME'], r.json()['workflow_runs']))
if len(runs) == 0:
raise Exception('No valid run found')
run = runs[0]
print("Using colobot-lint from run #{} ({}) for commit {}".format(run['run_number'], run['id'], run['head_sha']))
r = s.get(run['artifacts_url'])
r.raise_for_status()
artifacts = list(filter(lambda x: x['name'] == os.environ['ARTIFACT_NAME'], r.json()['artifacts']))
if len(artifacts) != 1:
raise Exception('Artifact not found')
artifact = artifacts[0]
print(artifact['archive_download_url'])
r = s.get(artifact['archive_download_url'], stream=True)
r.raise_for_status()
with open(os.environ['ARTIFACT_NAME'] + '.zip', 'wb') as f:
for block in r.iter_content(1024):
f.write(block)
print("Download finished")
- name: Unpack colobot-lint
working-directory: /tmp/colobot-lint
run: |
# Unzip the archive
mkdir archive; cd archive
unzip ../colobot-lint.zip
cd ..
# Workaround for Clang not finding system headers
mkdir ./bin
mv ./archive/build/colobot-lint ./bin/
chmod +x ./bin/colobot-lint
ln -s ${CLANG_PREFIX}/lib ./lib
# Unpack HtmlReport
tar -zxf ./archive/build/html_report.tar.gz
# Clean up
rm -r ./archive
- uses: actions/checkout@v2
- name: Create build directory
run: cmake -E make_directory build
- name: Run CMake
working-directory: build
run: cmake -DCOLOBOT_LINT_BUILD=1 -DTESTS=1 -DTOOLS=1 -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ..
- name: Run linter
shell: bash
run: |
set -e +x
WORKSPACE="$GITHUB_WORKSPACE"
COLOBOT_DIR="$WORKSPACE"
COLOBOT_BUILD_DIR="$WORKSPACE/build"
COLOBOT_LINT_REPORT_FILE="$WORKSPACE/build/colobot_lint_report.xml"
cd "/tmp/colobot-lint"
find "$WORKSPACE" \( -wholename "$COLOBOT_DIR/src/*.cpp" \
-or -wholename "$COLOBOT_DIR/test/unit/*.cpp" \
-or -wholename "$COLOBOT_BUILD_DIR/fake_header_sources/src/*.cpp" \
-or -wholename "$COLOBOT_BUILD_DIR/fake_header_sources/test/unit/*.cpp" \) \
-exec ./bin/colobot-lint \
-verbose \
-output-format xml \
-output-file "$COLOBOT_LINT_REPORT_FILE" \
-p "$COLOBOT_BUILD_DIR" \
-project-local-include-path "$COLOBOT_DIR/src" -project-local-include-path "$COLOBOT_BUILD_DIR/src" \
-license-template-file "$COLOBOT_DIR/LICENSE-HEADER.txt" \
{} +
- name: Upload results (XML)
uses: actions/upload-artifact@v2
with:
name: XML results
path: build/colobot_lint_report.xml
- name: Generate HTML report
shell: bash
run: /tmp/colobot-lint/HtmlReport/generate.py --xml-report "build/colobot_lint_report.xml" --output-dir "build/html_report"
- name: Upload results (HTML)
uses: actions/upload-artifact@v2
with:
name: HTML results
path: build/html_report
- name: Send linter results to GitHub
shell: python
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTUALLY_SEND: ${{ github.event.type != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}
run: |
import os
import sys
import requests
import xml.etree.ElementTree as ET
OVERALL_STABLE_RULES=[
"class naming",
"code block placement",
"compile error",
# "compile warning",
# "enum naming",
# "function naming",
"header file not self-contained",
# "implicit bool cast",
# "include style",
# "inconsistent declaration parameter name",
"license header",
# "naked delete",
# "naked new",
# "old style function",
"old-style null pointer",
# "possible forward declaration",
"undefined function",
# "uninitialized field",
# "uninitialized local variable",
# "unused forward declaration",
# "variable naming",
"whitespace",
]
STABLE_RULES_WITHOUT_CBOT=[
"class naming",
"code block placement",
"compile error",
"compile warning",
# "enum naming",
# "function naming",
"header file not self-contained",
# "implicit bool cast",
"include style",
"inconsistent declaration parameter name",
"license header",
"naked delete",
"naked new",
# "old style function",
"old-style null pointer",
# "possible forward declaration",
"undefined function",
"uninitialized field",
# "uninitialized local variable",
"unused forward declaration",
# "variable naming",
"whitespace",
]
# None of the available actions seem to do what I want, they all do stupid things like adding another check... let's just do it manually
# GitHub also doesn't seem to provide you with the check suite or check run ID, so we have to get it from the action ID via the API
s = requests.Session()
s.headers.update({
'Authorization': 'token ' + os.environ['GITHUB_TOKEN'],
'Accept': 'application/vnd.github.antiope-preview+json' # Annotations are still technically a preview feature of the API
})
action_run = s.get(os.environ['GITHUB_API_URL'] + "/repos/" + os.environ['GITHUB_REPOSITORY'] + "/actions/runs/" + os.environ['GITHUB_RUN_ID']).json()
check_suite = s.get(action_run['check_suite_url']).json()
check_suite_runs = s.get(check_suite['check_runs_url']).json()
check_run = check_suite_runs['check_runs'][0] # NOTE: This assumes that the 'lint' job is the first one in the workflow. You could find it by name if you really wanted.
def we_care_about(file_name, type):
if 'CBot' in file_name:
return type in OVERALL_STABLE_RULES
else:
return type in STABLE_RULES_WITHOUT_CBOT
results = ET.parse('build/colobot_lint_report.xml')
annotations = []
for error in results.find('errors').findall('error'):
location = error.find('location')
file_name = os.path.relpath(location.get('file'), os.environ['GITHUB_WORKSPACE'])
line_num = int(location.get('line'))
type = error.get('id')
severity = error.get('severity')
msg = error.get('msg')
gh_severity = 'warning'
if severity == 'error':
gh_severity = 'failure'
elif severity == 'information':
gh_severity = 'notice'
if not we_care_about(file_name, type):
# don't send the unstable rules to github at all as there are way too many of them and it would overload the API rate limit
continue
print('{}:{}: [{}] {}'.format(file_name, line_num, type, msg))
annotations.append({
'path': file_name,
'start_line': line_num,
'end_line': line_num,
'annotation_level': gh_severity,
'title': type,
'message': msg
})
summary = 'colobot-lint found {} issues'.format(len(annotations))
all_ok = len(annotations) == 0
print('Conclusion: {}'.format(summary))
if os.environ['ACTUALLY_SEND'] != "true":
print('Skip uploading the results as annotations because tokens from forks are readonly and there seems to be no way to do it. Blame GitHub Actions devs.')
else:
# Annotations have to be sent in batches of 50
first = True
while first or len(annotations) > 0:
first = False
to_send = annotations[:50]
annotations = annotations[50:]
data = {
'output': {
'title': summary,
'summary': summary,
'annotations': to_send
}
}
r = s.patch(check_run['url'], json=data)
r.raise_for_status()
sys.exit(0 if all_ok else 1)

View File

@ -1,14 +1,21 @@
name: Verify pull request target
on: [pull_request]
on: [pull_request_target]
jobs:
check_pr_target:
runs-on: ubuntu-latest
steps:
- name: Wrong pull request target
run: echo "This pull request targets the master branch. Please edit the pull request to target dev." && exit 1
- name: Send comment if wrong pull request target
if: github.base_ref == 'master'
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.number }}
body: |
Hey! This pull request targets the `master` branch. You should probably target `dev` instead. Make sure to read the [contributing guidelines](https://github.com/colobot/colobot/blob/master/CONTRIBUTING.md#submitting-pull-requests) and [edit the target branch if necessary](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-base-branch-of-a-pull-request).
- name: Wrong pull request target
if: github.base_ref == 'master'
run: echo "This pull request targets the master branch. Please edit the pull request to target dev." && exit 1
- name: Correct pull request target
if: github.base_ref != 'master'
run: echo "This pull request targets the correct branch." && exit 0
if: github.base_ref != 'master'

6
.gitignore vendored
View File

@ -11,11 +11,12 @@ Makefile
/src/libcolobotbase.a
# Ignore the generated documentation
CMakeDoxyfile.in
CMakeDoxygenDefaults.cmake
/doc
/Doxyfile
# Ignore targets
/colobot
/src/CBot/libCBot.so
# Ignore local data
@ -46,3 +47,6 @@ CMakeLists.txt.user.*
/CMakeSettings.json
/.vs
/out
# Ignore CMakeUserPresets.json
CMakeUserPresets.json

11
.gitmodules vendored
View File

@ -1,3 +1,12 @@
[submodule "data"]
path = data
url = git://github.com/colobot/colobot-data.git
url = https://github.com/colobot/colobot-data.git
branch = .
update = rebase
[submodule "lib/googletest"]
path = lib/googletest
url = https://github.com/google/googletest.git
ignore = all
[submodule "lib/json"]
path = lib/json
url = https://github.com/nlohmann/json

175
CBot/CMakeLists.txt Normal file
View File

@ -0,0 +1,175 @@
if(CBOT_STATIC)
add_library(CBot STATIC)
else()
add_library(CBot SHARED)
install(TARGETS CBot
LIBRARY DESTINATION ${COLOBOT_INSTALL_LIB_DIR}
ARCHIVE DESTINATION ${COLOBOT_INSTALL_LIB_DIR}
RUNTIME DESTINATION ${COLOBOT_INSTALL_BIN_DIR})
endif()
target_sources(CBot PRIVATE
src/CBot/CBot.h
src/CBot/CBotCStack.cpp
src/CBot/CBotCStack.h
src/CBot/CBotClass.cpp
src/CBot/CBotClass.h
src/CBot/CBotDebug.cpp
src/CBot/CBotDebug.h
src/CBot/CBotDefParam.cpp
src/CBot/CBotDefParam.h
src/CBot/CBotDefines.h
src/CBot/CBotEnums.h
src/CBot/CBotExternalCall.cpp
src/CBot/CBotExternalCall.h
src/CBot/CBotFileUtils.cpp
src/CBot/CBotFileUtils.h
src/CBot/CBotInstr/CBotBlock.cpp
src/CBot/CBotInstr/CBotBlock.h
src/CBot/CBotInstr/CBotBoolExpr.cpp
src/CBot/CBotInstr/CBotBoolExpr.h
src/CBot/CBotInstr/CBotBreak.cpp
src/CBot/CBotInstr/CBotBreak.h
src/CBot/CBotInstr/CBotCase.cpp
src/CBot/CBotInstr/CBotCase.h
src/CBot/CBotInstr/CBotCatch.cpp
src/CBot/CBotInstr/CBotCatch.h
src/CBot/CBotInstr/CBotCondition.cpp
src/CBot/CBotInstr/CBotCondition.h
src/CBot/CBotInstr/CBotDefArray.cpp
src/CBot/CBotInstr/CBotDefArray.h
src/CBot/CBotInstr/CBotDefBoolean.cpp
src/CBot/CBotInstr/CBotDefBoolean.h
src/CBot/CBotInstr/CBotDefClass.cpp
src/CBot/CBotInstr/CBotDefClass.h
src/CBot/CBotInstr/CBotDefFloat.cpp
src/CBot/CBotInstr/CBotDefFloat.h
src/CBot/CBotInstr/CBotDefInt.cpp
src/CBot/CBotInstr/CBotDefInt.h
src/CBot/CBotInstr/CBotDefString.cpp
src/CBot/CBotInstr/CBotDefString.h
src/CBot/CBotInstr/CBotDo.cpp
src/CBot/CBotInstr/CBotDo.h
src/CBot/CBotInstr/CBotEmpty.cpp
src/CBot/CBotInstr/CBotEmpty.h
src/CBot/CBotInstr/CBotExprLitBool.cpp
src/CBot/CBotInstr/CBotExprLitBool.h
src/CBot/CBotInstr/CBotExprLitChar.cpp
src/CBot/CBotInstr/CBotExprLitChar.h
src/CBot/CBotInstr/CBotExprLitNan.cpp
src/CBot/CBotInstr/CBotExprLitNan.h
src/CBot/CBotInstr/CBotExprLitNull.cpp
src/CBot/CBotInstr/CBotExprLitNull.h
src/CBot/CBotInstr/CBotExprLitNum.cpp
src/CBot/CBotInstr/CBotExprLitNum.h
src/CBot/CBotInstr/CBotExprLitString.cpp
src/CBot/CBotInstr/CBotExprLitString.h
src/CBot/CBotInstr/CBotExprRetVar.cpp
src/CBot/CBotInstr/CBotExprRetVar.h
src/CBot/CBotInstr/CBotExprUnaire.cpp
src/CBot/CBotInstr/CBotExprUnaire.h
src/CBot/CBotInstr/CBotExprVar.cpp
src/CBot/CBotInstr/CBotExprVar.h
src/CBot/CBotInstr/CBotExpression.cpp
src/CBot/CBotInstr/CBotExpression.h
src/CBot/CBotInstr/CBotFieldExpr.cpp
src/CBot/CBotInstr/CBotFieldExpr.h
src/CBot/CBotInstr/CBotFor.cpp
src/CBot/CBotInstr/CBotFor.h
src/CBot/CBotInstr/CBotFunction.cpp
src/CBot/CBotInstr/CBotFunction.h
src/CBot/CBotInstr/CBotIf.cpp
src/CBot/CBotInstr/CBotIf.h
src/CBot/CBotInstr/CBotIndexExpr.cpp
src/CBot/CBotInstr/CBotIndexExpr.h
src/CBot/CBotInstr/CBotInstr.cpp
src/CBot/CBotInstr/CBotInstr.h
src/CBot/CBotInstr/CBotInstrCall.cpp
src/CBot/CBotInstr/CBotInstrCall.h
src/CBot/CBotInstr/CBotInstrMethode.cpp
src/CBot/CBotInstr/CBotInstrMethode.h
src/CBot/CBotInstr/CBotInstrUtils.cpp
src/CBot/CBotInstr/CBotInstrUtils.h
src/CBot/CBotInstr/CBotLeftExpr.cpp
src/CBot/CBotInstr/CBotLeftExpr.h
src/CBot/CBotInstr/CBotLeftExprVar.cpp
src/CBot/CBotInstr/CBotLeftExprVar.h
src/CBot/CBotInstr/CBotListArray.cpp
src/CBot/CBotInstr/CBotListArray.h
src/CBot/CBotInstr/CBotListExpression.cpp
src/CBot/CBotInstr/CBotListExpression.h
src/CBot/CBotInstr/CBotListInstr.cpp
src/CBot/CBotInstr/CBotListInstr.h
src/CBot/CBotInstr/CBotLogicExpr.cpp
src/CBot/CBotInstr/CBotLogicExpr.h
src/CBot/CBotInstr/CBotNew.cpp
src/CBot/CBotInstr/CBotNew.h
src/CBot/CBotInstr/CBotParExpr.cpp
src/CBot/CBotInstr/CBotParExpr.h
src/CBot/CBotInstr/CBotPostIncExpr.cpp
src/CBot/CBotInstr/CBotPostIncExpr.h
src/CBot/CBotInstr/CBotPreIncExpr.cpp
src/CBot/CBotInstr/CBotPreIncExpr.h
src/CBot/CBotInstr/CBotRepeat.cpp
src/CBot/CBotInstr/CBotRepeat.h
src/CBot/CBotInstr/CBotReturn.cpp
src/CBot/CBotInstr/CBotReturn.h
src/CBot/CBotInstr/CBotSwitch.cpp
src/CBot/CBotInstr/CBotSwitch.h
src/CBot/CBotInstr/CBotThrow.cpp
src/CBot/CBotInstr/CBotThrow.h
src/CBot/CBotInstr/CBotTry.cpp
src/CBot/CBotInstr/CBotTry.h
src/CBot/CBotInstr/CBotTwoOpExpr.cpp
src/CBot/CBotInstr/CBotTwoOpExpr.h
src/CBot/CBotInstr/CBotWhile.cpp
src/CBot/CBotInstr/CBotWhile.h
src/CBot/CBotProgram.cpp
src/CBot/CBotProgram.h
src/CBot/CBotStack.cpp
src/CBot/CBotStack.h
src/CBot/CBotToken.cpp
src/CBot/CBotToken.h
src/CBot/CBotTypResult.cpp
src/CBot/CBotTypResult.h
src/CBot/CBotUtils.cpp
src/CBot/CBotUtils.h
src/CBot/CBotVar/CBotVar.cpp
src/CBot/CBotVar/CBotVar.h
src/CBot/CBotVar/CBotVarValue.h
src/CBot/CBotVar/CBotVarArray.cpp
src/CBot/CBotVar/CBotVarArray.h
src/CBot/CBotVar/CBotVarBoolean.cpp
src/CBot/CBotVar/CBotVarBoolean.h
src/CBot/CBotVar/CBotVarByte.h
src/CBot/CBotVar/CBotVarChar.h
src/CBot/CBotVar/CBotVarClass.cpp
src/CBot/CBotVar/CBotVarClass.h
src/CBot/CBotVar/CBotVarDouble.h
src/CBot/CBotVar/CBotVarFloat.cpp
src/CBot/CBotVar/CBotVarFloat.h
src/CBot/CBotVar/CBotVarInt.cpp
src/CBot/CBotVar/CBotVarInt.h
src/CBot/CBotVar/CBotVarLong.h
src/CBot/CBotVar/CBotVarPointer.cpp
src/CBot/CBotVar/CBotVarPointer.h
src/CBot/CBotVar/CBotVarShort.h
src/CBot/CBotVar/CBotVarString.cpp
src/CBot/CBotVar/CBotVarString.h
src/CBot/stdlib/Compilation.cpp
src/CBot/stdlib/Compilation.h
src/CBot/stdlib/FileFunctions.cpp
src/CBot/stdlib/MathFunctions.cpp
src/CBot/stdlib/StringFunctions.cpp
src/CBot/stdlib/stdlib.h
src/CBot/stdlib/stdlib_public.h
)
target_include_directories(CBot PUBLIC src)
target_link_libraries(CBot PRIVATE
Colobot-Common
)
if(COLOBOT_LINT_BUILD)
add_fake_header_sources("src/CBot" CBot)
endif()

View File

@ -1,9 +1,10 @@
/**
* \dir src/CBot
* \dir CBot
* \brief CBot library
*/
/**
* \namespace CBot
* \brief CBot engine
*/
*/

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -31,107 +31,100 @@
namespace CBot
{
////////////////////////////////////////////////////////////////////////////////
CBotProgram* CBotCStack::m_prog = nullptr; // init the static variable
CBotError CBotCStack::m_error = CBotNoErr;
int CBotCStack::m_end = 0;
CBotTypResult CBotCStack::m_retTyp = CBotTypResult(0);
struct CBotCStack::Data
{
//! The program currently being compiled
CBotProgram* prog = nullptr;
//! The current error state of the compile stack
CBotError error = CBotNoErr;
int errEnd = 0;
//! The return type of the function currently being compiled
CBotTypResult retTyp = CBotTypResult(CBotTypVoid);
};
////////////////////////////////////////////////////////////////////////////////
CBotCStack::CBotCStack(CBotCStack* ppapa)
{
m_next = nullptr;
m_prev = ppapa;
if (ppapa == nullptr)
{
m_error = CBotNoErr;
m_start = 0;
m_end = 0;
m_data = new CBotCStack::Data;
m_errStart = 0;
m_bBlock = true;
}
else
{
m_start = ppapa->m_start;
m_data = ppapa->m_data;
m_errStart = ppapa->m_errStart;
m_bBlock = false;
}
m_listVar = nullptr;
m_var = nullptr;
}
////////////////////////////////////////////////////////////////////////////////
CBotCStack::~CBotCStack()
{
if (m_next != nullptr) delete m_next;
if (m_prev != nullptr) m_prev->m_next = nullptr; // removes chain
delete m_var;
delete m_listVar;
if (m_prev == nullptr) delete m_data;
}
////////////////////////////////////////////////////////////////////////////////
CBotCStack* CBotCStack::TokenStack(CBotToken* pToken, bool bBlock)
{
if (m_next != nullptr) return m_next; // include on an existing stack
if (m_next) return m_next.get(); // include on an existing stack
CBotCStack* p = new CBotCStack(this);
m_next = p; // channel element
p->m_bBlock = bBlock;
m_next.reset(new CBotCStack(this));
m_next->m_bBlock = bBlock;
if (pToken != nullptr) p->SetStartError(pToken->GetStart());
if (pToken != nullptr) m_next->SetStartError(pToken->GetStart());
return p;
return m_next.get();
}
void CBotCStack::DeleteNext()
{
m_next.reset();
}
////////////////////////////////////////////////////////////////////////////////
CBotInstr* CBotCStack::Return(CBotInstr* inst, CBotCStack* pfils)
{
if ( pfils == this ) return inst;
if (m_var != nullptr) delete m_var; // value replaced?
m_var = pfils->m_var; // result transmitted
pfils->m_var = nullptr; // not to destroy the variable
m_var = std::move(pfils->m_var); // result transmitted
if (m_error)
if (m_data->error != CBotNoErr)
{
m_start = pfils->m_start; // retrieves the position of the error
m_end = pfils->m_end;
m_errStart = pfils->m_errStart; // retrieves the position of the error
}
delete pfils;
m_next.reset();
return inst;
}
////////////////////////////////////////////////////////////////////////////////
CBotFunction* CBotCStack::ReturnFunc(CBotFunction* inst, CBotCStack* pfils)
{
if (m_var != nullptr) delete m_var; // value replaced?
m_var = pfils->m_var; // result transmitted
pfils->m_var = nullptr; // not to destroy the variable
m_var = std::move(pfils->m_var); // result transmitted
if (m_error)
if (m_data->error != CBotNoErr)
{
m_start = pfils->m_start; // retrieves the position of the error
m_end = pfils->m_end;
m_errStart = pfils->m_errStart; // retrieves the position of the error
}
delete pfils;
m_next.reset();
return inst;
}
////////////////////////////////////////////////////////////////////////////////
CBotError CBotCStack::GetError(int& start, int& end)
{
start = m_start;
end = m_end;
return m_error;
start = m_errStart;
end = m_data->errEnd;
return m_data->error;
}
////////////////////////////////////////////////////////////////////////////////
CBotError CBotCStack::GetError()
{
return m_error;
return m_data->error;
}
////////////////////////////////////////////////////////////////////////////////
@ -171,18 +164,13 @@ void CBotCStack::SetType(CBotTypResult& type)
CBotVar* CBotCStack::FindVar(CBotToken* &pToken)
{
CBotCStack* p = this;
std::string name = pToken->GetString();
const auto& name = pToken->GetString();
while (p != nullptr)
{
CBotVar* pp = p->m_listVar;
while ( pp != nullptr)
if (p->m_bBlock) for (auto& var : p->m_listVar)
{
if (name == pp->GetName())
{
return pp;
}
pp = pp->m_next;
if (name == var->GetName()) return var.get();
}
p = p->m_prev;
}
@ -211,39 +199,39 @@ CBotVar* CBotCStack::CopyVar(CBotToken& Token)
////////////////////////////////////////////////////////////////////////////////
bool CBotCStack::IsOk()
{
return (m_error == 0);
return (m_data->error == CBotNoErr);
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetStartError( int pos )
{
if ( m_error != 0) return; // does not change existing error
m_start = pos;
if (m_data->error != CBotNoErr) return; // does not change existing error
m_errStart = pos;
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetError(CBotError n, int pos)
{
if ( n!= 0 && m_error != 0) return; // does not change existing error
m_error = n;
m_end = pos;
if (n != CBotNoErr && m_data->error != CBotNoErr) return; // does not change existing error
m_data->error = n;
m_data->errEnd = pos;
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetError(CBotError n, CBotToken* p)
{
if (m_error) return; // does not change existing error
m_error = n;
m_start = p->GetStart();
m_end = p->GetEnd();
if (m_data->error != CBotNoErr) return; // does not change existing error
m_data->error = n;
m_errStart = p->GetStart();
m_data->errEnd = p->GetEnd();
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::ResetError(CBotError n, int start, int end)
{
m_error = n;
m_start = start;
m_end = end;
m_data->error = n;
m_errStart = start;
m_data->errEnd = end;
}
////////////////////////////////////////////////////////////////////////////////
@ -261,48 +249,47 @@ bool CBotCStack::NextToken(CBotToken* &p)
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetProgram(CBotProgram* p)
{
m_prog = p;
m_data->prog = p;
}
////////////////////////////////////////////////////////////////////////////////
CBotProgram* CBotCStack::GetProgram()
{
return m_prog;
return m_data->prog;
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetRetType(CBotTypResult& type)
{
m_retTyp = type;
m_data->retTyp = type;
}
////////////////////////////////////////////////////////////////////////////////
CBotTypResult CBotCStack::GetRetType()
{
return m_retTyp;
return m_data->retTyp;
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetVar( CBotVar* var )
{
if (m_var) delete m_var; // replacement of a variable
m_var = var;
m_var.reset(var);
}
////////////////////////////////////////////////////////////////////////////////
void CBotCStack::SetCopyVar( CBotVar* var )
{
if (m_var) delete m_var; // replacement of a variable
m_var.reset();
if ( var == nullptr ) return;
m_var = CBotVar::Create("", var->GetTypResult(CBotVar::GetTypeMode::CLASS_AS_INTRINSIC));
m_var.reset(CBotVar::Create("", var->GetTypResult(CBotVar::GetTypeMode::CLASS_AS_INTRINSIC)));
m_var->Copy( var );
}
////////////////////////////////////////////////////////////////////////////////
CBotVar* CBotCStack::GetVar()
{
return m_var;
return m_var.get();
}
////////////////////////////////////////////////////////////////////////////////
@ -310,15 +297,12 @@ void CBotCStack::AddVar(CBotVar* pVar)
{
CBotCStack* p = this;
// returns to the father element
// find the level of the current block
while (p != nullptr && p->m_bBlock == 0) p = p->m_prev;
if ( p == nullptr ) return;
if (p == nullptr || pVar == nullptr) return;
CBotVar** pp = &p->m_listVar;
while ( *pp != nullptr ) pp = &(*pp)->m_next;
*pp = pVar; // added after
p->m_listVar.emplace_back(pVar);
}
////////////////////////////////////////////////////////////////////////////////
@ -369,19 +353,14 @@ void CBotCStack::CreateMemberVars(CBotClass* pClass, bool setDefined)
bool CBotCStack::CheckVarLocal(CBotToken* &pToken)
{
CBotCStack* p = this;
std::string name = pToken->GetString();
const auto& name = pToken->GetString();
while (p != nullptr)
// find the level of the current block
while (p != nullptr && p->m_bBlock == 0) p = p->m_prev;
if (p != nullptr) for (auto& var : p->m_listVar)
{
CBotVar* pp = p->m_listVar;
while ( pp != nullptr)
{
if (name == pp->GetName())
return true;
pp = pp->m_next;
}
if ( p->m_bBlock ) return false;
p = p->m_prev;
if (name == var->GetName()) return true;
}
return false;
}
@ -392,10 +371,10 @@ CBotTypResult CBotCStack::CompileCall(CBotToken* &p, CBotVar** ppVars, long& nId
nIdent = 0;
CBotTypResult val(-1);
val = m_prog->GetExternalCalls()->CompileCall(p, nullptr, ppVars, this);
val = GetProgram()->GetExternalCalls()->CompileCall(p, nullptr, ppVars, this);
if (val.GetType() < 0)
{
val = CBotFunction::CompileCall(p->GetString(), ppVars, nIdent, m_prog);
val = CBotFunction::CompileCall(p->GetString(), ppVars, nIdent, GetProgram());
if ( val.GetType() < 0 )
{
// pVar = nullptr; // the error is not on a particular parameter
@ -410,13 +389,13 @@ CBotTypResult CBotCStack::CompileCall(CBotToken* &p, CBotVar** ppVars, long& nId
////////////////////////////////////////////////////////////////////////////////
bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam, const std::string& className)
{
std::string name = pToken->GetString();
const auto& name = pToken->GetString();
if ( m_prog->GetExternalCalls()->CheckCall(name) ) return true;
if ( GetProgram()->GetExternalCalls()->CheckCall(name) ) return true;
for (CBotFunction* pp : m_prog->GetFunctions())
for (CBotFunction* pp : GetProgram()->GetFunctions())
{
if ( pToken->GetString() == pp->GetName() )
if ( name == pp->GetName() )
{
// ignore methods for a different class
if ( className != pp->GetClassName() )
@ -429,7 +408,7 @@ bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam, const std::
for (CBotFunction* pp : CBotFunction::m_publicFunctions)
{
if ( pToken->GetString() == pp->GetName() )
if ( name == pp->GetName() )
{
// ignore methods for a different class
if ( className != pp->GetClassName() )
@ -443,4 +422,4 @@ bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam, const std::
return false;
}
}
} // namespace CBot

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -22,6 +22,9 @@
#include "CBot/CBotVar/CBotVar.h"
#include "CBot/CBotProgram.h"
#include <list>
#include <memory>
namespace CBot
{
@ -157,6 +160,11 @@ public:
*/
CBotCStack* TokenStack(CBotToken* pToken = nullptr, bool bBlock = false);
/*!
* \brief Deletes all subsequent stack frames created by TokenStack.
*/
void DeleteNext();
/*!
* \brief Return Transmits the result upper.
* \param p
@ -269,21 +277,20 @@ public:
bool NextToken(CBotToken* &p);
private:
CBotCStack* m_next;
std::unique_ptr<CBotCStack> m_next;
CBotCStack* m_prev;
static CBotError m_error;
static int m_end;
int m_start;
int m_errStart = 0;
struct Data;
CBotCStack::Data* m_data;
//! Result of the operations.
CBotVar* m_var;
std::unique_ptr<CBotVar> m_var;
//! Is part of a block (variables are local to this block).
bool m_bBlock;
CBotVar* m_listVar;
//! List of compiled functions.
static CBotProgram* m_prog;
static CBotTypResult m_retTyp;
std::list<std::unique_ptr<CBotVar>> m_listVar;
};
} // namespace CBot

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -605,8 +605,8 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
// return a method precompiled in pass 1
CBotCStack* pStk = pStack->TokenStack(nullptr, true);
CBotDefParam* params = CBotDefParam::Compile(p, pStk );
delete pStk;
std::list<CBotFunction*>::iterator pfIter = std::find_if(m_pMethod.begin(), m_pMethod.end(), [&pp, &params](CBotFunction* x)
pStack->DeleteNext();
auto pfIter = std::find_if(m_pMethod.begin(), m_pMethod.end(), [&pp, &params](CBotFunction* x)
{
return x->GetName() == pp && x->CheckParam( params );
});
@ -626,7 +626,7 @@ bool CBotClass::CompileDefItem(CBotToken* &p, CBotCStack* pStack, bool bSecond)
f->m_pProg = pStack->GetProgram();
f->m_bSynchro = bSynchro;
}
pStack->Return(nullptr, pile);
pStack->DeleteNext();
}
return pStack->IsOk();

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -23,11 +23,11 @@
#include "CBot/CBotInstr/CBotFunction.h"
#include "CBot/CBotInstr/CBotInstrCall.h"
#include <array>
#include <functional>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <boost/algorithm/string/replace.hpp>
namespace CBot
{
@ -53,22 +53,34 @@ void CBotDebug::DumpCompiledProgram(CBotProgram* program)
instructions[ptr] = instructionsNextId++;
}
char buffer[20];
sprintf(buffer, "instr%d", instructions[ptr]);
return std::string(buffer);
std::array<char, 20> buffer;
snprintf(buffer.data(), buffer.size(), "instr%d", instructions[ptr]);
return std::string(buffer.data());
};
std::function<void(CBotInstr*)> DumpInstr = [&](CBotInstr* instr)
{
if (finished.find(instr) != finished.end()) return;
finished.insert(instr);
std::string label = "<b>"+instr->GetDebugName()+"</b>\n";
auto replaceAll = [](std::string& text, const std::string& from, const std::string& to)
{
std::size_t pos = 0;
while ((pos = text.find(from, pos)) != std::string::npos)
{
text.replace(pos, from.length(), to);
pos += to.length();
}
};
std::string data = instr->GetDebugData();
boost::algorithm::replace_all(data, "&", "&amp;");
boost::algorithm::replace_all(data, "<", "&lt;");
boost::algorithm::replace_all(data, ">", "&gt;");
replaceAll(data, "&", "&amp;");
replaceAll(data, "<", "&lt;");
replaceAll(data, ">", "&gt;");
std::string label = "<b>"+instr->GetDebugName()+"</b>\n";
label += data;
boost::algorithm::replace_all(label, "\n", "<br/>");
replaceAll(label, "\n", "<br/>");
std::string additional = "";
if (instr->GetDebugName() == "CBotFunction")

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -94,7 +94,7 @@ CBotDefParam* CBotDefParam::Compile(CBotToken* &p, CBotCStack* pStack)
prevHasDefault = true;
}
else pStack->SetError(CBotErrNoExpression, p);
delete pStk;
pStack->DeleteNext();
}
else
if (prevHasDefault) pStack->SetError(CBotErrDefaultValue, p->GetPrev());
@ -137,6 +137,7 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
while ( p != nullptr )
{
pile = pile->AddStack();
if (pile->StackOver()) return pj->Return(pile);
if (pile->GetState() == 1) // already done?
{
if (ppVars != nullptr && ppVars[i] != nullptr) ++i;

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -100,6 +100,7 @@ enum TokenId
ID_STATIC,
ID_PROTECTED,
ID_PRIVATE,
ID_REPEAT,
ID_INT,
ID_FLOAT,
ID_BOOLEAN,

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -82,19 +82,23 @@ int CBotExternalCallList::DoCall(CBotToken* token, CBotVar* thisVar, CBotVar** p
CBotExternalCall* pt = m_list[token->GetString()].get();
if (pStack->IsCallFinished()) return true;
CBotStack* pile = pStack->AddStackExternalCall(pt);
if (thisVar == nullptr && pStack->IsCallFinished()) return true; // only for non-method external call
// lists the parameters depending on the contents of the stack (pStackVar)
CBotVar* pVar = MakeListVars(ppVar, true);
// if this is a method call we need to use AddStack()
CBotStack* pile = (thisVar != nullptr) ? pStack->AddStack() : pStack->AddStackExternalCall(pt);
// creates a variable to the result
CBotVar* pResult = rettype.Eq(CBotTypVoid) ? nullptr : CBotVar::Create("", rettype);
if (pile->GetState() == 0) // the first time?
{
// lists the parameters depending on the contents of the stack
CBotVar* pVar = MakeListVars(ppVar, true);
pile->SetVar(pVar);
pile->SetVar(pVar);
CBotStack* pile2 = pile->AddStack();
pile2->SetVar(pResult);
CBotStack* pile2 = pile->AddStack();
// creates a variable to the result
CBotVar* pResult = rettype.Eq(CBotTypVoid) ? nullptr : CBotVar::Create("", rettype);
pile2->SetVar(pResult);
pile->IncState(); // increment state to mark this step done
}
pile->SetError(CBotNoErr, token); // save token for the position in case of error
return pt->Run(thisVar, pStack);
@ -107,7 +111,8 @@ bool CBotExternalCallList::RestoreCall(CBotToken* token, CBotVar* thisVar, CBotV
CBotExternalCall* pt = m_list[token->GetString()].get();
CBotStack* pile = pStack->RestoreStackEOX(pt);
// if this is a method call we need to use RestoreStack()
CBotStack* pile = (thisVar != nullptr) ? pStack->RestoreStack() : pStack->RestoreStackEOX(pt);
if (pile == nullptr) return true;
pile->RestoreStack();
@ -163,8 +168,7 @@ bool CBotExternalCallDefault::Run(CBotVar* thisVar, CBotStack* pStack)
return false;
}
if (result != nullptr) pStack->SetCopyVar(result);
pStack->Return(pile2); // return 'result' and clear extra stack
return true;
}
@ -187,8 +191,8 @@ CBotTypResult CBotExternalCallClass::Compile(CBotVar* thisVar, CBotVar* args, vo
bool CBotExternalCallClass::Run(CBotVar* thisVar, CBotStack* pStack)
{
if (pStack->IsCallFinished()) return true;
CBotStack* pile = pStack->AddStackExternalCall(this);
assert(thisVar != nullptr);
CBotStack* pile = pStack->AddStack();
CBotVar* args = pile->GetVar();
CBotStack* pile2 = pile->AddStack();
@ -207,9 +211,8 @@ bool CBotExternalCallClass::Run(CBotVar* thisVar, CBotStack* pStack)
return false;
}
if (result != nullptr) pStack->SetCopyVar(result);
pStack->Return(pile2); // return 'result' and clear extra stack
return true;
}
}
} // namespace CBot

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -59,7 +59,7 @@ static bool ReadBinary(std::istream &istr, T &value)
while (true) // unsigned LEB128
{
if (!istr.read(reinterpret_cast<char*>(&chr), 1)) return false;
if (shift < sizeof(T) * 8 - 1)
if (shift < sizeof(T) * 8)
value |= static_cast<T>(chr & 0x7F) << shift;
shift += 7;
if ((chr & 0x80) == 0) break;
@ -186,7 +186,7 @@ bool WriteFloat(std::ostream &ostr, float f)
union TypeConverter
{
float fValue;
unsigned int iValue;
uint32_t iValue;
};
TypeConverter u;
@ -194,7 +194,7 @@ bool WriteFloat(std::ostream &ostr, float f)
u.iValue = 0;
u.fValue = f;
return WriteBinary<unsigned int>(ostr, u.iValue);
return WriteBinary<uint32_t>(ostr, u.iValue);
}
bool ReadFloat(std::istream &istr, float &f)
@ -202,14 +202,14 @@ bool ReadFloat(std::istream &istr, float &f)
union TypeConverter
{
float fValue;
unsigned int iValue;
uint32_t iValue;
};
TypeConverter u;
u.fValue = 0.0f;
u.iValue = 0;
if (!ReadBinary<unsigned int>(istr, u.iValue)) return false;
if (!ReadBinary<uint32_t>(istr, u.iValue)) return false;
f = u.fValue;
return true;
}
@ -219,7 +219,7 @@ bool WriteDouble(std::ostream &ostr, double d)
union TypeConverter
{
double dValue;
unsigned long iValue;
uint64_t iValue;
};
TypeConverter u;
@ -227,7 +227,7 @@ bool WriteDouble(std::ostream &ostr, double d)
u.iValue = 0;
u.dValue = d;
return WriteBinary<unsigned long>(ostr, u.iValue);
return WriteBinary<uint64_t>(ostr, u.iValue);
}
bool ReadDouble(std::istream &istr, double &d)
@ -235,14 +235,14 @@ bool ReadDouble(std::istream &istr, double &d)
union TypeConverter
{
double dValue;
unsigned long iValue;
uint64_t iValue;
};
TypeConverter u;
u.dValue = 0.0;
u.iValue = 0;
if (!ReadBinary<unsigned long>(istr, u.iValue)) return false;
if (!ReadBinary<uint64_t>(istr, u.iValue)) return false;
d = u.dValue;
return true;
}
@ -342,7 +342,11 @@ bool WriteStream(std::ostream &ostr, std::istream& istr)
if (!WriteLong(ostr, size)) return false;
if (!istr.seekg(0, istr.beg)) return false;
if (!(ostr << istr.rdbuf())) return false;
while (size > 0)
{
size -= 1;
if (!ostr.put(istr.get())) return false;
}
return true;
}
@ -355,7 +359,7 @@ bool ReadStream(std::istream& istr, std::ostream &ostr)
while (length-- > 0)
{
if (!(ostr << istr.get())) return false;
if (!ostr.put(istr.get())) return false;
}
return true;
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -19,6 +19,7 @@
#pragma once
#include <cstdint>
#include <iostream>
#include <string>

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -135,7 +135,7 @@ CBotInstr* CBotDefClass::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* p
// the constructor is there?
// std::string noname;
CBotTypResult r = pClass->CompileMethode(&token, var, ppVars, pStk, inst->m_nMethodeIdent);
delete pStk->TokenStack(); // releases the supplement stack
pStk->DeleteNext(); // releases the supplement stack
int typ = r.GetType();
if (typ == CBotErrUndefCall)
@ -160,7 +160,7 @@ CBotInstr* CBotDefClass::Compile(CBotToken* &p, CBotCStack* pStack, CBotClass* p
if (nullptr != (inst->m_exprRetVar = CBotExprRetVar::Compile(p, pStk, true)))
{
inst->m_exprRetVar->SetToken(vartoken);
delete pStk->TokenStack();
pStk->DeleteNext();
}
pStk->SetVar(nullptr);
@ -360,6 +360,7 @@ bool CBotDefClass::Execute(CBotStack* &pj)
if ( p != nullptr) while ( true )
{
pile2 = pile2->AddStack(); // place on the stack for the results
if (pile2->StackOver()) return pj->Return(pile2);
if ( pile2->GetState() == 0 )
{
if (!p->Execute(pile2)) return false; // interrupted here?

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -21,6 +21,8 @@
#include "CBot/CBotInstr/CBotInstr.h"
#include <cstdint>
namespace CBot
{

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -23,6 +23,8 @@
#include "CBot/CBotVar/CBotVar.h"
#include <cmath>
namespace CBot
{
@ -41,9 +43,9 @@ bool CBotExprLitNan::Execute(CBotStack* &pj)
CBotStack* pile = pj->AddStack(this);
if (pile->IfStep()) return false;
CBotVar* var = CBotVar::Create("", CBotTypInt);
CBotVar* var = CBotVar::Create("", CBotTypFloat);
var->SetInit(CBotVar::InitType::IS_NAN); // nan
var->SetValFloat(nanf(""));
pile->SetVar(var); // put on the stack
return pj->Return(pile); // forward below
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -206,12 +206,6 @@ bool CBotExpression::Execute(CBotStack* &pj)
if (m_token.GetType() != ID_ASS)
{
pVar = pile1->GetVar(); // recovers if interrupted
initKind = pVar->GetInit();
if (initKind == CBotVar::InitType::IS_NAN)
{
pile2->SetError(CBotErrNan, m_leftop->GetToken());
return pj->Return(pile2);
}
result = CBotVar::Create("", pVar->GetTypResult(CBotVar::GetTypeMode::CLASS_AS_INTRINSIC));
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -445,7 +445,7 @@ bool CBotFunction::Execute(CBotVar** ppVars, CBotStack* &pj, CBotVar* pInstance)
pile->IncState();
}
if ( !m_block->Execute(pile) )
if (!pile->GetRetVar(m_block->Execute(pile)))
{
if ( pile->GetError() < 0 )
pile->SetError( CBotNoErr );

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -30,6 +30,7 @@
#include "CBot/CBotInstr/CBotExpression.h"
#include "CBot/CBotInstr/CBotFor.h"
#include "CBot/CBotInstr/CBotIf.h"
#include "CBot/CBotInstr/CBotRepeat.h"
#include "CBot/CBotInstr/CBotReturn.h"
#include "CBot/CBotInstr/CBotSwitch.h"
#include "CBot/CBotInstr/CBotThrow.h"
@ -176,7 +177,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
{
type = pp->GetType();
// Allow only instructions that accept a label
if (!IsOfTypeList(pp, ID_WHILE, ID_FOR, ID_DO, 0))
if (!IsOfTypeList(pp, ID_WHILE, ID_FOR, ID_DO, ID_REPEAT, 0))
{
pStack->SetError(CBotErrLabel, pp->GetStart());
return nullptr;
@ -195,6 +196,9 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
case ID_DO:
return CBotDo::Compile(p, pStack);
case ID_REPEAT:
return CBotRepeat::Compile(p, pStack);
case ID_BREAK:
case ID_CONTINUE:
return CBotBreak::Compile(p, pStack);

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -38,7 +38,7 @@ class CBotDebug;
* \endcode
* the following structure is generated:
* \dot
* # Generated using the CBot_compile_graph tool
* # Generated using the CBot-CompileGraph tool
* # and slightly modified
* digraph {
* start [label=<START> shape=box3d color=cyan]

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -78,12 +78,12 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
{
// if (pVar2!=nullptr) pp = pVar2->RetToken();
pStack->SetError( static_cast<CBotError>(inst->m_typRes.GetType()), pp );
delete pStack->TokenStack();
pStack->DeleteNext();
delete inst;
return nullptr;
}
delete pStack->TokenStack();
pStack->DeleteNext();
if ( inst->m_typRes.GetType() > 0 )
{
CBotVar* pRes = CBotVar::Create("", inst->m_typRes);
@ -94,7 +94,7 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
if (nullptr != (inst->m_exprRetVar = CBotExprRetVar::Compile(p, pStack)))
{
inst->m_exprRetVar->SetToken(&inst->m_token);
delete pStack->TokenStack();
pStack->DeleteNext();
}
if ( !pStack->IsOk() )
{
@ -105,7 +105,7 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
return inst;
}
p = pp;
delete pStack->TokenStack();
pStack->DeleteNext();
return nullptr;
}
@ -138,6 +138,7 @@ bool CBotInstrCall::Execute(CBotStack* &pj)
if ( p != nullptr) while ( true )
{
pile = pile->AddStack(); // place on the stack for the results
if (pile->StackOver()) return pj->Return(pile);
if ( pile->GetState() == 0 )
{
if (!p->Execute(pile)) return false; // interrupted here?

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -70,7 +70,7 @@ CBotInstr* CBotInstrMethode::Compile(CBotToken* &p, CBotCStack* pStack, CBotVar*
CBotClass* pClass = var->GetClass(); // pointer to the class
inst->m_className = pClass->GetName(); // name of the class
CBotTypResult r = pClass->CompileMethode(pp, var, ppVars, pStack, inst->m_MethodeIdent);
delete pStack->TokenStack(); // release parameters on the stack
pStack->DeleteNext(); // release parameters on the stack
inst->m_typRes = r;
if (inst->m_typRes.GetType() > 20)
@ -95,7 +95,7 @@ CBotInstr* CBotInstrMethode::Compile(CBotToken* &p, CBotCStack* pStack, CBotVar*
if (nullptr != (inst->m_exprRetVar = CBotExprRetVar::Compile(p, pStack, bMethodChain)))
{
inst->m_exprRetVar->SetToken(pp);
delete pStack->TokenStack();
pStack->DeleteNext();
}
if ( pStack->IsOk() )
@ -164,6 +164,7 @@ bool CBotInstrMethode::ExecuteVar(CBotVar* &pVar, CBotStack* &pj, CBotToken* pre
}
ppVars[i++] = pile2->GetVar(); // construct the list of pointers
pile2 = pile2->AddStack(); // space on the stack for the result
if (pile2->StackOver()) return pj->Return(pile2);
p = p->GetNext();
if ( p == nullptr) break;
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify
@ -65,7 +65,7 @@ CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars)
{
if (pile->GetTypResult().Eq(99))
{
delete pStack->TokenStack();
pStack->DeleteNext();
pStack->SetError(CBotErrVoid, p->GetStart());
return nullptr;
}
@ -78,7 +78,7 @@ CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars)
}
pStack->SetError(CBotErrClosePar, p->GetStart());
delete pStack->TokenStack();
pStack->DeleteNext();
return nullptr;
}
}

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* This file is part of the Colobot: Gold Edition source code
* Copyright (C) 2001-2020, Daniel Roux, EPSITEC SA & TerranovaTeam
* Copyright (C) 2001-2023, Daniel Roux, EPSITEC SA & TerranovaTeam
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
*
* This program is free software: you can redistribute it and/or modify

Some files were not shown because too many files have changed in this diff Show More