Compare commits
554 Commits
5eebe300fc
...
3a8f75bd02
Author | SHA1 | Date |
---|---|---|
|
3a8f75bd02 | |
|
32fed5af73 | |
![]() |
f07b7a1b60 | |
![]() |
0a95289f9f | |
![]() |
7d75b9cc14 | |
![]() |
909a2b2d2e | |
![]() |
7d22b607cc | |
![]() |
2f80292176 | |
![]() |
53b3062bee | |
![]() |
8e128ff08c | |
![]() |
3c4b9f6d01 | |
![]() |
9d5f88f07c | |
![]() |
b9c8d36d8b | |
![]() |
ff340fda92 | |
![]() |
c0d568241b | |
![]() |
d879fa5fc9 | |
![]() |
510fe6804a | |
![]() |
2b84da8a77 | |
![]() |
670cedd967 | |
![]() |
5a52c66b1f | |
![]() |
434bd0bd3a | |
![]() |
5f854da5fc | |
![]() |
86c2b2f0dc | |
![]() |
7fe75e20ad | |
![]() |
261eaa78e4 | |
![]() |
4d11040dba | |
![]() |
97ea5cc895 | |
![]() |
fe36b0fe29 | |
![]() |
8fab817118 | |
![]() |
8601066761 | |
![]() |
9586474fa8 | |
![]() |
5b79a4eb38 | |
![]() |
1034c2e45c | |
![]() |
fde2b901bd | |
![]() |
3e06584956 | |
![]() |
0ab9ae4b6e | |
![]() |
b296ee4d47 | |
![]() |
dccacd6352 | |
![]() |
b3c6e667f5 | |
![]() |
a48f13fb35 | |
![]() |
7db69f5d53 | |
![]() |
ae5e5b3874 | |
![]() |
b5b3f81840 | |
![]() |
fd81641cf7 | |
![]() |
840ded7e61 | |
![]() |
4c7e7280dd | |
![]() |
af1abfe41e | |
![]() |
8e950e5145 | |
![]() |
e807e7c984 | |
![]() |
d9d401e636 | |
![]() |
9a14d0c837 | |
![]() |
ee9f9d875d | |
![]() |
b12e5ad7cd | |
![]() |
ecb789d059 | |
![]() |
32fb105bca | |
![]() |
7d3e3c91e8 | |
![]() |
1b69589302 | |
![]() |
f7a33bbeb0 | |
![]() |
0ef77132a0 | |
![]() |
550193e570 | |
![]() |
beb29333d5 | |
![]() |
f9714c35f7 | |
![]() |
26598c4247 | |
![]() |
1ee0790785 | |
![]() |
6f05280ccb | |
![]() |
63b6bcf38d | |
![]() |
83b9ded0dc | |
![]() |
84ac0d3ba8 | |
![]() |
acc3c5ae5e | |
![]() |
ec0e735a3f | |
![]() |
a16771425a | |
![]() |
4fcd989e72 | |
![]() |
882672c0b5 | |
![]() |
b152bd5dea | |
![]() |
59600ae5c7 | |
![]() |
11f5073a3f | |
![]() |
cfa9a00024 | |
![]() |
9e1248e459 | |
![]() |
9ccc514a67 | |
![]() |
63ad09b615 | |
![]() |
1376d8b16d | |
![]() |
a04dcd8014 | |
![]() |
9c8a8f4cf4 | |
![]() |
dfac4209ef | |
![]() |
793ef3d0a4 | |
![]() |
0d57ac43bb | |
![]() |
3baf2bbb10 | |
![]() |
7c95855d4f | |
![]() |
dd2fbd2675 | |
![]() |
8eaebb8c84 | |
![]() |
172e1fbff0 | |
![]() |
461f1e2240 | |
![]() |
7c40c10b7a | |
![]() |
017a1571f7 | |
![]() |
f672e89201 | |
![]() |
9417b916da | |
![]() |
4f0854068c | |
![]() |
3171dc4a89 | |
![]() |
10b89e36f9 | |
![]() |
080c46daa1 | |
![]() |
b3d19a9e8d | |
![]() |
1bb918ce23 | |
![]() |
160a4a4f75 | |
![]() |
71e3e78644 | |
![]() |
6e7dee74cf | |
![]() |
8f11fc0126 | |
![]() |
5f9b14f43d | |
![]() |
b66ea8bcee | |
![]() |
37b403c46d | |
![]() |
2e7bf2a7a6 | |
![]() |
4b1b20ec5f | |
![]() |
d24a6b37a4 | |
![]() |
4531dc432e | |
![]() |
06bf44da38 | |
![]() |
9dd0159585 | |
![]() |
158901ff02 | |
![]() |
9a01408eda | |
![]() |
7c0dbd914f | |
![]() |
b990ee81ff | |
![]() |
bfd9dae533 | |
![]() |
cbfcbae7ab | |
![]() |
2e95aeac9b | |
![]() |
efbd296fc3 | |
![]() |
9c5d9d8f17 | |
![]() |
0b978f7dbc | |
![]() |
4634461c1d | |
![]() |
1c9c0929da | |
![]() |
24622e6a75 | |
![]() |
f60c62f05d | |
![]() |
ec9607784c | |
![]() |
5efd8342ec | |
![]() |
0618174b2b | |
![]() |
d47e265863 | |
![]() |
436c316a4a | |
![]() |
1d8e06c7ba | |
![]() |
21b6572b5b | |
![]() |
3b3cdb9961 | |
![]() |
bedd24801c | |
![]() |
983a9a6e03 | |
![]() |
2f50470591 | |
![]() |
5feffc70df | |
![]() |
e3ba33a508 | |
![]() |
b7cb26822b | |
![]() |
0e53336d61 | |
![]() |
0df78e7fa6 | |
![]() |
789c8b2292 | |
![]() |
c0669a591b | |
![]() |
708d3cfd46 | |
![]() |
6cc58b872f | |
![]() |
4c767953ea | |
![]() |
4ec0083cd8 | |
![]() |
87ad81f891 | |
![]() |
afbf687255 | |
![]() |
0693aa5e1e | |
![]() |
2a91d6bf35 | |
![]() |
b09977a503 | |
![]() |
438e4bba62 | |
![]() |
a74adb5f59 | |
![]() |
8632c7404d | |
![]() |
2ea94244e9 | |
![]() |
3c98af04b5 | |
![]() |
b5e27c9f19 | |
![]() |
ec425c768b | |
![]() |
3fd9815138 | |
![]() |
3805851255 | |
![]() |
a88d9cdd39 | |
![]() |
7d31b1e55d | |
![]() |
56e0c915b5 | |
![]() |
a25ce2d5df | |
![]() |
cac34e259b | |
![]() |
2a529ae07f | |
![]() |
a1e4e4b97c | |
![]() |
3b4c2f3049 | |
![]() |
f2cc131ff7 | |
![]() |
b6f2a9e544 | |
![]() |
daa9419557 | |
![]() |
0882b69ec8 | |
![]() |
013d3cccf4 | |
![]() |
8f710a24c8 | |
![]() |
7135a6660b | |
![]() |
7664594b8e | |
![]() |
07541d0bbb | |
![]() |
8fb0f76f6f | |
![]() |
640cde1653 | |
![]() |
4b1b1763df | |
![]() |
829c5fb42f | |
![]() |
fd3c2af358 | |
![]() |
5c2c52ad31 | |
![]() |
aa3efd5841 | |
![]() |
920a4c3fc8 | |
![]() |
d57370578f | |
![]() |
4a16ee76a1 | |
![]() |
7af32caec2 | |
![]() |
2d9db9c90a | |
![]() |
d7a22bf74c | |
![]() |
1a7346b845 | |
![]() |
8c40b7c753 | |
![]() |
fdc1792932 | |
![]() |
483a855848 | |
![]() |
4541db7f21 | |
![]() |
86d8ee4c38 | |
![]() |
73db861cc6 | |
![]() |
061ef44def | |
![]() |
dffb988798 | |
![]() |
d09c5da493 | |
![]() |
c011e49112 | |
![]() |
628567701a | |
![]() |
38990e283b | |
![]() |
fa5e229015 | |
![]() |
05163c09a1 | |
![]() |
8533be8d5c | |
![]() |
89551c83cf | |
![]() |
3001927576 | |
![]() |
baa616050a | |
![]() |
e839f0dec7 | |
![]() |
3168bf4350 | |
![]() |
6447304531 | |
![]() |
6aebf60300 | |
![]() |
0829cd84fe | |
![]() |
8af600692e | |
![]() |
3478ee322b | |
![]() |
550d0f915b | |
![]() |
d9e26c2516 | |
![]() |
4bce63e38d | |
![]() |
ec8a09e4a9 | |
![]() |
05b68a4b80 | |
![]() |
c378009128 | |
![]() |
2d794d1a32 | |
![]() |
e38835cfd4 | |
![]() |
e3ba1a1840 | |
![]() |
08f6c32551 | |
![]() |
2b8d580355 | |
![]() |
ee390bc270 | |
![]() |
14e7cd0e52 | |
![]() |
6d8a52eb15 | |
![]() |
951db17d53 | |
![]() |
0d612b9928 | |
![]() |
aacc2d0596 | |
![]() |
074706e7ec | |
![]() |
1631b9587f | |
![]() |
750a470b9a | |
![]() |
37bdc8665f | |
![]() |
cbf661f69f | |
![]() |
d16144eee4 | |
![]() |
1a190b7f6f | |
![]() |
a7b294025e | |
![]() |
e2d4dd6995 | |
![]() |
d9f3078396 | |
![]() |
0908e10ff6 | |
![]() |
7d9badb542 | |
![]() |
3bd4fee844 | |
![]() |
3405c038c9 | |
![]() |
3400a0fab0 | |
![]() |
85dc3f68e7 | |
![]() |
eff8e885d5 | |
![]() |
cbc07c04a5 | |
![]() |
0003494c9e | |
![]() |
741d5c75ba | |
![]() |
2ff722eee6 | |
![]() |
39b6621463 | |
![]() |
9a07c1d858 | |
![]() |
19ae57c9ad | |
![]() |
6e0207ca5e | |
![]() |
be8d37241a | |
![]() |
e76c00c7f4 | |
![]() |
cba70fc912 | |
![]() |
048393f448 | |
![]() |
710f448477 | |
![]() |
367dab9c5a | |
![]() |
c280924c0e | |
![]() |
5dacb82b22 | |
![]() |
a54a59146d | |
![]() |
a1ea633a3e | |
![]() |
68a222e03a | |
![]() |
67bd982969 | |
![]() |
d9073de251 | |
![]() |
754684bfe9 | |
![]() |
9c37f6cbd5 | |
![]() |
208f142cd2 | |
![]() |
e5d8e2b428 | |
![]() |
0bba168f94 | |
![]() |
db3b1d74d1 | |
![]() |
50fe905455 | |
![]() |
d5e8cfd4ba | |
![]() |
ffe1815ec9 | |
![]() |
2690d04f64 | |
![]() |
3707daf678 | |
![]() |
076dce6981 | |
![]() |
d6d74f200b | |
![]() |
1a7ffa693b | |
![]() |
dbe127569b | |
![]() |
da2471567d | |
![]() |
55f5d25c95 | |
![]() |
4634564f17 | |
![]() |
300a2d8569 | |
![]() |
b4bfb8b242 | |
![]() |
6277e10b3f | |
![]() |
47ad390f1d | |
![]() |
d25d6124a9 | |
![]() |
70151279f6 | |
![]() |
431416d75e | |
![]() |
77c6f8e54f | |
![]() |
dc99e19ed9 | |
![]() |
c659e060c1 | |
![]() |
f8f3a64612 | |
![]() |
7bf37a3999 | |
![]() |
3fabdad1fe | |
![]() |
a806bb2657 | |
![]() |
91c19bff55 | |
![]() |
9691974b1a | |
![]() |
07d3d79e8d | |
![]() |
498f15cc92 | |
![]() |
b36ec266f0 | |
![]() |
c0d067d24b | |
![]() |
12c0f41477 | |
![]() |
f7c66741c6 | |
![]() |
60deb0328a | |
![]() |
0ef4579da8 | |
![]() |
55c692e8bb | |
![]() |
835f84584e | |
![]() |
bd2ad39f6a | |
![]() |
48d2b4a618 | |
![]() |
cd6ea1a4c5 | |
![]() |
4ecfb47f07 | |
![]() |
d3dd99c384 | |
![]() |
69ea470a26 | |
![]() |
65da4c42c4 | |
![]() |
cd059bd511 | |
![]() |
53053b901f | |
![]() |
17f68efb81 | |
![]() |
98ad26da3d | |
![]() |
36ac6d9956 | |
![]() |
1eb17b2fa1 | |
![]() |
33744de372 | |
![]() |
d651b36eb2 | |
![]() |
7e0db31cc1 | |
![]() |
c389156499 | |
![]() |
0207669d61 | |
![]() |
b158318e83 | |
![]() |
11bfcc6d53 | |
![]() |
9269a55e8b | |
![]() |
2583f6fe36 | |
![]() |
193d105a3f | |
![]() |
ea7837b4c6 | |
![]() |
f9c275919e | |
![]() |
38b9b9be4c | |
![]() |
9fd935770a | |
![]() |
d1489a1fb1 | |
![]() |
0568fcdb81 | |
![]() |
39c837d323 | |
![]() |
3aa7c3c2e0 | |
![]() |
7a555e19c4 | |
![]() |
26c0d85c66 | |
![]() |
613efd7599 | |
![]() |
ae179d9005 | |
![]() |
96fece4e6d | |
![]() |
9139239f9f | |
![]() |
57502d2f54 | |
![]() |
ce71f25901 | |
![]() |
fea6b87139 | |
![]() |
4157604458 | |
![]() |
117c72ba72 | |
![]() |
79d4cd9060 | |
![]() |
1438438937 | |
![]() |
80f074e2ba | |
![]() |
171bba1bcd | |
![]() |
95579bbf1d | |
![]() |
c9dca4cebd | |
![]() |
6aa83c93ac | |
![]() |
a69b88e09a | |
![]() |
5daaba6e64 | |
![]() |
2b107736e2 | |
![]() |
30d688c1ec | |
![]() |
58c75ce61a | |
![]() |
100be95113 | |
![]() |
5c037837f5 | |
![]() |
12e696bf1c | |
![]() |
55513703b2 | |
![]() |
f2eafd563e | |
![]() |
16200bbeac | |
![]() |
465fe59dfb | |
![]() |
704e3f2f0d | |
![]() |
fe02cf3e4b | |
![]() |
5e7fb5010f | |
![]() |
b322ce064b | |
![]() |
ec21faf15c | |
![]() |
e0c5ca962f | |
![]() |
37f82acff0 | |
![]() |
c04d3ef50d | |
![]() |
62b14bcf62 | |
![]() |
005f5b5103 | |
![]() |
bb6c32c897 | |
![]() |
8299fe41bc | |
![]() |
d39f1999e7 | |
![]() |
d06b7e1456 | |
![]() |
41cf9974f9 | |
![]() |
bbf5c806d8 | |
![]() |
8f0b367f9c | |
![]() |
65e12621ff | |
![]() |
84d23e91ed | |
![]() |
5e37f84bc7 | |
![]() |
11047ecd53 | |
![]() |
91a290dade | |
![]() |
ea62a449d4 | |
![]() |
faa4eaae20 | |
![]() |
c039e7e859 | |
![]() |
d9c966a95b | |
![]() |
92f574d2ca | |
![]() |
decab29555 | |
![]() |
ecc23dfb3e | |
![]() |
a5d9bae052 | |
![]() |
c04291a55e | |
![]() |
efad9a4dae | |
![]() |
3ab153225a | |
|
76314f522f | |
![]() |
55d6c431f2 | |
![]() |
ce450d1c00 | |
![]() |
9f5ee21bbe | |
![]() |
27466a4223 | |
![]() |
a279541198 | |
![]() |
309f80b25f | |
![]() |
993a6adf6e | |
![]() |
fabbdda964 | |
![]() |
cdb63e2a8c | |
![]() |
8647deafc8 | |
![]() |
dbd9db86a6 | |
![]() |
b338b18f16 | |
![]() |
0b948b655e | |
![]() |
52446c1049 | |
![]() |
fbbe25b25e | |
![]() |
f5519f8936 | |
![]() |
9f2f7780a4 | |
![]() |
9c91fd1e52 | |
![]() |
7b237ce9ad | |
![]() |
404d2dbeb1 | |
![]() |
9a04685101 | |
![]() |
a7aaa07356 | |
![]() |
71ff89a803 | |
![]() |
c336a67afa | |
![]() |
10ec454f6b | |
![]() |
d71ee4ef68 | |
![]() |
05de2baef5 | |
![]() |
f64c610fa4 | |
![]() |
ad2e3db92f | |
![]() |
13098ee378 | |
![]() |
8fdf79958f | |
![]() |
8c6ac4cd16 | |
![]() |
2685a1eb60 | |
![]() |
a54a117ba4 | |
![]() |
a4cfe616a8 | |
![]() |
f08c67bef9 | |
![]() |
b17a4391b0 | |
![]() |
1c9f5f3f64 | |
![]() |
68c254c101 | |
![]() |
d7ec891ab8 | |
![]() |
dbc13bad20 | |
![]() |
d2c8888067 | |
![]() |
8d5cafecb3 | |
![]() |
d0961a517a | |
![]() |
4c1d3eecd1 | |
![]() |
56c99e741e | |
![]() |
4bb6f9f1b3 | |
![]() |
b9305dfd45 | |
![]() |
5749fff377 | |
![]() |
4c14050b27 | |
![]() |
33b7c893cb | |
![]() |
2023756023 | |
![]() |
a92fa950e2 | |
![]() |
e63afb3461 | |
![]() |
25a8d7b5b5 | |
![]() |
4780716c18 | |
![]() |
9cb80daedf | |
![]() |
aa8122f16f | |
|
9e743e86af | |
![]() |
fd36ff3840 | |
![]() |
93f3abee1a | |
![]() |
b685d0060c | |
![]() |
253cca379b | |
![]() |
e6ce4112c6 | |
![]() |
51668c12d7 | |
![]() |
16795e0d49 | |
![]() |
62b770f7d3 | |
![]() |
df415880d0 | |
![]() |
1be69a0a51 | |
![]() |
2b96eda86d | |
![]() |
f57da76ae8 | |
![]() |
eac74c23ec | |
![]() |
242477e3ee | |
![]() |
754dfefefd | |
![]() |
7e6782a1be | |
![]() |
56a8c5eb48 | |
![]() |
63bf6bed08 | |
![]() |
69d2d39c36 | |
![]() |
a0635ae400 | |
![]() |
dc64b95406 | |
![]() |
8390d85e46 | |
![]() |
95cab790c1 | |
![]() |
b72bedaf60 | |
![]() |
5f76722ecb | |
![]() |
4905abe30b | |
![]() |
ac32e40003 | |
![]() |
52ed8041f7 | |
![]() |
2fa706a123 | |
![]() |
73429315a7 | |
![]() |
419bd1cc21 | |
![]() |
167dd01bbe | |
![]() |
df7cdd4b8e | |
![]() |
2143f21828 | |
![]() |
17e38bf66c | |
![]() |
3ec39047e1 | |
![]() |
a9717206f3 | |
![]() |
634efbcabd | |
![]() |
c15efbad7b | |
![]() |
f0ba8ec325 | |
![]() |
fde66a9422 | |
![]() |
17ece36b3e | |
![]() |
86f595b8ef | |
![]() |
cc4cfd2122 | |
![]() |
c4037a885f | |
![]() |
fa5cf01af0 | |
![]() |
1b9d40d2fb | |
![]() |
9e8ebe4595 | |
![]() |
e8f9c0292b | |
![]() |
004c861ba9 | |
![]() |
81ddda4515 | |
![]() |
3da26a38ed | |
![]() |
6c3012b8a1 | |
![]() |
9cf30fd9bc | |
![]() |
df65862c49 | |
![]() |
f2d91cde80 | |
![]() |
db031c7985 | |
![]() |
a3ceecb21e | |
![]() |
da6c0c66d7 | |
![]() |
767f7f0049 | |
![]() |
85f0f88c20 | |
![]() |
870d5237bb | |
![]() |
4ae0360640 | |
![]() |
4c02fe9cda | |
![]() |
70b7a63b66 | |
![]() |
31781f214c | |
![]() |
1b74cc1144 | |
![]() |
535696de28 | |
![]() |
b9297cd9f4 | |
![]() |
a78cc159f8 | |
![]() |
fbb45807f1 | |
![]() |
50c3c45ef8 | |
![]() |
6f3b14202e | |
![]() |
7d30a82747 | |
![]() |
cd140f1384 | |
![]() |
e823c209fa | |
![]() |
1b47cf76d3 | |
![]() |
4119e669d1 | |
![]() |
285350464f | |
![]() |
2a003a27b1 |
|
@ -3,51 +3,42 @@ name: Build
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-linux:
|
||||||
runs-on: ${{ matrix.host_os }}
|
runs-on: ${{ matrix.host_os }}
|
||||||
container: ${{ matrix.container }}
|
container: ${{ matrix.container }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
target_os: [linux]
|
target_os: [linux]
|
||||||
host_os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]
|
host_os: [ubuntu-20.04]
|
||||||
container: ['']
|
container: ['']
|
||||||
include:
|
|
||||||
- target_os: windows
|
|
||||||
host_os: ubuntu-latest
|
|
||||||
container: krzysh/colobot-build:latest
|
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
steps:
|
steps:
|
||||||
- name: Install Colobot dependencies
|
- 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 == ''
|
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
|
- name: Create build directory
|
||||||
run: cmake -E make_directory build
|
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)
|
- name: Run CMake (for Linux)
|
||||||
working-directory: build
|
run: cmake --preset Linux-CI
|
||||||
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 ..
|
|
||||||
if: matrix.target_os == 'linux'
|
if: matrix.target_os == 'linux'
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: build
|
run: cmake --build --preset Linux-CI
|
||||||
run: make -j `nproc`
|
|
||||||
- name: Install
|
- name: Install
|
||||||
working-directory: build
|
run: cmake --build --preset Linux-CI --target install
|
||||||
run: DESTDIR=. make install
|
|
||||||
- name: Patch library path
|
- name: Patch library path
|
||||||
working-directory: build
|
|
||||||
run: patchelf --set-rpath '.' install/colobot
|
run: patchelf --set-rpath '.' install/colobot
|
||||||
if: matrix.target_os == 'linux'
|
if: matrix.target_os == 'linux'
|
||||||
- name: Upload build
|
- name: Upload build
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{matrix.target_os}}-debug
|
name: ${{matrix.target_os}}-debug
|
||||||
path: build/install
|
path: install
|
||||||
if: matrix.target_os == 'windows' || matrix.host_os == 'ubuntu-18.04'
|
if: matrix.host_os == 'ubuntu-20.04'
|
||||||
- name: Create AppImage
|
- name: Create AppImage
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: |
|
run: |
|
||||||
|
@ -58,39 +49,155 @@ jobs:
|
||||||
|
|
||||||
# Create AppImage
|
# Create AppImage
|
||||||
NO_STRIP=1 ./squashfs-root/AppRun -e colobot --output appimage --appdir colobot.AppDir -d desktop/colobot.desktop -i ../desktop/colobot.svg
|
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
|
# Prepare folder for zip
|
||||||
mkdir -p appimage
|
mkdir -p appimage
|
||||||
cp -rp install/data appimage/data
|
cp -rp ../install/data appimage/data
|
||||||
cp -rp install/lang appimage/lang
|
cp -rp ../install/lang appimage/lang
|
||||||
cp -p Colobot-*-x86_64.AppImage appimage/colobot
|
cp -p Colobot-x86_64.AppImage appimage/colobot
|
||||||
if: matrix.target_os == 'linux'
|
if: matrix.target_os == 'linux'
|
||||||
- name: Upload AppImage
|
- name: Upload AppImage
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{matrix.target_os}}-debug-AppImage
|
name: ${{matrix.target_os}}-debug-AppImage
|
||||||
path: build/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
|
- name: Run tests
|
||||||
# TODO: Maybe run Windows tests using wine as well?
|
# TODO: Maybe run Windows tests using wine as well?
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: ./colobot_ut --gtest_output=xml:gtestresults.xml
|
run: ./Colobot-UnitTests --gtest_output=xml:gtestresults.xml
|
||||||
if: matrix.target_os == 'linux'
|
if: matrix.target_os == 'linux'
|
||||||
- name: Upload test results
|
- name: Upload test results
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: Test results (${{ matrix.target_os }}, ${{ matrix.host_os }})
|
name: Test results (${{ matrix.target_os }}, ${{ matrix.host_os }})
|
||||||
path: build/gtestresults.xml
|
path: build/gtestresults.xml
|
||||||
if: matrix.target_os == 'linux'
|
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:
|
doc:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Install Colobot dependencies
|
- 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
|
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@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Create build directory
|
- name: Create build directory
|
||||||
run: cmake -E make_directory build
|
run: cmake -E make_directory build
|
||||||
|
- name: Checkout the nlohmann json submodule
|
||||||
|
run: git submodule update --init -- lib/json
|
||||||
- name: Run CMake
|
- name: Run CMake
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: cmake ..
|
run: cmake ..
|
||||||
|
@ -98,7 +205,7 @@ jobs:
|
||||||
working-directory: build
|
working-directory: build
|
||||||
run: make doc
|
run: make doc
|
||||||
- name: Upload docs
|
- name: Upload docs
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: doc
|
name: doc
|
||||||
path: build/doc
|
path: build/doc
|
||||||
|
|
|
@ -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)
|
|
|
@ -1,14 +1,21 @@
|
||||||
name: Verify pull request target
|
name: Verify pull request target
|
||||||
|
|
||||||
on: [pull_request]
|
on: [pull_request_target]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check_pr_target:
|
check_pr_target:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Wrong pull request target
|
- name: Send comment if wrong pull request target
|
||||||
run: echo "This pull request targets the master branch. Please edit the pull request to target dev." && exit 1
|
|
||||||
if: github.base_ref == 'master'
|
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
|
- name: Correct pull request target
|
||||||
|
if: github.base_ref != 'master'
|
||||||
run: echo "This pull request targets the correct branch." && exit 0
|
run: echo "This pull request targets the correct branch." && exit 0
|
||||||
if: github.base_ref != 'master'
|
|
|
@ -11,11 +11,12 @@ Makefile
|
||||||
/src/libcolobotbase.a
|
/src/libcolobotbase.a
|
||||||
|
|
||||||
# Ignore the generated documentation
|
# Ignore the generated documentation
|
||||||
|
CMakeDoxyfile.in
|
||||||
|
CMakeDoxygenDefaults.cmake
|
||||||
/doc
|
/doc
|
||||||
/Doxyfile
|
/Doxyfile
|
||||||
|
|
||||||
# Ignore targets
|
# Ignore targets
|
||||||
/colobot
|
|
||||||
/src/CBot/libCBot.so
|
/src/CBot/libCBot.so
|
||||||
|
|
||||||
# Ignore local data
|
# Ignore local data
|
||||||
|
@ -46,3 +47,6 @@ CMakeLists.txt.user.*
|
||||||
/CMakeSettings.json
|
/CMakeSettings.json
|
||||||
/.vs
|
/.vs
|
||||||
/out
|
/out
|
||||||
|
|
||||||
|
# Ignore CMakeUserPresets.json
|
||||||
|
CMakeUserPresets.json
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
[submodule "data"]
|
[submodule "data"]
|
||||||
path = 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
|
||||||
|
|
|
@ -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()
|
|
@ -1,9 +1,10 @@
|
||||||
/**
|
/**
|
||||||
* \dir src/CBot
|
* \dir CBot
|
||||||
* \brief CBot library
|
* \brief CBot library
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \namespace CBot
|
* \namespace CBot
|
||||||
* \brief CBot engine
|
* \brief CBot engine
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -31,107 +31,100 @@
|
||||||
namespace CBot
|
namespace CBot
|
||||||
{
|
{
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
struct CBotCStack::Data
|
||||||
CBotProgram* CBotCStack::m_prog = nullptr; // init the static variable
|
{
|
||||||
CBotError CBotCStack::m_error = CBotNoErr;
|
//! The program currently being compiled
|
||||||
int CBotCStack::m_end = 0;
|
CBotProgram* prog = nullptr;
|
||||||
CBotTypResult CBotCStack::m_retTyp = CBotTypResult(0);
|
//! 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)
|
CBotCStack::CBotCStack(CBotCStack* ppapa)
|
||||||
{
|
{
|
||||||
m_next = nullptr;
|
|
||||||
m_prev = ppapa;
|
m_prev = ppapa;
|
||||||
|
|
||||||
if (ppapa == nullptr)
|
if (ppapa == nullptr)
|
||||||
{
|
{
|
||||||
m_error = CBotNoErr;
|
m_data = new CBotCStack::Data;
|
||||||
m_start = 0;
|
m_errStart = 0;
|
||||||
m_end = 0;
|
|
||||||
m_bBlock = true;
|
m_bBlock = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_start = ppapa->m_start;
|
m_data = ppapa->m_data;
|
||||||
|
m_errStart = ppapa->m_errStart;
|
||||||
m_bBlock = false;
|
m_bBlock = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_listVar = nullptr;
|
|
||||||
m_var = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotCStack::~CBotCStack()
|
CBotCStack::~CBotCStack()
|
||||||
{
|
{
|
||||||
if (m_next != nullptr) delete m_next;
|
if (m_prev == nullptr) delete m_data;
|
||||||
if (m_prev != nullptr) m_prev->m_next = nullptr; // removes chain
|
|
||||||
|
|
||||||
delete m_var;
|
|
||||||
delete m_listVar;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotCStack* CBotCStack::TokenStack(CBotToken* pToken, bool bBlock)
|
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.reset(new CBotCStack(this));
|
||||||
m_next = p; // channel element
|
m_next->m_bBlock = bBlock;
|
||||||
p->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)
|
CBotInstr* CBotCStack::Return(CBotInstr* inst, CBotCStack* pfils)
|
||||||
{
|
{
|
||||||
if ( pfils == this ) return inst;
|
if ( pfils == this ) return inst;
|
||||||
|
|
||||||
if (m_var != nullptr) delete m_var; // value replaced?
|
m_var = std::move(pfils->m_var); // result transmitted
|
||||||
m_var = pfils->m_var; // result transmitted
|
|
||||||
pfils->m_var = nullptr; // not to destroy the variable
|
|
||||||
|
|
||||||
if (m_error)
|
if (m_data->error != CBotNoErr)
|
||||||
{
|
{
|
||||||
m_start = pfils->m_start; // retrieves the position of the error
|
m_errStart = pfils->m_errStart; // retrieves the position of the error
|
||||||
m_end = pfils->m_end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pfils;
|
m_next.reset();
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotFunction* CBotCStack::ReturnFunc(CBotFunction* inst, CBotCStack* pfils)
|
CBotFunction* CBotCStack::ReturnFunc(CBotFunction* inst, CBotCStack* pfils)
|
||||||
{
|
{
|
||||||
if (m_var != nullptr) delete m_var; // value replaced?
|
m_var = std::move(pfils->m_var); // result transmitted
|
||||||
m_var = pfils->m_var; // result transmitted
|
|
||||||
pfils->m_var = nullptr; // not to destroy the variable
|
|
||||||
|
|
||||||
if (m_error)
|
if (m_data->error != CBotNoErr)
|
||||||
{
|
{
|
||||||
m_start = pfils->m_start; // retrieves the position of the error
|
m_errStart = pfils->m_errStart; // retrieves the position of the error
|
||||||
m_end = pfils->m_end;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pfils;
|
m_next.reset();
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotError CBotCStack::GetError(int& start, int& end)
|
CBotError CBotCStack::GetError(int& start, int& end)
|
||||||
{
|
{
|
||||||
start = m_start;
|
start = m_errStart;
|
||||||
end = m_end;
|
end = m_data->errEnd;
|
||||||
return m_error;
|
return m_data->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotError CBotCStack::GetError()
|
CBotError CBotCStack::GetError()
|
||||||
{
|
{
|
||||||
return m_error;
|
return m_data->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -171,18 +164,13 @@ void CBotCStack::SetType(CBotTypResult& type)
|
||||||
CBotVar* CBotCStack::FindVar(CBotToken* &pToken)
|
CBotVar* CBotCStack::FindVar(CBotToken* &pToken)
|
||||||
{
|
{
|
||||||
CBotCStack* p = this;
|
CBotCStack* p = this;
|
||||||
std::string name = pToken->GetString();
|
const auto& name = pToken->GetString();
|
||||||
|
|
||||||
while (p != nullptr)
|
while (p != nullptr)
|
||||||
{
|
{
|
||||||
CBotVar* pp = p->m_listVar;
|
if (p->m_bBlock) for (auto& var : p->m_listVar)
|
||||||
while ( pp != nullptr)
|
|
||||||
{
|
{
|
||||||
if (name == pp->GetName())
|
if (name == var->GetName()) return var.get();
|
||||||
{
|
|
||||||
return pp;
|
|
||||||
}
|
|
||||||
pp = pp->m_next;
|
|
||||||
}
|
}
|
||||||
p = p->m_prev;
|
p = p->m_prev;
|
||||||
}
|
}
|
||||||
|
@ -211,39 +199,39 @@ CBotVar* CBotCStack::CopyVar(CBotToken& Token)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
bool CBotCStack::IsOk()
|
bool CBotCStack::IsOk()
|
||||||
{
|
{
|
||||||
return (m_error == 0);
|
return (m_data->error == CBotNoErr);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotCStack::SetStartError( int pos )
|
void CBotCStack::SetStartError( int pos )
|
||||||
{
|
{
|
||||||
if ( m_error != 0) return; // does not change existing error
|
if (m_data->error != CBotNoErr) return; // does not change existing error
|
||||||
m_start = pos;
|
m_errStart = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotCStack::SetError(CBotError n, int pos)
|
void CBotCStack::SetError(CBotError n, int pos)
|
||||||
{
|
{
|
||||||
if ( n!= 0 && m_error != 0) return; // does not change existing error
|
if (n != CBotNoErr && m_data->error != CBotNoErr) return; // does not change existing error
|
||||||
m_error = n;
|
m_data->error = n;
|
||||||
m_end = pos;
|
m_data->errEnd = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotCStack::SetError(CBotError n, CBotToken* p)
|
void CBotCStack::SetError(CBotError n, CBotToken* p)
|
||||||
{
|
{
|
||||||
if (m_error) return; // does not change existing error
|
if (m_data->error != CBotNoErr) return; // does not change existing error
|
||||||
m_error = n;
|
m_data->error = n;
|
||||||
m_start = p->GetStart();
|
m_errStart = p->GetStart();
|
||||||
m_end = p->GetEnd();
|
m_data->errEnd = p->GetEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotCStack::ResetError(CBotError n, int start, int end)
|
void CBotCStack::ResetError(CBotError n, int start, int end)
|
||||||
{
|
{
|
||||||
m_error = n;
|
m_data->error = n;
|
||||||
m_start = start;
|
m_errStart = start;
|
||||||
m_end = end;
|
m_data->errEnd = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -261,48 +249,47 @@ bool CBotCStack::NextToken(CBotToken* &p)
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotCStack::SetProgram(CBotProgram* p)
|
void CBotCStack::SetProgram(CBotProgram* p)
|
||||||
{
|
{
|
||||||
m_prog = p;
|
m_data->prog = p;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotProgram* CBotCStack::GetProgram()
|
CBotProgram* CBotCStack::GetProgram()
|
||||||
{
|
{
|
||||||
return m_prog;
|
return m_data->prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotCStack::SetRetType(CBotTypResult& type)
|
void CBotCStack::SetRetType(CBotTypResult& type)
|
||||||
{
|
{
|
||||||
m_retTyp = type;
|
m_data->retTyp = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotTypResult CBotCStack::GetRetType()
|
CBotTypResult CBotCStack::GetRetType()
|
||||||
{
|
{
|
||||||
return m_retTyp;
|
return m_data->retTyp;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotCStack::SetVar( CBotVar* var )
|
void CBotCStack::SetVar( CBotVar* var )
|
||||||
{
|
{
|
||||||
if (m_var) delete m_var; // replacement of a variable
|
m_var.reset(var);
|
||||||
m_var = var;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void CBotCStack::SetCopyVar( CBotVar* var )
|
void CBotCStack::SetCopyVar( CBotVar* var )
|
||||||
{
|
{
|
||||||
if (m_var) delete m_var; // replacement of a variable
|
m_var.reset();
|
||||||
|
|
||||||
if ( var == nullptr ) return;
|
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 );
|
m_var->Copy( var );
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
CBotVar* CBotCStack::GetVar()
|
CBotVar* CBotCStack::GetVar()
|
||||||
{
|
{
|
||||||
return m_var;
|
return m_var.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -310,15 +297,12 @@ void CBotCStack::AddVar(CBotVar* pVar)
|
||||||
{
|
{
|
||||||
CBotCStack* p = this;
|
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;
|
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;
|
p->m_listVar.emplace_back(pVar);
|
||||||
while ( *pp != nullptr ) pp = &(*pp)->m_next;
|
|
||||||
|
|
||||||
*pp = pVar; // added after
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -369,19 +353,14 @@ void CBotCStack::CreateMemberVars(CBotClass* pClass, bool setDefined)
|
||||||
bool CBotCStack::CheckVarLocal(CBotToken* &pToken)
|
bool CBotCStack::CheckVarLocal(CBotToken* &pToken)
|
||||||
{
|
{
|
||||||
CBotCStack* p = this;
|
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;
|
if (name == var->GetName()) return true;
|
||||||
while ( pp != nullptr)
|
|
||||||
{
|
|
||||||
if (name == pp->GetName())
|
|
||||||
return true;
|
|
||||||
pp = pp->m_next;
|
|
||||||
}
|
|
||||||
if ( p->m_bBlock ) return false;
|
|
||||||
p = p->m_prev;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -392,10 +371,10 @@ CBotTypResult CBotCStack::CompileCall(CBotToken* &p, CBotVar** ppVars, long& nId
|
||||||
nIdent = 0;
|
nIdent = 0;
|
||||||
CBotTypResult val(-1);
|
CBotTypResult val(-1);
|
||||||
|
|
||||||
val = m_prog->GetExternalCalls()->CompileCall(p, nullptr, ppVars, this);
|
val = GetProgram()->GetExternalCalls()->CompileCall(p, nullptr, ppVars, this);
|
||||||
if (val.GetType() < 0)
|
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 )
|
if ( val.GetType() < 0 )
|
||||||
{
|
{
|
||||||
// pVar = nullptr; // the error is not on a particular parameter
|
// 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)
|
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
|
// ignore methods for a different class
|
||||||
if ( className != pp->GetClassName() )
|
if ( className != pp->GetClassName() )
|
||||||
|
@ -429,7 +408,7 @@ bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam, const std::
|
||||||
|
|
||||||
for (CBotFunction* pp : CBotFunction::m_publicFunctions)
|
for (CBotFunction* pp : CBotFunction::m_publicFunctions)
|
||||||
{
|
{
|
||||||
if ( pToken->GetString() == pp->GetName() )
|
if ( name == pp->GetName() )
|
||||||
{
|
{
|
||||||
// ignore methods for a different class
|
// ignore methods for a different class
|
||||||
if ( className != pp->GetClassName() )
|
if ( className != pp->GetClassName() )
|
||||||
|
@ -443,4 +422,4 @@ bool CBotCStack::CheckCall(CBotToken* &pToken, CBotDefParam* pParam, const std::
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace CBot
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -22,6 +22,9 @@
|
||||||
#include "CBot/CBotVar/CBotVar.h"
|
#include "CBot/CBotVar/CBotVar.h"
|
||||||
#include "CBot/CBotProgram.h"
|
#include "CBot/CBotProgram.h"
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace CBot
|
namespace CBot
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -157,6 +160,11 @@ public:
|
||||||
*/
|
*/
|
||||||
CBotCStack* TokenStack(CBotToken* pToken = nullptr, bool bBlock = false);
|
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.
|
* \brief Return Transmits the result upper.
|
||||||
* \param p
|
* \param p
|
||||||
|
@ -269,21 +277,20 @@ public:
|
||||||
bool NextToken(CBotToken* &p);
|
bool NextToken(CBotToken* &p);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CBotCStack* m_next;
|
std::unique_ptr<CBotCStack> m_next;
|
||||||
CBotCStack* m_prev;
|
CBotCStack* m_prev;
|
||||||
|
|
||||||
static CBotError m_error;
|
int m_errStart = 0;
|
||||||
static int m_end;
|
|
||||||
int m_start;
|
struct Data;
|
||||||
|
|
||||||
|
CBotCStack::Data* m_data;
|
||||||
|
|
||||||
//! Result of the operations.
|
//! Result of the operations.
|
||||||
CBotVar* m_var;
|
std::unique_ptr<CBotVar> m_var;
|
||||||
//! Is part of a block (variables are local to this block).
|
//! Is part of a block (variables are local to this block).
|
||||||
bool m_bBlock;
|
bool m_bBlock;
|
||||||
CBotVar* m_listVar;
|
std::list<std::unique_ptr<CBotVar>> m_listVar;
|
||||||
//! List of compiled functions.
|
|
||||||
static CBotProgram* m_prog;
|
|
||||||
static CBotTypResult m_retTyp;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace CBot
|
} // namespace CBot
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
// return a method precompiled in pass 1
|
||||||
CBotCStack* pStk = pStack->TokenStack(nullptr, true);
|
CBotCStack* pStk = pStack->TokenStack(nullptr, true);
|
||||||
CBotDefParam* params = CBotDefParam::Compile(p, pStk );
|
CBotDefParam* params = CBotDefParam::Compile(p, pStk );
|
||||||
delete pStk;
|
pStack->DeleteNext();
|
||||||
std::list<CBotFunction*>::iterator pfIter = std::find_if(m_pMethod.begin(), m_pMethod.end(), [&pp, ¶ms](CBotFunction* x)
|
auto pfIter = std::find_if(m_pMethod.begin(), m_pMethod.end(), [&pp, ¶ms](CBotFunction* x)
|
||||||
{
|
{
|
||||||
return x->GetName() == pp && x->CheckParam( params );
|
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_pProg = pStack->GetProgram();
|
||||||
f->m_bSynchro = bSynchro;
|
f->m_bSynchro = bSynchro;
|
||||||
}
|
}
|
||||||
pStack->Return(nullptr, pile);
|
pStack->DeleteNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
return pStack->IsOk();
|
return pStack->IsOk();
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -23,11 +23,11 @@
|
||||||
#include "CBot/CBotInstr/CBotFunction.h"
|
#include "CBot/CBotInstr/CBotFunction.h"
|
||||||
#include "CBot/CBotInstr/CBotInstrCall.h"
|
#include "CBot/CBotInstr/CBotInstrCall.h"
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <boost/algorithm/string/replace.hpp>
|
|
||||||
|
|
||||||
namespace CBot
|
namespace CBot
|
||||||
{
|
{
|
||||||
|
@ -53,22 +53,34 @@ void CBotDebug::DumpCompiledProgram(CBotProgram* program)
|
||||||
instructions[ptr] = instructionsNextId++;
|
instructions[ptr] = instructionsNextId++;
|
||||||
}
|
}
|
||||||
|
|
||||||
char buffer[20];
|
std::array<char, 20> buffer;
|
||||||
sprintf(buffer, "instr%d", instructions[ptr]);
|
snprintf(buffer.data(), buffer.size(), "instr%d", instructions[ptr]);
|
||||||
return std::string(buffer);
|
return std::string(buffer.data());
|
||||||
};
|
};
|
||||||
std::function<void(CBotInstr*)> DumpInstr = [&](CBotInstr* instr)
|
std::function<void(CBotInstr*)> DumpInstr = [&](CBotInstr* instr)
|
||||||
{
|
{
|
||||||
if (finished.find(instr) != finished.end()) return;
|
if (finished.find(instr) != finished.end()) return;
|
||||||
finished.insert(instr);
|
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();
|
std::string data = instr->GetDebugData();
|
||||||
boost::algorithm::replace_all(data, "&", "&");
|
replaceAll(data, "&", "&");
|
||||||
boost::algorithm::replace_all(data, "<", "<");
|
replaceAll(data, "<", "<");
|
||||||
boost::algorithm::replace_all(data, ">", ">");
|
replaceAll(data, ">", ">");
|
||||||
|
|
||||||
|
std::string label = "<b>"+instr->GetDebugName()+"</b>\n";
|
||||||
label += data;
|
label += data;
|
||||||
boost::algorithm::replace_all(label, "\n", "<br/>");
|
replaceAll(label, "\n", "<br/>");
|
||||||
|
|
||||||
std::string additional = "";
|
std::string additional = "";
|
||||||
if (instr->GetDebugName() == "CBotFunction")
|
if (instr->GetDebugName() == "CBotFunction")
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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;
|
prevHasDefault = true;
|
||||||
}
|
}
|
||||||
else pStack->SetError(CBotErrNoExpression, p);
|
else pStack->SetError(CBotErrNoExpression, p);
|
||||||
delete pStk;
|
pStack->DeleteNext();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (prevHasDefault) pStack->SetError(CBotErrDefaultValue, p->GetPrev());
|
if (prevHasDefault) pStack->SetError(CBotErrDefaultValue, p->GetPrev());
|
||||||
|
@ -137,6 +137,7 @@ bool CBotDefParam::Execute(CBotVar** ppVars, CBotStack* &pj)
|
||||||
while ( p != nullptr )
|
while ( p != nullptr )
|
||||||
{
|
{
|
||||||
pile = pile->AddStack();
|
pile = pile->AddStack();
|
||||||
|
if (pile->StackOver()) return pj->Return(pile);
|
||||||
if (pile->GetState() == 1) // already done?
|
if (pile->GetState() == 1) // already done?
|
||||||
{
|
{
|
||||||
if (ppVars != nullptr && ppVars[i] != nullptr) ++i;
|
if (ppVars != nullptr && ppVars[i] != nullptr) ++i;
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -100,6 +100,7 @@ enum TokenId
|
||||||
ID_STATIC,
|
ID_STATIC,
|
||||||
ID_PROTECTED,
|
ID_PROTECTED,
|
||||||
ID_PRIVATE,
|
ID_PRIVATE,
|
||||||
|
ID_REPEAT,
|
||||||
ID_INT,
|
ID_INT,
|
||||||
ID_FLOAT,
|
ID_FLOAT,
|
||||||
ID_BOOLEAN,
|
ID_BOOLEAN,
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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();
|
CBotExternalCall* pt = m_list[token->GetString()].get();
|
||||||
|
|
||||||
if (pStack->IsCallFinished()) return true;
|
if (thisVar == nullptr && pStack->IsCallFinished()) return true; // only for non-method external call
|
||||||
CBotStack* pile = pStack->AddStackExternalCall(pt);
|
|
||||||
|
|
||||||
// lists the parameters depending on the contents of the stack (pStackVar)
|
// if this is a method call we need to use AddStack()
|
||||||
CBotVar* pVar = MakeListVars(ppVar, true);
|
CBotStack* pile = (thisVar != nullptr) ? pStack->AddStack() : pStack->AddStackExternalCall(pt);
|
||||||
|
|
||||||
// creates a variable to the result
|
if (pile->GetState() == 0) // the first time?
|
||||||
CBotVar* pResult = rettype.Eq(CBotTypVoid) ? nullptr : CBotVar::Create("", rettype);
|
{
|
||||||
|
// 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();
|
||||||
|
// creates a variable to the result
|
||||||
CBotStack* pile2 = pile->AddStack();
|
CBotVar* pResult = rettype.Eq(CBotTypVoid) ? nullptr : CBotVar::Create("", rettype);
|
||||||
pile2->SetVar(pResult);
|
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
|
pile->SetError(CBotNoErr, token); // save token for the position in case of error
|
||||||
return pt->Run(thisVar, pStack);
|
return pt->Run(thisVar, pStack);
|
||||||
|
@ -107,7 +111,8 @@ bool CBotExternalCallList::RestoreCall(CBotToken* token, CBotVar* thisVar, CBotV
|
||||||
|
|
||||||
CBotExternalCall* pt = m_list[token->GetString()].get();
|
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;
|
if (pile == nullptr) return true;
|
||||||
|
|
||||||
pile->RestoreStack();
|
pile->RestoreStack();
|
||||||
|
@ -163,8 +168,7 @@ bool CBotExternalCallDefault::Run(CBotVar* thisVar, CBotStack* pStack)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != nullptr) pStack->SetCopyVar(result);
|
pStack->Return(pile2); // return 'result' and clear extra stack
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,8 +191,8 @@ CBotTypResult CBotExternalCallClass::Compile(CBotVar* thisVar, CBotVar* args, vo
|
||||||
|
|
||||||
bool CBotExternalCallClass::Run(CBotVar* thisVar, CBotStack* pStack)
|
bool CBotExternalCallClass::Run(CBotVar* thisVar, CBotStack* pStack)
|
||||||
{
|
{
|
||||||
if (pStack->IsCallFinished()) return true;
|
assert(thisVar != nullptr);
|
||||||
CBotStack* pile = pStack->AddStackExternalCall(this);
|
CBotStack* pile = pStack->AddStack();
|
||||||
CBotVar* args = pile->GetVar();
|
CBotVar* args = pile->GetVar();
|
||||||
|
|
||||||
CBotStack* pile2 = pile->AddStack();
|
CBotStack* pile2 = pile->AddStack();
|
||||||
|
@ -207,9 +211,8 @@ bool CBotExternalCallClass::Run(CBotVar* thisVar, CBotStack* pStack)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result != nullptr) pStack->SetCopyVar(result);
|
pStack->Return(pile2); // return 'result' and clear extra stack
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} // namespace CBot
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
while (true) // unsigned LEB128
|
||||||
{
|
{
|
||||||
if (!istr.read(reinterpret_cast<char*>(&chr), 1)) return false;
|
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;
|
value |= static_cast<T>(chr & 0x7F) << shift;
|
||||||
shift += 7;
|
shift += 7;
|
||||||
if ((chr & 0x80) == 0) break;
|
if ((chr & 0x80) == 0) break;
|
||||||
|
@ -186,7 +186,7 @@ bool WriteFloat(std::ostream &ostr, float f)
|
||||||
union TypeConverter
|
union TypeConverter
|
||||||
{
|
{
|
||||||
float fValue;
|
float fValue;
|
||||||
unsigned int iValue;
|
uint32_t iValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
TypeConverter u;
|
TypeConverter u;
|
||||||
|
@ -194,7 +194,7 @@ bool WriteFloat(std::ostream &ostr, float f)
|
||||||
u.iValue = 0;
|
u.iValue = 0;
|
||||||
|
|
||||||
u.fValue = f;
|
u.fValue = f;
|
||||||
return WriteBinary<unsigned int>(ostr, u.iValue);
|
return WriteBinary<uint32_t>(ostr, u.iValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadFloat(std::istream &istr, float &f)
|
bool ReadFloat(std::istream &istr, float &f)
|
||||||
|
@ -202,14 +202,14 @@ bool ReadFloat(std::istream &istr, float &f)
|
||||||
union TypeConverter
|
union TypeConverter
|
||||||
{
|
{
|
||||||
float fValue;
|
float fValue;
|
||||||
unsigned int iValue;
|
uint32_t iValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
TypeConverter u;
|
TypeConverter u;
|
||||||
u.fValue = 0.0f;
|
u.fValue = 0.0f;
|
||||||
u.iValue = 0;
|
u.iValue = 0;
|
||||||
|
|
||||||
if (!ReadBinary<unsigned int>(istr, u.iValue)) return false;
|
if (!ReadBinary<uint32_t>(istr, u.iValue)) return false;
|
||||||
f = u.fValue;
|
f = u.fValue;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -219,7 +219,7 @@ bool WriteDouble(std::ostream &ostr, double d)
|
||||||
union TypeConverter
|
union TypeConverter
|
||||||
{
|
{
|
||||||
double dValue;
|
double dValue;
|
||||||
unsigned long iValue;
|
uint64_t iValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
TypeConverter u;
|
TypeConverter u;
|
||||||
|
@ -227,7 +227,7 @@ bool WriteDouble(std::ostream &ostr, double d)
|
||||||
u.iValue = 0;
|
u.iValue = 0;
|
||||||
|
|
||||||
u.dValue = d;
|
u.dValue = d;
|
||||||
return WriteBinary<unsigned long>(ostr, u.iValue);
|
return WriteBinary<uint64_t>(ostr, u.iValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ReadDouble(std::istream &istr, double &d)
|
bool ReadDouble(std::istream &istr, double &d)
|
||||||
|
@ -235,14 +235,14 @@ bool ReadDouble(std::istream &istr, double &d)
|
||||||
union TypeConverter
|
union TypeConverter
|
||||||
{
|
{
|
||||||
double dValue;
|
double dValue;
|
||||||
unsigned long iValue;
|
uint64_t iValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
TypeConverter u;
|
TypeConverter u;
|
||||||
u.dValue = 0.0;
|
u.dValue = 0.0;
|
||||||
u.iValue = 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;
|
d = u.dValue;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,11 @@ bool WriteStream(std::ostream &ostr, std::istream& istr)
|
||||||
if (!WriteLong(ostr, size)) return false;
|
if (!WriteLong(ostr, size)) return false;
|
||||||
|
|
||||||
if (!istr.seekg(0, istr.beg)) 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;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +359,7 @@ bool ReadStream(std::istream& istr, std::ostream &ostr)
|
||||||
|
|
||||||
while (length-- > 0)
|
while (length-- > 0)
|
||||||
{
|
{
|
||||||
if (!(ostr << istr.get())) return false;
|
if (!ostr.put(istr.get())) return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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?
|
// the constructor is there?
|
||||||
// std::string noname;
|
// std::string noname;
|
||||||
CBotTypResult r = pClass->CompileMethode(&token, var, ppVars, pStk, inst->m_nMethodeIdent);
|
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();
|
int typ = r.GetType();
|
||||||
|
|
||||||
if (typ == CBotErrUndefCall)
|
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)))
|
if (nullptr != (inst->m_exprRetVar = CBotExprRetVar::Compile(p, pStk, true)))
|
||||||
{
|
{
|
||||||
inst->m_exprRetVar->SetToken(vartoken);
|
inst->m_exprRetVar->SetToken(vartoken);
|
||||||
delete pStk->TokenStack();
|
pStk->DeleteNext();
|
||||||
}
|
}
|
||||||
pStk->SetVar(nullptr);
|
pStk->SetVar(nullptr);
|
||||||
|
|
||||||
|
@ -360,6 +360,7 @@ bool CBotDefClass::Execute(CBotStack* &pj)
|
||||||
if ( p != nullptr) while ( true )
|
if ( p != nullptr) while ( true )
|
||||||
{
|
{
|
||||||
pile2 = pile2->AddStack(); // place on the stack for the results
|
pile2 = pile2->AddStack(); // place on the stack for the results
|
||||||
|
if (pile2->StackOver()) return pj->Return(pile2);
|
||||||
if ( pile2->GetState() == 0 )
|
if ( pile2->GetState() == 0 )
|
||||||
{
|
{
|
||||||
if (!p->Execute(pile2)) return false; // interrupted here?
|
if (!p->Execute(pile2)) return false; // interrupted here?
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -21,6 +21,8 @@
|
||||||
|
|
||||||
#include "CBot/CBotInstr/CBotInstr.h"
|
#include "CBot/CBotInstr/CBotInstr.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
namespace CBot
|
namespace CBot
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -23,6 +23,8 @@
|
||||||
|
|
||||||
#include "CBot/CBotVar/CBotVar.h"
|
#include "CBot/CBotVar/CBotVar.h"
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
namespace CBot
|
namespace CBot
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -41,9 +43,9 @@ bool CBotExprLitNan::Execute(CBotStack* &pj)
|
||||||
CBotStack* pile = pj->AddStack(this);
|
CBotStack* pile = pj->AddStack(this);
|
||||||
|
|
||||||
if (pile->IfStep()) return false;
|
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
|
pile->SetVar(var); // put on the stack
|
||||||
return pj->Return(pile); // forward below
|
return pj->Return(pile); // forward below
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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)
|
if (m_token.GetType() != ID_ASS)
|
||||||
{
|
{
|
||||||
pVar = pile1->GetVar(); // recovers if interrupted
|
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));
|
result = CBotVar::Create("", pVar->GetTypResult(CBotVar::GetTypeMode::CLASS_AS_INTRINSIC));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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();
|
pile->IncState();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !m_block->Execute(pile) )
|
if (!pile->GetRetVar(m_block->Execute(pile)))
|
||||||
{
|
{
|
||||||
if ( pile->GetError() < 0 )
|
if ( pile->GetError() < 0 )
|
||||||
pile->SetError( CBotNoErr );
|
pile->SetError( CBotNoErr );
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -30,6 +30,7 @@
|
||||||
#include "CBot/CBotInstr/CBotExpression.h"
|
#include "CBot/CBotInstr/CBotExpression.h"
|
||||||
#include "CBot/CBotInstr/CBotFor.h"
|
#include "CBot/CBotInstr/CBotFor.h"
|
||||||
#include "CBot/CBotInstr/CBotIf.h"
|
#include "CBot/CBotInstr/CBotIf.h"
|
||||||
|
#include "CBot/CBotInstr/CBotRepeat.h"
|
||||||
#include "CBot/CBotInstr/CBotReturn.h"
|
#include "CBot/CBotInstr/CBotReturn.h"
|
||||||
#include "CBot/CBotInstr/CBotSwitch.h"
|
#include "CBot/CBotInstr/CBotSwitch.h"
|
||||||
#include "CBot/CBotInstr/CBotThrow.h"
|
#include "CBot/CBotInstr/CBotThrow.h"
|
||||||
|
@ -176,7 +177,7 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
|
||||||
{
|
{
|
||||||
type = pp->GetType();
|
type = pp->GetType();
|
||||||
// Allow only instructions that accept a label
|
// 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());
|
pStack->SetError(CBotErrLabel, pp->GetStart());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@ -195,6 +196,9 @@ CBotInstr* CBotInstr::Compile(CBotToken* &p, CBotCStack* pStack)
|
||||||
case ID_DO:
|
case ID_DO:
|
||||||
return CBotDo::Compile(p, pStack);
|
return CBotDo::Compile(p, pStack);
|
||||||
|
|
||||||
|
case ID_REPEAT:
|
||||||
|
return CBotRepeat::Compile(p, pStack);
|
||||||
|
|
||||||
case ID_BREAK:
|
case ID_BREAK:
|
||||||
case ID_CONTINUE:
|
case ID_CONTINUE:
|
||||||
return CBotBreak::Compile(p, pStack);
|
return CBotBreak::Compile(p, pStack);
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
@ -38,7 +38,7 @@ class CBotDebug;
|
||||||
* \endcode
|
* \endcode
|
||||||
* the following structure is generated:
|
* the following structure is generated:
|
||||||
* \dot
|
* \dot
|
||||||
* # Generated using the CBot_compile_graph tool
|
* # Generated using the CBot-CompileGraph tool
|
||||||
* # and slightly modified
|
* # and slightly modified
|
||||||
* digraph {
|
* digraph {
|
||||||
* start [label=<START> shape=box3d color=cyan]
|
* start [label=<START> shape=box3d color=cyan]
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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();
|
// if (pVar2!=nullptr) pp = pVar2->RetToken();
|
||||||
pStack->SetError( static_cast<CBotError>(inst->m_typRes.GetType()), pp );
|
pStack->SetError( static_cast<CBotError>(inst->m_typRes.GetType()), pp );
|
||||||
delete pStack->TokenStack();
|
pStack->DeleteNext();
|
||||||
delete inst;
|
delete inst;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete pStack->TokenStack();
|
pStack->DeleteNext();
|
||||||
if ( inst->m_typRes.GetType() > 0 )
|
if ( inst->m_typRes.GetType() > 0 )
|
||||||
{
|
{
|
||||||
CBotVar* pRes = CBotVar::Create("", inst->m_typRes);
|
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)))
|
if (nullptr != (inst->m_exprRetVar = CBotExprRetVar::Compile(p, pStack)))
|
||||||
{
|
{
|
||||||
inst->m_exprRetVar->SetToken(&inst->m_token);
|
inst->m_exprRetVar->SetToken(&inst->m_token);
|
||||||
delete pStack->TokenStack();
|
pStack->DeleteNext();
|
||||||
}
|
}
|
||||||
if ( !pStack->IsOk() )
|
if ( !pStack->IsOk() )
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ CBotInstr* CBotInstrCall::Compile(CBotToken* &p, CBotCStack* pStack)
|
||||||
return inst;
|
return inst;
|
||||||
}
|
}
|
||||||
p = pp;
|
p = pp;
|
||||||
delete pStack->TokenStack();
|
pStack->DeleteNext();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +138,7 @@ bool CBotInstrCall::Execute(CBotStack* &pj)
|
||||||
if ( p != nullptr) while ( true )
|
if ( p != nullptr) while ( true )
|
||||||
{
|
{
|
||||||
pile = pile->AddStack(); // place on the stack for the results
|
pile = pile->AddStack(); // place on the stack for the results
|
||||||
|
if (pile->StackOver()) return pj->Return(pile);
|
||||||
if ( pile->GetState() == 0 )
|
if ( pile->GetState() == 0 )
|
||||||
{
|
{
|
||||||
if (!p->Execute(pile)) return false; // interrupted here?
|
if (!p->Execute(pile)) return false; // interrupted here?
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
CBotClass* pClass = var->GetClass(); // pointer to the class
|
||||||
inst->m_className = pClass->GetName(); // name of the class
|
inst->m_className = pClass->GetName(); // name of the class
|
||||||
CBotTypResult r = pClass->CompileMethode(pp, var, ppVars, pStack, inst->m_MethodeIdent);
|
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;
|
inst->m_typRes = r;
|
||||||
|
|
||||||
if (inst->m_typRes.GetType() > 20)
|
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)))
|
if (nullptr != (inst->m_exprRetVar = CBotExprRetVar::Compile(p, pStack, bMethodChain)))
|
||||||
{
|
{
|
||||||
inst->m_exprRetVar->SetToken(pp);
|
inst->m_exprRetVar->SetToken(pp);
|
||||||
delete pStack->TokenStack();
|
pStack->DeleteNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( pStack->IsOk() )
|
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
|
ppVars[i++] = pile2->GetVar(); // construct the list of pointers
|
||||||
pile2 = pile2->AddStack(); // space on the stack for the result
|
pile2 = pile2->AddStack(); // space on the stack for the result
|
||||||
|
if (pile2->StackOver()) return pj->Return(pile2);
|
||||||
p = p->GetNext();
|
p = p->GetNext();
|
||||||
if ( p == nullptr) break;
|
if ( p == nullptr) break;
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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))
|
if (pile->GetTypResult().Eq(99))
|
||||||
{
|
{
|
||||||
delete pStack->TokenStack();
|
pStack->DeleteNext();
|
||||||
pStack->SetError(CBotErrVoid, p->GetStart());
|
pStack->SetError(CBotErrVoid, p->GetStart());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ CBotInstr* CompileParams(CBotToken* &p, CBotCStack* pStack, CBotVar** ppVars)
|
||||||
}
|
}
|
||||||
|
|
||||||
pStack->SetError(CBotErrClosePar, p->GetStart());
|
pStack->SetError(CBotErrClosePar, p->GetStart());
|
||||||
delete pStack->TokenStack();
|
pStack->DeleteNext();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* This file is part of the Colobot: Gold Edition source code
|
* 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
|
* http://epsitec.ch; http://colobot.info; http://github.com/colobot
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
Loading…
Reference in New Issue