forked from mirror/openmw-tes3mp
Compare commits
1021 commits
sol2-serve
...
0.7.0
Author | SHA1 | Date | |
---|---|---|---|
|
8aad93b904 | ||
|
3effd5f1ff | ||
|
4692f29b9d | ||
|
03d377ec54 | ||
|
8ff2d1b829 | ||
|
cb82318c36 | ||
|
3b2098382b | ||
|
cb5e24e6c5 | ||
|
91f82d845c | ||
|
d35026bbf5 | ||
|
bd677726bf | ||
|
9fc4c83858 | ||
|
ece39748de | ||
|
5c4d3df551 | ||
|
2cdabddc0e | ||
|
b46767de6e | ||
|
911079e0bc | ||
|
331fa86844 | ||
|
a0ec9dfd2e | ||
|
986528c67d | ||
|
552a94a0ca | ||
|
a508a0faf8 | ||
|
dcbc9d1831 | ||
|
828c52138f | ||
|
69e7d3f2a7 | ||
|
f3b8a5b909 | ||
|
a0ad0b29bc | ||
|
222837976c | ||
|
77386525f2 | ||
|
c058dce346 | ||
|
1df1515c7e | ||
|
999ce857c7 | ||
|
db7e09f441 | ||
|
0fa116b47d | ||
|
0df32accca | ||
|
fd40e8c971 | ||
|
6e47b65205 | ||
|
f481c85e07 | ||
|
8a99f215f6 | ||
|
db9c1b9882 | ||
|
799241e8c6 | ||
|
43f195f0c7 | ||
|
2e1d4a9449 | ||
|
81e2e48561 | ||
|
d83160523f | ||
|
433a69a588 | ||
|
e70fd2cf3a | ||
|
eb52babf29 | ||
|
e96091fd6b | ||
|
906d2a837d | ||
|
71679934a1 | ||
|
5d9893ee92 | ||
|
6e1504f0a1 | ||
|
42b5a8054f | ||
|
4ce0331f1b | ||
|
9343b8af2f | ||
|
c2230a8a21 | ||
|
a0e89208a0 | ||
|
55cea491ca | ||
|
6af2400752 | ||
|
b3456a8841 | ||
|
343dd8b5ea | ||
|
76ac905efc | ||
|
f853368641 | ||
|
5e38e8abdb | ||
|
9fe54aa8c6 | ||
|
fa1700e2ab | ||
|
da6b89c185 | ||
|
50714599d9 | ||
|
afd17e5a48 | ||
|
a6c6db89fc | ||
|
d05a82a734 | ||
|
b5b26c6685 | ||
|
35755eb1f1 | ||
|
b7090b2550 | ||
|
b39e3f518b | ||
|
d8ca268067 | ||
|
2933526995 | ||
|
ef80894c5c | ||
|
6b3f598837 | ||
|
eb3ae95f0e | ||
|
d3eb106c3b | ||
|
e834a4ec74 | ||
|
bc7bcae190 | ||
|
8f90f8a3b8 | ||
|
e162af0003 | ||
|
07a5f5296c | ||
|
20a7619a4a | ||
|
f1e8569291 | ||
|
efa362031e | ||
|
b83e4056a8 | ||
|
585557ad8a | ||
|
3101de5f02 | ||
|
e5e13b21ae | ||
|
c65d6c1328 | ||
|
1baf82db32 | ||
|
d9bc1abf48 | ||
|
a8cf1e02c4 | ||
|
99f8ef88a5 | ||
|
17f13872aa | ||
|
bfd7c83c4d | ||
|
d9dd7073cf | ||
|
66d666d60c | ||
|
bb834748c5 | ||
|
a3111fbcc1 | ||
|
3d40a162bc | ||
|
df1667b6e4 | ||
|
db2b3e95b8 | ||
|
1e171ad9fd | ||
|
e402a17757 | ||
|
292536439e | ||
|
c79660f721 | ||
|
8c7e06293f | ||
|
b76e00c66e | ||
|
f100a660d4 | ||
|
3f304866fd | ||
|
995d20348f | ||
|
db39c62e89 | ||
|
b04ca28ece | ||
|
b5f46ada73 | ||
|
7281f9fc42 | ||
|
770d36ef67 | ||
|
33a0886790 | ||
|
490303dc0b | ||
|
9d2dc96a2e | ||
|
af49f711ca | ||
|
3f6ca6f22b | ||
|
9d2cf6629b | ||
|
fcd31bf4a6 | ||
|
31a9b77f34 | ||
|
7d221509cd | ||
|
c9ad411dd3 | ||
|
8012d0d7b7 | ||
|
dcd4478028 | ||
|
113002ca19 | ||
|
48f4792bc1 | ||
|
3bd8aa82fe | ||
|
ee3fc4a303 | ||
|
9e58cc82bd | ||
|
be448e5b8e | ||
|
d1fa57ac14 | ||
|
0658d39eaa | ||
|
03832f933b | ||
|
75a64a69c7 | ||
|
45b011452e | ||
|
140e0ed52c | ||
|
aed4ca2fd2 | ||
|
a083439139 | ||
|
7efee0e968 | ||
|
5bd2244898 | ||
|
5fd4113978 | ||
|
338efdb705 | ||
|
aec0c5bd49 | ||
|
9598212aad | ||
|
a3b9274365 | ||
|
a1933e7bc2 | ||
|
1cfc1f9bdb | ||
|
0aedb3aada | ||
|
b67b17010d | ||
|
24212d58e8 | ||
|
ec9a1b0d05 | ||
|
cde95979d0 | ||
|
5d66a9bb66 | ||
|
8df08c7d10 | ||
|
780648b584 | ||
|
df577babe9 | ||
|
71bcc11ba5 | ||
|
a0d0e5d2db | ||
|
6a03aa6fdb | ||
|
cd92014533 | ||
|
fe19d8ff35 | ||
|
a2a57cf694 | ||
|
0f510011b3 | ||
|
cb62936949 | ||
|
03bf599426 | ||
|
144f37f9b3 | ||
|
126b2fdd42 | ||
|
0d976f2c5e | ||
|
57e1462417 | ||
|
348c6f848e | ||
|
51af729305 | ||
|
6202b4eca9 | ||
|
85208eff7f | ||
|
0c0379c1ef | ||
|
97bc9954d0 | ||
|
e9e9c0dd6b | ||
|
b7859b3fa9 | ||
|
bcd9cc4baa | ||
|
a19d55e035 | ||
|
bda23c6ad6 | ||
|
a9729878d7 | ||
|
a1e3b2e586 | ||
|
b75b5d139a | ||
|
7a93d118d2 | ||
|
31491fdbde | ||
|
7087bad580 | ||
|
1f4dd3b393 | ||
|
888e1dfff8 | ||
|
b0f2e00e7f | ||
|
d03722b3f4 | ||
|
452a706047 | ||
|
b6a919a2d1 | ||
|
99c03d55f0 | ||
|
2a621fedd1 | ||
|
d15dcaff68 | ||
|
dd6cb85783 | ||
|
6498bcb22b | ||
|
e2519226aa | ||
|
eeffe2e557 | ||
|
e4f862c0b9 | ||
|
c2a175c2e0 | ||
|
725a9323c4 | ||
|
1d1eedc001 | ||
|
2f44acafe2 | ||
|
4c7f3cf626 | ||
|
433c24562e | ||
|
ac98797999 | ||
|
4d280add81 | ||
|
d7718aae9b | ||
|
eb5f558f6f | ||
|
79aaf0163a | ||
|
712c9995db | ||
|
c454f1bdad | ||
|
9d85b7c2d3 | ||
|
73d5496711 | ||
|
16af1a6c1c | ||
|
3ac030d75a | ||
|
80f3bd9f86 | ||
|
fa6c205e5d | ||
|
bec47dfb7c | ||
|
369ea7e177 | ||
|
382b68a081 | ||
|
12144de8ed | ||
|
c0bed0fde2 | ||
|
770d86f9bd | ||
|
a08048da4e | ||
|
ab29f9e13f | ||
|
1c13256456 | ||
|
0e75e3816a | ||
|
8812f9ddfa | ||
|
0c507b74bc | ||
|
7c7af1da61 | ||
|
e8139a5cc7 | ||
|
66c241337d | ||
|
f717c9e56d | ||
|
4d48ede6f1 | ||
|
be2e7e9e09 | ||
|
5b92910829 | ||
|
aac580da6b | ||
|
20d4e27f82 | ||
|
c07cc0dc40 | ||
|
469bb29621 | ||
|
0f2c3ecb17 | ||
|
8c40010c87 | ||
|
b57807407a | ||
|
c79f96d0d2 | ||
|
1d463d129d | ||
|
75835c8326 | ||
|
9e6cba09a6 | ||
|
84de55fb46 | ||
|
78121c1774 | ||
|
3ba9229f47 | ||
|
9c8e284ead | ||
|
84a871cac7 | ||
|
6d5d0039ec | ||
|
bc82dbbd1b | ||
|
7e0df01c83 | ||
|
2d4ec86b8d | ||
|
29a1899045 | ||
|
2dbf3893c0 | ||
|
2332423527 | ||
|
7136329a94 | ||
|
28a02ac93b | ||
|
b7c159e5b6 | ||
|
c508938674 | ||
|
bbb22643e8 | ||
|
9497c7f6f2 | ||
|
25fcd09780 | ||
|
7995466e3c | ||
|
8d286657d4 | ||
|
f7887ab05f | ||
|
c7bcf70c32 | ||
|
d93b67ef21 | ||
|
f52364e05c | ||
|
60bc7447d9 | ||
|
51d369d4da | ||
|
4e78642273 | ||
|
d778bc3b8a | ||
|
c3ff273a22 | ||
|
b4802e4201 | ||
|
23d917df9c | ||
|
a4b588d1b5 | ||
|
e55f49be45 | ||
|
cac2bc768e | ||
|
ea8a41160c | ||
|
b79221efcc | ||
|
8fbed1f808 | ||
|
2e0b6e4e3e | ||
|
65de028e0d | ||
|
74fa1d0f01 | ||
|
b69e6b96e6 | ||
|
84b80ae405 | ||
|
36ac2d9de4 | ||
|
692ee01340 | ||
|
63a86f145d | ||
|
d4a84ac34a | ||
|
3165c84db4 | ||
|
9e6459043b | ||
|
3dc2d1b214 | ||
|
b891acd46e | ||
|
2189ea1a63 | ||
|
8c0b75d9f4 | ||
|
715cac807d | ||
|
cb6c37a26d | ||
|
18f8725d33 | ||
|
b910106713 | ||
|
c959bdcf32 | ||
|
9f2ef1e68a | ||
|
038757b91a | ||
|
8b2b37c270 | ||
|
ddd5cbd17c | ||
|
3944c8aec6 | ||
|
99e64bdcd7 | ||
|
cd1fc590a7 | ||
|
5466092582 | ||
|
20e0100706 | ||
|
0f0e8b7c08 | ||
|
f1315ef30d | ||
|
b6324e3532 | ||
|
826e64b40e | ||
|
21d5bb4d4e | ||
|
6c50d4199b | ||
|
421d0e7a99 | ||
|
892d71ce71 | ||
|
4c9e1295e8 | ||
|
a54b779672 | ||
|
8281fd903f | ||
|
ee3aba149d | ||
|
038d5a5566 | ||
|
b6db570d9c | ||
|
105b172fb5 | ||
|
5c16ce1d36 | ||
|
78a2725169 | ||
|
326a3e61f4 | ||
|
0142525ea2 | ||
|
111407c282 | ||
|
38fa4e0a8a | ||
|
9823a77bf2 | ||
|
3ff2740e59 | ||
|
2e227c7af5 | ||
|
b5c957c473 | ||
|
1a9bf253f6 | ||
|
193034f09c | ||
|
e7e3dab130 | ||
|
edd5769022 | ||
|
1430b64aaa | ||
|
30716344f2 | ||
|
d5d3c0937f | ||
|
35fdb833df | ||
|
72d286473b | ||
|
0b5cb15f71 | ||
|
646111d998 | ||
|
0f36c3ea24 | ||
|
22b2b7a9c6 | ||
|
9445db61b4 | ||
|
6ddf6eb885 | ||
|
21f198af7a | ||
|
4ac371d292 | ||
|
3649cf553f | ||
|
18a2d238ab | ||
|
4ef2aff11e | ||
|
f13705e8be | ||
|
6ebe09375f | ||
|
81b160cae8 | ||
|
61da0d2475 | ||
|
32b6134fad | ||
|
a471f5e452 | ||
|
ae55ee7f0b | ||
|
f410cb90d8 | ||
|
98ff44172a | ||
|
2fcde5e8ba | ||
|
88e4927146 | ||
|
6cb5ac6e63 | ||
|
6d43c8d63d | ||
|
743933134d | ||
|
5f4ec1331f | ||
|
cc9e294cc0 | ||
|
528bd26a3b | ||
|
ab5fd0aef8 | ||
|
6c1173d598 | ||
|
09da24f1ea | ||
|
20296859ee | ||
|
04dd59e638 | ||
|
aeb2e57444 | ||
|
837c5369c0 | ||
|
8f745df055 | ||
|
f0d4f1bbe5 | ||
|
6316f1e590 | ||
|
0fd8f7660b | ||
|
0bd6078826 | ||
|
32bd294a8a | ||
|
3d1daaebab | ||
|
bdf2f03c4f | ||
|
59a56ca35e | ||
|
8ca29dbaac | ||
|
5bb442bbd3 | ||
|
25f7a55495 | ||
|
ceea65f666 | ||
|
4e3bc3e403 | ||
|
99e4d49e7c | ||
|
70b6d4983d | ||
|
2d919ba215 | ||
|
232be000a2 | ||
|
5080a65910 | ||
|
ee759effce | ||
|
fa96154edd | ||
|
7a646494ee | ||
|
686830a6e3 | ||
|
3f21c49479 | ||
|
2599aba196 | ||
|
bff6e9e235 | ||
|
c77c50e92b | ||
|
3186edc630 | ||
|
5cb9dc9d12 | ||
|
b390ce3002 | ||
|
df1576fcf5 | ||
|
fde46f03b3 | ||
|
76fa8a163d | ||
|
1c35e20fcc | ||
|
75dcbea365 | ||
|
3f63e625cf | ||
|
d000f2756e | ||
|
21403f8920 | ||
|
7fd66c77e6 | ||
|
5a1dba6a09 | ||
|
c921d1c7e9 | ||
|
2e31c212c0 | ||
|
79ee976c95 | ||
|
0f30e21312 | ||
|
27a5da59ba | ||
|
16a4df25d6 | ||
|
c984fc0881 | ||
|
00c13ae96c | ||
|
0e13207afe | ||
|
5baef09f79 | ||
|
5628f3b977 | ||
|
b86155dc11 | ||
|
864c66d1d4 | ||
|
26ac29e8b1 | ||
|
4d4bced929 | ||
|
48296a7452 | ||
|
0bdd8f7d03 | ||
|
34c7181afc | ||
|
5abc3bd320 | ||
|
725cc94210 | ||
|
d4d2077174 | ||
|
a6f962156c | ||
|
467989cdd5 | ||
|
1786211b83 | ||
|
1177e5ac79 | ||
|
d26b5a13ef | ||
|
01b8ce5f70 | ||
|
4a6457c346 | ||
|
4222b44dbb | ||
|
143eadb58e | ||
|
4780f1b2bd | ||
|
78a5799911 | ||
|
8834396cdd | ||
|
13d8fba223 | ||
|
7f4320feb0 | ||
|
ba15d0a848 | ||
|
d09c327b20 | ||
|
efcad5e751 | ||
|
14d3b213a1 | ||
|
6ff7fa525e | ||
|
a3a002e008 | ||
|
caad14093e | ||
|
04ba324290 | ||
|
5043fb4246 | ||
|
cbb9817913 | ||
|
6ba9b1742b | ||
|
acdaf1a282 | ||
|
8d9fde810e | ||
|
f3892d697b | ||
|
563269d359 | ||
|
2f1ef049d2 | ||
|
380384ff39 | ||
|
141e404ed9 | ||
|
c0fde5ae97 | ||
|
6041425122 | ||
|
6a3fbf4e98 | ||
|
14e4f64296 | ||
|
3ed9d89280 | ||
|
509882b5f6 | ||
|
7f0549fc4f | ||
|
ae8b5a0709 | ||
|
b5abe6a230 | ||
|
e3e1cfc549 | ||
|
bded697f07 | ||
|
4eb72eecb1 | ||
|
f4146d0079 | ||
|
4b30a44816 | ||
|
d9de8ccb5b | ||
|
dd08194c75 | ||
|
7ba512b389 | ||
|
94ea9e7dd0 | ||
|
6a2b8f7e85 | ||
|
c23fc3446f | ||
|
17c234d9ca | ||
|
3e52857e2b | ||
|
97cd3effa7 | ||
|
6a78379757 | ||
|
03c75794c1 | ||
|
33c462c3c2 | ||
|
9abfabb065 | ||
|
b0bd12f9dd | ||
|
c075496748 | ||
|
934e592bdb | ||
|
e8ce009521 | ||
|
f02492a593 | ||
|
b8e53b5b81 | ||
|
e187733811 | ||
|
f9b565a46e | ||
|
61109d70b1 | ||
|
691b332d03 | ||
|
130a32ebb0 | ||
|
7a032baaa3 | ||
|
533cd9cdec | ||
|
470ea50b54 | ||
|
9ebcd65634 | ||
|
b36bd75b59 | ||
|
d03f9125e3 | ||
|
32ad8ef2f0 | ||
|
bbb461a5e5 | ||
|
7010575075 | ||
|
5bc073603e | ||
|
faf3e9ba5a | ||
|
9bfa01c579 | ||
|
76731f5def | ||
|
3cbbbeceb4 | ||
|
bf49a3e760 | ||
|
96cf2cbd05 | ||
|
1c1b5986e9 | ||
|
5d38160239 | ||
|
2c39dba83b | ||
|
baf21362e1 | ||
|
414f626309 | ||
|
c2411982d2 | ||
|
2ff9dc34a4 | ||
|
d4d46fc602 | ||
|
739c49d59b | ||
|
8c153d116b | ||
|
7775780ad7 | ||
|
3438061b55 | ||
|
8a23a96da4 | ||
|
a236ffc4be | ||
|
79903c455c | ||
|
57e2573593 | ||
|
70e9d5c0a0 | ||
|
11030e56c4 | ||
|
4f07ca28a6 | ||
|
d4c9586bd0 | ||
|
1f4e6e9114 | ||
|
f9ff5f10df | ||
|
fa2bf0663e | ||
|
908af3720f | ||
|
47d0321366 | ||
|
2a367a0c35 | ||
|
e50c3657b3 | ||
|
9a88f9147e | ||
|
e9cc697b60 | ||
|
3aa125ceda | ||
|
53346e2663 | ||
|
c5c1a160b2 | ||
|
c69819e0db | ||
|
99158beb2e | ||
|
895634cd16 | ||
|
779f2a564d | ||
|
23684489da | ||
|
7639db02f3 | ||
|
45c7c3a0b6 | ||
|
d999cc0d55 | ||
|
695fb7d4a7 | ||
|
f9ebe400f7 | ||
|
d162f6fd3a | ||
|
a48d5b48ef | ||
|
62877f38b7 | ||
|
685a80887b | ||
|
f4330cf057 | ||
|
7cbc4eeb49 | ||
|
bef53749ed | ||
|
8ce225b1cc | ||
|
aa5ddd6b28 | ||
|
5d9035c6b2 | ||
|
958b220835 | ||
|
3660d55adf | ||
|
362798bd90 | ||
|
2ea85d0bb6 | ||
|
af75c1e909 | ||
|
dcb2ab80f5 | ||
|
4d60fe5a76 | ||
|
09c9bd34c3 | ||
|
b8b07b52f0 | ||
|
4177fd04eb | ||
|
209359bbc3 | ||
|
78a3f95ee4 | ||
|
2bf0d598cf | ||
|
6e9c08083d | ||
|
bccba24c40 | ||
|
9b6ea0e89f | ||
|
d3dfe17441 | ||
|
69cd7031e7 | ||
|
596be205c1 | ||
|
06216aa124 | ||
|
2722ca50fb | ||
|
c474709127 | ||
|
ca0f6fff4a | ||
|
dc48a46e50 | ||
|
a6d6dd5995 | ||
|
8811c7141a | ||
|
a45d86bdf3 | ||
|
f06dd39892 | ||
|
c2ff30c4d7 | ||
|
a532aef935 | ||
|
4c0e475092 | ||
|
bccd83c656 | ||
|
bc830a9c45 | ||
|
63bbc77ee7 | ||
|
7ae388086b | ||
|
72f6b1a693 | ||
|
3379eafd33 | ||
|
3ceb9116de | ||
|
ed71656ea6 | ||
|
c4a4111b2e | ||
|
fb6ad9faec | ||
|
4ad3d66629 | ||
|
8be52d228e | ||
|
24d5fb09da | ||
|
60ec340fa3 | ||
|
71314f0c3a | ||
|
46575d8de7 | ||
|
660193ae1b | ||
|
1c4363eaa6 | ||
|
7bf502dd02 | ||
|
1061270ac0 | ||
|
45d77372a0 | ||
|
2d70c94733 | ||
|
f07d50e5bf | ||
|
102266d08d | ||
|
a8adb9374b | ||
|
d790a27060 | ||
|
7cd0235fed | ||
|
d9a1de0ec7 | ||
|
5455490ad2 | ||
|
80a3f0a0d4 | ||
|
335e2c5897 | ||
|
9102df7fde | ||
|
c7f10892a9 | ||
|
84af9d9999 | ||
|
b81ca18316 | ||
|
83e23ee6fd | ||
|
5fcb091127 | ||
|
f17426cbcd | ||
|
9c78364c45 | ||
|
7ffdb18bf9 | ||
|
8511f2398a | ||
|
df23e0f857 | ||
|
bd602847b5 | ||
|
59a4251a6a | ||
|
609d6a1b29 | ||
|
b6fc204dd3 | ||
|
f7e1083ba4 | ||
|
da5d7afe22 | ||
|
6751a7991d | ||
|
2d5f71e5be | ||
|
edd22342f2 | ||
|
218353e452 | ||
|
0105a48a4f | ||
|
6d1a83e667 | ||
|
51179a2c38 | ||
![]() |
1fdffd6ef9 | ||
|
87d9a4ff0b | ||
|
520e65f822 | ||
|
5ee731d86f | ||
|
8bc6c85396 | ||
|
f64d949169 | ||
|
8cda355af6 | ||
|
2afcea3870 | ||
|
ec73011617 | ||
|
ee45f54b53 | ||
|
3c7ab976c3 | ||
|
cac6d59140 | ||
|
26615d588e | ||
|
4d6ca2c387 | ||
|
9e7731259d | ||
|
cfcd9c3fc6 | ||
|
dd60b8f179 | ||
|
c1aee49b76 | ||
|
06eb9539bd | ||
|
e068ee3533 | ||
|
9e2c6d9fe1 | ||
|
308d78e3da | ||
|
ae4cb0c3ee | ||
|
43c9fd4cec | ||
|
186ec8c50f | ||
|
705b2dca0e | ||
|
baeaff2309 | ||
|
a0cae78cb2 | ||
|
97d8cc0efe | ||
|
7dff8d8fe2 | ||
|
46c6abcf54 | ||
|
441463327c | ||
|
359e748c28 | ||
|
d008cd0c46 | ||
|
87f367ec11 | ||
|
d6a170f848 | ||
|
ecafcefae9 | ||
|
f1158e8129 | ||
|
55de1c1a72 | ||
|
afbe8f2161 | ||
|
35b0546737 | ||
|
da4c55d5ad | ||
|
40a9d8ac06 | ||
|
c2826ca878 | ||
|
393ec99944 | ||
|
88555c0463 | ||
|
601b69b36c | ||
|
dcba3a1058 | ||
|
516fc0283b | ||
|
64cc3b3a6a | ||
|
9667dd051c | ||
|
a55583a395 | ||
|
f0acc64544 | ||
|
f52e06fc19 | ||
|
d1736ad0c8 | ||
|
405a0caf29 | ||
|
5a4817c147 | ||
|
90ccf5b42b | ||
|
22eb037c18 | ||
|
6655b7e512 | ||
|
9cf815505b | ||
|
4e121a7434 | ||
|
c90996f991 | ||
|
6315848620 | ||
|
65ec58a669 | ||
|
b619c0de2d | ||
|
c195144b17 | ||
|
c0fc615cd6 | ||
|
664edc5a39 | ||
|
c9756cee4c | ||
|
3ebebdf3c1 | ||
|
f3923a41c0 | ||
|
9d61d76e92 | ||
|
24ddb66af9 | ||
|
6c23caadd7 | ||
|
0d70cb9473 | ||
|
0731d79c09 | ||
|
0c4fa55f16 | ||
|
101f0b1579 | ||
|
975597bac9 | ||
|
c1eb9042b3 | ||
|
7cfb7063c2 | ||
|
7be069fcd2 | ||
|
f275e657f6 | ||
|
5fd3ec1035 | ||
|
a8ad530db9 | ||
|
2a52ade219 | ||
|
fe86e7ffc7 | ||
|
1c7d5c68c5 | ||
|
0cf2f6452b | ||
|
8376c8c68e | ||
|
e93104a6b3 | ||
|
70dec71c00 | ||
|
3cc6da1db2 | ||
|
88bf74b2a3 | ||
|
3f2dbdc8a8 | ||
|
ecfc5fcd63 | ||
|
7e23e6586b | ||
|
c5f5984c09 | ||
|
f3f7487664 | ||
|
e08b0d3070 | ||
|
75d79e98b9 | ||
|
2a65aaf5ab | ||
|
359f87ab9f | ||
|
3f88aa46d0 | ||
|
9c3da41130 | ||
|
5a9e382efe | ||
|
506d615acc | ||
|
e51bfb46c6 | ||
|
7615e78e52 | ||
|
1abf749f03 | ||
|
2854f6ca83 | ||
|
2a23b53515 | ||
|
477e1437d2 | ||
|
49ba00a3ec | ||
|
34f8eca7bd | ||
|
31c68c534c | ||
|
24078d4a72 | ||
|
ab8de9fa14 | ||
|
414e6caafe | ||
|
f18d57429e | ||
|
1b8d500c07 | ||
|
1fd5ad3e56 | ||
|
ccfc07e7e3 | ||
|
dd00e438fe | ||
|
7178ee3a6e | ||
|
d629c30fdb | ||
|
5387e3ba8f | ||
|
60d2678cff | ||
|
e814843cdb | ||
|
2b35c5efd7 | ||
|
aea481eacb | ||
|
f62df90960 | ||
|
17db4b4db3 | ||
|
48d74a8781 | ||
|
a275972361 | ||
|
61c968d550 | ||
|
45957dd707 | ||
|
7ca56ccd29 | ||
|
81b78a82e8 | ||
|
9bd940e153 | ||
|
7d2394273e | ||
|
032768a505 | ||
|
3f4d5598a5 | ||
|
da37585a8e | ||
|
559754fa76 | ||
|
a49649c313 | ||
|
674925dfb5 | ||
|
dcfbd554bb | ||
|
2e2be76e3f | ||
|
3e4dc31e39 | ||
|
a747318c90 | ||
|
4c4d4672d4 | ||
|
1ba0317905 | ||
|
48711bbdde | ||
|
c3d7ee5a9e | ||
|
b37f325126 | ||
|
058cfb553c | ||
|
bd4badc153 | ||
|
94f695cffc | ||
|
db8aaa74d6 | ||
|
3c933ebaad | ||
|
cc396f4dfd | ||
|
224b94c0ce | ||
|
9c45cc7e48 | ||
|
a3911f52a0 | ||
|
6114cff842 | ||
|
97773697a9 | ||
|
1c8a20a54a | ||
|
565922f9ad | ||
|
296ad8424e | ||
|
8d0f717e72 | ||
|
90febde783 | ||
|
816a1733dc | ||
|
1c736ea064 | ||
|
bce6d79ad3 | ||
|
f299be8158 | ||
|
a166534226 | ||
|
dddceba8f2 | ||
|
e3832cd2e2 | ||
|
bc0eb3349b | ||
|
25bb7c1826 | ||
|
e5dff83e38 | ||
|
a89441e879 | ||
|
20d8a424d6 | ||
|
0e441d48ac | ||
|
8c4731728c | ||
|
de1cad86ab | ||
|
d986354d53 | ||
|
8714f48ce7 | ||
|
04dc74a1d6 | ||
|
3af003d36b | ||
|
7502a7dc4d | ||
|
0c92655250 | ||
|
e3812f4075 | ||
|
b0a140e714 | ||
|
ebaa6fb5a2 | ||
|
5fba1c599b | ||
|
0d3f535590 | ||
|
427be928d0 | ||
|
977a27ecb7 | ||
|
7310e3c8c2 | ||
|
a42c663fd7 | ||
|
d0619cfb35 | ||
|
6099735c60 | ||
|
e53fb953bc | ||
|
e234dd2a36 | ||
|
23d16dc870 | ||
|
66a46ff03c | ||
|
d43766d3c9 | ||
|
ab03d238bb | ||
|
acd3cba5fa | ||
|
9fd2d57b86 | ||
|
f977c6876f | ||
|
4de9d9fa77 | ||
|
d1b1cb748d | ||
|
9b72a6ac69 | ||
|
0375bedab2 | ||
|
926ddcd47e | ||
|
dbc87e7c7d | ||
|
25e4c52adf | ||
|
a9ca528fb8 | ||
|
7344323b9e | ||
|
8f45b0d53a | ||
|
fba0c155df | ||
|
ae87e0d3fc | ||
|
5ead6353ac | ||
|
4ba361fea6 | ||
|
7d9de93fd3 | ||
|
551a69f1b1 | ||
|
efb4abbb7f | ||
|
619110ca4c | ||
|
76972bb2f6 | ||
|
6a4cd975b6 | ||
|
dfa9968565 | ||
|
62c4eb8d6a | ||
|
6277f5511c | ||
|
2e6cf2a414 | ||
|
6ed2773299 | ||
|
74a2cbe696 | ||
|
3d0631cfcc | ||
|
3a0ee78d2b | ||
|
2f5beb8853 | ||
|
57d686131e | ||
|
5105c67642 | ||
|
81f29d8dcd | ||
|
18ff097e4a | ||
|
9d27eb197f | ||
|
3c2c0960d1 | ||
|
61c969e970 | ||
|
b274931165 | ||
|
dd2a11b243 | ||
|
99781ab70c | ||
|
01f12a6bd5 | ||
|
24c1ee7744 | ||
|
b7026df551 | ||
|
fed10e87aa | ||
|
9d0ce25052 | ||
|
de5a3eaae9 | ||
|
7899f44173 | ||
|
6c04cecab1 | ||
|
fea34bd73f | ||
|
0db702dfa7 | ||
|
11103211c5 | ||
|
2fada94879 | ||
|
53e8882366 | ||
|
21ea49fe83 | ||
|
b784c7873d | ||
|
4a9b790dbe | ||
|
7cafec9861 | ||
|
1a354f88ac | ||
|
05026b891e | ||
|
6eb531c6ac | ||
|
1b9edbe119 | ||
|
bde1d07d4e | ||
|
4666a6a0ab | ||
|
9e5d577a71 | ||
|
f5dc9f0162 | ||
|
ab433102a4 | ||
|
d46590934a | ||
|
e282ece3d1 | ||
|
103a7ac628 | ||
|
e26c675829 | ||
|
26dfef7970 | ||
|
78234e9468 | ||
|
c2fff61ccd | ||
|
d58cce9c72 | ||
|
e32f38b939 | ||
|
fb27f34a32 | ||
|
d42791e260 | ||
|
f07a12af73 | ||
|
6931f6cadc | ||
|
dcc262ed91 | ||
|
082e166fae | ||
|
da74ca5ce0 | ||
|
10fe334247 | ||
|
db6107f12f | ||
|
a142a67972 | ||
|
37aa761283 | ||
|
390838e084 | ||
|
ea5e078526 | ||
|
df61a30259 | ||
|
ddbf6c162f | ||
|
fc507c66f7 | ||
|
3ae5310567 | ||
|
2b5f147545 | ||
|
902862aa8b | ||
|
bccff768ff | ||
|
56c74fb96f | ||
|
1a4f351e3d | ||
|
af38d3a47d | ||
|
226fb9c26b | ||
|
1c3d45f641 | ||
|
823218bb61 | ||
|
1ab854446c | ||
|
511a5686da | ||
|
4fc532d873 | ||
|
d71d984cfa | ||
|
e804c4a011 | ||
|
525f8b4d8e | ||
|
1f49612ca3 | ||
|
319ed2f9b8 | ||
|
497b33e403 | ||
|
9ab3a0c44b | ||
|
5baff05bac | ||
|
5a07d135ae | ||
|
43c49e2f31 | ||
|
1b184d8716 | ||
|
e54c0a90fa | ||
|
d763e9fe46 | ||
|
8f32114025 | ||
|
d4fd08a63f | ||
|
1b97a541f4 | ||
|
f60840754f | ||
|
5698d70806 | ||
|
5f36518181 | ||
|
4761a3d98b | ||
|
3be9e2ee95 | ||
|
5afe02505b | ||
|
ce55d7c2f5 | ||
|
7feba7e498 |
945 changed files with 40618 additions and 17501 deletions
|
@ -9,3 +9,8 @@ insert_final_newline = true
|
|||
indent_style = space
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
|
||||
[*.glsl]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
insert_final_newline = false
|
69
.gitlab-ci.yml
Normal file
69
.gitlab-ci.yml
Normal file
|
@ -0,0 +1,69 @@
|
|||
stages:
|
||||
- build
|
||||
|
||||
Debian:
|
||||
tags:
|
||||
- docker
|
||||
- linux
|
||||
image: gcc
|
||||
cache:
|
||||
key: apt-cache
|
||||
paths:
|
||||
- apt-cache/
|
||||
before_script:
|
||||
- export APT_CACHE_DIR=`pwd`/apt-cache && mkdir -pv $APT_CACHE_DIR
|
||||
- apt-get update -yq
|
||||
- apt-get -o dir::cache::archives="$APT_CACHE_DIR" install -y cmake libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev libsdl2-dev libqt4-dev libopenal-dev libopenscenegraph-3.4-dev libunshield-dev libtinyxml-dev
|
||||
# - apt-get install -y libmygui-dev libbullet-dev # to be updated to latest below because stretch is too old
|
||||
- curl http://ftp.us.debian.org/debian/pool/main/b/bullet/libbullet-dev_2.87+dfsg-2_amd64.deb -o libbullet-dev_2.87+dfsg-2_amd64.deb
|
||||
- curl http://ftp.us.debian.org/debian/pool/main/b/bullet/libbullet2.87_2.87+dfsg-2_amd64.deb -o libbullet2.87_2.87+dfsg-2_amd64.deb
|
||||
- curl http://ftp.us.debian.org/debian/pool/main/m/mygui/libmygui.openglplatform0debian1v5_3.2.2+dfsg-1_amd64.deb -o libmygui.openglplatform0debian1v5_3.2.2+dfsg-1_amd64.deb
|
||||
- curl http://ftp.us.debian.org/debian/pool/main/m/mygui/libmyguiengine3debian1v5_3.2.2+dfsg-1_amd64.deb -o libmyguiengine3debian1v5_3.2.2+dfsg-1_amd64.deb
|
||||
- curl http://ftp.us.debian.org/debian/pool/main/m/mygui/libmygui-dev_3.2.2+dfsg-1_amd64.deb -o libmygui-dev_3.2.2+dfsg-1_amd64.deb
|
||||
- dpkg --ignore-depends=libmygui.ogreplatform0debian1v5 -i *.deb
|
||||
stage: build
|
||||
script:
|
||||
- cores_to_use=$((`nproc`-2)); if (( $cores_to_use < 1 )); then cores_to_use=1; fi
|
||||
- mkdir build; cd build; cmake -DCMAKE_BUILD_TYPE=MinSizeRel ../
|
||||
- make -j$cores_to_use
|
||||
- DESTDIR=artifacts make install
|
||||
artifacts:
|
||||
paths:
|
||||
- build/artifacts/
|
||||
MacOS:
|
||||
tags:
|
||||
- macos
|
||||
- xcode
|
||||
except:
|
||||
- branches # because our CI VMs are not public, MRs can't use them and timeout
|
||||
stage: build
|
||||
allow_failure: true
|
||||
script:
|
||||
- rm -fr build/* # remove anything in the build directory
|
||||
- CI/before_install.osx.sh
|
||||
- CI/before_script.osx.sh
|
||||
- cd build; make -j2 package
|
||||
artifacts:
|
||||
paths:
|
||||
- build/OpenMW-*.dmg
|
||||
|
||||
Windows:
|
||||
tags:
|
||||
- win10
|
||||
- msvc2017
|
||||
except:
|
||||
- branches # because our CI VMs are not public, MRs can't use them and timeout
|
||||
stage: build
|
||||
allow_failure: true
|
||||
script:
|
||||
# - env # turn on for debugging
|
||||
- sh %CI_PROJECT_DIR%/CI/before_script.msvc.sh -c Release -p x64 -v 2017 -V
|
||||
- SET msBuildLocation="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\msbuild.exe"
|
||||
- call %msBuildLocation% MSVC2017_64\OpenMW.sln /t:Build /p:Configuration=Release /m:%NUMBER_OF_PROCESSORS%
|
||||
- 7z a OpenMW_MSVC2017_64_%CI_BUILD_REF_NAME%_%CI_BUILD_ID%.zip %CI_PROJECT_DIR%\MSVC2017_64\Release\
|
||||
cache:
|
||||
paths:
|
||||
- deps
|
||||
artifacts:
|
||||
paths:
|
||||
- "*.zip"
|
3
.gitmodules
vendored
3
.gitmodules
vendored
|
@ -1,6 +1,3 @@
|
|||
[submodule "extern/breakpad"]
|
||||
path = extern/breakpad
|
||||
url = https://chromium.googlesource.com/breakpad/breakpad
|
||||
[submodule "extern/sol"]
|
||||
path = extern/sol
|
||||
url = https://github.com/ThePhD/sol2
|
||||
|
|
31
.travis.yml
31
.travis.yml
|
@ -1,6 +1,10 @@
|
|||
os:
|
||||
- linux
|
||||
# - osx
|
||||
osx_image: xcode9.4
|
||||
language: cpp
|
||||
sudo: required
|
||||
dist: trusty
|
||||
dist: xenial
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
|
@ -11,19 +15,18 @@ env:
|
|||
global:
|
||||
# The next declaration is the encrypted COVERITY_SCAN_TOKEN, created
|
||||
# via the "travis encrypt" command using the project repo's public key
|
||||
- secure: NZmvVuA0O9NJXVQ12tXQZHDJC2mbFgYNFcsicw0DgW1It2Nk5hxIkF0pfu4/Z59mhQuOPgRVjl5b0FKy2Axh0gkWc1DJEXGwNaiW5lpTMNWR1LJG5rxa8LrDUpFkycpbzfAFuTUZu5z3iYVv64XzELvBuqNGhPMu1LeBnrlech0jFNjkR9p5qtJGWb8zYcPMCC57rig8a9g1ABoVYS6UXjrKpx0946ZLRsE5ukc9pXsypGwPmOMyfzZkxxzIqFaxoE5JIEdaJTWba/6Za315ozYYIi/N35ROI1YAv5GHRe/Iw9XAa4vQpbDzjM7ZSsZdTvvQsSU598gD2xC6jFUKSrpW6GZKwM2x236fZLGnOk5Uw7DUbG+AwpcEmxBwoy9PjBl9ZF3tJykI0gROewCy8MODhdsVMKr1HGIMVBIJySm/RnNqtoDbYV8mYnSl5b8rwJiCajoiR8Zuv4CIfGneeH1a3DOQDPH/qkDsU6ilzF4ANsBlMUUpgY653KBMBmTlNuVZSH527tnD7Fg6JgHVuSQkTbRa1vSkR7Zcre604RZcAoaEdbX3bhVDasPPghU/I742L0RH3oQNlR09pPBDZ8kG7ydl4aPHwpCWnvXNM1vgxtGvnYLztwrse7IoaRXRYiMFmrso78WhMWUDKgvY4wV9aeUu0DtnMezZVIQwCKg=
|
||||
- macos_qt_formula=qt
|
||||
- secure: 1QK0yVyoOB+gf2I7XzvhXu9w/5lq4stBXIwJbVCTjz4Q4XVHCosURaW1MAgKzMrPnbFEwjyn5uQ8BwsvvfkuN1AZD0YXITgc7gyI+J1wQ/p/ljxRxglakU6WEgsTs2J5z9UmGac4YTXg+quK7YP3rv+zuGim2I2rhzImejyzp0Ym3kRCnNcy+SGBsiRaevRJMe00Ch8zGAbEhduQGeSoS6W0rcu02DNlQKiq5NktWsXR+TWWWVfIeIlQR/lbPsCd0pdxMaMv2QCY0rVbwrYxWJwr/Qe45dAdWp+8/C3PbXpeMSGxlLa33nJNX4Lf/djxbjm8KWk6edaXPajrjR/0iwcpwq0jg2Jt6XfEdnJt35F1gpXlc04sxStjG45uloOKCFYT0wdhIO1Lq+hDP54wypQl+JInd5qC001O7pwhVxO36EgKWqo8HD+BqGDBwsNj2engy9Qcp3wO6G0rLBPB3CrZsk9wrHVv5cSiQSLMhId3Xviu3ZI2qEDA+kgTvxrKrsnMj4bILVCyG5Ka2Mj22wIDW9e8oIab9oTdujax3DTN1GkD6QuOAGzwDsNwGASsgfoeZ+FUhgM75RlBWGMilgkmnF7EJ0oAXLEpjtABnEr2d4qHv+y08kOuTDBLB9ExzCIj024dYYYNLZrqPKx0ncHuCMG2QNj2aJAJEZtj1rQ=
|
||||
|
||||
addons:
|
||||
apt:
|
||||
sources:
|
||||
- sourceline: 'ppa:openmw/openmw'
|
||||
- sourceline: 'ppa:rakhimov/boost'
|
||||
- ubuntu-toolchain-r-test
|
||||
- llvm-toolchain-precise-3.8
|
||||
packages: [
|
||||
# Dev
|
||||
cmake, clang-3.8, libunshield-dev, libtinyxml-dev,
|
||||
g++-6,
|
||||
cmake, clang-6.0, libunshield-dev, libtinyxml-dev,
|
||||
g++-8,
|
||||
# Tests
|
||||
libgtest-dev, google-mock,
|
||||
# Boost
|
||||
|
@ -42,7 +45,7 @@ addons:
|
|||
project:
|
||||
name: "TES3MP/openmw-tes3mp"
|
||||
description: "<Your project description here>"
|
||||
notification_email: stas5978@gmail.com
|
||||
notification_email: koncord@tes3mp.com
|
||||
build_command_prepend: "cmake . -DBUILD_UNITTESTS=FALSE -DBUILD_OPENCS=FALSE -DBUILD_BSATOOL=FALSE -DBUILD_ESMTOOL=FALSE -DBUILD_MWINIIMPORTER=FALSE -DBUILD_LAUNCHER=FALSE"
|
||||
build_command: "make -j3"
|
||||
branch_pattern: coverity_scan
|
||||
|
@ -50,19 +53,21 @@ matrix:
|
|||
include:
|
||||
- os: linux
|
||||
env:
|
||||
- ANALYZE="scan-build-3.8 --use-cc clang-3.8 --use-c++ clang++-3.8 "
|
||||
- MATRIX_CC="CC=clang-3.8 && CXX=clang++-3.8"
|
||||
- ANALYZE="scan-build-6.0 --use-cc clang-6.0 --use-c++ clang++-6.0 "
|
||||
- MATRIX_CC="CC=clang-6.0 && CXX=clang++-6.0"
|
||||
compiler: clang
|
||||
- os: linux
|
||||
env:
|
||||
- MATRIX_CC="CC=gcc-6 && CXX=g++-6"
|
||||
- MATRIX_CC="CC=gcc-8 && CXX=g++-8"
|
||||
- os: linux
|
||||
env:
|
||||
- MATRIX_CC="CC=clang-3.8 && CXX=clang++-3.8"
|
||||
- MATRIX_CC="CC=clang-6.0 && CXX=clang++-6.0"
|
||||
allow_failures:
|
||||
- env:
|
||||
- ANALYZE="scan-build-3.8 --use-cc clang-3.8 --use-c++ clang++-3.8 "
|
||||
- MATRIX_CC="CC=clang-3.8 && CXX=clang++-3.8"
|
||||
- MATRIX_CC="CC=clang-6.0 && CXX=clang++-6.0"
|
||||
- env:
|
||||
- ANALYZE="scan-build-6.0 --use-cc clang-6.0 --use-c++ clang++-6.0 "
|
||||
- MATRIX_CC="CC=clang-6.0 && CXX=clang++-6.0"
|
||||
|
||||
before_install:
|
||||
- ./CI/before_install.${TRAVIS_OS_NAME}.sh
|
||||
|
|
|
@ -22,6 +22,7 @@ Programmers
|
|||
alexanderkjall
|
||||
Alexander Nadeau (wareya)
|
||||
Alexander Olofsson (Ace)
|
||||
Alex S (docwest)
|
||||
Allofich
|
||||
Andrei Kortunov (akortunov)
|
||||
AnyOldName3
|
||||
|
@ -37,6 +38,7 @@ Programmers
|
|||
Britt Mathis (galdor557)
|
||||
Capostrophic
|
||||
cc9cii
|
||||
Cédric Mocquillon
|
||||
Chris Boyce (slothlife)
|
||||
Chris Robinson (KittyCat)
|
||||
Cory F. Cohen (cfcohen)
|
||||
|
@ -62,6 +64,8 @@ Programmers
|
|||
Evgeniy Mineev (sandstranger)
|
||||
Federico Guerra (FedeWar)
|
||||
Fil Krynicki (filkry)
|
||||
Finbar Crago (finbar-crago)
|
||||
Florian Weber (Florianjw)
|
||||
Gašper Sedej
|
||||
gugus/gus
|
||||
Hallfaer Tuilinn
|
||||
|
@ -139,6 +143,7 @@ Programmers
|
|||
Rohit Nirmal
|
||||
Roman Melnik (Kromgart)
|
||||
Roman Proskuryakov (kpp)
|
||||
Roman Siromakha (elsid)
|
||||
Sandy Carter (bwrsandman)
|
||||
Scott Howard
|
||||
scrawl
|
||||
|
@ -171,6 +176,7 @@ Programmers
|
|||
Documentation
|
||||
-------------
|
||||
|
||||
Adam Bowen (adamnbowen)
|
||||
Alejandro Sanchez (HiPhish)
|
||||
Bodillium
|
||||
Bret Curtis (psi29a)
|
||||
|
|
107
CHANGELOG.md
107
CHANGELOG.md
|
@ -1,8 +1,114 @@
|
|||
0.45.0
|
||||
------
|
||||
|
||||
Bug #1990: Sunrise/sunset not set correct
|
||||
Bug #2131: Lustidrike's spell misses the player every time
|
||||
Bug #2222: Fatigue's effect on selling price is backwards
|
||||
Bug #2326: After a bound item expires the last equipped item of that type is not automatically re-equipped
|
||||
Bug #2455: Creatures attacks degrade armor
|
||||
Bug #2562: Forcing AI to activate a teleport door sometimes causes a crash
|
||||
Bug #2626: Resurrecting the player does not resume the game
|
||||
Bug #2772: Non-existing class or faction freezes the game
|
||||
Bug #2835: Player able to slowly move when overencumbered
|
||||
Bug #2852: No murder bounty when a player follower commits murder
|
||||
Bug #2862: [macOS] Can't quit launcher using Command-Q or OpenMW->Quit
|
||||
Bug #2872: Tab completion in console doesn't work with explicit reference
|
||||
Bug #2971: Compiler did not reject lines with naked expressions beginning with x.y
|
||||
Bug #3249: Fixed revert function not updating views properly
|
||||
Bug #3374: Touch spells not hitting kwama foragers
|
||||
Bug #3486: [Mod] NPC Commands does not work
|
||||
Bug #3591: Angled hit distance too low
|
||||
Bug #3629: DB assassin attack never triggers creature spawning
|
||||
Bug #3876: Landscape texture painting is misaligned
|
||||
Bug #3897: Have Goodbye give all choices the effects of Goodbye
|
||||
Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters
|
||||
Bug #3950: FLATTEN_STATIC_TRANSFORMS optimization breaks animated collision shapes
|
||||
Bug #3993: Terrain texture blending map is not upscaled
|
||||
Bug #3997: Almalexia doesn't pace
|
||||
Bug #4036: Weird behaviour of AI packages if package target has non-unique ID
|
||||
Bug #4047: OpenMW not reporting its version number in MacOS; OpenMW-CS not doing it fully
|
||||
Bug #4110: Fixed undo / redo menu text losing the assigned shortcuts
|
||||
Bug #4125: OpenMW logo cropped on bugtracker
|
||||
Bug #4215: OpenMW shows book text after last EOL tag
|
||||
Bug #4221: Characters get stuck in V-shaped terrain
|
||||
Bug #4230: AiTravel package issues break some Tribunal quests
|
||||
Bug #4251: Stationary NPCs do not return to their position after combat
|
||||
Bug #4274: Pre-0.43 death animations are not forward-compatible with 0.43+
|
||||
Bug #4286: Scripted animations can be interrupted
|
||||
Bug #4291: Non-persistent actors that started the game as dead do not play death animations
|
||||
Bug #4293: Faction members are not aware of faction ownerships in barter
|
||||
Bug #4307: World cleanup should remove dead bodies only if death animation is finished
|
||||
Bug #4311: OpenMW does not handle RootCollisionNode correctly
|
||||
Bug #4327: Missing animations during spell/weapon stance switching
|
||||
Bug #4358: Running animation is interrupted when magic mode is toggled
|
||||
Bug #4368: Settings window ok button doesn't have key focus by default
|
||||
Bug #4378: On-self absorb spells restore stats
|
||||
Bug #4393: NPCs walk back to where they were after using ResetActors
|
||||
Bug #4416: Handle exception if we try to play non-music file
|
||||
Bug #4419: MRK NiStringExtraData is handled incorrectly
|
||||
Bug #4426: RotateWorld behavior is incorrect
|
||||
Bug #4429: [Windows] Error on build INSTALL.vcxproj project (debug) with cmake 3.7.2
|
||||
Bug #4431: "Lock 0" console command is a no-op
|
||||
Bug #4432: Guards behaviour is incorrect if they do not have AI packages
|
||||
Bug #4433: Guard behaviour is incorrect with Alarm = 0
|
||||
Bug #4451: Script fails to compile when using "Begin, [ScriptName]" syntax
|
||||
Bug #4452: Default terrain texture bleeds through texture transitions
|
||||
Bug #4453: Quick keys behaviour is invalid for equipment
|
||||
Bug #4454: AI opens doors too slow
|
||||
Bug #4457: Item without CanCarry flag prevents shield autoequipping in dark areas
|
||||
Bug #4458: AiWander console command handles idle chances incorrectly
|
||||
Bug #4459: NotCell dialogue condition doesn't support partial matches
|
||||
Bug #4460: Script function "Equip" doesn't bypass beast restrictions
|
||||
Bug #4461: "Open" spell from non-player caster isn't a crime
|
||||
Bug #4464: OpenMW keeps AiState cached storages even after we cancel AI packages
|
||||
Bug #4469: Abot Silt Striders – Model turn 90 degrees on horizontal
|
||||
Bug #4474: No fallback when getVampireHead fails
|
||||
Bug #4475: Scripted animations should not cause movement
|
||||
Bug #4479: "Game" category on Advanced page is getting too long
|
||||
Bug #4480: Segfault in QuickKeysMenu when item no longer in inventory
|
||||
Bug #4489: Goodbye doesn't block dialogue hyperlinks
|
||||
Bug #4490: PositionCell on player gives "Error: tried to add local script twice"
|
||||
Bug #4494: Training cap based off Base Skill instead of Modified Skill
|
||||
Bug #4495: Crossbow animations blending is buggy
|
||||
Bug #4496: SpellTurnLeft and SpellTurnRight animation groups are unused
|
||||
Bug #4497: File names starting with x or X are not classified as animation
|
||||
Bug #4503: Cast and ExplodeSpell commands increase alteration skill
|
||||
Bug #4510: Division by zero in MWMechanics::CreatureStats::setAttribute
|
||||
Bug #4519: Knockdown does not discard movement in the 1st-person mode
|
||||
Bug #4539: Paper Doll is affected by GUI scaling
|
||||
Bug #4545: Creatures flee from werewolves
|
||||
Bug #4551: Replace 0 sound range with default range separately
|
||||
Bug #4553: Forcegreeting on non-actor opens a dialogue window which cannot be closed
|
||||
Bug #4557: Topics with reserved names are handled differently from vanilla
|
||||
Bug #4558: Mesh optimizer: check for reserved node name is case-sensitive
|
||||
Bug #4563: Fast travel price logic checks destination cell instead of service actor cell
|
||||
Bug #4565: Underwater view distance should be limited
|
||||
Bug #4573: Player uses headtracking in the 1st-person mode
|
||||
Bug #4574: Player turning animations are twitchy
|
||||
Bug #4575: Weird result of attack animation blending with movement animations
|
||||
Bug #4576: Reset of idle animations when attack can not be started
|
||||
Feature #2606: Editor: Implemented (optional) case sensitive global search
|
||||
Feature #3083: Play animation when NPC is casting spell via script
|
||||
Feature #3103: Provide option for disposition to get increased by successful trade
|
||||
Feature #3276: Editor: Search - Show number of (remaining) search results and indicate a search without any results
|
||||
Feature #3641: Editor: Limit FPS in 3d preview window
|
||||
Feature #3703: Ranged sneak attack criticals
|
||||
Feature #4012: Editor: Write a log file if OpenCS crashes
|
||||
Feature #4222: 360° screenshots
|
||||
Feature #4256: Implement ToggleBorders (TB) console command
|
||||
Feature #4324: Add CFBundleIdentifier in Info.plist to allow for macOS function key shortcuts
|
||||
Feature #4345: Add equivalents for the command line commands to Launcher
|
||||
Feature #4404: Editor: All EnumDelegate fields should have their items sorted alphabetically
|
||||
Feature #4444: Per-group KF-animation files support
|
||||
Feature #4466: Editor: Add option to ignore "Base" records when running verifier
|
||||
Feature #4488: Make water shader rougher during rain
|
||||
Feature #4509: Show count of enchanted items in stack in the spells list
|
||||
Feature #4512: Editor: Use markers for lights and creatures levelled lists
|
||||
Feature #4548: Weapon priority: use the actual chance to hit the target instead of weapon skill
|
||||
Feature #4549: Weapon priority: use the actual damage in weapon rating calculations
|
||||
Feature #4550: Weapon priority: make ranged weapon bonus more sensible
|
||||
Task #2490: Don't open command prompt window on Release-mode builds automatically
|
||||
Task #4545: Enable is_pod string test
|
||||
|
||||
0.44.0
|
||||
------
|
||||
|
@ -88,6 +194,7 @@
|
|||
Bug #4412: openmw-iniimporter ignores data paths from config
|
||||
Bug #4413: Moving with 0 strength uses all of your fatigue
|
||||
Bug #4420: Camera flickering when I open up and close menus while sneaking
|
||||
Bug #4424: [macOS] Cursor is either empty or garbage when compiled against macOS 10.13 SDK
|
||||
Bug #4435: Item health is considered a signed integer
|
||||
Bug #4441: Adding items to currently disabled weapon-wielding creatures crashes the game
|
||||
Feature #1786: Round up encumbrance value in the encumbrance bar
|
||||
|
|
|
@ -15,7 +15,8 @@ sudo ln -s /usr/src/gtest/build/libgtest.so /usr/lib/libgtest.so
|
|||
sudo ln -s /usr/src/gtest/build/libgtest_main.so /usr/lib/libgtest_main.so
|
||||
|
||||
cd ~/
|
||||
git clone https://github.com/TES3MP/RakNet
|
||||
cd RakNet
|
||||
cmake . -DRAKNET_ENABLE_DLL=OFF -DRAKNET_ENABLE_SAMPLES=OFF -DCMAKE_BUILD_TYPE=Release
|
||||
git clone https://github.com/TES3MP/CrabNet
|
||||
cd CrabNet
|
||||
cmake . -DCRABNET_ENABLE_DLL=OFF -DCRABNET_ENABLE_SAMPLES=OFF -DCMAKE_BUILD_TYPE=Release
|
||||
make -j3
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ brew update
|
|||
|
||||
brew outdated cmake || brew upgrade cmake
|
||||
brew outdated pkgconfig || brew upgrade pkgconfig
|
||||
brew install $macos_qt_formula
|
||||
brew install qt
|
||||
|
||||
curl https://downloads.openmw.org/osx/dependencies/openmw-deps-c40905f.zip -o ~/openmw-deps.zip
|
||||
unzip ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null
|
||||
curl -fSL -R -J https://downloads.openmw.org/osx/dependencies/openmw-deps-100d2e0.zip -o ~/openmw-deps.zip
|
||||
unzip -o ~/openmw-deps.zip -d /private/tmp/openmw-deps > /dev/null
|
||||
|
|
|
@ -9,7 +9,7 @@ if [ ! -z "${MATRIX_CC}" ]; then
|
|||
eval "${MATRIX_CC}"
|
||||
fi
|
||||
|
||||
export RAKNET_ROOT=~/RakNet
|
||||
export RAKNET_ROOT=~/CrabNet
|
||||
|
||||
export CODE_COVERAGE=0
|
||||
if [ ! -z "${ANALYZE}" ]; then
|
||||
|
@ -35,5 +35,5 @@ ${ANALYZE}cmake .. \
|
|||
-DBINDIR=/usr/games \
|
||||
-DCMAKE_BUILD_TYPE="None" \
|
||||
-DUSE_SYSTEM_TINYXML=TRUE \
|
||||
-DRakNet_LIBRARY_RELEASE=~/RakNet/lib/libRakNetLibStatic.a \
|
||||
-DRakNet_LIBRARY_DEBUG=~/RakNet/lib/libRakNetLibStatic.a \
|
||||
-DRakNet_LIBRARY_RELEASE=~/CrabNet/lib/libRakNetLibStatic.a \
|
||||
-DRakNet_LIBRARY_DEBUG=~/CrabNet/lib/libRakNetLibStatic.a
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/bin/bash
|
||||
# set -x # turn-on for debugging
|
||||
|
||||
MISSINGTOOLS=0
|
||||
|
||||
|
@ -76,7 +77,6 @@ while [ $# -gt 0 ]; do
|
|||
h )
|
||||
cat <<EOF
|
||||
Usage: $0 [-cdehkpuvV]
|
||||
|
||||
Options:
|
||||
-c <Release/Debug>
|
||||
Set the configuration, can also be set with environment variable CONFIGURATION.
|
||||
|
@ -232,10 +232,9 @@ fi
|
|||
case $VS_VERSION in
|
||||
15|15.0|2017 )
|
||||
GENERATOR="Visual Studio 15 2017"
|
||||
TOOLSET="vc140"
|
||||
TOOLSET_REAL="vc141"
|
||||
TOOLSET="vc141"
|
||||
MSVC_REAL_VER="15"
|
||||
MSVC_VER="14"
|
||||
MSVC_VER="14.1"
|
||||
MSVC_YEAR="2015"
|
||||
MSVC_DISPLAY_YEAR="2017"
|
||||
;;
|
||||
|
@ -243,9 +242,8 @@ case $VS_VERSION in
|
|||
14|14.0|2015 )
|
||||
GENERATOR="Visual Studio 14 2015"
|
||||
TOOLSET="vc140"
|
||||
TOOLSET_REAL="vc140"
|
||||
MSVC_REAL_VER="14"
|
||||
MSVC_VER="14"
|
||||
MSVC_VER="14.0"
|
||||
MSVC_YEAR="2015"
|
||||
MSVC_DISPLAY_YEAR="2015"
|
||||
;;
|
||||
|
@ -253,9 +251,8 @@ case $VS_VERSION in
|
|||
12|12.0|2013 )
|
||||
GENERATOR="Visual Studio 12 2013"
|
||||
TOOLSET="vc120"
|
||||
TOOLSET_REAL="vc120"
|
||||
MSVC_REAL_VER="12"
|
||||
MSVC_VER="12"
|
||||
MSVC_VER="12.0"
|
||||
MSVC_YEAR="2013"
|
||||
MSVC_DISPLAY_YEAR="2013"
|
||||
;;
|
||||
|
@ -325,9 +322,9 @@ if [ -z $SKIP_DOWNLOAD ]; then
|
|||
|
||||
# Boost
|
||||
if [ -z $APPVEYOR ]; then
|
||||
download "Boost 1.61.0" \
|
||||
"https://sourceforge.net/projects/boost/files/boost-binaries/1.61.0/boost_1_61_0-msvc-${MSVC_VER}.0-${BITS}.exe" \
|
||||
"boost-1.61.0-msvc${MSVC_YEAR}-win${BITS}.exe"
|
||||
download "Boost 1.67.0" \
|
||||
"https://sourceforge.net/projects/boost/files/boost-binaries/1.67.0/boost_1_67_0-msvc-${MSVC_VER}-${BITS}.exe" \
|
||||
"boost-1.67.0-msvc${MSVC_YEAR}-win${BITS}.exe"
|
||||
fi
|
||||
|
||||
# Bullet
|
||||
|
@ -365,8 +362,8 @@ if [ -z $SKIP_DOWNLOAD ]; then
|
|||
QT_SUFFIX=""
|
||||
fi
|
||||
|
||||
download "Qt 5.7.2" \
|
||||
"https://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-windows-x86-msvc${MSVC_YEAR}${QT_SUFFIX}-5.7.0.exe" \
|
||||
download "Qt 5.7.0" \
|
||||
"https://download.qt.io/archive/qt/5.7/5.7.0/qt-opensource-windows-x86-msvc${MSVC_YEAR}${QT_SUFFIX}-5.7.0.exe" \
|
||||
"qt-5.7.0-msvc${MSVC_YEAR}-win${BITS}.exe" \
|
||||
"https://www.lysator.liu.se/~ace/OpenMW/deps/qt-5-install.qs" \
|
||||
"qt-5-install.qs"
|
||||
|
@ -403,9 +400,9 @@ echo
|
|||
|
||||
# Boost
|
||||
if [ -z $APPVEYOR ]; then
|
||||
printf "Boost 1.61.0... "
|
||||
printf "Boost 1.67.0... "
|
||||
else
|
||||
if [ $MSVC_VER -eq 12 ]; then
|
||||
if [ $MSVC_VER -eq 12.0 ]; then
|
||||
printf "Boost 1.58.0 AppVeyor... "
|
||||
else
|
||||
printf "Boost 1.67.0 AppVeyor... "
|
||||
|
@ -417,17 +414,28 @@ fi
|
|||
|
||||
BOOST_SDK="$(real_pwd)/Boost"
|
||||
|
||||
if [ -d Boost ] && grep "BOOST_VERSION 106100" Boost/boost/version.hpp > /dev/null; then
|
||||
# Boost's installer is still based on ms-dos API that doesn't support larger than 260 char path names
|
||||
# We work around this by installing to root of the current working drive and then move it to our deps
|
||||
# get the current working drive's root, we'll install to that temporarily
|
||||
CWD_DRIVE_ROOT="$(powershell -command '(get-location).Drive.Root')Boost_temp"
|
||||
CWD_DRIVE_ROOT_BASH=$(echo "$CWD_DRIVE_ROOT" | sed "s,\\\\,/,g" | sed "s,\(.\):,/\\1,")
|
||||
if [ -d CWD_DRIVE_ROOT_BASH ]; then
|
||||
printf "Cannot continue, ${CWD_DRIVE_ROOT_BASH} aka ${CWD_DRIVE_ROOT} already exists. Please remove before re-running. ";
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
if [ -d ${BOOST_SDK} ] && grep "BOOST_VERSION 106700" Boost/boost/version.hpp > /dev/null; then
|
||||
printf "Exists. "
|
||||
elif [ -z $SKIP_EXTRACT ]; then
|
||||
rm -rf Boost
|
||||
"${DEPS}/boost-1.61.0-msvc${MSVC_YEAR}-win${BITS}.exe" //dir="$(echo $BOOST_SDK | sed s,/,\\\\,g)" //verysilent
|
||||
CI_EXTRA_INNO_OPTIONS=""
|
||||
[ -n "$CI" ] && CI_EXTRA_INNO_OPTIONS="//SUPPRESSMSGBOXES //LOG='boost_install.log'"
|
||||
"${DEPS}/boost-1.67.0-msvc${MSVC_YEAR}-win${BITS}.exe" //DIR="${CWD_DRIVE_ROOT}" //VERYSILENT //NORESTART ${CI_EXTRA_INNO_OPTIONS}
|
||||
mv "${CWD_DRIVE_ROOT_BASH}" "${BOOST_SDK}"
|
||||
fi
|
||||
|
||||
add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \
|
||||
-DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.0"
|
||||
-DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}"
|
||||
add_cmake_opts -DBoost_COMPILER="-${TOOLSET}"
|
||||
|
||||
echo Done.
|
||||
else
|
||||
# Appveyor unstable has all the boost we need already
|
||||
|
@ -444,19 +452,17 @@ fi
|
|||
|
||||
add_cmake_opts -DBOOST_ROOT="$BOOST_SDK" \
|
||||
-DBOOST_LIBRARYDIR="${BOOST_SDK}/lib${BITS}-msvc-${MSVC_VER}.${LIB_SUFFIX}"
|
||||
add_cmake_opts -DBoost_COMPILER="-${TOOLSET_REAL}"
|
||||
add_cmake_opts -DBoost_COMPILER="-${TOOLSET}"
|
||||
|
||||
echo Done.
|
||||
fi
|
||||
}
|
||||
cd $DEPS
|
||||
echo
|
||||
|
||||
# Bullet
|
||||
printf "Bullet 2.86... "
|
||||
{
|
||||
cd $DEPS_INSTALL
|
||||
|
||||
if [ -d Bullet ]; then
|
||||
printf -- "Exists. (No version checking) "
|
||||
elif [ -z $SKIP_EXTRACT ]; then
|
||||
|
@ -464,49 +470,38 @@ printf "Bullet 2.86... "
|
|||
eval 7z x -y "${DEPS}/Bullet-2.86-msvc${MSVC_YEAR}-win${BITS}.7z" $STRIP
|
||||
mv "Bullet-2.86-msvc${MSVC_YEAR}-win${BITS}" Bullet
|
||||
fi
|
||||
|
||||
export BULLET_ROOT="$(real_pwd)/Bullet"
|
||||
|
||||
echo Done.
|
||||
}
|
||||
cd $DEPS
|
||||
echo
|
||||
|
||||
# FFmpeg
|
||||
printf "FFmpeg 3.2.4... "
|
||||
{
|
||||
cd $DEPS_INSTALL
|
||||
|
||||
if [ -d FFmpeg ] && grep "FFmpeg version: 3.2.4" FFmpeg/README.txt > /dev/null; then
|
||||
printf "Exists. "
|
||||
elif [ -z $SKIP_EXTRACT ]; then
|
||||
rm -rf FFmpeg
|
||||
|
||||
eval 7z x -y "${DEPS}/ffmpeg-3.2.4-win${BITS}.zip" $STRIP
|
||||
eval 7z x -y "${DEPS}/ffmpeg-3.2.4-dev-win${BITS}.zip" $STRIP
|
||||
|
||||
mv "ffmpeg-3.2.4-win${BITS}-shared" FFmpeg
|
||||
cp -r "ffmpeg-3.2.4-win${BITS}-dev/"* FFmpeg/
|
||||
rm -rf "ffmpeg-3.2.4-win${BITS}-dev"
|
||||
fi
|
||||
|
||||
export FFMPEG_HOME="$(real_pwd)/FFmpeg"
|
||||
add_runtime_dlls "$(pwd)/FFmpeg/bin/"{avcodec-57,avformat-57,avutil-55,swresample-2,swscale-4}.dll
|
||||
|
||||
if [ $BITS -eq 32 ]; then
|
||||
add_cmake_opts "-DCMAKE_EXE_LINKER_FLAGS=\"/machine:X86 /safeseh:no\""
|
||||
fi
|
||||
|
||||
echo Done.
|
||||
}
|
||||
cd $DEPS
|
||||
echo
|
||||
|
||||
# MyGUI
|
||||
printf "MyGUI 3.2.2... "
|
||||
{
|
||||
cd $DEPS_INSTALL
|
||||
|
||||
if [ -d MyGUI ] && \
|
||||
grep "MYGUI_VERSION_MAJOR 3" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \
|
||||
grep "MYGUI_VERSION_MINOR 2" MyGUI/include/MYGUI/MyGUI_Prerequest.h > /dev/null && \
|
||||
|
@ -518,21 +513,17 @@ printf "MyGUI 3.2.2... "
|
|||
eval 7z x -y "${DEPS}/MyGUI-3.2.2-msvc${MSVC_YEAR}-win${BITS}.7z" $STRIP
|
||||
mv "MyGUI-3.2.2-msvc${MSVC_YEAR}-win${BITS}" MyGUI
|
||||
fi
|
||||
|
||||
export MYGUI_HOME="$(real_pwd)/MyGUI"
|
||||
|
||||
if [ $CONFIGURATION == "Debug" ]; then
|
||||
SUFFIX="_d"
|
||||
else
|
||||
SUFFIX=""
|
||||
fi
|
||||
add_runtime_dlls "$(pwd)/MyGUI/bin/${CONFIGURATION}/MyGUIEngine${SUFFIX}.dll"
|
||||
|
||||
echo Done.
|
||||
}
|
||||
cd $DEPS
|
||||
echo
|
||||
|
||||
# OpenAL
|
||||
printf "OpenAL-Soft 1.17.2... "
|
||||
{
|
||||
|
@ -542,24 +533,18 @@ printf "OpenAL-Soft 1.17.2... "
|
|||
rm -rf openal-soft-1.17.2-bin
|
||||
eval 7z x -y OpenAL-Soft-1.17.2.zip $STRIP
|
||||
fi
|
||||
|
||||
OPENAL_SDK="$(real_pwd)/openal-soft-1.17.2-bin"
|
||||
|
||||
add_cmake_opts -DOPENAL_INCLUDE_DIR="${OPENAL_SDK}/include/AL" \
|
||||
-DOPENAL_LIBRARY="${OPENAL_SDK}/libs/Win${BITS}/OpenAL32.lib"
|
||||
|
||||
add_runtime_dlls "$(pwd)/openal-soft-1.17.2-bin/bin/WIN${BITS}/soft_oal.dll:OpenAL32.dll"
|
||||
|
||||
echo Done.
|
||||
}
|
||||
cd $DEPS
|
||||
echo
|
||||
|
||||
# OSG
|
||||
printf "OSG 3.4.1-scrawl... "
|
||||
{
|
||||
cd $DEPS_INSTALL
|
||||
|
||||
if [ -d OSG ] && \
|
||||
grep "OPENSCENEGRAPH_MAJOR_VERSION 3" OSG/include/osg/Version > /dev/null && \
|
||||
grep "OPENSCENEGRAPH_MINOR_VERSION 4" OSG/include/osg/Version > /dev/null && \
|
||||
|
@ -571,28 +556,21 @@ printf "OSG 3.4.1-scrawl... "
|
|||
eval 7z x -y "${DEPS}/OSG-3.4.1-scrawl-msvc${MSVC_YEAR}-win${BITS}.7z" $STRIP
|
||||
mv "OSG-3.4.1-scrawl-msvc${MSVC_YEAR}-win${BITS}" OSG
|
||||
fi
|
||||
|
||||
OSG_SDK="$(real_pwd)/OSG"
|
||||
|
||||
add_cmake_opts -DOSG_DIR="$OSG_SDK"
|
||||
|
||||
if [ $CONFIGURATION == "Debug" ]; then
|
||||
SUFFIX="d"
|
||||
else
|
||||
SUFFIX=""
|
||||
fi
|
||||
|
||||
add_runtime_dlls "$(pwd)/OSG/bin/"{OpenThreads,zlib,libpng*}${SUFFIX}.dll \
|
||||
"$(pwd)/OSG/bin/osg"{,Animation,DB,FX,GA,Particle,Text,Util,Viewer}${SUFFIX}.dll
|
||||
|
||||
add_osg_dlls "$(pwd)/OSG/bin/osgPlugins-3.4.1/osgdb_"{bmp,dds,jpeg,osg,png,tga}${SUFFIX}.dll
|
||||
add_osg_dlls "$(pwd)/OSG/bin/osgPlugins-3.4.1/osgdb_serializers_osg"{,animation,fx,ga,particle,text,util,viewer}${SUFFIX}.dll
|
||||
|
||||
echo Done.
|
||||
}
|
||||
cd $DEPS
|
||||
echo
|
||||
|
||||
# Qt
|
||||
if [ -z $APPVEYOR ]; then
|
||||
printf "Qt 5.7.0... "
|
||||
|
@ -605,71 +583,53 @@ fi
|
|||
else
|
||||
SUFFIX=""
|
||||
fi
|
||||
|
||||
if [ -z $APPVEYOR ]; then
|
||||
cd $DEPS_INSTALL
|
||||
QT_SDK="$(real_pwd)/Qt/5.7/msvc${MSVC_YEAR}${SUFFIX}"
|
||||
|
||||
if [ -d Qt ] && head -n2 Qt/InstallationLog.txt | grep "5.7.0" > /dev/null; then
|
||||
printf "Exists. "
|
||||
elif [ -z $SKIP_EXTRACT ]; then
|
||||
rm -rf Qt
|
||||
cp "${DEPS}/qt-5-install.qs" qt-install.qs
|
||||
|
||||
|
||||
sed -i "s|INSTALL_DIR|$(real_pwd)/Qt|" qt-install.qs
|
||||
sed -i "s/qt.VERSION.winBITS_msvcYEAR/qt.57.win${BITS}_msvc${MSVC_YEAR}${SUFFIX}/" qt-install.qs
|
||||
|
||||
printf -- "(Installation might take a while) "
|
||||
"${DEPS}/qt-5.7.0-msvc${MSVC_YEAR}-win${BITS}.exe" --script qt-install.qs --silent
|
||||
|
||||
mv qt-install.qs Qt/
|
||||
|
||||
echo Done.
|
||||
printf " Cleaning up extraneous data... "
|
||||
rm -r "$(real_pwd)/Qt/"{dist,Docs,Examples,Tools,vcredist,components.xml,MaintenanceTool.dat,MaintenanceTool.exe,MaintenanceTool.ini,network.xml,qt-install.qs}
|
||||
fi
|
||||
|
||||
cd $QT_SDK
|
||||
|
||||
add_cmake_opts -DDESIRED_QT_VERSION=5 \
|
||||
-DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
|
||||
-DCMAKE_PREFIX_PATH="$QT_SDK"
|
||||
|
||||
if [ $CONFIGURATION == "Debug" ]; then
|
||||
SUFFIX="d"
|
||||
else
|
||||
SUFFIX=""
|
||||
fi
|
||||
|
||||
add_runtime_dlls "$(pwd)/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${SUFFIX}.dll
|
||||
add_qt_platform_dlls "$(pwd)/plugins/platforms/qwindows${SUFFIX}.dll"
|
||||
|
||||
echo Done.
|
||||
else
|
||||
QT_SDK="C:/Qt/5.10/msvc${MSVC_DISPLAY_YEAR}${SUFFIX}"
|
||||
|
||||
add_cmake_opts -DDESIRED_QT_VERSION=5 \
|
||||
-DQT_QMAKE_EXECUTABLE="${QT_SDK}/bin/qmake.exe" \
|
||||
-DCMAKE_PREFIX_PATH="$QT_SDK"
|
||||
|
||||
if [ $CONFIGURATION == "Debug" ]; then
|
||||
SUFFIX="d"
|
||||
else
|
||||
SUFFIX=""
|
||||
fi
|
||||
|
||||
DIR=$(echo "${QT_SDK}" | sed "s,\\\\,/,g" | sed "s,\(.\):,/\\1,")
|
||||
|
||||
add_runtime_dlls "${DIR}/bin/Qt5"{Core,Gui,Network,OpenGL,Widgets}${SUFFIX}.dll
|
||||
add_qt_platform_dlls "${DIR}/plugins/platforms/qwindows${SUFFIX}.dll"
|
||||
|
||||
echo Done.
|
||||
fi
|
||||
}
|
||||
cd $DEPS
|
||||
echo
|
||||
|
||||
# SDL2
|
||||
printf "SDL 2.0.7... "
|
||||
{
|
||||
|
@ -679,26 +639,18 @@ printf "SDL 2.0.7... "
|
|||
rm -rf SDL2-2.0.7
|
||||
eval 7z x -y SDL2-2.0.7.zip $STRIP
|
||||
fi
|
||||
|
||||
export SDL2DIR="$(real_pwd)/SDL2-2.0.7"
|
||||
|
||||
add_runtime_dlls "$(pwd)/SDL2-2.0.7/lib/x${ARCHSUFFIX}/SDL2.dll"
|
||||
|
||||
echo Done.
|
||||
}
|
||||
echo
|
||||
|
||||
|
||||
cd $DEPS_INSTALL/..
|
||||
|
||||
echo
|
||||
echo "Setting up OpenMW build..."
|
||||
|
||||
add_cmake_opts -DBUILD_BSATOOL=no \
|
||||
-DBUILD_ESMTOOL=no \
|
||||
-DBUILD_MYGUI_PLUGIN=no \
|
||||
-DOPENMW_MP_BUILD=on
|
||||
|
||||
if [ ! -z $CI ]; then
|
||||
case $STEP in
|
||||
components )
|
||||
|
@ -710,7 +662,6 @@ if [ ! -z $CI ]; then
|
|||
-DBUILD_OPENMW=no \
|
||||
-DBUILD_WIZARD=no
|
||||
;;
|
||||
|
||||
openmw )
|
||||
echo " Building subproject: OpenMW."
|
||||
add_cmake_opts -DBUILD_ESSIMPORTER=no \
|
||||
|
@ -719,7 +670,6 @@ if [ ! -z $CI ]; then
|
|||
-DBUILD_OPENCS=no \
|
||||
-DBUILD_WIZARD=no
|
||||
;;
|
||||
|
||||
opencs )
|
||||
echo " Building subproject: OpenCS."
|
||||
add_cmake_opts -DBUILD_ESSIMPORTER=no \
|
||||
|
@ -728,7 +678,6 @@ if [ ! -z $CI ]; then
|
|||
-DBUILD_OPENMW=no \
|
||||
-DBUILD_WIZARD=no
|
||||
;;
|
||||
|
||||
misc )
|
||||
echo " Building subprojects: Misc."
|
||||
add_cmake_opts -DBUILD_OPENCS=no \
|
||||
|
@ -736,7 +685,6 @@ if [ ! -z $CI ]; then
|
|||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# NOTE: Disable this when/if we want to run test cases
|
||||
#if [ -z $CI ]; then
|
||||
echo "- Copying Runtime DLLs..."
|
||||
|
@ -745,16 +693,13 @@ fi
|
|||
TARGET="$(basename "$DLL")"
|
||||
if [[ "$DLL" == *":"* ]]; then
|
||||
IFS=':'; SPLIT=( ${DLL} ); unset IFS
|
||||
|
||||
DLL=${SPLIT[0]}
|
||||
TARGET=${SPLIT[1]}
|
||||
fi
|
||||
|
||||
echo " ${TARGET}."
|
||||
cp "$DLL" "$BUILD_CONFIG/$TARGET"
|
||||
done
|
||||
echo
|
||||
|
||||
echo "- OSG Plugin DLLs..."
|
||||
mkdir -p $BUILD_CONFIG/osgPlugins-3.4.1
|
||||
for DLL in $OSG_PLUGINS; do
|
||||
|
@ -762,7 +707,6 @@ fi
|
|||
cp "$DLL" $BUILD_CONFIG/osgPlugins-3.4.1
|
||||
done
|
||||
echo
|
||||
|
||||
echo "- Qt Platform DLLs..."
|
||||
mkdir -p ${BUILD_CONFIG}/platforms
|
||||
for DLL in $QT_PLATFORMS; do
|
||||
|
@ -771,16 +715,13 @@ fi
|
|||
done
|
||||
echo
|
||||
#fi
|
||||
|
||||
if [ -z $VERBOSE ]; then
|
||||
printf -- "- Configuring... "
|
||||
else
|
||||
echo "- cmake .. $CMAKE_OPTS"
|
||||
fi
|
||||
|
||||
run_cmd cmake .. $CMAKE_OPTS
|
||||
RET=$?
|
||||
|
||||
if [ -z $VERBOSE ]; then
|
||||
if [ $RET -eq 0 ]; then
|
||||
echo Done.
|
||||
|
@ -788,5 +729,4 @@ if [ -z $VERBOSE ]; then
|
|||
echo Failed.
|
||||
fi
|
||||
fi
|
||||
|
||||
exit $RET
|
||||
|
|
|
@ -4,14 +4,14 @@ export CXX=clang++
|
|||
export CC=clang
|
||||
|
||||
DEPENDENCIES_ROOT="/private/tmp/openmw-deps/openmw-deps"
|
||||
QT_PATH=`brew --prefix $macos_qt_formula`
|
||||
QT_PATH=`brew --prefix qt`
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
cmake \
|
||||
-D CMAKE_PREFIX_PATH="$DEPENDENCIES_ROOT;$QT_PATH" \
|
||||
-D CMAKE_OSX_DEPLOYMENT_TARGET="10.9" \
|
||||
-D CMAKE_OSX_SYSROOT="macosx10.12" \
|
||||
-D CMAKE_OSX_SYSROOT="macosx10.13" \
|
||||
-D CMAKE_BUILD_TYPE=Release \
|
||||
-D OPENMW_OSX_DEPLOYMENT=TRUE \
|
||||
-D DESIRED_QT_VERSION=5 \
|
||||
|
|
|
@ -140,16 +140,6 @@ endif()
|
|||
find_package(RakNet REQUIRED)
|
||||
include_directories(${RakNet_INCLUDES})
|
||||
|
||||
if (BUILD_OPENMW_MP OR BUILD_MASTER)
|
||||
find_package(LuaJit REQUIRED)
|
||||
find_package(Sol2 REQUIRED)
|
||||
include_directories(${LuaJit_INCLUDE_DIRS} ${Sol2_INCLUDE_DIRS})
|
||||
endif()
|
||||
if (BUILD_MASTER)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
include_directories(${OpenSSL_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
# Dependencies
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
|
@ -219,6 +209,7 @@ endif()
|
|||
IF(BUILD_OPENMW OR BUILD_OPENCS)
|
||||
|
||||
find_package(OpenSceneGraph 3.3.4 REQUIRED osgDB osgViewer osgText osgGA osgParticle osgUtil osgFX)
|
||||
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS})
|
||||
|
||||
set(USED_OSG_PLUGINS
|
||||
osgdb_bmp
|
||||
|
@ -259,11 +250,10 @@ IF(BUILD_OPENMW OR BUILD_OPENCS)
|
|||
find_package(SDL2 REQUIRED)
|
||||
find_package(OpenAL REQUIRED)
|
||||
find_package(Bullet ${REQUIRED_BULLET_VERSION} REQUIRED COMPONENTS BulletCollision LinearMath)
|
||||
|
||||
ELSE()
|
||||
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) # HACK: DO NOT MOVE THIS. Used for server only build, kept here to avoid merge conflicts above.
|
||||
ENDIF(BUILD_OPENMW OR BUILD_OPENCS)
|
||||
|
||||
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}) # HACK: DON'T TOUCH IT!
|
||||
|
||||
|
||||
set(BOOST_COMPONENTS system filesystem program_options)
|
||||
if(WIN32)
|
||||
|
@ -676,10 +666,10 @@ if (WIN32)
|
|||
endif()
|
||||
|
||||
if (BUILD_OPENMW)
|
||||
# Release builds use the debug console
|
||||
set_target_properties(tes3mp PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:CONSOLE")
|
||||
set_target_properties(tes3mp PROPERTIES COMPILE_DEFINITIONS_RELEASE "_CONSOLE")
|
||||
set_target_properties(tes3mp PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:CONSOLE")
|
||||
# Release builds don't use the debug console
|
||||
set_target_properties(tes3mp PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
|
||||
set_target_properties(tes3mp PROPERTIES COMPILE_DEFINITIONS_RELEASE "_WINDOWS")
|
||||
set_target_properties(tes3mp PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS")
|
||||
endif()
|
||||
|
||||
# Play a bit with the warning levels
|
||||
|
@ -690,7 +680,8 @@ if (WIN32)
|
|||
# Warnings that aren't enabled normally and don't need to be enabled
|
||||
# They're unneeded and sometimes completely retarded warnings that /Wall enables
|
||||
# Not going to bother commenting them as they tend to warn on every standard library file
|
||||
4061 4263 4264 4266 4350 4371 4435 4514 4548 4571 4610 4619 4623 4625 4626 4628 4640 4668 4710 4711 4820 4826 4917 4946
|
||||
4061 4263 4264 4266 4350 4371 4435 4514 4548 4571 4610 4619 4623 4625
|
||||
4626 4628 4640 4668 4710 4711 4768 4820 4826 4917 4946 5032 5039 5045
|
||||
|
||||
# Warnings that are thrown on standard libraries and not OpenMW
|
||||
4347 # Non-template function with same name and parameter count as template function
|
||||
|
@ -711,6 +702,7 @@ if (WIN32)
|
|||
|
||||
# caused by MyGUI
|
||||
4275 # non dll-interface class 'std::exception' used as base for dll-interface class 'MyGUI::Exception'
|
||||
4297 # function assumed not to throw an exception but does
|
||||
|
||||
# OpenMW specific warnings
|
||||
4099 # Type mismatch, declared class or struct is defined with other type
|
||||
|
@ -744,7 +736,10 @@ if (WIN32)
|
|||
endforeach(d)
|
||||
|
||||
set_target_properties(components PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}")
|
||||
set_target_properties(osg-ffmpeg-videoplayer PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}")
|
||||
|
||||
if (BUILD_OPENMW)
|
||||
set_target_properties(osg-ffmpeg-videoplayer PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}")
|
||||
endif()
|
||||
|
||||
if (BUILD_BSATOOL)
|
||||
set_target_properties(bsatool PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}")
|
||||
|
|
|
@ -3,7 +3,7 @@ How to contribute to OpenMW
|
|||
|
||||
Not sure what to do with all your free time? Pick out a task from here:
|
||||
|
||||
https://bugs.openmw.org/
|
||||
https://gitlab.com/OpenMW/openmw/issues
|
||||
|
||||
Currently, we are focused on completing the MW game experience and general polishing. Features out of this scope may be approved in some cases, but you should probably start a discussion first.
|
||||
|
||||
|
|
34
README.md
34
README.md
|
@ -1,47 +1,49 @@
|
|||
TES3MP
|
||||
======
|
||||
|
||||
[](https://travis-ci.org/TES3MP/openmw-tes3mp)
|
||||
Copyright (c) 2008-2015, OpenMW Team
|
||||
Copyright (c) 2016-2019, Stanislav Zhukov & David Cernat
|
||||
|
||||
TES3MP is a project aiming to add multiplayer functionality to [OpenMW](https://github.com/OpenMW/openmw), a free and open source engine recreation of the popular Bethesda Softworks game "The Elder Scrolls III: Morrowind".
|
||||
[](https://travis-ci.org/TES3MP/openmw-tes3mp)
|
||||
|
||||
* TES3MP version: TBD-rewrite
|
||||
TES3MP is a project adding multiplayer functionality to [OpenMW](https://github.com/OpenMW/openmw), an open-source game engine that supports playing "The Elder Scrolls III: Morrowind" by Bethesda Softworks.
|
||||
|
||||
* TES3MP version: 0.7.0-alpha
|
||||
* OpenMW version: 0.44.0
|
||||
* License: GPLv3 (see [LICENSE](https://github.com/TES3MP/openmw-tes3mp/blob/master/LICENSE) for more information)
|
||||
|
||||
Font Licenses:
|
||||
* DejaVuLGCSansMono.ttf: custom (see [files/mygui/DejaVu Font License.txt](https://github.com/TES3MP/openmw-tes3mp/blob/master/files/mygui/DejaVu%20Font%20License.txt) for more information)
|
||||
|
||||
Project Status
|
||||
Project status
|
||||
--------------
|
||||
|
||||
[Version changelog](https://github.com/TES3MP/openmw-tes3mp/blob/master/tes3mp-changelog.md)
|
||||
|
||||
As of version 0.6, TES3MP is playable in most respects. Player and NPC movement, animations, combat and spell casting are properly synchronized with small exceptions, as is picking up and dropping items in the world, using doors and levers, and adding and removing items from containers. Journal entries, faction stats and dialogue topics are also synchronized, allowing the majority of quests to work fine.
|
||||
As of version 0.7.0, TES3MP is fully playable, providing very extensive player, NPC, world and quest synchronization, as well as state saving and loading, all of which are highly customizable via [serverside Lua scripts](https://github.com/TES3MP/CoreScripts).
|
||||
|
||||
[Serverside Lua scripts](https://github.com/TES3MP/CoreScripts) are used to save and load the state of most of the aforementioned.
|
||||
Remaining gameplay problems mostly relate to AI and the synchronization of clientside script variables.
|
||||
|
||||
Please note that the master branch is an unfinished rewrite of a large part of the project and is not yet playable. You should use the [latest 0.6 release](https://github.com/TES3MP/openmw-tes3mp/releases/latest) for now.
|
||||
Donations
|
||||
---------------
|
||||
|
||||
You can benefit the project by donating on Patreon to our two developers, [David Cernat](https://www.patreon.com/davidcernat) and [Koncord](https://www.patreon.com/Koncord), as well as by supporting [OpenMW](https://openmw.org).
|
||||
|
||||
Contributing
|
||||
--------------
|
||||
---------------
|
||||
|
||||
Development has been relatively fast, but any contribution regarding [code](https://github.com/TES3MP/openmw-tes3mp/blob/master/CONTRIBUTING.md), documentation, bug hunting or video showcases is greatly appreciated.
|
||||
Helping us with documentation, bug hunting and video showcases is always greatly appreciated.
|
||||
|
||||
Test sessions are often advertised on [our Discord server](https://discord.gg/ECJk293) or in [our Steam group](https://steamcommunity.com/groups/mwmulti).
|
||||
For code contributions, it's best to start out with modestly sized fixes and features and work your way up. There are so many different possible implementations of more major features – many of which would cause undesirable code or vision conflicts with OpenMW – that those should be talked over in advance with the existing developers before effort is spent on them.
|
||||
|
||||
Feel free to contact the [team members](https://github.com/TES3MP/openmw-tes3mp/blob/master/tes3mp-credits.md) for any questions you might have.
|
||||
|
||||
Getting Started
|
||||
Getting started
|
||||
---------------
|
||||
|
||||
* [Quickstart guide](https://github.com/TES3MP/openmw-tes3mp/wiki/Quickstart-guide)
|
||||
* [Steam group](https://steamcommunity.com/groups/mwmulti) and its [detailed FAQ](https://steamcommunity.com/groups/mwmulti/discussions/1/353916184342480541/)
|
||||
* [TES3MP section on OpenMW forums](https://forum.openmw.org/viewforum.php?f=45)
|
||||
* [Discord server](https://discord.gg/ECJk293)
|
||||
* [Subreddit](https://www.reddit.com/r/tes3mp)
|
||||
* [Known issues and bug reports](https://github.com/TES3MP/openmw-tes3mp/issues)
|
||||
|
||||
Donations
|
||||
---------------
|
||||
|
||||
You can benefit the project by contributing to the Patreon pages of our two developers, [Koncord](https://www.patreon.com/Koncord) and [David Cernat](https://www.patreon.com/davidcernat), as well as by supporting [OpenMW](https://openmw.org).
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
option(OPTION_TES3MP_PRE07 "Temporary. Pre 0.7.0 compatible mode." OFF)
|
||||
|
||||
set (CMAKE_CXX_STANDARD 14)
|
||||
|
||||
set(BROWSER_UI
|
||||
${CMAKE_SOURCE_DIR}/files/tes3mp/ui/Main.ui
|
||||
|
@ -16,7 +17,6 @@ set(BROWSER
|
|||
PingUpdater.cpp
|
||||
PingHelper.cpp
|
||||
QueryHelper.cpp
|
||||
Settings.cpp
|
||||
${CMAKE_SOURCE_DIR}/files/tes3mp/browser.rc
|
||||
)
|
||||
|
||||
|
@ -36,7 +36,6 @@ set(BROWSER_HEADER
|
|||
netutils/Utils.hpp
|
||||
netutils/QueryClient.hpp
|
||||
Types.hpp
|
||||
Settings.hpp
|
||||
)
|
||||
|
||||
source_group(browser FILES ${BROWSER} ${BROWSER_HEADER})
|
||||
|
@ -76,13 +75,6 @@ add_executable(tes3mp-browser
|
|||
${UI_HDRS}
|
||||
)
|
||||
|
||||
set_property(TARGET tes3mp-browser PROPERTY CXX_STANDARD 14)
|
||||
|
||||
if (OPTION_TES3MP_PRE07)
|
||||
target_compile_definitions(tes3mp-browser PRIVATE TES3MP_PRE07)
|
||||
endif (OPTION_TES3MP_PRE07)
|
||||
|
||||
|
||||
if (WIN32)
|
||||
INSTALL(TARGETS tes3mp-browser RUNTIME DESTINATION ".")
|
||||
endif (WIN32)
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
#include <QJsonArray>
|
||||
#include <QFile>
|
||||
#include <QJsonDocument>
|
||||
#include <apps/browser/netutils/Utils.hpp>
|
||||
#include <QtWidgets/QFileDialog>
|
||||
|
||||
|
||||
using namespace Process;
|
||||
|
@ -33,6 +31,9 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
tblServerBrowser->setModel(proxyModel);
|
||||
tblFavorites->setModel(proxyModel);
|
||||
|
||||
// Remove Favorites tab while it remains broken
|
||||
tabWidget->removeTab(1);
|
||||
|
||||
tblServerBrowser->hideColumn(ServerData::ADDR);
|
||||
tblFavorites->hideColumn(ServerData::ADDR);
|
||||
|
||||
|
@ -56,31 +57,12 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
connect(cBBoxWOPass, SIGNAL(toggled(bool)), this, SLOT(noPasswordSwitch(bool)));
|
||||
connect(comboLatency, SIGNAL(currentIndexChanged(int)), this, SLOT(maxLatencyChanged(int)));
|
||||
connect(leGamemode, SIGNAL(textChanged(const QString &)), this, SLOT(gamemodeChanged(const QString &)));
|
||||
connect(pbModulePath, &QPushButton::clicked, [this](bool) {
|
||||
QString str = QFileDialog::getExistingDirectory(this, tr("Module path"),
|
||||
leModulePath->text(), QFileDialog::ShowDirsOnly);
|
||||
if(!str.isEmpty())
|
||||
leModulePath->setText(str);
|
||||
});
|
||||
loadFavorites();
|
||||
queryHelper->refresh();
|
||||
settingsMgr.loadBrowserSettings(*this);
|
||||
|
||||
#ifdef TES3MP_PRE07
|
||||
gbModules->setTitle(tr("Plugins Path"));
|
||||
chbAutosort->setVisible(false);
|
||||
listModules->setVisible(false);
|
||||
leAddModule->setVisible(false);
|
||||
pbAddModule->setVisible(false);
|
||||
pbUpModule->setVisible(false);
|
||||
pbDownModule->setVisible(false);
|
||||
pbRemModule->setVisible(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
settingsMgr.saveBrowserSettings(*this);
|
||||
delete mGameInvoker;
|
||||
}
|
||||
|
||||
|
@ -89,9 +71,6 @@ void MainWindow::addServerAndUpdate(const QString &addr)
|
|||
favorites->insertRow(0);
|
||||
QModelIndex mi = favorites->index(0, ServerData::ADDR);
|
||||
favorites->setData(mi, addr, Qt::EditRole);
|
||||
/*auto address = addr.split(":");
|
||||
auto data = getExtendedData(address[0].toLatin1(), address[1].toUShort());*/
|
||||
|
||||
//NetController::get()->updateInfo(favorites, mi);
|
||||
//QueryClient::Update(RakNet::SystemAddress())
|
||||
/*auto data = QueryClient::Get().Query();
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "ui_Main.h"
|
||||
#include "ServerModel.hpp"
|
||||
#include "MySortFilterProxyModel.hpp"
|
||||
#include "Settings.hpp"
|
||||
#include <components/process/processinvoker.hpp>
|
||||
|
||||
class QueryHelper;
|
||||
|
@ -40,7 +39,6 @@ private:
|
|||
Process::ProcessInvoker *mGameInvoker;
|
||||
ServerModel *browser, *favorites;
|
||||
MySortFilterProxyModel *proxyModel;
|
||||
SettingsMgr settingsMgr;
|
||||
void loadFavorites();
|
||||
};
|
||||
|
||||
|
|
|
@ -1,198 +0,0 @@
|
|||
//
|
||||
// Created by koncord on 31.03.18.
|
||||
//
|
||||
|
||||
#include "Settings.hpp"
|
||||
#include <QDebug>
|
||||
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <apps/browser/netutils/QueryClient.hpp>
|
||||
#include "MainWindow.hpp"
|
||||
|
||||
std::string loadSettings (Settings::Manager & settings, const std::string &cfgName)
|
||||
{
|
||||
Files::ConfigurationManager mCfgMgr;
|
||||
// Create the settings manager and load default settings file
|
||||
const std::string localdefault = (mCfgMgr.getLocalPath() / (cfgName + "-default.cfg")).string();
|
||||
const std::string globaldefault = (mCfgMgr.getGlobalPath() / (cfgName + "-default.cfg")).string();
|
||||
|
||||
// prefer local
|
||||
if (boost::filesystem::exists(localdefault))
|
||||
settings.loadDefault(localdefault);
|
||||
else if (boost::filesystem::exists(globaldefault))
|
||||
settings.loadDefault(globaldefault);
|
||||
else
|
||||
throw std::runtime_error ("No default settings file found! Make sure the file \"" + cfgName + "-default.cfg\" was properly installed.");
|
||||
|
||||
// load user settings if they exist
|
||||
const std::string settingspath = (mCfgMgr.getUserConfigPath() / (cfgName + ".cfg")).string();
|
||||
if (boost::filesystem::exists(settingspath))
|
||||
settings.loadUser(settingspath);
|
||||
|
||||
return settingspath;
|
||||
}
|
||||
|
||||
SettingsMgr::SettingsMgr()
|
||||
{
|
||||
clientCfg = loadSettings(clientMgr, "tes3mp-client");
|
||||
switchMgr();
|
||||
serverCfg = loadSettings(serverMgr, "tes3mp-server");
|
||||
switchMgr();
|
||||
|
||||
std::string addr = clientMgr.getString("address", "Master");
|
||||
int port = clientMgr.getInt("port", "Master");
|
||||
QueryClient::Get().SetServer(addr, port);
|
||||
|
||||
}
|
||||
|
||||
void SettingsMgr::loadBrowserSettings(Ui::MainWindow &mw)
|
||||
{
|
||||
mw.comboLatency->setCurrentIndex(clientMgr.getInt("maxLatency", "Browser"));
|
||||
mw.leGamemode->setText(QString::fromStdString(clientMgr.getString("gameMode", "Browser")));
|
||||
mw.cBoxNotFull->setCheckState(clientMgr.getBool("notFull", "Browser") ? Qt::Checked : Qt::Unchecked);
|
||||
mw.cBoxWithPlayers->setCheckState(clientMgr.getBool("withPlayers", "Browser") ? Qt::Checked : Qt::Unchecked);
|
||||
mw.cBBoxWOPass->setCheckState(clientMgr.getBool("noPassword", "Browser") ? Qt::Checked : Qt::Unchecked);
|
||||
|
||||
mw.tblServerBrowser->sortByColumn(clientMgr.getInt("sortByCol", "Browser"),
|
||||
clientMgr.getBool("sortByColAscending", "Browser") ? Qt::AscendingOrder : Qt::DescendingOrder);
|
||||
|
||||
loadClientSettings(mw);
|
||||
switchMgr();
|
||||
loadServerSettings(mw);
|
||||
switchMgr();
|
||||
}
|
||||
|
||||
void SettingsMgr::saveBrowserSettings(Ui::MainWindow &mw)
|
||||
{
|
||||
clientMgr.setInt("maxLatency", "Browser", mw.comboLatency->currentIndex());
|
||||
clientMgr.setString("gameMode", "Browser", mw.leGamemode->text().toStdString());
|
||||
clientMgr.setBool("notFull", "Browser", mw.cBoxNotFull->checkState() == Qt::Checked);
|
||||
clientMgr.setBool("withPlayers", "Browser", mw.cBoxWithPlayers->checkState() == Qt::Checked);
|
||||
clientMgr.setBool("noPassword", "Browser", mw.cBBoxWOPass->checkState() == Qt::Checked);
|
||||
|
||||
clientMgr.setInt("sortByCol", "Browser", mw.tblServerBrowser->horizontalHeader()->sortIndicatorSection());
|
||||
clientMgr.setBool("sortByColAscending", "Browser", mw.tblServerBrowser->horizontalHeader()->sortIndicatorOrder() == Qt::AscendingOrder);
|
||||
|
||||
saveClientSettings(mw);
|
||||
|
||||
clientMgr.saveUser(clientCfg);
|
||||
switchMgr();
|
||||
saveServerSettings(mw);
|
||||
switchMgr();
|
||||
}
|
||||
|
||||
void SettingsMgr::loadClientSettings(Ui::MainWindow &mw)
|
||||
{
|
||||
mw.leClientAddress->setText(QString::fromStdString(clientMgr.getString("destinationAddress", "General")));
|
||||
mw.leClientPort->setText(QString::fromStdString(clientMgr.getString("port", "General")));
|
||||
mw.leClientPassword->setText(QString::fromStdString(clientMgr.getString("password", "General")));
|
||||
mw.combLoglevel->setCurrentIndex(clientMgr.getInt("logLevel", "General"));
|
||||
|
||||
mw.leClientMAddress->setText(QString::fromStdString(clientMgr.getString("address", "Master")));
|
||||
mw.leClientMPort->setText(QString::fromStdString(clientMgr.getString("port", "Master")));
|
||||
|
||||
mw.pbChatKey->setText(QString::fromStdString(clientMgr.getString("keySay", "Chat")));
|
||||
mw.pbModeKey->setText(QString::fromStdString(clientMgr.getString("keyChatMode", "Chat")));
|
||||
|
||||
mw.sbPosX->setValue(clientMgr.getInt("x", "Chat"));
|
||||
mw.sbPosY->setValue(clientMgr.getInt("y", "Chat"));
|
||||
mw.sbPosW->setValue(clientMgr.getInt("w", "Chat"));
|
||||
mw.sbPosH->setValue(clientMgr.getInt("h", "Chat"));
|
||||
|
||||
mw.sbDelay->setValue(clientMgr.getFloat("delay", "Chat"));
|
||||
}
|
||||
|
||||
void SettingsMgr::saveClientSettings(Ui::MainWindow &mw)
|
||||
{
|
||||
clientMgr.setString("destinationAddress", "General", mw.leClientAddress->text().toStdString());
|
||||
clientMgr.setString("port", "General", mw.leClientPort->text().toStdString());
|
||||
clientMgr.setString("password", "General", mw.leClientPassword->text().toStdString());
|
||||
clientMgr.setInt("logLevel", "General", mw.combLoglevel->currentIndex());
|
||||
|
||||
clientMgr.setString("address", "Master", mw.leClientMAddress->text().toStdString());
|
||||
clientMgr.setString("port", "Master", mw.leClientMPort->text().toStdString());
|
||||
|
||||
clientMgr.setString("keySay", "Chat", mw.pbChatKey->text().toStdString());
|
||||
clientMgr.setString("keyChatMode", "Chat", mw.pbModeKey->text().toStdString());
|
||||
|
||||
clientMgr.setInt("x", "Chat", mw.sbPosX->value());
|
||||
clientMgr.setInt("y", "Chat", mw.sbPosY->value());
|
||||
clientMgr.setInt("w", "Chat", mw.sbPosW->value());
|
||||
clientMgr.setInt("h", "Chat", mw.sbPosH->value());
|
||||
|
||||
clientMgr.setFloat("delay", "Chat", mw.sbDelay->value());
|
||||
|
||||
}
|
||||
|
||||
void SettingsMgr::loadServerSettings(Ui::MainWindow &mw)
|
||||
{
|
||||
mw.leServerAddress->setText(QString::fromStdString(serverMgr.getString("localAddress", "General")));
|
||||
mw.leServerPort->setText(QString::fromStdString(serverMgr.getString("port", "General")));
|
||||
mw.sbMaxPlayers->setValue(serverMgr.getInt("maximumPlayers", "General"));
|
||||
mw.leHostname->setText(QString::fromStdString(serverMgr.getString("hostname", "General")));
|
||||
mw.combServerLoglevel->setCurrentIndex(serverMgr.getInt("logLevel", "General"));
|
||||
mw.leServerPassword->setText(QString::fromStdString(serverMgr.getString("password", "General")));
|
||||
|
||||
mw.chbMSenabled->setCheckState(serverMgr.getBool("enabled", "MasterServer") ? Qt::Checked : Qt::Unchecked);
|
||||
mw.leServerMaddress->setText(QString::fromStdString(serverMgr.getString("address", "MasterServer")));
|
||||
mw.leServerMPort->setText(QString::fromStdString(serverMgr.getString("port", "MasterServer")));
|
||||
mw.sbRate->setValue(serverMgr.getInt("rate", "MasterServer"));
|
||||
|
||||
#ifndef TES3MP_PRE07
|
||||
mw.leModulePath->setText(QString::fromStdString(serverMgr.getString("home", "Modules")));
|
||||
mw.chbAutosort->setCheckState(serverMgr.getBool("autoSort", "Modules") ? Qt::Checked : Qt::Unchecked);
|
||||
#else
|
||||
mw.leModulePath->setText(QString::fromStdString(serverMgr.getString("home", "Plugins")));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
void SettingsMgr::saveServerSettings(Ui::MainWindow &mw)
|
||||
{
|
||||
serverMgr.setString("localAddress", "General", mw.leServerAddress->text().toStdString());
|
||||
serverMgr.setString("port", "General", mw.leServerPort->text().toStdString());
|
||||
serverMgr.setInt("maximumPlayers", "General", mw.sbMaxPlayers->value());
|
||||
serverMgr.setString("hostname", "General", mw.leHostname->text().toStdString());
|
||||
serverMgr.setInt("logLevel", "General", mw.combServerLoglevel->currentIndex());
|
||||
serverMgr.setString("password", "General", mw.leServerPassword->text().toStdString());
|
||||
|
||||
serverMgr.setBool("enabled", "MasterServer", mw.chbMSenabled->checkState() == Qt::Checked);
|
||||
serverMgr.setString("address", "MasterServer", mw.leServerMaddress->text().toStdString());
|
||||
serverMgr.setString("port", "MasterServer", mw.leServerMPort->text().toStdString());
|
||||
serverMgr.setInt("rate", "MasterServer", mw.sbRate->value());
|
||||
|
||||
#ifndef TES3MP_PRE07
|
||||
serverMgr.setString("home", "Modules", mw.leModulePath->text().toStdString());
|
||||
serverMgr.setBool("autoSort", "Modules", mw.chbAutosort->checkState() == Qt::Checked);
|
||||
#else
|
||||
serverMgr.setString("home", "Plugins", mw.leModulePath->text().toStdString());
|
||||
#endif
|
||||
|
||||
serverMgr.saveUser(serverCfg);
|
||||
}
|
||||
|
||||
void SettingsMgr::switchMgr()
|
||||
{
|
||||
static Settings::CategorySettingValueMap saveUserSettings;
|
||||
static Settings::CategorySettingValueMap saveDefaultSettings;
|
||||
static Settings::CategorySettingVector saveChangedSettings;
|
||||
static bool currentMgrIsClient = true;
|
||||
|
||||
if(!currentMgrIsClient)
|
||||
{
|
||||
saveUserSettings.swap(clientMgr.mUserSettings);
|
||||
saveDefaultSettings.swap(clientMgr.mDefaultSettings);
|
||||
saveChangedSettings.swap(clientMgr.mChangedSettings);
|
||||
|
||||
qDebug() << "Manager switched to Client config";
|
||||
}
|
||||
else
|
||||
{
|
||||
saveUserSettings.swap(serverMgr.mUserSettings);
|
||||
saveDefaultSettings.swap(serverMgr.mDefaultSettings);
|
||||
saveChangedSettings.swap(serverMgr.mChangedSettings);
|
||||
|
||||
qDebug() << "Manager switched to Server config";
|
||||
}
|
||||
currentMgrIsClient = !currentMgrIsClient;
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
//
|
||||
// Created by koncord on 31.03.18.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class SettingsMgr
|
||||
{
|
||||
public:
|
||||
SettingsMgr();
|
||||
|
||||
void loadBrowserSettings(Ui::MainWindow &mw);
|
||||
void saveBrowserSettings(Ui::MainWindow &mw);
|
||||
|
||||
void loadClientSettings(Ui::MainWindow &mw);
|
||||
void saveClientSettings(Ui::MainWindow &mw);
|
||||
|
||||
void loadServerSettings(Ui::MainWindow &mw);
|
||||
void saveServerSettings(Ui::MainWindow &mw);
|
||||
|
||||
private:
|
||||
Settings::Manager serverMgr, clientMgr;
|
||||
std::string serverCfg, clientCfg;
|
||||
void switchMgr();
|
||||
};
|
|
@ -4,8 +4,47 @@
|
|||
#include <apps/browser/netutils/QueryClient.hpp>
|
||||
#include "MainWindow.hpp"
|
||||
|
||||
std::string loadSettings (Settings::Manager & settings)
|
||||
{
|
||||
Files::ConfigurationManager mCfgMgr;
|
||||
// Create the settings manager and load default settings file
|
||||
const std::string localdefault = (mCfgMgr.getLocalPath() / "tes3mp-client-default.cfg").string();
|
||||
const std::string globaldefault = (mCfgMgr.getGlobalPath() / "tes3mp-client-default.cfg").string();
|
||||
|
||||
// prefer local
|
||||
if (boost::filesystem::exists(localdefault))
|
||||
settings.loadDefault(localdefault);
|
||||
else if (boost::filesystem::exists(globaldefault))
|
||||
settings.loadDefault(globaldefault);
|
||||
else
|
||||
throw std::runtime_error ("No default settings file found! Make sure the file \"tes3mp-client-default.cfg\" was properly installed.");
|
||||
|
||||
// load user settings if they exist
|
||||
const std::string settingspath = (mCfgMgr.getUserConfigPath() / "tes3mp-client.cfg").string();
|
||||
if (boost::filesystem::exists(settingspath))
|
||||
settings.loadUser(settingspath);
|
||||
|
||||
return settingspath;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Settings::Manager mgr;
|
||||
|
||||
loadSettings(mgr);
|
||||
|
||||
std::string addr = mgr.getString("address", "Master");
|
||||
int port = mgr.getInt("port", "Master");
|
||||
|
||||
// Is this an attempt to connect to the official master server at the old port? If so,
|
||||
// redirect it to the correct port for the currently used fork of RakNet
|
||||
if (Misc::StringUtils::ciEqual(addr, "master.tes3mp.com") && port == 25560)
|
||||
port = 25561;
|
||||
|
||||
// initialize resources, if needed
|
||||
// Q_INIT_RESOURCE(resfile);
|
||||
|
||||
QueryClient::Get().SetServer(addr, port);
|
||||
QApplication app(argc, argv);
|
||||
MainWindow d;
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@ namespace ESSImport
|
|||
item.mId = contItem.mItem.toString();
|
||||
item.mCount = contItem.mCount;
|
||||
item.mRelativeEquipmentSlot = -1;
|
||||
item.mLockLevel = 0;
|
||||
|
||||
unsigned int itemCount = std::abs(item.mCount);
|
||||
bool separateStacks = false;
|
||||
|
|
|
@ -8,6 +8,7 @@ set(LAUNCHER
|
|||
settingspage.cpp
|
||||
advancedpage.cpp
|
||||
|
||||
utils/cellnameloader.cpp
|
||||
utils/profilescombobox.cpp
|
||||
utils/textinputdialog.cpp
|
||||
utils/lineedit.cpp
|
||||
|
@ -24,6 +25,7 @@ set(LAUNCHER_HEADER
|
|||
settingspage.hpp
|
||||
advancedpage.hpp
|
||||
|
||||
utils/cellnameloader.hpp
|
||||
utils/profilescombobox.hpp
|
||||
utils/textinputdialog.hpp
|
||||
utils/lineedit.hpp
|
||||
|
@ -39,6 +41,7 @@ set(LAUNCHER_HEADER_MOC
|
|||
settingspage.hpp
|
||||
advancedpage.hpp
|
||||
|
||||
utils/cellnameloader.hpp
|
||||
utils/textinputdialog.hpp
|
||||
utils/profilescombobox.hpp
|
||||
utils/lineedit.hpp
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
#include "advancedpage.hpp"
|
||||
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
#include <components/config/gamesettings.hpp>
|
||||
#include <components/config/launchersettings.hpp>
|
||||
#include <QFileDialog>
|
||||
#include <QCompleter>
|
||||
#include <components/contentselector/view/contentselector.hpp>
|
||||
#include <components/contentselector/model/esmfile.hpp>
|
||||
|
||||
Launcher::AdvancedPage::AdvancedPage(Files::ConfigurationManager &cfg, Settings::Manager &engineSettings, QWidget *parent)
|
||||
Launcher::AdvancedPage::AdvancedPage(Files::ConfigurationManager &cfg,
|
||||
Config::GameSettings &gameSettings,
|
||||
Settings::Manager &engineSettings, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, mCfgMgr(cfg)
|
||||
, mGameSettings(gameSettings)
|
||||
, mEngineSettings(engineSettings)
|
||||
{
|
||||
setObjectName ("AdvancedPage");
|
||||
|
@ -13,23 +21,61 @@ Launcher::AdvancedPage::AdvancedPage(Files::ConfigurationManager &cfg, Settings:
|
|||
loadSettings();
|
||||
}
|
||||
|
||||
void Launcher::AdvancedPage::loadCellsForAutocomplete(QStringList cellNames) {
|
||||
// Set up an auto-completer for the "Start default character at" field
|
||||
auto *completer = new QCompleter(cellNames);
|
||||
completer->setCompletionMode(QCompleter::PopupCompletion);
|
||||
completer->setCaseSensitivity(Qt::CaseSensitivity::CaseInsensitive);
|
||||
startDefaultCharacterAtField->setCompleter(completer);
|
||||
|
||||
}
|
||||
|
||||
void Launcher::AdvancedPage::on_skipMenuCheckBox_stateChanged(int state) {
|
||||
startDefaultCharacterAtLabel->setEnabled(state == Qt::Checked);
|
||||
startDefaultCharacterAtField->setEnabled(state == Qt::Checked);
|
||||
}
|
||||
|
||||
void Launcher::AdvancedPage::on_runScriptAfterStartupBrowseButton_clicked()
|
||||
{
|
||||
QString scriptFile = QFileDialog::getOpenFileName(
|
||||
this,
|
||||
QObject::tr("Select script file"),
|
||||
QDir::currentPath(),
|
||||
QString(tr("Text file (*.txt)")));
|
||||
|
||||
if (scriptFile.isEmpty())
|
||||
return;
|
||||
|
||||
QFileInfo info(scriptFile);
|
||||
|
||||
if (!info.exists() || !info.isReadable())
|
||||
return;
|
||||
|
||||
const QString path(QDir::toNativeSeparators(info.absoluteFilePath()));
|
||||
runScriptAfterStartupField->setText(path);
|
||||
}
|
||||
|
||||
bool Launcher::AdvancedPage::loadSettings()
|
||||
{
|
||||
// Testing
|
||||
bool skipMenu = mGameSettings.value("skip-menu").toInt() == 1;
|
||||
if (skipMenu) {
|
||||
skipMenuCheckBox->setCheckState(Qt::Checked);
|
||||
}
|
||||
startDefaultCharacterAtLabel->setEnabled(skipMenu);
|
||||
startDefaultCharacterAtField->setEnabled(skipMenu);
|
||||
|
||||
startDefaultCharacterAtField->setText(mGameSettings.value("start"));
|
||||
runScriptAfterStartupField->setText(mGameSettings.value("script-run"));
|
||||
|
||||
// Game Settings
|
||||
loadSettingBool(canLootDuringDeathAnimationCheckBox, "can loot during death animation", "Game");
|
||||
loadSettingBool(followersAttackOnSightCheckBox, "followers attack on sight", "Game");
|
||||
loadSettingBool(preventMerchantEquippingCheckBox, "prevent merchant equipping", "Game");
|
||||
loadSettingBool(showEffectDurationCheckBox, "show effect duration", "Game");
|
||||
loadSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
|
||||
loadSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
|
||||
loadSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
|
||||
loadSettingBool(rebalanceSoulGemValuesCheckBox, "rebalance soul gem values", "Game");
|
||||
|
||||
// Expected values are (0, 1, 2, 3)
|
||||
int showOwnedIndex = mEngineSettings.getInt("show owned", "Game");
|
||||
// Match the index with the option. Will default to 0 if invalid.
|
||||
if (showOwnedIndex >= 0 && showOwnedIndex <= 3)
|
||||
showOwnedComboBox->setCurrentIndex(showOwnedIndex);
|
||||
loadSettingBool(chargeForEveryFollowerCheckBox, "charge for every follower travelling", "Game");
|
||||
loadSettingBool(enchantedWeaponsMagicalCheckBox, "enchanted weapons are magical", "Game");
|
||||
loadSettingBool(permanentBarterDispositionChangeCheckBox, "barter disposition change is permanent", "Game");
|
||||
|
||||
// Input Settings
|
||||
loadSettingBool(allowThirdPersonZoomCheckBox, "allow third person zoom", "Input");
|
||||
|
@ -40,6 +86,16 @@ bool Launcher::AdvancedPage::loadSettings()
|
|||
loadSettingBool(timePlayedCheckbox, "timeplayed", "Saves");
|
||||
maximumQuicksavesComboBox->setValue(mEngineSettings.getInt("max quicksaves", "Saves"));
|
||||
|
||||
// User Interface Settings
|
||||
loadSettingBool(showEffectDurationCheckBox, "show effect duration", "Game");
|
||||
loadSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
|
||||
loadSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
|
||||
loadSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
|
||||
int showOwnedIndex = mEngineSettings.getInt("show owned", "Game");
|
||||
// Match the index with the option (only 0, 1, 2, or 3 are valid). Will default to 0 if invalid.
|
||||
if (showOwnedIndex >= 0 && showOwnedIndex <= 3)
|
||||
showOwnedComboBox->setCurrentIndex(showOwnedIndex);
|
||||
|
||||
// Other Settings
|
||||
QString screenshotFormatString = QString::fromStdString(mEngineSettings.getString("screenshot format", "General")).toUpper();
|
||||
if (screenshotFormatComboBox->findText(screenshotFormatString) == -1)
|
||||
|
@ -54,19 +110,27 @@ void Launcher::AdvancedPage::saveSettings()
|
|||
// Ensure we only set the new settings if they changed. This is to avoid cluttering the
|
||||
// user settings file (which by definition should only contain settings the user has touched)
|
||||
|
||||
// Testing
|
||||
int skipMenu = skipMenuCheckBox->checkState() == Qt::Checked;
|
||||
if (skipMenu != mGameSettings.value("skip-menu").toInt())
|
||||
mGameSettings.setValue("skip-menu", QString::number(skipMenu));
|
||||
|
||||
QString startCell = startDefaultCharacterAtField->text();
|
||||
if (startCell != mGameSettings.value("start")) {
|
||||
mGameSettings.setValue("start", startCell);
|
||||
}
|
||||
QString scriptRun = runScriptAfterStartupField->text();
|
||||
if (scriptRun != mGameSettings.value("script-run"))
|
||||
mGameSettings.setValue("script-run", scriptRun);
|
||||
|
||||
// Game Settings
|
||||
saveSettingBool(canLootDuringDeathAnimationCheckBox, "can loot during death animation", "Game");
|
||||
saveSettingBool(followersAttackOnSightCheckBox, "followers attack on sight", "Game");
|
||||
saveSettingBool(preventMerchantEquippingCheckBox, "prevent merchant equipping", "Game");
|
||||
saveSettingBool(showEffectDurationCheckBox, "show effect duration", "Game");
|
||||
saveSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
|
||||
saveSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
|
||||
saveSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
|
||||
saveSettingBool(rebalanceSoulGemValuesCheckBox, "rebalance soul gem values", "Game");
|
||||
|
||||
int showOwnedCurrentIndex = showOwnedComboBox->currentIndex();
|
||||
if (showOwnedCurrentIndex != mEngineSettings.getInt("show owned", "Game"))
|
||||
mEngineSettings.setInt("show owned", "Game", showOwnedCurrentIndex);
|
||||
saveSettingBool(chargeForEveryFollowerCheckBox, "charge for every follower travelling", "Game");
|
||||
saveSettingBool(enchantedWeaponsMagicalCheckBox, "enchanted weapons are magical", "Game");
|
||||
saveSettingBool(permanentBarterDispositionChangeCheckBox, "barter disposition change is permanent", "Game");
|
||||
|
||||
// Input Settings
|
||||
saveSettingBool(allowThirdPersonZoomCheckBox, "allow third person zoom", "Input");
|
||||
|
@ -80,6 +144,15 @@ void Launcher::AdvancedPage::saveSettings()
|
|||
mEngineSettings.setInt("max quicksaves", "Saves", maximumQuicksaves);
|
||||
}
|
||||
|
||||
// User Interface Settings
|
||||
saveSettingBool(showEffectDurationCheckBox, "show effect duration", "Game");
|
||||
saveSettingBool(showEnchantChanceCheckBox, "show enchant chance", "Game");
|
||||
saveSettingBool(showMeleeInfoCheckBox, "show melee info", "Game");
|
||||
saveSettingBool(showProjectileDamageCheckBox, "show projectile damage", "Game");
|
||||
int showOwnedCurrentIndex = showOwnedComboBox->currentIndex();
|
||||
if (showOwnedCurrentIndex != mEngineSettings.getInt("show owned", "Game"))
|
||||
mEngineSettings.setInt("show owned", "Game", showOwnedCurrentIndex);
|
||||
|
||||
// Other Settings
|
||||
std::string screenshotFormatString = screenshotFormatComboBox->currentText().toLower().toStdString();
|
||||
if (screenshotFormatString != mEngineSettings.getString("screenshot format", "General"))
|
||||
|
@ -96,3 +169,8 @@ void Launcher::AdvancedPage::saveSettingBool(QCheckBox *checkbox, const std::str
|
|||
if (cValue != mEngineSettings.getBool(setting, group))
|
||||
mEngineSettings.setBool(setting, group, cValue);
|
||||
}
|
||||
|
||||
void Launcher::AdvancedPage::slotLoadedCellsChanged(QStringList cellNames)
|
||||
{
|
||||
loadCellsForAutocomplete(cellNames);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <components/settings/settings.hpp>
|
||||
|
||||
namespace Files { struct ConfigurationManager; }
|
||||
namespace Config { class GameSettings; }
|
||||
|
||||
namespace Launcher
|
||||
{
|
||||
|
@ -16,15 +17,29 @@ namespace Launcher
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AdvancedPage(Files::ConfigurationManager &cfg, Settings::Manager &engineSettings, QWidget *parent = 0);
|
||||
AdvancedPage(Files::ConfigurationManager &cfg, Config::GameSettings &gameSettings,
|
||||
Settings::Manager &engineSettings, QWidget *parent = 0);
|
||||
|
||||
bool loadSettings();
|
||||
void saveSettings();
|
||||
|
||||
public slots:
|
||||
void slotLoadedCellsChanged(QStringList cellNames);
|
||||
|
||||
private slots:
|
||||
void on_skipMenuCheckBox_stateChanged(int state);
|
||||
void on_runScriptAfterStartupBrowseButton_clicked();
|
||||
|
||||
private:
|
||||
Files::ConfigurationManager &mCfgMgr;
|
||||
Config::GameSettings &mGameSettings;
|
||||
Settings::Manager &mEngineSettings;
|
||||
|
||||
/**
|
||||
* Load the cells associated with the given content files for use in autocomplete
|
||||
* @param filePaths the file paths of the content files to be examined
|
||||
*/
|
||||
void loadCellsForAutocomplete(QStringList filePaths);
|
||||
void loadSettingBool(QCheckBox *checkbox, const std::string& setting, const std::string& group);
|
||||
void saveSettingBool(QCheckBox *checkbox, const std::string& setting, const std::string& group);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,10 @@
|
|||
#include <QCheckBox>
|
||||
#include <QMenu>
|
||||
#include <QSortFilterProxyModel>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
|
||||
#include <apps/launcher/utils/cellnameloader.hpp>
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
|
||||
#include <components/contentselector/model/esmfile.hpp>
|
||||
|
@ -16,6 +19,7 @@
|
|||
|
||||
#include <components/config/gamesettings.hpp>
|
||||
#include <components/config/launchersettings.hpp>
|
||||
#include <iostream>
|
||||
|
||||
#include "utils/textinputdialog.hpp"
|
||||
#include "utils/profilescombobox.hpp"
|
||||
|
@ -40,6 +44,13 @@ Launcher::DataFilesPage::DataFilesPage(Files::ConfigurationManager &cfg, Config:
|
|||
|
||||
buildView();
|
||||
loadSettings();
|
||||
|
||||
// Connect signal and slot after the settings have been loaded. We only care about the user changing
|
||||
// the addons and don't want to get signals of the system doing it during startup.
|
||||
connect(mSelector, SIGNAL(signalAddonDataChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(slotAddonDataChanged()));
|
||||
// Call manually to indicate all changes to addon data during startup.
|
||||
slotAddonDataChanged();
|
||||
}
|
||||
|
||||
void Launcher::DataFilesPage::buildView()
|
||||
|
@ -142,6 +153,17 @@ void Launcher::DataFilesPage::saveSettings(const QString &profile)
|
|||
mGameSettings.setContentList(fileNames);
|
||||
}
|
||||
|
||||
QStringList Launcher::DataFilesPage::selectedFilePaths()
|
||||
{
|
||||
//retrieve the files selected for the profile
|
||||
ContentSelectorModel::ContentFileList items = mSelector->selectedFiles();
|
||||
QStringList filePaths;
|
||||
foreach(const ContentSelectorModel::EsmFile *item, items) {
|
||||
filePaths.append(item->filePath());
|
||||
}
|
||||
return filePaths;
|
||||
}
|
||||
|
||||
void Launcher::DataFilesPage::removeProfile(const QString &profile)
|
||||
{
|
||||
mLauncherSettings.removeContentList(profile);
|
||||
|
@ -308,3 +330,31 @@ bool Launcher::DataFilesPage::showDeleteMessageBox (const QString &text)
|
|||
|
||||
return (msgBox.clickedButton() == deleteButton);
|
||||
}
|
||||
|
||||
void Launcher::DataFilesPage::slotAddonDataChanged()
|
||||
{
|
||||
QStringList selectedFiles = selectedFilePaths();
|
||||
if (previousSelectedFiles != selectedFiles) {
|
||||
previousSelectedFiles = selectedFiles;
|
||||
// Loading cells for core Morrowind + Expansions takes about 0.2 seconds, which is enough to cause a
|
||||
// barely perceptible UI lag. Splitting into its own thread to alleviate that.
|
||||
std::thread loadCellsThread(&DataFilesPage::reloadCells, this, selectedFiles);
|
||||
loadCellsThread.detach();
|
||||
}
|
||||
}
|
||||
|
||||
// Mutex lock to run reloadCells synchronously.
|
||||
std::mutex _reloadCellsMutex;
|
||||
|
||||
void Launcher::DataFilesPage::reloadCells(QStringList selectedFiles)
|
||||
{
|
||||
// Use a mutex lock so that we can prevent two threads from executing the rest of this code at the same time
|
||||
// Based on https://stackoverflow.com/a/5429695/531762
|
||||
std::unique_lock<std::mutex> lock(_reloadCellsMutex);
|
||||
|
||||
// The following code will run only if there is not another thread currently running it
|
||||
CellNameLoader cellNameLoader;
|
||||
QStringList cellNamesList = QStringList::fromSet(cellNameLoader.getCellNames(selectedFiles));
|
||||
std::sort(cellNamesList.begin(), cellNamesList.end());
|
||||
emit signalLoadedCellsChanged(cellNamesList);
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QStringList>
|
||||
|
||||
class QSortFilterProxyModel;
|
||||
class QAbstractItemModel;
|
||||
|
@ -41,8 +42,15 @@ namespace Launcher
|
|||
void saveSettings(const QString &profile = "");
|
||||
bool loadSettings();
|
||||
|
||||
/**
|
||||
* Returns the file paths of all selected content files
|
||||
* @return the file paths of all selected content files
|
||||
*/
|
||||
QStringList selectedFilePaths();
|
||||
|
||||
signals:
|
||||
void signalProfileChanged (int index);
|
||||
void signalLoadedCellsChanged(QStringList selectedFiles);
|
||||
|
||||
public slots:
|
||||
void slotProfileChanged (int index);
|
||||
|
@ -52,6 +60,7 @@ namespace Launcher
|
|||
void slotProfileChangedByUser(const QString &previous, const QString ¤t);
|
||||
void slotProfileRenamed(const QString &previous, const QString ¤t);
|
||||
void slotProfileDeleted(const QString &item);
|
||||
void slotAddonDataChanged ();
|
||||
|
||||
void updateOkButton(const QString &text);
|
||||
|
||||
|
@ -72,7 +81,7 @@ namespace Launcher
|
|||
Config::LauncherSettings &mLauncherSettings;
|
||||
|
||||
QString mPreviousProfile;
|
||||
|
||||
QStringList previousSelectedFiles;
|
||||
QString mDataLocal;
|
||||
|
||||
void setPluginsCheckstates(Qt::CheckState state);
|
||||
|
@ -87,6 +96,7 @@ namespace Launcher
|
|||
void addProfile (const QString &profile, bool setAsCurrent);
|
||||
void checkForDefaultProfile();
|
||||
void populateFileViews(const QString& contentModelName);
|
||||
void reloadCells(QStringList selectedFiles);
|
||||
|
||||
class PathIterator
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include "graphicspage.hpp"
|
||||
|
||||
#include <boost/math/common_factor.hpp>
|
||||
#include <csignal>
|
||||
#include <QDesktopWidget>
|
||||
#include <QMessageBox>
|
||||
#include <QDir>
|
||||
|
@ -11,6 +12,7 @@
|
|||
#define MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
||||
#endif // MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
|
||||
#include <SDL.h>
|
||||
#include <SDL_video.h>
|
||||
|
||||
#include <components/files/configurationmanager.hpp>
|
||||
|
@ -46,8 +48,28 @@ Launcher::GraphicsPage::GraphicsPage(Files::ConfigurationManager &cfg, Settings:
|
|||
|
||||
}
|
||||
|
||||
bool Launcher::GraphicsPage::connectToSdl() {
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
|
||||
SDL_SetMainReady();
|
||||
// Required for determining screen resolution and such on the Graphics tab
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
signal(SIGINT, SIG_DFL); // We don't want to use the SDL event loop in the launcher,
|
||||
// so reset SIGINT which SDL wants to redirect to an SDL_Quit event.
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Launcher::GraphicsPage::setupSDL()
|
||||
{
|
||||
bool sdlConnectSuccessful = connectToSdl();
|
||||
if (!sdlConnectSuccessful)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int displays = SDL_GetNumVideoDisplays();
|
||||
|
||||
if (displays < 0)
|
||||
|
@ -67,6 +89,9 @@ bool Launcher::GraphicsPage::setupSDL()
|
|||
screenComboBox->addItem(QString(tr("Screen ")) + QString::number(i + 1));
|
||||
}
|
||||
|
||||
// Disconnect from SDL processes
|
||||
SDL_Quit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,11 @@ namespace Launcher
|
|||
QStringList getAvailableResolutions(int screen);
|
||||
QRect getMaximumResolution();
|
||||
|
||||
/**
|
||||
* Connect to the SDL so that we can use it to determine graphics
|
||||
* @return whether or not connecting to SDL is successful
|
||||
*/
|
||||
bool connectToSdl();
|
||||
bool setupSDL();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include <iostream>
|
||||
#include <csignal>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QTextCodec>
|
||||
|
@ -12,24 +11,12 @@
|
|||
#define MAC_OS_X_VERSION_MIN_REQUIRED __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
|
||||
#endif // MAC_OS_X_VERSION_MIN_REQUIRED
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
#include "maindialog.hpp"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
try
|
||||
{
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
|
||||
SDL_SetMainReady();
|
||||
if (SDL_Init(SDL_INIT_VIDEO) != 0)
|
||||
{
|
||||
qDebug() << "SDL_Init failed: " << QString::fromUtf8(SDL_GetError());
|
||||
return 0;
|
||||
}
|
||||
signal(SIGINT, SIG_DFL); // We don't want to use the SDL event loop in the launcher,
|
||||
// so reset SIGINT which SDL wants to redirect to an SDL_Quit event.
|
||||
|
||||
QApplication app(argc, argv);
|
||||
|
||||
// Now we make sure the current dir is set to application path
|
||||
|
@ -46,9 +33,7 @@ int main(int argc, char *argv[])
|
|||
if (result == Launcher::FirstRunDialogResultContinue)
|
||||
mainWin.show();
|
||||
|
||||
int returnValue = app.exec();
|
||||
SDL_Quit();
|
||||
return returnValue;
|
||||
return app.exec();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
|
|
@ -90,19 +90,19 @@ void Launcher::MainDialog::createIcons()
|
|||
dataFilesButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
QListWidgetItem *graphicsButton = new QListWidgetItem(iconWidget);
|
||||
graphicsButton->setIcon(QIcon::fromTheme("video-display"));
|
||||
graphicsButton->setIcon(QIcon(":/images/preferences-video.png"));
|
||||
graphicsButton->setText(tr("Graphics"));
|
||||
graphicsButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom | Qt::AlignAbsolute);
|
||||
graphicsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
QListWidgetItem *settingsButton = new QListWidgetItem(iconWidget);
|
||||
settingsButton->setIcon(QIcon::fromTheme("preferences-system"));
|
||||
settingsButton->setIcon(QIcon(":/images/preferences.png"));
|
||||
settingsButton->setText(tr("Settings"));
|
||||
settingsButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
||||
settingsButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
||||
QListWidgetItem *advancedButton = new QListWidgetItem(iconWidget);
|
||||
advancedButton->setIcon(QIcon::fromTheme("emblem-system"));
|
||||
advancedButton->setIcon(QIcon(":/images/preferences-advanced.png"));
|
||||
advancedButton->setText(tr("Advanced"));
|
||||
advancedButton->setTextAlignment(Qt::AlignHCenter | Qt::AlignBottom);
|
||||
advancedButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
|
||||
|
@ -119,7 +119,7 @@ void Launcher::MainDialog::createPages()
|
|||
mDataFilesPage = new DataFilesPage(mCfgMgr, mGameSettings, mLauncherSettings, this);
|
||||
mGraphicsPage = new GraphicsPage(mCfgMgr, mEngineSettings, this);
|
||||
mSettingsPage = new SettingsPage(mCfgMgr, mGameSettings, mLauncherSettings, this);
|
||||
mAdvancedPage = new AdvancedPage(mCfgMgr, mEngineSettings, this);
|
||||
mAdvancedPage = new AdvancedPage(mCfgMgr, mGameSettings, mEngineSettings, this);
|
||||
|
||||
// Set the combobox of the play page to imitate the combobox on the datafilespage
|
||||
mPlayPage->setProfilesModel(mDataFilesPage->profilesModel());
|
||||
|
@ -139,6 +139,8 @@ void Launcher::MainDialog::createPages()
|
|||
|
||||
connect(mPlayPage, SIGNAL(signalProfileChanged(int)), mDataFilesPage, SLOT(slotProfileChanged(int)));
|
||||
connect(mDataFilesPage, SIGNAL(signalProfileChanged(int)), mPlayPage, SLOT(setProfilesIndex(int)));
|
||||
// Using Qt::QueuedConnection because signal is emitted in a subthread and slot is in the main thread
|
||||
connect(mDataFilesPage, SIGNAL(signalLoadedCellsChanged(QStringList)), mAdvancedPage, SLOT(slotLoadedCellsChanged(QStringList)), Qt::QueuedConnection);
|
||||
|
||||
}
|
||||
|
||||
|
|
48
apps/launcher/utils/cellnameloader.cpp
Normal file
48
apps/launcher/utils/cellnameloader.cpp
Normal file
|
@ -0,0 +1,48 @@
|
|||
#include "cellnameloader.hpp"
|
||||
|
||||
#include <components/esm/loadcell.hpp>
|
||||
#include <components/contentselector/view/contentselector.hpp>
|
||||
|
||||
QSet<QString> CellNameLoader::getCellNames(QStringList &contentPaths)
|
||||
{
|
||||
QSet<QString> cellNames;
|
||||
ESM::ESMReader esmReader;
|
||||
|
||||
// Loop through all content files
|
||||
for (auto &contentPath : contentPaths) {
|
||||
esmReader.open(contentPath.toStdString());
|
||||
|
||||
// Loop through all records
|
||||
while(esmReader.hasMoreRecs())
|
||||
{
|
||||
ESM::NAME recordName = esmReader.getRecName();
|
||||
esmReader.getRecHeader();
|
||||
|
||||
if (isCellRecord(recordName)) {
|
||||
QString cellName = getCellName(esmReader);
|
||||
if (!cellName.isEmpty()) {
|
||||
cellNames.insert(cellName);
|
||||
}
|
||||
}
|
||||
|
||||
// Stop loading content for this record and continue to the next
|
||||
esmReader.skipRecord();
|
||||
}
|
||||
}
|
||||
|
||||
return cellNames;
|
||||
}
|
||||
|
||||
bool CellNameLoader::isCellRecord(ESM::NAME &recordName)
|
||||
{
|
||||
return recordName.intval == ESM::REC_CELL;
|
||||
}
|
||||
|
||||
QString CellNameLoader::getCellName(ESM::ESMReader &esmReader)
|
||||
{
|
||||
ESM::Cell cell;
|
||||
bool isDeleted = false;
|
||||
cell.loadNameAndData(esmReader, isDeleted);
|
||||
|
||||
return QString::fromStdString(cell.mName);
|
||||
}
|
41
apps/launcher/utils/cellnameloader.hpp
Normal file
41
apps/launcher/utils/cellnameloader.hpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#ifndef OPENMW_CELLNAMELOADER_H
|
||||
#define OPENMW_CELLNAMELOADER_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QSet>
|
||||
#include <QString>
|
||||
|
||||
#include <components/esm/esmreader.hpp>
|
||||
|
||||
namespace ESM {class ESMReader; struct Cell;}
|
||||
namespace ContentSelectorView {class ContentSelector;}
|
||||
|
||||
class CellNameLoader {
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the names of all cells contained within the given content files
|
||||
* @param contentPaths the file paths of each content file to be examined
|
||||
* @return the names of all cells
|
||||
*/
|
||||
QSet<QString> getCellNames(QStringList &contentPaths);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Returns whether or not the given record is of type "Cell"
|
||||
* @param name The name associated with the record
|
||||
* @return whether or not the given record is of type "Cell"
|
||||
*/
|
||||
bool isCellRecord(ESM::NAME &name);
|
||||
|
||||
/**
|
||||
* Returns the name of the cell
|
||||
* @param esmReader the reader currently pointed to a loaded cell
|
||||
* @return the name of the cell
|
||||
*/
|
||||
QString getCellName(ESM::ESMReader &esmReader);
|
||||
};
|
||||
|
||||
|
||||
#endif //OPENMW_CELLNAMELOADER_H
|
|
@ -1,69 +0,0 @@
|
|||
//
|
||||
// Created by koncord on 04.09.17.
|
||||
//
|
||||
|
||||
#include "AdminRest.hpp"
|
||||
|
||||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
|
||||
#include "RestUtils.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace chrono;
|
||||
using namespace boost::property_tree;
|
||||
|
||||
|
||||
AdminRest::AdminRest(const std::string &cert, const std::string &key, const std::string &verifyFile,
|
||||
unsigned short port, std::shared_ptr<MasterServer> master) : httpServer(cert, key, verifyFile), master(master)
|
||||
{
|
||||
httpServer.config.port = port;
|
||||
}
|
||||
|
||||
void AdminRest::start()
|
||||
{
|
||||
static const string AdminArea = "^/api/admin?";
|
||||
|
||||
httpServer.resource[AdminArea]["POST"] = [this](auto response, auto request) {
|
||||
cout << request->method << endl;
|
||||
cout << request->path << endl;
|
||||
cout << request->http_version << endl;
|
||||
|
||||
for (auto &header : request->header)
|
||||
cout << header.first << ": " << header.second << endl;
|
||||
|
||||
string resp;
|
||||
master->luaStuff([&request, &response, &resp](sol::state &state) {
|
||||
sol::protected_function func = state["OnAdminRequest"];
|
||||
|
||||
sol::protected_function_result result = func.call(request->remote_endpoint_address, request->content.string());
|
||||
if (result.valid())
|
||||
*response << result.get<string>();
|
||||
else
|
||||
{
|
||||
cerr << "Error: " << result.get<string>() << endl;
|
||||
*response << response500;
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
/*httpServer.on_error = [](auto request, const boost::system::error_code& err)
|
||||
{
|
||||
std::cerr << "Error: " << err.message() << " " << err.category().name() << std::endl;
|
||||
};*/
|
||||
|
||||
httpServer.default_resource["GET"] = [](auto response, auto /*request*/) {
|
||||
cout << "Default request" << endl;
|
||||
*response << response400;
|
||||
};
|
||||
|
||||
thr = thread([this](){httpServer.start();});
|
||||
}
|
||||
|
||||
void AdminRest::stop()
|
||||
{
|
||||
httpServer.stop();
|
||||
if(thr.joinable())
|
||||
thr.join();
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
//
|
||||
// Created by koncord on 04.09.17.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "SimpleWeb/https_server.hpp"
|
||||
#include "MasterServer.hpp"
|
||||
|
||||
typedef SimpleWeb::Server<SimpleWeb::HTTPS> HttpsServer;
|
||||
|
||||
class AdminRest
|
||||
{
|
||||
public:
|
||||
AdminRest(const std::string &cert, const std::string &key, const std::string &verifyFile, unsigned short port, std::shared_ptr<MasterServer> master);
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
private:
|
||||
HttpsServer httpServer;
|
||||
std::shared_ptr<MasterServer> master;
|
||||
std::thread thr;
|
||||
};
|
||||
|
||||
|
|
@ -1,13 +1,14 @@
|
|||
project(masterserver)
|
||||
|
||||
#set(CMAKE_CXX_STANDARD 14)
|
||||
add_definitions(-std=gnu++14)
|
||||
|
||||
include_directories("./")
|
||||
|
||||
set(SOURCE_FILES main.cpp MasterServer.cpp MasterServer.hpp RestServer.cpp RestServer.hpp AdminRest.cpp)
|
||||
set(SOURCE_FILES main.cpp MasterServer.cpp MasterServer.hpp RestServer.cpp RestServer.hpp)
|
||||
|
||||
add_executable(masterserver ${SOURCE_FILES})
|
||||
target_link_libraries(masterserver ${RakNet_LIBRARY} ${LuaJit_LIBRARIES} ${OPENSSL_LIBRARIES} components)
|
||||
|
||||
set_property(TARGET masterserver PROPERTY CXX_STANDARD 14)
|
||||
target_link_libraries(masterserver ${RakNet_LIBRARY} components)
|
||||
|
||||
option(BUILD_MASTER_TEST "build master server test program" OFF)
|
||||
|
||||
|
|
|
@ -12,54 +12,19 @@
|
|||
#include <components/openmw-mp/Master/PacketMasterUpdate.hpp>
|
||||
#include <components/openmw-mp/Master/PacketMasterAnnounce.hpp>
|
||||
#include <components/openmw-mp/Version.hpp>
|
||||
#include <components/openmw-mp/Utils.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
using namespace RakNet;
|
||||
using namespace std;
|
||||
using namespace mwmp;
|
||||
using namespace chrono;
|
||||
|
||||
MasterServer::MasterServer(const std::string &luaScript)
|
||||
MasterServer::MasterServer(unsigned short maxConnections, unsigned short port)
|
||||
{
|
||||
state.open_libraries();
|
||||
|
||||
boost::filesystem::path absPath = boost::filesystem::absolute(luaScript);
|
||||
|
||||
std::string package_path = state["package"]["path"];
|
||||
state["package"]["path"] = Utils::convertPath(absPath.parent_path().string() + "/?.lua") + ";" + package_path;
|
||||
|
||||
state.set_function("BanAddress", &MasterServer::ban, this);
|
||||
state.set_function("UnbanAddress", &MasterServer::unban, this);
|
||||
|
||||
state.script_file(luaScript);
|
||||
|
||||
sol::table config = state["config"];
|
||||
|
||||
if (config.get_type() != sol::type::table)
|
||||
throw runtime_error("config is not correct");
|
||||
|
||||
sol::object maxConnections = config["maxConnections"];
|
||||
if (maxConnections.get_type() != sol::type::number)
|
||||
throw runtime_error("config.maxConnections is not correct");
|
||||
|
||||
sol::object port = config["port"];
|
||||
if (port.get_type() != sol::type::number)
|
||||
throw runtime_error("config.port is not correct");
|
||||
|
||||
state.new_usertype<MasterServer::SServer>("Server",
|
||||
"name", sol::property(&MasterServer::SServer::GetName),
|
||||
"gamemode", sol::property(&MasterServer::SServer::GetGameMode),
|
||||
"version", sol::property(&MasterServer::SServer::GetVersion)
|
||||
);
|
||||
|
||||
|
||||
peer = RakPeerInterface::GetInstance();
|
||||
sockdescr = SocketDescriptor(port.as<unsigned short>(), nullptr);
|
||||
peer->Startup(maxConnections.as<unsigned short>(), &sockdescr, 1, 1000);
|
||||
peer->SetLimitIPConnectionFrequency(true);
|
||||
sockdescr = SocketDescriptor(port, 0);
|
||||
peer->Startup(maxConnections, &sockdescr, 1, 1000);
|
||||
|
||||
peer->SetMaximumIncomingConnections(maxConnections.as<unsigned short>());
|
||||
peer->SetMaximumIncomingConnections(maxConnections);
|
||||
peer->SetIncomingPassword(TES3MP_MASTERSERVER_PASSW, (int) strlen(TES3MP_MASTERSERVER_PASSW));
|
||||
run = false;
|
||||
}
|
||||
|
@ -87,13 +52,6 @@ void MasterServer::Thread()
|
|||
PacketMasterAnnounce pma(peer);
|
||||
pma.SetSendStream(&send);
|
||||
|
||||
luaStuff([](sol::state &state) {
|
||||
sol::protected_function func = state["OnInit"];
|
||||
sol::protected_function_result result = func.call();
|
||||
if (!result.valid())
|
||||
cerr << "Error: " << result.get<string>() << endl;
|
||||
});
|
||||
|
||||
while (run)
|
||||
{
|
||||
Packet *packet = peer->Receive();
|
||||
|
@ -109,9 +67,9 @@ void MasterServer::Thread()
|
|||
servers.erase(it++);
|
||||
else ++it;
|
||||
}
|
||||
for (auto id = pendingACKs.begin(); id != pendingACKs.end();)
|
||||
for(auto id = pendingACKs.begin(); id != pendingACKs.end();)
|
||||
{
|
||||
if (now - id->second >= 30s)
|
||||
if(now - id->second >= 30s)
|
||||
{
|
||||
cout << "timeout: " << peer->GetSystemAddressFromGuid(id->first).ToString() << endl;
|
||||
peer->CloseConnection(id->first, true);
|
||||
|
@ -155,7 +113,7 @@ void MasterServer::Thread()
|
|||
SystemAddress addr;
|
||||
data.Read(addr); // update 1 server
|
||||
|
||||
auto it = servers.find(addr);
|
||||
ServerIter it = servers.find(addr);
|
||||
if (it != servers.end())
|
||||
{
|
||||
pair<SystemAddress, QueryData> pairPtr(it->first, static_cast<QueryData>(it->second));
|
||||
|
@ -169,7 +127,7 @@ void MasterServer::Thread()
|
|||
}
|
||||
case ID_MASTER_ANNOUNCE:
|
||||
{
|
||||
auto iter = servers.find(packet->systemAddress);
|
||||
ServerIter iter = servers.find(packet->systemAddress);
|
||||
|
||||
pma.SetReadStream(&data);
|
||||
SServer server;
|
||||
|
@ -183,26 +141,6 @@ void MasterServer::Thread()
|
|||
pendingACKs[packet->guid] = steady_clock::now();
|
||||
};
|
||||
|
||||
auto isServerValid = [&](const SServer &sserver) {
|
||||
bool ret = false;
|
||||
auto addr = packet->systemAddress.ToString(false);
|
||||
|
||||
lock_guard<mutex> lock(banMutex);
|
||||
|
||||
if (peer->IsBanned(addr)) // check if address is banned
|
||||
return false;
|
||||
|
||||
luaStuff([&ret, &packet, &sserver, &addr](sol::state &state) {
|
||||
sol::protected_function func = state["OnServerAnnounce"];
|
||||
sol::protected_function_result result = func.call(addr, sserver);
|
||||
if (result.valid())
|
||||
ret = result.get<bool>();
|
||||
else
|
||||
cerr << "Error: " << result.get<string>() << endl;
|
||||
});
|
||||
return ret;
|
||||
};
|
||||
|
||||
if (iter != servers.end())
|
||||
{
|
||||
if (pma.GetFunc() == PacketMasterAnnounce::FUNCTION_DELETE)
|
||||
|
@ -214,19 +152,9 @@ void MasterServer::Thread()
|
|||
}
|
||||
else if (pma.GetFunc() == PacketMasterAnnounce::FUNCTION_ANNOUNCE)
|
||||
{
|
||||
|
||||
if (isServerValid(server))
|
||||
{
|
||||
cout << "Updated";
|
||||
iter->second = server;
|
||||
keepAliveFunc();
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "Update rejected";
|
||||
servers.erase(iter);
|
||||
pendingACKs.erase(packet->guid);
|
||||
}
|
||||
cout << "Updated";
|
||||
iter->second = server;
|
||||
keepAliveFunc();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -236,14 +164,9 @@ void MasterServer::Thread()
|
|||
}
|
||||
else if (pma.GetFunc() == PacketMasterAnnounce::FUNCTION_ANNOUNCE)
|
||||
{
|
||||
if (isServerValid(server))
|
||||
{
|
||||
cout << "Added";
|
||||
iter = servers.insert({packet->systemAddress, server}).first;
|
||||
keepAliveFunc();
|
||||
}
|
||||
else
|
||||
cout << "Adding rejected";
|
||||
cout << "Added";
|
||||
iter = servers.insert({packet->systemAddress, server}).first;
|
||||
keepAliveFunc();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -263,8 +186,7 @@ void MasterServer::Thread()
|
|||
peer->CloseConnection(packet->systemAddress, true);
|
||||
break;
|
||||
default:
|
||||
cout << "Wrong packet. id " << (unsigned) packet->data[0] << " packet length "
|
||||
<< packet->length << " from " << packet->systemAddress.ToString() << endl;
|
||||
cout << "Wrong packet. id " << (unsigned) packet->data[0] << " packet length " << packet->length << " from " << packet->systemAddress.ToString() << endl;
|
||||
peer->CloseConnection(packet->systemAddress, true);
|
||||
}
|
||||
}
|
||||
|
@ -312,22 +234,3 @@ MasterServer::ServerMap *MasterServer::GetServers()
|
|||
{
|
||||
return &servers;
|
||||
}
|
||||
|
||||
|
||||
void MasterServer::luaStuff(std::function<void(sol::state &)> f)
|
||||
{
|
||||
lock_guard<mutex> lock(luaMutex);
|
||||
f(state);
|
||||
}
|
||||
|
||||
void MasterServer::ban(const std::string &addr)
|
||||
{
|
||||
lock_guard<mutex> lock(banMutex);
|
||||
peer->AddToBanList(addr.c_str());
|
||||
}
|
||||
|
||||
void MasterServer::unban(const std::string &addr)
|
||||
{
|
||||
lock_guard<mutex> lock(banMutex);
|
||||
peer->RemoveFromBanList(addr.c_str());
|
||||
}
|
||||
|
|
|
@ -9,12 +9,18 @@
|
|||
#include <chrono>
|
||||
#include <RakPeerInterface.h>
|
||||
#include <components/openmw-mp/Master/MasterData.hpp>
|
||||
#include <sol.hpp>
|
||||
#include <mutex>
|
||||
|
||||
class MasterServer
|
||||
{
|
||||
public:
|
||||
struct Ban
|
||||
{
|
||||
RakNet::SystemAddress sa;
|
||||
bool permanent;
|
||||
struct Date
|
||||
{
|
||||
} date;
|
||||
};
|
||||
struct SServer : QueryData
|
||||
{
|
||||
std::chrono::steady_clock::time_point lastUpdate;
|
||||
|
@ -23,7 +29,7 @@ public:
|
|||
//typedef ServerMap::const_iterator ServerCIter;
|
||||
typedef ServerMap::iterator ServerIter;
|
||||
|
||||
explicit MasterServer(const std::string &luaScript);
|
||||
MasterServer(unsigned short maxConnections, unsigned short port);
|
||||
~MasterServer();
|
||||
|
||||
void Start();
|
||||
|
@ -32,10 +38,6 @@ public:
|
|||
void Wait();
|
||||
|
||||
ServerMap* GetServers();
|
||||
void luaStuff(std::function<void(sol::state &)> f);
|
||||
|
||||
void ban(const std::string &addr);
|
||||
void unban(const std::string &addr);
|
||||
|
||||
private:
|
||||
void Thread();
|
||||
|
@ -47,9 +49,6 @@ private:
|
|||
ServerMap servers;
|
||||
bool run;
|
||||
std::map<RakNet::RakNetGUID, std::chrono::steady_clock::time_point> pendingACKs;
|
||||
sol::state state;
|
||||
std::mutex luaMutex;
|
||||
std::mutex banMutex;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -7,12 +7,22 @@
|
|||
#include <boost/property_tree/ptree.hpp>
|
||||
#include <boost/property_tree/json_parser.hpp>
|
||||
|
||||
#include "RestUtils.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace chrono;
|
||||
using namespace boost::property_tree;
|
||||
|
||||
static string response201 = "HTTP/1.1 201 Created\r\nContent-Length: 7\r\n\r\nCreated";
|
||||
static string response202 = "HTTP/1.1 202 Accepted\r\nContent-Length: 8\r\n\r\nAccepted";
|
||||
static string response400 = "HTTP/1.1 400 Bad Request\r\nContent-Length: 11\r\n\r\nbad request";
|
||||
|
||||
inline void ResponseStr(HttpServer::Response &response, string content, string type = "", string code = "200 OK")
|
||||
{
|
||||
response << "HTTP/1.1 " << code << "\r\n";
|
||||
if (!type.empty())
|
||||
response << "Content-Type: " << type <<"\r\n";
|
||||
response << "Content-Length: " << content.length() << "\r\n\r\n" << content;
|
||||
}
|
||||
|
||||
inline void ptreeToServer(boost::property_tree::ptree &pt, MasterServer::SServer &server)
|
||||
{
|
||||
server.SetName(pt.get<string>("hostname").c_str());
|
||||
|
@ -60,7 +70,7 @@ void RestServer::start()
|
|||
auto port = (unsigned short)stoi(&(addr[addr.find(':')+1]));
|
||||
queryToStringStream(ss, "server", serverMap->at(RakNet::SystemAddress(addr.c_str(), port)));
|
||||
ss << "}";
|
||||
ResponseStr<SimpleWeb::HTTP>(response, ss.str(), "application/json");
|
||||
ResponseStr(*response, ss.str(), "application/json");
|
||||
}
|
||||
catch(out_of_range e)
|
||||
{
|
||||
|
@ -83,7 +93,7 @@ void RestServer::start()
|
|||
ss << ", ";
|
||||
}
|
||||
ss << "}}";
|
||||
ResponseStr<SimpleWeb::HTTP>(response, ss.str(), "application/json");
|
||||
ResponseStr(*response, ss.str(), "application/json");
|
||||
updatedCache = false;
|
||||
}
|
||||
*response << str;
|
||||
|
@ -100,7 +110,7 @@ void RestServer::start()
|
|||
MasterServer::SServer server;
|
||||
ptreeToServer(pt, server);
|
||||
|
||||
auto port = pt.get<unsigned short>("port");
|
||||
unsigned short port = pt.get<unsigned short>("port");
|
||||
server.lastUpdate = steady_clock::now();
|
||||
serverMap->insert({RakNet::SystemAddress(request->remote_endpoint_address.c_str(), port), server});
|
||||
updatedCache = true;
|
||||
|
@ -127,6 +137,7 @@ void RestServer::start()
|
|||
*response << response400;
|
||||
return;
|
||||
}
|
||||
|
||||
if (request->content.size() != 0)
|
||||
{
|
||||
try
|
||||
|
@ -160,14 +171,14 @@ void RestServer::start()
|
|||
ss << ", \"players\": " << players;
|
||||
ss << "}";
|
||||
|
||||
ResponseStr<SimpleWeb::HTTP>(response, ss.str(), "application/json");
|
||||
ResponseStr(*response, ss.str(), "application/json");
|
||||
};
|
||||
|
||||
httpServer.default_resource["GET"]=[](auto response, auto /*request*/) {
|
||||
*response << response400;
|
||||
};
|
||||
|
||||
thr = thread([this](){httpServer.start();});
|
||||
httpServer.start();
|
||||
}
|
||||
|
||||
void RestServer::cacheUpdated()
|
||||
|
@ -178,6 +189,4 @@ void RestServer::cacheUpdated()
|
|||
void RestServer::stop()
|
||||
{
|
||||
httpServer.stop();
|
||||
if(thr.joinable())
|
||||
thr.join();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ private:
|
|||
HttpServer httpServer;
|
||||
MasterServer::ServerMap *serverMap;
|
||||
bool updatedCache = true;
|
||||
std::thread thr;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
//
|
||||
// Created by koncord on 04.09.17.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "SimpleWeb/base_server.hpp"
|
||||
|
||||
static std::string response201 = "HTTP/1.1 201 Created\r\nContent-Length: 7\r\n\r\nCreated";
|
||||
static std::string response202 = "HTTP/1.1 202 Accepted\r\nContent-Length: 8\r\n\r\nAccepted";
|
||||
static std::string response400 = "HTTP/1.1 400 Bad Request\r\nContent-Length: 11\r\n\r\nbad request";
|
||||
|
||||
static std::string response403 = "HTTP/1.1 403 Forbidden\r\nContent-Length: 9\r\n\r\nForbidden";
|
||||
static std::string response500 = "HTTP/1.1 500 Internal Server Error\r\nContent-Length: 21\r\n\r\nInternal Server Error";
|
||||
|
||||
template <class Protocol>
|
||||
inline void ResponseStr(std::shared_ptr<typename SimpleWeb::ServerBase<Protocol>::Response> response,
|
||||
std::string content, std::string type = "", std::string code = "200 OK")
|
||||
{
|
||||
*response << "HTTP/1.1 " << code << "\r\n";
|
||||
if (!type.empty())
|
||||
*response << "Content-Type: " << type <<"\r\n";
|
||||
*response << "Content-Length: " << content.length() << "\r\n\r\n" << content;
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2016 Ole Christian Eidheim
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -1,137 +1,72 @@
|
|||
#pragma once
|
||||
#ifndef BASE_SERVER_HPP
|
||||
#define BASE_SERVER_HPP
|
||||
|
||||
#include "utility.hpp"
|
||||
#include <condition_variable>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/functional/hash.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <thread>
|
||||
#include <functional>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <thread>
|
||||
#include <unordered_set>
|
||||
#include <regex>
|
||||
|
||||
#ifdef USE_STANDALONE_ASIO
|
||||
#include <asio.hpp>
|
||||
#include <asio/steady_timer.hpp>
|
||||
namespace SimpleWeb {
|
||||
using error_code = std::error_code;
|
||||
using errc = std::errc;
|
||||
namespace make_error_code = std;
|
||||
} // namespace SimpleWeb
|
||||
#else
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/asio/steady_timer.hpp>
|
||||
namespace SimpleWeb {
|
||||
namespace asio = boost::asio;
|
||||
using error_code = boost::system::error_code;
|
||||
namespace errc = boost::system::errc;
|
||||
namespace make_error_code = boost::system::errc;
|
||||
} // namespace SimpleWeb
|
||||
#ifndef CASE_INSENSITIVE_EQUALS_AND_HASH
|
||||
#define CASE_INSENSITIVE_EQUALS_AND_HASH
|
||||
|
||||
//Based on http://www.boost.org/doc/libs/1_60_0/doc/html/unordered/hash_equality.html
|
||||
struct case_insensitive_equals
|
||||
{
|
||||
bool operator()(const std::string &key1, const std::string &key2) const
|
||||
{
|
||||
return boost::algorithm::iequals(key1, key2);
|
||||
}
|
||||
};
|
||||
|
||||
struct case_insensitive_hash
|
||||
{
|
||||
size_t operator()(const std::string &key) const
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
for (auto &c: key)
|
||||
boost::hash_combine(seed, std::tolower(c));
|
||||
return seed;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
namespace SimpleWeb {
|
||||
template <class socket_type>
|
||||
namespace SimpleWeb
|
||||
{
|
||||
template<class socket_type>
|
||||
class Server;
|
||||
|
||||
template <class socket_type>
|
||||
class ServerBase {
|
||||
protected:
|
||||
class Session;
|
||||
|
||||
template<class socket_type>
|
||||
class ServerBase
|
||||
{
|
||||
public:
|
||||
class Response : public std::enable_shared_from_this<Response>, public std::ostream {
|
||||
virtual ~ServerBase()
|
||||
{}
|
||||
|
||||
class Response : public std::ostream
|
||||
{
|
||||
friend class ServerBase<socket_type>;
|
||||
friend class Server<socket_type>;
|
||||
|
||||
asio::streambuf streambuf;
|
||||
boost::asio::streambuf streambuf;
|
||||
|
||||
std::shared_ptr<Session> session;
|
||||
long timeout_content;
|
||||
std::shared_ptr<socket_type> socket;
|
||||
|
||||
Response(std::shared_ptr<Session> session, long timeout_content) noexcept : std::ostream(&streambuf), session(std::move(session)), timeout_content(timeout_content) {}
|
||||
|
||||
template <typename size_type>
|
||||
void write_header(const CaseInsensitiveMultimap &header, size_type size) {
|
||||
bool content_length_written = false;
|
||||
bool chunked_transfer_encoding = false;
|
||||
for(auto &field : header) {
|
||||
if(!content_length_written && case_insensitive_equal(field.first, "content-length"))
|
||||
content_length_written = true;
|
||||
else if(!chunked_transfer_encoding && case_insensitive_equal(field.first, "transfer-encoding") && case_insensitive_equal(field.second, "chunked"))
|
||||
chunked_transfer_encoding = true;
|
||||
|
||||
*this << field.first << ": " << field.second << "\r\n";
|
||||
}
|
||||
if(!content_length_written && !chunked_transfer_encoding && !close_connection_after_response)
|
||||
*this << "Content-Length: " << size << "\r\n\r\n";
|
||||
else
|
||||
*this << "\r\n";
|
||||
}
|
||||
Response(const std::shared_ptr<socket_type> &socket) : std::ostream(&streambuf), socket(socket)
|
||||
{}
|
||||
|
||||
public:
|
||||
size_t size() noexcept {
|
||||
size_t size()
|
||||
{
|
||||
return streambuf.size();
|
||||
}
|
||||
|
||||
/// Use this function if you need to recursively send parts of a longer message
|
||||
void send(const std::function<void(const error_code &)> &callback = nullptr) noexcept {
|
||||
session->connection->set_timeout(timeout_content);
|
||||
auto self = this->shared_from_this(); // Keep Response instance alive through the following async_write
|
||||
asio::async_write(*session->connection->socket, streambuf, [self, callback](const error_code &ec, size_t /*bytes_transferred*/) {
|
||||
self->session->connection->cancel_timeout();
|
||||
auto lock = self->session->connection->handler_runner->continue_lock();
|
||||
if(!lock)
|
||||
return;
|
||||
if(callback)
|
||||
callback(ec);
|
||||
});
|
||||
}
|
||||
|
||||
/// Write directly to stream buffer using std::ostream::write
|
||||
void write(const char_type *ptr, std::streamsize n) {
|
||||
std::ostream::write(ptr, n);
|
||||
}
|
||||
|
||||
/// Convenience function for writing status line, potential header fields, and empty content
|
||||
void write(StatusCode status_code = StatusCode::success_ok, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
|
||||
*this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n";
|
||||
write_header(header, 0);
|
||||
}
|
||||
|
||||
/// Convenience function for writing status line, header fields, and content
|
||||
void write(StatusCode status_code, const std::string &content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
|
||||
*this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n";
|
||||
write_header(header, content.size());
|
||||
if(!content.empty())
|
||||
*this << content;
|
||||
}
|
||||
|
||||
/// Convenience function for writing status line, header fields, and content
|
||||
void write(StatusCode status_code, std::istream &content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
|
||||
*this << "HTTP/1.1 " << SimpleWeb::status_code(status_code) << "\r\n";
|
||||
content.seekg(0, std::ios::end);
|
||||
auto size = content.tellg();
|
||||
content.seekg(0, std::ios::beg);
|
||||
write_header(header, size);
|
||||
if(size)
|
||||
*this << content.rdbuf();
|
||||
}
|
||||
|
||||
/// Convenience function for writing success status line, header fields, and content
|
||||
void write(const std::string &content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
|
||||
write(StatusCode::success_ok, content, header);
|
||||
}
|
||||
|
||||
/// Convenience function for writing success status line, header fields, and content
|
||||
void write(std::istream &content, const CaseInsensitiveMultimap &header = CaseInsensitiveMultimap()) {
|
||||
write(StatusCode::success_ok, content, header);
|
||||
}
|
||||
|
||||
/// Convenience function for writing success status line, and header fields
|
||||
void write(const CaseInsensitiveMultimap &header) {
|
||||
write(StatusCode::success_ok, std::string(), header);
|
||||
}
|
||||
|
||||
/// If true, force server to close the connection after the response have been sent.
|
||||
///
|
||||
/// This is useful when implementing a HTTP/1.0-server sending content
|
||||
|
@ -139,399 +74,438 @@ namespace SimpleWeb {
|
|||
bool close_connection_after_response = false;
|
||||
};
|
||||
|
||||
class Content : public std::istream {
|
||||
class Content : public std::istream
|
||||
{
|
||||
friend class ServerBase<socket_type>;
|
||||
|
||||
public:
|
||||
size_t size() noexcept {
|
||||
size_t size()
|
||||
{
|
||||
return streambuf.size();
|
||||
}
|
||||
/// Convenience function to return std::string. The stream buffer is consumed.
|
||||
std::string string() noexcept {
|
||||
try {
|
||||
std::stringstream ss;
|
||||
ss << rdbuf();
|
||||
return ss.str();
|
||||
}
|
||||
catch(...) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
std::string string()
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << rdbuf();
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
private:
|
||||
asio::streambuf &streambuf;
|
||||
Content(asio::streambuf &streambuf) noexcept : std::istream(&streambuf), streambuf(streambuf) {}
|
||||
boost::asio::streambuf &streambuf;
|
||||
|
||||
Content(boost::asio::streambuf &streambuf) : std::istream(&streambuf), streambuf(streambuf)
|
||||
{}
|
||||
};
|
||||
|
||||
class Request {
|
||||
class Request
|
||||
{
|
||||
friend class ServerBase<socket_type>;
|
||||
|
||||
friend class Server<socket_type>;
|
||||
friend class Session;
|
||||
|
||||
public:
|
||||
std::string method, path, query_string, http_version;
|
||||
std::string method, path, http_version;
|
||||
|
||||
Content content;
|
||||
|
||||
CaseInsensitiveMultimap header;
|
||||
std::unordered_multimap<std::string, std::string, case_insensitive_hash, case_insensitive_equals> header;
|
||||
|
||||
std::smatch path_match;
|
||||
|
||||
std::string remote_endpoint_address;
|
||||
unsigned short remote_endpoint_port;
|
||||
|
||||
/// Returns query keys with percent-decoded values.
|
||||
CaseInsensitiveMultimap parse_query_string() noexcept {
|
||||
return SimpleWeb::QueryString::parse(query_string);
|
||||
}
|
||||
|
||||
private:
|
||||
asio::streambuf streambuf;
|
||||
Request(const socket_type &socket) : content(streambuf)
|
||||
{
|
||||
try
|
||||
{
|
||||
remote_endpoint_address = socket.lowest_layer().remote_endpoint().address().to_string();
|
||||
remote_endpoint_port = socket.lowest_layer().remote_endpoint().port();
|
||||
}
|
||||
catch (...)
|
||||
{}
|
||||
}
|
||||
|
||||
Request(const std::string &remote_endpoint_address = std::string(), unsigned short remote_endpoint_port = 0) noexcept
|
||||
: content(streambuf), remote_endpoint_address(remote_endpoint_address), remote_endpoint_port(remote_endpoint_port) {}
|
||||
boost::asio::streambuf streambuf;
|
||||
};
|
||||
|
||||
protected:
|
||||
class Connection : public std::enable_shared_from_this<Connection> {
|
||||
public:
|
||||
template <typename... Args>
|
||||
Connection(std::shared_ptr<ScopeRunner> handler_runner, Args &&... args) noexcept : handler_runner(std::move(handler_runner)), socket(new socket_type(std::forward<Args>(args)...)) {}
|
||||
|
||||
std::shared_ptr<ScopeRunner> handler_runner;
|
||||
|
||||
std::unique_ptr<socket_type> socket; // Socket must be unique_ptr since asio::ssl::stream<asio::ip::tcp::socket> is not movable
|
||||
std::mutex socket_close_mutex;
|
||||
|
||||
std::unique_ptr<asio::steady_timer> timer;
|
||||
|
||||
void close() noexcept {
|
||||
error_code ec;
|
||||
std::unique_lock<std::mutex> lock(socket_close_mutex); // The following operations seems to be needed to run sequentially
|
||||
socket->lowest_layer().shutdown(asio::ip::tcp::socket::shutdown_both, ec);
|
||||
socket->lowest_layer().close(ec);
|
||||
}
|
||||
|
||||
void set_timeout(long seconds) noexcept {
|
||||
if(seconds == 0) {
|
||||
timer = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
timer = std::unique_ptr<asio::steady_timer>(new asio::steady_timer(socket->get_io_service()));
|
||||
timer->expires_from_now(std::chrono::seconds(seconds));
|
||||
auto self = this->shared_from_this();
|
||||
timer->async_wait([self](const error_code &ec) {
|
||||
if(!ec)
|
||||
self->close();
|
||||
});
|
||||
}
|
||||
|
||||
void cancel_timeout() noexcept {
|
||||
if(timer) {
|
||||
error_code ec;
|
||||
timer->cancel(ec);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class Session {
|
||||
public:
|
||||
Session(std::shared_ptr<Connection> connection) noexcept : connection(std::move(connection)) {
|
||||
try {
|
||||
auto remote_endpoint = this->connection->socket->lowest_layer().remote_endpoint();
|
||||
request = std::shared_ptr<Request>(new Request(remote_endpoint.address().to_string(), remote_endpoint.port()));
|
||||
}
|
||||
catch(...) {
|
||||
request = std::shared_ptr<Request>(new Request());
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Connection> connection;
|
||||
std::shared_ptr<Request> request;
|
||||
};
|
||||
|
||||
public:
|
||||
class Config {
|
||||
class Config
|
||||
{
|
||||
friend class ServerBase<socket_type>;
|
||||
|
||||
Config(unsigned short port) noexcept : port(port) {}
|
||||
Config(unsigned short port) : port(port)
|
||||
{}
|
||||
|
||||
public:
|
||||
/// Port number to use. Defaults to 80 for HTTP and 443 for HTTPS.
|
||||
unsigned short port;
|
||||
/// If io_service is not set, number of threads that the server will use when start() is called.
|
||||
/// Defaults to 1 thread.
|
||||
/// Number of threads that the server will use when start() is called. Defaults to 1 thread.
|
||||
size_t thread_pool_size = 1;
|
||||
/// Timeout on request handling. Defaults to 5 seconds.
|
||||
long timeout_request = 5;
|
||||
size_t timeout_request = 5;
|
||||
/// Timeout on content handling. Defaults to 300 seconds.
|
||||
long timeout_content = 300;
|
||||
size_t timeout_content = 300;
|
||||
/// IPv4 address in dotted decimal form or IPv6 address in hexadecimal notation.
|
||||
/// If empty, the address will be any address.
|
||||
std::string address;
|
||||
/// Set to false to avoid binding the socket to an address that is already in use. Defaults to true.
|
||||
bool reuse_address = true;
|
||||
};
|
||||
/// Set before calling start().
|
||||
|
||||
///Set before calling start().
|
||||
Config config;
|
||||
|
||||
private:
|
||||
class regex_orderable : public std::regex {
|
||||
class regex_orderable : public std::regex
|
||||
{
|
||||
std::string str;
|
||||
|
||||
public:
|
||||
regex_orderable(const char *regex_cstr) : std::regex(regex_cstr), str(regex_cstr) {}
|
||||
regex_orderable(std::string regex_str) : std::regex(regex_str), str(std::move(regex_str)) {}
|
||||
bool operator<(const regex_orderable &rhs) const noexcept {
|
||||
regex_orderable(const char *regex_cstr) : std::regex(regex_cstr), str(regex_cstr)
|
||||
{}
|
||||
|
||||
regex_orderable(const std::string ®ex_str) : std::regex(regex_str), str(regex_str)
|
||||
{}
|
||||
|
||||
bool operator<(const regex_orderable &rhs) const
|
||||
{
|
||||
return str < rhs.str;
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
/// Warning: do not add or remove resources after start() is called
|
||||
std::map<regex_orderable, std::map<std::string, std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>, std::shared_ptr<typename ServerBase<socket_type>::Request>)>>> resource;
|
||||
std::map<regex_orderable, std::map<std::string,
|
||||
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>,
|
||||
std::shared_ptr<typename ServerBase<socket_type>::Request>)>>>
|
||||
resource;
|
||||
|
||||
std::map<std::string, std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>, std::shared_ptr<typename ServerBase<socket_type>::Request>)>> default_resource;
|
||||
std::map<std::string,
|
||||
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>,
|
||||
std::shared_ptr<typename ServerBase<socket_type>::Request>)>> default_resource;
|
||||
|
||||
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Request>, const error_code &)> on_error;
|
||||
std::function<
|
||||
void(std::shared_ptr<typename ServerBase<socket_type>::Request>,
|
||||
const boost::system::error_code &)>
|
||||
on_error;
|
||||
|
||||
std::function<void(std::unique_ptr<socket_type> &, std::shared_ptr<typename ServerBase<socket_type>::Request>)> on_upgrade;
|
||||
std::function<void(std::shared_ptr<socket_type> socket,
|
||||
std::shared_ptr<typename ServerBase<socket_type>::Request>)> on_upgrade;
|
||||
|
||||
/// If you have your own asio::io_service, store its pointer here before running start().
|
||||
std::shared_ptr<asio::io_service> io_service;
|
||||
virtual void start()
|
||||
{
|
||||
if (!io_service)
|
||||
io_service = std::make_shared<boost::asio::io_service>();
|
||||
|
||||
virtual void start() {
|
||||
if(!io_service) {
|
||||
io_service = std::make_shared<asio::io_service>();
|
||||
internal_io_service = true;
|
||||
}
|
||||
|
||||
if(io_service->stopped())
|
||||
if (io_service->stopped())
|
||||
io_service->reset();
|
||||
|
||||
asio::ip::tcp::endpoint endpoint;
|
||||
if(config.address.size() > 0)
|
||||
endpoint = asio::ip::tcp::endpoint(asio::ip::address::from_string(config.address), config.port);
|
||||
boost::asio::ip::tcp::endpoint endpoint;
|
||||
if (config.address.size() > 0)
|
||||
endpoint = boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(config.address),
|
||||
config.port);
|
||||
else
|
||||
endpoint = asio::ip::tcp::endpoint(asio::ip::tcp::v4(), config.port);
|
||||
endpoint = boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), config.port);
|
||||
|
||||
if(!acceptor)
|
||||
acceptor = std::unique_ptr<asio::ip::tcp::acceptor>(new asio::ip::tcp::acceptor(*io_service));
|
||||
if (!acceptor)
|
||||
acceptor = std::unique_ptr<boost::asio::ip::tcp::acceptor>(
|
||||
new boost::asio::ip::tcp::acceptor(*io_service));
|
||||
acceptor->open(endpoint.protocol());
|
||||
acceptor->set_option(asio::socket_base::reuse_address(config.reuse_address));
|
||||
acceptor->set_option(boost::asio::socket_base::reuse_address(config.reuse_address));
|
||||
acceptor->bind(endpoint);
|
||||
acceptor->listen();
|
||||
|
||||
accept();
|
||||
|
||||
if(internal_io_service) {
|
||||
// If thread_pool_size>1, start m_io_service.run() in (thread_pool_size-1) threads for thread-pooling
|
||||
threads.clear();
|
||||
for(size_t c = 1; c < config.thread_pool_size; c++) {
|
||||
threads.emplace_back([this]() {
|
||||
this->io_service->run();
|
||||
});
|
||||
}
|
||||
//If thread_pool_size>1, start m_io_service.run() in (thread_pool_size-1) threads for thread-pooling
|
||||
threads.clear();
|
||||
for (size_t c = 1; c < config.thread_pool_size; c++)
|
||||
{
|
||||
threads.emplace_back([this]()
|
||||
{
|
||||
io_service->run();
|
||||
});
|
||||
}
|
||||
|
||||
// Main thread
|
||||
if(config.thread_pool_size > 0)
|
||||
io_service->run();
|
||||
//Main thread
|
||||
if (config.thread_pool_size > 0)
|
||||
io_service->run();
|
||||
|
||||
// Wait for the rest of the threads, if any, to finish as well
|
||||
for(auto &t : threads)
|
||||
t.join();
|
||||
//Wait for the rest of the threads, if any, to finish as well
|
||||
for (auto &t: threads)
|
||||
{
|
||||
t.join();
|
||||
}
|
||||
}
|
||||
|
||||
/// Stop accepting new requests, and close current connections.
|
||||
void stop() noexcept {
|
||||
if(acceptor) {
|
||||
error_code ec;
|
||||
acceptor->close(ec);
|
||||
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(*connections_mutex);
|
||||
for(auto &connection : *connections)
|
||||
connection->close();
|
||||
connections->clear();
|
||||
}
|
||||
|
||||
if(internal_io_service)
|
||||
io_service->stop();
|
||||
}
|
||||
void stop()
|
||||
{
|
||||
acceptor->close();
|
||||
if (config.thread_pool_size > 0)
|
||||
io_service->stop();
|
||||
}
|
||||
|
||||
virtual ~ServerBase() noexcept {
|
||||
handler_runner->stop();
|
||||
stop();
|
||||
///Use this function if you need to recursively send parts of a longer message
|
||||
void send(const std::shared_ptr<Response> &response,
|
||||
const std::function<void(const boost::system::error_code &)> &callback = nullptr) const
|
||||
{
|
||||
boost::asio::async_write(*response->socket, response->streambuf, [this, response, callback]
|
||||
(const boost::system::error_code &ec, size_t /*bytes_transferred*/)
|
||||
{
|
||||
if (callback)
|
||||
callback(ec);
|
||||
});
|
||||
}
|
||||
|
||||
/// If you have your own boost::asio::io_service, store its pointer here before running start().
|
||||
/// You might also want to set config.thread_pool_size to 0.
|
||||
std::shared_ptr<boost::asio::io_service> io_service;
|
||||
protected:
|
||||
bool internal_io_service = false;
|
||||
|
||||
std::unique_ptr<asio::ip::tcp::acceptor> acceptor;
|
||||
std::unique_ptr<boost::asio::ip::tcp::acceptor> acceptor;
|
||||
std::vector<std::thread> threads;
|
||||
|
||||
std::shared_ptr<std::unordered_set<Connection *>> connections;
|
||||
std::shared_ptr<std::mutex> connections_mutex;
|
||||
ServerBase(unsigned short port) : config(port)
|
||||
{}
|
||||
|
||||
std::shared_ptr<ScopeRunner> handler_runner;
|
||||
virtual void accept()=0;
|
||||
|
||||
ServerBase(unsigned short port) noexcept : config(port), connections(new std::unordered_set<Connection *>()), connections_mutex(new std::mutex()), handler_runner(new ScopeRunner()) {}
|
||||
std::shared_ptr<boost::asio::deadline_timer>
|
||||
get_timeout_timer(const std::shared_ptr<socket_type> &socket, long seconds)
|
||||
{
|
||||
if (seconds == 0)
|
||||
return nullptr;
|
||||
|
||||
virtual void accept() = 0;
|
||||
|
||||
template <typename... Args>
|
||||
std::shared_ptr<Connection> create_connection(Args &&... args) noexcept {
|
||||
auto connections = this->connections;
|
||||
auto connections_mutex = this->connections_mutex;
|
||||
auto connection = std::shared_ptr<Connection>(new Connection(handler_runner, std::forward<Args>(args)...), [connections, connections_mutex](Connection *connection) {
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(*connections_mutex);
|
||||
auto it = connections->find(connection);
|
||||
if(it != connections->end())
|
||||
connections->erase(it);
|
||||
}
|
||||
delete connection;
|
||||
});
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(*connections_mutex);
|
||||
connections->emplace(connection.get());
|
||||
}
|
||||
return connection;
|
||||
auto timer = std::make_shared<boost::asio::deadline_timer>(*io_service);
|
||||
timer->expires_from_now(boost::posix_time::seconds(seconds));
|
||||
timer->async_wait([socket](const boost::system::error_code &ec)
|
||||
{
|
||||
if (!ec)
|
||||
{
|
||||
boost::system::error_code ec;
|
||||
socket->lowest_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
|
||||
socket->lowest_layer().close();
|
||||
}
|
||||
});
|
||||
return timer;
|
||||
}
|
||||
|
||||
void read_request_and_content(const std::shared_ptr<Session> &session) {
|
||||
session->connection->set_timeout(config.timeout_request);
|
||||
asio::async_read_until(*session->connection->socket, session->request->streambuf, "\r\n\r\n", [this, session](const error_code &ec, size_t bytes_transferred) {
|
||||
session->connection->cancel_timeout();
|
||||
auto lock = session->connection->handler_runner->continue_lock();
|
||||
if(!lock)
|
||||
return;
|
||||
if(!ec) {
|
||||
// request->streambuf.size() is not necessarily the same as bytes_transferred, from Boost-docs:
|
||||
// "After a successful async_read_until operation, the streambuf may contain additional data beyond the delimiter"
|
||||
// The chosen solution is to extract lines from the stream directly when parsing the header. What is left of the
|
||||
// streambuf (maybe some bytes of the content) is appended to in the async_read-function below (for retrieving content).
|
||||
size_t num_additional_bytes = session->request->streambuf.size() - bytes_transferred;
|
||||
void read_request_and_content(const std::shared_ptr<socket_type> &socket)
|
||||
{
|
||||
//Create new streambuf (Request::streambuf) for async_read_until()
|
||||
//shared_ptr is used to pass temporary objects to the asynchronous functions
|
||||
std::shared_ptr<Request> request(new Request(*socket));
|
||||
|
||||
if(!RequestMessage::parse(session->request->content, session->request->method, session->request->path,
|
||||
session->request->query_string, session->request->http_version, session->request->header)) {
|
||||
if(this->on_error)
|
||||
this->on_error(session->request, make_error_code::make_error_code(errc::protocol_error));
|
||||
//Set timeout on the following boost::asio::async-read or write function
|
||||
auto timer = this->get_timeout_timer(socket, config.timeout_request);
|
||||
|
||||
boost::asio::async_read_until(*socket, request->streambuf, "\r\n\r\n", [this, socket, request, timer]
|
||||
(const boost::system::error_code &ec,
|
||||
size_t bytes_transferred)
|
||||
{
|
||||
if (timer)
|
||||
timer->cancel();
|
||||
if (!ec)
|
||||
{
|
||||
//request->streambuf.size() is not necessarily the same as bytes_transferred, from Boost-docs:
|
||||
//"After a successful async_read_until operation, the streambuf may contain additional data beyond the delimiter"
|
||||
//The chosen solution is to extract lines from the stream directly when parsing the header. What is left of the
|
||||
//streambuf (maybe some bytes of the content) is appended to in the async_read-function below (for retrieving content).
|
||||
size_t num_additional_bytes =
|
||||
request->streambuf.size() - bytes_transferred;
|
||||
|
||||
if (!this->parse_request(request))
|
||||
return;
|
||||
}
|
||||
|
||||
// If content, read that as well
|
||||
auto it = session->request->header.find("Content-Length");
|
||||
if(it != session->request->header.end()) {
|
||||
unsigned long long content_length = 0;
|
||||
try {
|
||||
//If content, read that as well
|
||||
auto it = request->header.find("Content-Length");
|
||||
if (it != request->header.end())
|
||||
{
|
||||
unsigned long long content_length;
|
||||
try
|
||||
{
|
||||
content_length = stoull(it->second);
|
||||
}
|
||||
catch(const std::exception &e) {
|
||||
if(this->on_error)
|
||||
this->on_error(session->request, make_error_code::make_error_code(errc::protocol_error));
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
if (on_error)
|
||||
on_error(request, boost::system::error_code(
|
||||
boost::system::errc::protocol_error,
|
||||
boost::system::generic_category()));
|
||||
return;
|
||||
}
|
||||
if(content_length > num_additional_bytes) {
|
||||
session->connection->set_timeout(config.timeout_content);
|
||||
asio::async_read(*session->connection->socket, session->request->streambuf, asio::transfer_exactly(content_length - num_additional_bytes), [this, session](const error_code &ec, size_t /*bytes_transferred*/) {
|
||||
session->connection->cancel_timeout();
|
||||
auto lock = session->connection->handler_runner->continue_lock();
|
||||
if(!lock)
|
||||
return;
|
||||
if(!ec)
|
||||
this->find_resource(session);
|
||||
else if(this->on_error)
|
||||
this->on_error(session->request, ec);
|
||||
});
|
||||
if (content_length > num_additional_bytes)
|
||||
{
|
||||
//Set timeout on the following boost::asio::async-read or write function
|
||||
auto timer = this->get_timeout_timer(socket,
|
||||
config.timeout_content);
|
||||
boost::asio::async_read(*socket, request->streambuf,
|
||||
boost::asio::transfer_exactly(
|
||||
content_length -
|
||||
num_additional_bytes),
|
||||
[this, socket, request, timer]
|
||||
(const boost::system::error_code &ec,
|
||||
size_t /*bytes_transferred*/)
|
||||
{
|
||||
if (timer)
|
||||
timer->cancel();
|
||||
if (!ec)
|
||||
this->find_resource(socket,
|
||||
request);
|
||||
else if (on_error)
|
||||
on_error(request, ec);
|
||||
});
|
||||
}
|
||||
else
|
||||
this->find_resource(session);
|
||||
this->find_resource(socket, request);
|
||||
}
|
||||
else
|
||||
this->find_resource(session);
|
||||
this->find_resource(socket, request);
|
||||
}
|
||||
else if(this->on_error)
|
||||
this->on_error(session->request, ec);
|
||||
else if (on_error)
|
||||
on_error(request, ec);
|
||||
});
|
||||
}
|
||||
|
||||
void find_resource(const std::shared_ptr<Session> &session) {
|
||||
// Upgrade connection
|
||||
if(on_upgrade) {
|
||||
auto it = session->request->header.find("Upgrade");
|
||||
if(it != session->request->header.end()) {
|
||||
// remove connection from connections
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(*connections_mutex);
|
||||
auto it = connections->find(session->connection.get());
|
||||
if(it != connections->end())
|
||||
connections->erase(it);
|
||||
}
|
||||
bool parse_request(const std::shared_ptr<Request> &request) const
|
||||
{
|
||||
std::string line;
|
||||
getline(request->content, line);
|
||||
size_t method_end;
|
||||
if ((method_end = line.find(' ')) != std::string::npos)
|
||||
{
|
||||
size_t path_end;
|
||||
if ((path_end = line.find(' ', method_end + 1)) != std::string::npos)
|
||||
{
|
||||
request->method = line.substr(0, method_end);
|
||||
request->path = line.substr(method_end + 1, path_end - method_end - 1);
|
||||
|
||||
on_upgrade(session->connection->socket, session->request);
|
||||
size_t protocol_end;
|
||||
if ((protocol_end = line.find('/', path_end + 1)) != std::string::npos)
|
||||
{
|
||||
if (line.compare(path_end + 1, protocol_end - path_end - 1, "HTTP") != 0)
|
||||
return false;
|
||||
request->http_version = line.substr(protocol_end + 1, line.size() - protocol_end - 2);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
getline(request->content, line);
|
||||
size_t param_end;
|
||||
while ((param_end = line.find(':')) != std::string::npos)
|
||||
{
|
||||
size_t value_start = param_end + 1;
|
||||
if ((value_start) < line.size())
|
||||
{
|
||||
if (line[value_start] == ' ')
|
||||
value_start++;
|
||||
if (value_start < line.size())
|
||||
request->header.emplace(line.substr(0, param_end),
|
||||
line.substr(value_start, line.size() - value_start - 1));
|
||||
}
|
||||
|
||||
getline(request->content, line);
|
||||
}
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void find_resource(const std::shared_ptr<socket_type> &socket, const std::shared_ptr<Request> &request)
|
||||
{
|
||||
//Upgrade connection
|
||||
if (on_upgrade)
|
||||
{
|
||||
auto it = request->header.find("Upgrade");
|
||||
if (it != request->header.end())
|
||||
{
|
||||
on_upgrade(socket, request);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Find path- and method-match, and call write_response
|
||||
for(auto ®ex_method : resource) {
|
||||
auto it = regex_method.second.find(session->request->method);
|
||||
if(it != regex_method.second.end()) {
|
||||
//Find path- and method-match, and call write_response
|
||||
for (auto ®ex_method: resource)
|
||||
{
|
||||
auto it = regex_method.second.find(request->method);
|
||||
if (it != regex_method.second.end())
|
||||
{
|
||||
std::smatch sm_res;
|
||||
if(std::regex_match(session->request->path, sm_res, regex_method.first)) {
|
||||
session->request->path_match = std::move(sm_res);
|
||||
write_response(session, it->second);
|
||||
if (std::regex_match(request->path, sm_res, regex_method.first))
|
||||
{
|
||||
request->path_match = std::move(sm_res);
|
||||
write_response(socket, request, it->second);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
auto it = default_resource.find(session->request->method);
|
||||
if(it != default_resource.end())
|
||||
write_response(session, it->second);
|
||||
auto it = default_resource.find(request->method);
|
||||
if (it != default_resource.end())
|
||||
{
|
||||
write_response(socket, request, it->second);
|
||||
}
|
||||
}
|
||||
|
||||
void write_response(const std::shared_ptr<Session> &session,
|
||||
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>, std::shared_ptr<typename ServerBase<socket_type>::Request>)> &resource_function) {
|
||||
session->connection->set_timeout(config.timeout_content);
|
||||
auto response = std::shared_ptr<Response>(new Response(session, config.timeout_content), [this](Response *response_ptr) {
|
||||
void write_response(const std::shared_ptr<socket_type> &socket, const std::shared_ptr<Request> &request,
|
||||
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>,
|
||||
std::shared_ptr<
|
||||
typename ServerBase<socket_type>::Request>)> &resource_function)
|
||||
{
|
||||
//Set timeout on the following boost::asio::async-read or write function
|
||||
auto timer = this->get_timeout_timer(socket, config.timeout_content);
|
||||
|
||||
auto response = std::shared_ptr<Response>(new Response(socket), [this, request, timer]
|
||||
(Response *response_ptr)
|
||||
{
|
||||
auto response = std::shared_ptr<Response>(response_ptr);
|
||||
response->send([this, response](const error_code &ec) {
|
||||
if(!ec) {
|
||||
if(response->close_connection_after_response)
|
||||
this->send(response, [this, response, request, timer](
|
||||
const boost::system::error_code &ec)
|
||||
{
|
||||
if (timer)
|
||||
timer->cancel();
|
||||
if (!ec)
|
||||
{
|
||||
if (response->close_connection_after_response)
|
||||
return;
|
||||
|
||||
auto range = response->session->request->header.equal_range("Connection");
|
||||
for(auto it = range.first; it != range.second; it++) {
|
||||
if(case_insensitive_equal(it->second, "close"))
|
||||
auto range = request->header.equal_range(
|
||||
"Connection");
|
||||
for (auto it = range.first; it != range.second; it++)
|
||||
{
|
||||
if (boost::iequals(it->second, "close"))
|
||||
{
|
||||
return;
|
||||
else if(case_insensitive_equal(it->second, "keep-alive")) {
|
||||
auto new_session = std::make_shared<Session>(response->session->connection);
|
||||
this->read_request_and_content(new_session);
|
||||
}
|
||||
else if (boost::iequals(it->second, "keep-alive"))
|
||||
{
|
||||
this->read_request_and_content(
|
||||
response->socket);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(response->session->request->http_version >= "1.1") {
|
||||
auto new_session = std::make_shared<Session>(response->session->connection);
|
||||
this->read_request_and_content(new_session);
|
||||
return;
|
||||
}
|
||||
if (request->http_version >= "1.1")
|
||||
this->read_request_and_content(response->socket);
|
||||
}
|
||||
else if(this->on_error)
|
||||
this->on_error(response->session->request, ec);
|
||||
else if (on_error)
|
||||
on_error(request, ec);
|
||||
});
|
||||
});
|
||||
|
||||
try {
|
||||
resource_function(response, session->request);
|
||||
try
|
||||
{
|
||||
resource_function(response, request);
|
||||
}
|
||||
catch(const std::exception &e) {
|
||||
if(on_error)
|
||||
on_error(session->request, make_error_code::make_error_code(errc::operation_canceled));
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
if (on_error)
|
||||
on_error(request, boost::system::error_code(boost::system::errc::operation_canceled,
|
||||
boost::system::generic_category()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif //BASE_SERVER_HPP
|
||||
|
|
|
@ -1,42 +1,55 @@
|
|||
#pragma once
|
||||
/*
|
||||
* https://github.com/eidheim/Simple-Web-Server/
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
* Copyright (c) 2014-2016 Ole Christian Eidheim
|
||||
*/
|
||||
|
||||
#ifndef SERVER_HTTP_HPP
|
||||
#define SERVER_HTTP_HPP
|
||||
|
||||
#include "base_server.hpp"
|
||||
|
||||
namespace SimpleWeb {
|
||||
namespace SimpleWeb
|
||||
{
|
||||
|
||||
template <class socket_type>
|
||||
template<class socket_type>
|
||||
class Server : public ServerBase<socket_type> {};
|
||||
|
||||
using HTTP = asio::ip::tcp::socket;
|
||||
typedef boost::asio::ip::tcp::socket HTTP;
|
||||
|
||||
template <>
|
||||
class Server<HTTP> : public ServerBase<HTTP> {
|
||||
template<>
|
||||
class Server<HTTP> : public ServerBase<HTTP>
|
||||
{
|
||||
public:
|
||||
Server() noexcept : ServerBase<HTTP>::ServerBase(80) {}
|
||||
Server() : ServerBase<HTTP>::ServerBase(80)
|
||||
{}
|
||||
|
||||
protected:
|
||||
void accept() override {
|
||||
auto session = std::make_shared<Session>(create_connection(*io_service));
|
||||
virtual void accept()
|
||||
{
|
||||
//Create new socket for this connection
|
||||
//Shared_ptr is used to pass temporary objects to the asynchronous functions
|
||||
auto socket = std::make_shared<HTTP>(*io_service);
|
||||
|
||||
acceptor->async_accept(*session->connection->socket, [this, session](const error_code &ec) {
|
||||
auto lock = session->connection->handler_runner->continue_lock();
|
||||
if(!lock)
|
||||
return;
|
||||
acceptor->async_accept(*socket, [this, socket](const boost::system::error_code &ec)
|
||||
{
|
||||
//Immediately start accepting a new connection (if io_service hasn't been stopped)
|
||||
if (ec != boost::asio::error::operation_aborted)
|
||||
accept();
|
||||
|
||||
// Immediately start accepting a new connection (unless io_service has been stopped)
|
||||
if(ec != asio::error::operation_aborted)
|
||||
this->accept();
|
||||
if (!ec)
|
||||
{
|
||||
boost::asio::ip::tcp::no_delay option(true);
|
||||
socket->set_option(option);
|
||||
|
||||
if(!ec) {
|
||||
asio::ip::tcp::no_delay option(true);
|
||||
error_code ec;
|
||||
session->connection->socket->set_option(option, ec);
|
||||
|
||||
this->read_request_and_content(session);
|
||||
this->read_request_and_content(socket);
|
||||
}
|
||||
else if(this->on_error)
|
||||
this->on_error(session->request, ec);
|
||||
else if (on_error)
|
||||
on_error(std::shared_ptr<Request>(new Request(*socket)), ec);
|
||||
});
|
||||
}
|
||||
};
|
||||
} // namespace SimpleWeb
|
||||
}
|
||||
|
||||
#endif //SERVER_HTTP_HPP
|
||||
|
|
|
@ -1,82 +1,91 @@
|
|||
#pragma once
|
||||
#ifndef HTTPS_SERVER_HPP
|
||||
#define HTTPS_SERVER_HPP
|
||||
|
||||
#include "base_server.hpp"
|
||||
|
||||
#ifdef USE_STANDALONE_ASIO
|
||||
#include <asio/ssl.hpp>
|
||||
#else
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <openssl/ssl.h>
|
||||
#include <algorithm>
|
||||
|
||||
namespace SimpleWeb {
|
||||
using HTTPS = asio::ssl::stream<asio::ip::tcp::socket>;
|
||||
namespace SimpleWeb
|
||||
{
|
||||
typedef boost::asio::ssl::stream<boost::asio::ip::tcp::socket> HTTPS;
|
||||
|
||||
template <>
|
||||
class Server<HTTPS> : public ServerBase<HTTPS> {
|
||||
template<>
|
||||
class Server<HTTPS> : public ServerBase<HTTPS>
|
||||
{
|
||||
std::string session_id_context;
|
||||
bool set_session_id_context = false;
|
||||
|
||||
public:
|
||||
Server(const std::string &cert_file, const std::string &private_key_file, const std::string &verify_file = std::string())
|
||||
: ServerBase<HTTPS>::ServerBase(443), context(asio::ssl::context::tlsv12) {
|
||||
Server(const std::string &cert_file, const std::string &private_key_file,
|
||||
const std::string &verify_file = std::string()) : ServerBase<HTTPS>::ServerBase(443),
|
||||
context(boost::asio::ssl::context::tlsv12)
|
||||
{
|
||||
context.use_certificate_chain_file(cert_file);
|
||||
context.use_private_key_file(private_key_file, asio::ssl::context::pem);
|
||||
context.use_private_key_file(private_key_file, boost::asio::ssl::context::pem);
|
||||
|
||||
if(verify_file.size() > 0) {
|
||||
if (verify_file.size() > 0)
|
||||
{
|
||||
context.load_verify_file(verify_file);
|
||||
context.set_verify_mode(asio::ssl::verify_peer | asio::ssl::verify_fail_if_no_peer_cert | asio::ssl::verify_client_once);
|
||||
context.set_verify_mode(boost::asio::ssl::verify_peer | boost::asio::ssl::verify_fail_if_no_peer_cert |
|
||||
boost::asio::ssl::verify_client_once);
|
||||
set_session_id_context = true;
|
||||
}
|
||||
}
|
||||
|
||||
void start() override {
|
||||
if(set_session_id_context) {
|
||||
void start()
|
||||
{
|
||||
if (set_session_id_context)
|
||||
{
|
||||
// Creating session_id_context from address:port but reversed due to small SSL_MAX_SSL_SESSION_ID_LENGTH
|
||||
session_id_context = std::to_string(config.port) + ':';
|
||||
session_id_context.append(config.address.rbegin(), config.address.rend());
|
||||
SSL_CTX_set_session_id_context(context.native_handle(), reinterpret_cast<const unsigned char *>(session_id_context.data()),
|
||||
std::min<size_t>(session_id_context.size(), SSL_MAX_SSL_SESSION_ID_LENGTH));
|
||||
SSL_CTX_set_session_id_context(context.native_handle(),
|
||||
reinterpret_cast<const unsigned char *>(session_id_context.data()),
|
||||
std::min<size_t>(session_id_context.size(),
|
||||
SSL_MAX_SSL_SESSION_ID_LENGTH));
|
||||
}
|
||||
ServerBase::start();
|
||||
}
|
||||
|
||||
protected:
|
||||
asio::ssl::context context;
|
||||
boost::asio::ssl::context context;
|
||||
|
||||
void accept() override {
|
||||
auto session = std::make_shared<Session>(create_connection(*io_service, context));
|
||||
virtual void accept()
|
||||
{
|
||||
//Create new socket for this connection
|
||||
//Shared_ptr is used to pass temporary objects to the asynchronous functions
|
||||
auto socket = std::make_shared<HTTPS>(*io_service, context);
|
||||
|
||||
acceptor->async_accept(session->connection->socket->lowest_layer(), [this, session](const error_code &ec) {
|
||||
auto lock = session->connection->handler_runner->continue_lock();
|
||||
if(!lock)
|
||||
return;
|
||||
acceptor->async_accept((*socket).lowest_layer(), [this, socket](const boost::system::error_code &ec)
|
||||
{
|
||||
//Immediately start accepting a new connection (if io_service hasn't been stopped)
|
||||
if (ec != boost::asio::error::operation_aborted)
|
||||
accept();
|
||||
|
||||
if(ec != asio::error::operation_aborted)
|
||||
this->accept();
|
||||
|
||||
if(!ec) {
|
||||
asio::ip::tcp::no_delay option(true);
|
||||
error_code ec;
|
||||
session->connection->socket->lowest_layer().set_option(option, ec);
|
||||
if (!ec)
|
||||
{
|
||||
boost::asio::ip::tcp::no_delay option(true);
|
||||
socket->lowest_layer().set_option(option);
|
||||
|
||||
session->connection->set_timeout(config.timeout_request);
|
||||
session->connection->socket->async_handshake(asio::ssl::stream_base::server, [this, session](const error_code &ec) {
|
||||
session->connection->cancel_timeout();
|
||||
auto lock = session->connection->handler_runner->continue_lock();
|
||||
if(!lock)
|
||||
return;
|
||||
if(!ec)
|
||||
this->read_request_and_content(session);
|
||||
else if(this->on_error)
|
||||
this->on_error(session->request, ec);
|
||||
//Set timeout on the following boost::asio::ssl::stream::async_handshake
|
||||
auto timer = get_timeout_timer(socket, config.timeout_request);
|
||||
socket->async_handshake(boost::asio::ssl::stream_base::server, [this, socket, timer]
|
||||
(const boost::system::error_code &ec)
|
||||
{
|
||||
if (timer)
|
||||
timer->cancel();
|
||||
if (!ec)
|
||||
read_request_and_content(socket);
|
||||
else if (on_error)
|
||||
on_error(std::shared_ptr<Request>(new Request(*socket)), ec);
|
||||
});
|
||||
}
|
||||
else if(this->on_error)
|
||||
this->on_error(session->request, ec);
|
||||
else if (on_error)
|
||||
on_error(std::shared_ptr<Request>(new Request(*socket)), ec);
|
||||
});
|
||||
}
|
||||
};
|
||||
} // namespace SimpleWeb
|
||||
}
|
||||
|
||||
#endif //HTTPS_SERVER_HPP
|
||||
|
|
|
@ -1,154 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace SimpleWeb {
|
||||
enum class StatusCode {
|
||||
unknown = 0,
|
||||
information_continue = 100,
|
||||
information_switching_protocols,
|
||||
information_processing,
|
||||
success_ok = 200,
|
||||
success_created,
|
||||
success_accepted,
|
||||
success_non_authoritative_information,
|
||||
success_no_content,
|
||||
success_reset_content,
|
||||
success_partial_content,
|
||||
success_multi_status,
|
||||
success_already_reported,
|
||||
success_im_used = 226,
|
||||
redirection_multiple_choices = 300,
|
||||
redirection_moved_permanently,
|
||||
redirection_found,
|
||||
redirection_see_other,
|
||||
redirection_not_modified,
|
||||
redirection_use_proxy,
|
||||
redirection_switch_proxy,
|
||||
redirection_temporary_redirect,
|
||||
redirection_permanent_redirect,
|
||||
client_error_bad_request = 400,
|
||||
client_error_unauthorized,
|
||||
client_error_payment_required,
|
||||
client_error_forbidden,
|
||||
client_error_not_found,
|
||||
client_error_method_not_allowed,
|
||||
client_error_not_acceptable,
|
||||
client_error_proxy_authentication_required,
|
||||
client_error_request_timeout,
|
||||
client_error_conflict,
|
||||
client_error_gone,
|
||||
client_error_length_required,
|
||||
client_error_precondition_failed,
|
||||
client_error_payload_too_large,
|
||||
client_error_uri_too_long,
|
||||
client_error_unsupported_media_type,
|
||||
client_error_range_not_satisfiable,
|
||||
client_error_expectation_failed,
|
||||
client_error_im_a_teapot,
|
||||
client_error_misdirection_required = 421,
|
||||
client_error_unprocessable_entity,
|
||||
client_error_locked,
|
||||
client_error_failed_dependency,
|
||||
client_error_upgrade_required = 426,
|
||||
client_error_precondition_required = 428,
|
||||
client_error_too_many_requests,
|
||||
client_error_request_header_fields_too_large = 431,
|
||||
client_error_unavailable_for_legal_reasons = 451,
|
||||
server_error_internal_server_error = 500,
|
||||
server_error_not_implemented,
|
||||
server_error_bad_gateway,
|
||||
server_error_service_unavailable,
|
||||
server_error_gateway_timeout,
|
||||
server_error_http_version_not_supported,
|
||||
server_error_variant_also_negotiates,
|
||||
server_error_insufficient_storage,
|
||||
server_error_loop_detected,
|
||||
server_error_not_extended = 510,
|
||||
server_error_network_authentication_required
|
||||
};
|
||||
|
||||
const static std::vector<std::pair<StatusCode, std::string>> &status_codes() noexcept {
|
||||
const static std::vector<std::pair<StatusCode, std::string>> status_codes = {
|
||||
{StatusCode::unknown, ""},
|
||||
{StatusCode::information_continue, "100 Continue"},
|
||||
{StatusCode::information_switching_protocols, "101 Switching Protocols"},
|
||||
{StatusCode::information_processing, "102 Processing"},
|
||||
{StatusCode::success_ok, "200 OK"},
|
||||
{StatusCode::success_created, "201 Created"},
|
||||
{StatusCode::success_accepted, "202 Accepted"},
|
||||
{StatusCode::success_non_authoritative_information, "203 Non-Authoritative Information"},
|
||||
{StatusCode::success_no_content, "204 No Content"},
|
||||
{StatusCode::success_reset_content, "205 Reset Content"},
|
||||
{StatusCode::success_partial_content, "206 Partial Content"},
|
||||
{StatusCode::success_multi_status, "207 Multi-Status"},
|
||||
{StatusCode::success_already_reported, "208 Already Reported"},
|
||||
{StatusCode::success_im_used, "226 IM Used"},
|
||||
{StatusCode::redirection_multiple_choices, "300 Multiple Choices"},
|
||||
{StatusCode::redirection_moved_permanently, "301 Moved Permanently"},
|
||||
{StatusCode::redirection_found, "302 Found"},
|
||||
{StatusCode::redirection_see_other, "303 See Other"},
|
||||
{StatusCode::redirection_not_modified, "304 Not Modified"},
|
||||
{StatusCode::redirection_use_proxy, "305 Use Proxy"},
|
||||
{StatusCode::redirection_switch_proxy, "306 Switch Proxy"},
|
||||
{StatusCode::redirection_temporary_redirect, "307 Temporary Redirect"},
|
||||
{StatusCode::redirection_permanent_redirect, "308 Permanent Redirect"},
|
||||
{StatusCode::client_error_bad_request, "400 Bad Request"},
|
||||
{StatusCode::client_error_unauthorized, "401 Unauthorized"},
|
||||
{StatusCode::client_error_payment_required, "402 Payment Required"},
|
||||
{StatusCode::client_error_forbidden, "403 Forbidden"},
|
||||
{StatusCode::client_error_not_found, "404 Not Found"},
|
||||
{StatusCode::client_error_method_not_allowed, "405 Method Not Allowed"},
|
||||
{StatusCode::client_error_not_acceptable, "406 Not Acceptable"},
|
||||
{StatusCode::client_error_proxy_authentication_required, "407 Proxy Authentication Required"},
|
||||
{StatusCode::client_error_request_timeout, "408 Request Timeout"},
|
||||
{StatusCode::client_error_conflict, "409 Conflict"},
|
||||
{StatusCode::client_error_gone, "410 Gone"},
|
||||
{StatusCode::client_error_length_required, "411 Length Required"},
|
||||
{StatusCode::client_error_precondition_failed, "412 Precondition Failed"},
|
||||
{StatusCode::client_error_payload_too_large, "413 Payload Too Large"},
|
||||
{StatusCode::client_error_uri_too_long, "414 URI Too Long"},
|
||||
{StatusCode::client_error_unsupported_media_type, "415 Unsupported Media Type"},
|
||||
{StatusCode::client_error_range_not_satisfiable, "416 Range Not Satisfiable"},
|
||||
{StatusCode::client_error_expectation_failed, "417 Expectation Failed"},
|
||||
{StatusCode::client_error_im_a_teapot, "418 I'm a teapot"},
|
||||
{StatusCode::client_error_misdirection_required, "421 Misdirected Request"},
|
||||
{StatusCode::client_error_unprocessable_entity, "422 Unprocessable Entity"},
|
||||
{StatusCode::client_error_locked, "423 Locked"},
|
||||
{StatusCode::client_error_failed_dependency, "424 Failed Dependency"},
|
||||
{StatusCode::client_error_upgrade_required, "426 Upgrade Required"},
|
||||
{StatusCode::client_error_precondition_required, "428 Precondition Required"},
|
||||
{StatusCode::client_error_too_many_requests, "429 Too Many Requests"},
|
||||
{StatusCode::client_error_request_header_fields_too_large, "431 Request Header Fields Too Large"},
|
||||
{StatusCode::client_error_unavailable_for_legal_reasons, "451 Unavailable For Legal Reasons"},
|
||||
{StatusCode::server_error_internal_server_error, "500 Internal Server Error"},
|
||||
{StatusCode::server_error_not_implemented, "501 Not Implemented"},
|
||||
{StatusCode::server_error_bad_gateway, "502 Bad Gateway"},
|
||||
{StatusCode::server_error_service_unavailable, "503 Service Unavailable"},
|
||||
{StatusCode::server_error_gateway_timeout, "504 Gateway Timeout"},
|
||||
{StatusCode::server_error_http_version_not_supported, "505 HTTP Version Not Supported"},
|
||||
{StatusCode::server_error_variant_also_negotiates, "506 Variant Also Negotiates"},
|
||||
{StatusCode::server_error_insufficient_storage, "507 Insufficient Storage"},
|
||||
{StatusCode::server_error_loop_detected, "508 Loop Detected"},
|
||||
{StatusCode::server_error_not_extended, "510 Not Extended"},
|
||||
{StatusCode::server_error_network_authentication_required, "511 Network Authentication Required"}};
|
||||
return status_codes;
|
||||
}
|
||||
|
||||
inline StatusCode status_code(const std::string &status_code_str) noexcept {
|
||||
for(auto &status_code : status_codes()) {
|
||||
if(status_code.second == status_code_str)
|
||||
return status_code.first;
|
||||
}
|
||||
return StatusCode::unknown;
|
||||
}
|
||||
|
||||
inline const std::string &status_code(StatusCode status_code_enum) noexcept {
|
||||
for(auto &status_code : status_codes()) {
|
||||
if(status_code.first == status_code_enum)
|
||||
return status_code.second;
|
||||
}
|
||||
return status_codes()[0].second;
|
||||
}
|
||||
} // namespace SimpleWeb
|
|
@ -1,340 +0,0 @@
|
|||
#pragma once
|
||||
|
||||
#include "status_code.hpp"
|
||||
#include <atomic>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace SimpleWeb {
|
||||
inline bool case_insensitive_equal(const std::string &str1, const std::string &str2) noexcept {
|
||||
return str1.size() == str2.size() &&
|
||||
std::equal(str1.begin(), str1.end(), str2.begin(), [](char a, char b) {
|
||||
return tolower(a) == tolower(b);
|
||||
});
|
||||
}
|
||||
class CaseInsensitiveEqual {
|
||||
public:
|
||||
bool operator()(const std::string &str1, const std::string &str2) const noexcept {
|
||||
return case_insensitive_equal(str1, str2);
|
||||
}
|
||||
};
|
||||
// Based on https://stackoverflow.com/questions/2590677/how-do-i-combine-hash-values-in-c0x/2595226#2595226
|
||||
class CaseInsensitiveHash {
|
||||
public:
|
||||
size_t operator()(const std::string &str) const noexcept {
|
||||
size_t h = 0;
|
||||
std::hash<int> hash;
|
||||
for(auto c : str)
|
||||
h ^= hash(tolower(c)) + 0x9e3779b9 + (h << 6) + (h >> 2);
|
||||
return h;
|
||||
}
|
||||
};
|
||||
|
||||
using CaseInsensitiveMultimap = std::unordered_multimap<std::string, std::string, CaseInsensitiveHash, CaseInsensitiveEqual>;
|
||||
|
||||
/// Percent encoding and decoding
|
||||
class Percent {
|
||||
public:
|
||||
/// Returns percent-encoded string
|
||||
static std::string encode(const std::string &value) noexcept {
|
||||
static auto hex_chars = "0123456789ABCDEF";
|
||||
|
||||
std::string result;
|
||||
result.reserve(value.size()); // Minimum size of result
|
||||
|
||||
for(auto &chr : value) {
|
||||
if(chr == ' ')
|
||||
result += '+';
|
||||
else if(chr == '!' || chr == '#' || chr == '$' || (chr >= '&' && chr <= ',') || (chr >= '/' && chr <= ';') || chr == '=' || chr == '?' || chr == '@' || chr == '[' || chr == ']')
|
||||
result += std::string("%") + hex_chars[chr >> 4] + hex_chars[chr & 15];
|
||||
else
|
||||
result += chr;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Returns percent-decoded string
|
||||
static std::string decode(const std::string &value) noexcept {
|
||||
std::string result;
|
||||
result.reserve(value.size() / 3 + (value.size() % 3)); // Minimum size of result
|
||||
|
||||
for(size_t i = 0; i < value.size(); ++i) {
|
||||
auto &chr = value[i];
|
||||
if(chr == '%' && i + 2 < value.size()) {
|
||||
auto hex = value.substr(i + 1, 2);
|
||||
auto decoded_chr = static_cast<char>(std::strtol(hex.c_str(), nullptr, 16));
|
||||
result += decoded_chr;
|
||||
i += 2;
|
||||
}
|
||||
else if(chr == '+')
|
||||
result += ' ';
|
||||
else
|
||||
result += chr;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
/// Query string creation and parsing
|
||||
class QueryString {
|
||||
public:
|
||||
/// Returns query string created from given field names and values
|
||||
static std::string create(const CaseInsensitiveMultimap &fields) noexcept {
|
||||
std::string result;
|
||||
|
||||
bool first = true;
|
||||
for(auto &field : fields) {
|
||||
result += (!first ? "&" : "") + field.first + '=' + Percent::encode(field.second);
|
||||
first = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// Returns query keys with percent-decoded values.
|
||||
static CaseInsensitiveMultimap parse(const std::string &query_string) noexcept {
|
||||
CaseInsensitiveMultimap result;
|
||||
|
||||
if(query_string.empty())
|
||||
return result;
|
||||
|
||||
size_t name_pos = 0;
|
||||
auto name_end_pos = std::string::npos;
|
||||
auto value_pos = std::string::npos;
|
||||
for(size_t c = 0; c < query_string.size(); ++c) {
|
||||
if(query_string[c] == '&') {
|
||||
auto name = query_string.substr(name_pos, (name_end_pos == std::string::npos ? c : name_end_pos) - name_pos);
|
||||
if(!name.empty()) {
|
||||
auto value = value_pos == std::string::npos ? std::string() : query_string.substr(value_pos, c - value_pos);
|
||||
result.emplace(std::move(name), Percent::decode(value));
|
||||
}
|
||||
name_pos = c + 1;
|
||||
name_end_pos = std::string::npos;
|
||||
value_pos = std::string::npos;
|
||||
}
|
||||
else if(query_string[c] == '=') {
|
||||
name_end_pos = c;
|
||||
value_pos = c + 1;
|
||||
}
|
||||
}
|
||||
if(name_pos < query_string.size()) {
|
||||
auto name = query_string.substr(name_pos, name_end_pos - name_pos);
|
||||
if(!name.empty()) {
|
||||
auto value = value_pos >= query_string.size() ? std::string() : query_string.substr(value_pos);
|
||||
result.emplace(std::move(name), Percent::decode(value));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
class HttpHeader {
|
||||
public:
|
||||
/// Parse header fields
|
||||
static CaseInsensitiveMultimap parse(std::istream &stream) noexcept {
|
||||
CaseInsensitiveMultimap result;
|
||||
std::string line;
|
||||
getline(stream, line);
|
||||
size_t param_end;
|
||||
while((param_end = line.find(':')) != std::string::npos) {
|
||||
size_t value_start = param_end + 1;
|
||||
if(value_start < line.size()) {
|
||||
if(line[value_start] == ' ')
|
||||
value_start++;
|
||||
if(value_start < line.size())
|
||||
result.emplace(line.substr(0, param_end), line.substr(value_start, line.size() - value_start - 1));
|
||||
}
|
||||
|
||||
getline(stream, line);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
class RequestMessage {
|
||||
public:
|
||||
/// Parse request line and header fields
|
||||
static bool parse(std::istream &stream, std::string &method, std::string &path, std::string &query_string, std::string &version, CaseInsensitiveMultimap &header) noexcept {
|
||||
header.clear();
|
||||
std::string line;
|
||||
getline(stream, line);
|
||||
size_t method_end;
|
||||
if((method_end = line.find(' ')) != std::string::npos) {
|
||||
method = line.substr(0, method_end);
|
||||
|
||||
size_t query_start = std::string::npos;
|
||||
size_t path_and_query_string_end = std::string::npos;
|
||||
for(size_t i = method_end + 1; i < line.size(); ++i) {
|
||||
if(line[i] == '?' && (i + 1) < line.size())
|
||||
query_start = i + 1;
|
||||
else if(line[i] == ' ') {
|
||||
path_and_query_string_end = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(path_and_query_string_end != std::string::npos) {
|
||||
if(query_start != std::string::npos) {
|
||||
path = line.substr(method_end + 1, query_start - method_end - 2);
|
||||
query_string = line.substr(query_start, path_and_query_string_end - query_start);
|
||||
}
|
||||
else
|
||||
path = line.substr(method_end + 1, path_and_query_string_end - method_end - 1);
|
||||
|
||||
size_t protocol_end;
|
||||
if((protocol_end = line.find('/', path_and_query_string_end + 1)) != std::string::npos) {
|
||||
if(line.compare(path_and_query_string_end + 1, protocol_end - path_and_query_string_end - 1, "HTTP") != 0)
|
||||
return false;
|
||||
version = line.substr(protocol_end + 1, line.size() - protocol_end - 2);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
header = HttpHeader::parse(stream);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class ResponseMessage {
|
||||
public:
|
||||
/// Parse status line and header fields
|
||||
static bool parse(std::istream &stream, std::string &version, std::string &status_code, CaseInsensitiveMultimap &header) noexcept {
|
||||
header.clear();
|
||||
std::string line;
|
||||
getline(stream, line);
|
||||
size_t version_end = line.find(' ');
|
||||
if(version_end != std::string::npos) {
|
||||
if(5 < line.size())
|
||||
version = line.substr(5, version_end - 5);
|
||||
else
|
||||
return false;
|
||||
if((version_end + 1) < line.size())
|
||||
status_code = line.substr(version_end + 1, line.size() - (version_end + 1) - 1);
|
||||
else
|
||||
return false;
|
||||
|
||||
header = HttpHeader::parse(stream);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class ContentDisposition {
|
||||
public:
|
||||
/// Can be used to parse the Content-Disposition header field value when
|
||||
/// clients are posting requests with enctype="multipart/form-data"
|
||||
static CaseInsensitiveMultimap parse(const std::string &line) {
|
||||
CaseInsensitiveMultimap result;
|
||||
|
||||
size_t para_start_pos = 0;
|
||||
size_t para_end_pos = std::string::npos;
|
||||
size_t value_start_pos = std::string::npos;
|
||||
for(size_t c = 0; c < line.size(); ++c) {
|
||||
if(para_start_pos != std::string::npos) {
|
||||
if(para_end_pos == std::string::npos) {
|
||||
if(line[c] == ';') {
|
||||
result.emplace(line.substr(para_start_pos, c - para_start_pos), std::string());
|
||||
para_start_pos = std::string::npos;
|
||||
}
|
||||
else if(line[c] == '=')
|
||||
para_end_pos = c;
|
||||
}
|
||||
else {
|
||||
if(value_start_pos == std::string::npos) {
|
||||
if(line[c] == '"' && c + 1 < line.size())
|
||||
value_start_pos = c + 1;
|
||||
}
|
||||
else if(line[c] == '"') {
|
||||
result.emplace(line.substr(para_start_pos, para_end_pos - para_start_pos), line.substr(value_start_pos, c - value_start_pos));
|
||||
para_start_pos = std::string::npos;
|
||||
para_end_pos = std::string::npos;
|
||||
value_start_pos = std::string::npos;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(line[c] != ' ' && line[c] != ';')
|
||||
para_start_pos = c;
|
||||
}
|
||||
if(para_start_pos != std::string::npos && para_end_pos == std::string::npos)
|
||||
result.emplace(line.substr(para_start_pos), std::string());
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
} // namespace SimpleWeb
|
||||
|
||||
#ifdef __SSE2__
|
||||
#include <emmintrin.h>
|
||||
namespace SimpleWeb {
|
||||
inline void spin_loop_pause() noexcept { _mm_pause(); }
|
||||
} // namespace SimpleWeb
|
||||
// TODO: need verification that the following checks are correct:
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1800 && (defined(_M_X64) || defined(_M_IX86))
|
||||
#include <intrin.h>
|
||||
namespace SimpleWeb {
|
||||
inline void spin_loop_pause() noexcept { _mm_pause(); }
|
||||
} // namespace SimpleWeb
|
||||
#else
|
||||
namespace SimpleWeb {
|
||||
inline void spin_loop_pause() noexcept {}
|
||||
} // namespace SimpleWeb
|
||||
#endif
|
||||
|
||||
namespace SimpleWeb {
|
||||
/// Makes it possible to for instance cancel Asio handlers without stopping asio::io_service
|
||||
class ScopeRunner {
|
||||
/// Scope count that is set to -1 if scopes are to be canceled
|
||||
std::atomic<long> count;
|
||||
|
||||
public:
|
||||
class SharedLock {
|
||||
friend class ScopeRunner;
|
||||
std::atomic<long> &count;
|
||||
SharedLock(std::atomic<long> &count) noexcept : count(count) {}
|
||||
SharedLock &operator=(const SharedLock &) = delete;
|
||||
SharedLock(const SharedLock &) = delete;
|
||||
|
||||
public:
|
||||
~SharedLock() noexcept {
|
||||
count.fetch_sub(1);
|
||||
}
|
||||
};
|
||||
|
||||
ScopeRunner() noexcept : count(0) {}
|
||||
|
||||
/// Returns nullptr if scope should be exited, or a shared lock otherwise
|
||||
std::unique_ptr<SharedLock> continue_lock() noexcept {
|
||||
long expected = count;
|
||||
while(expected >= 0 && !count.compare_exchange_weak(expected, expected + 1))
|
||||
spin_loop_pause();
|
||||
|
||||
if(expected < 0)
|
||||
return nullptr;
|
||||
else
|
||||
return std::unique_ptr<SharedLock>(new SharedLock(count));
|
||||
}
|
||||
|
||||
/// Blocks until all shared locks are released, then prevents future shared locks
|
||||
void stop() noexcept {
|
||||
long expected = 0;
|
||||
while(!count.compare_exchange_weak(expected, -1)) {
|
||||
if(expected < 0)
|
||||
return;
|
||||
expected = 0;
|
||||
spin_loop_pause();
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace SimpleWeb
|
|
@ -1,74 +1,36 @@
|
|||
#include <iostream>
|
||||
#include <Kbhit.h>
|
||||
#include <RakSleep.h>
|
||||
#include <sol.hpp>
|
||||
#include "MasterServer.hpp"
|
||||
#include "RestServer.hpp"
|
||||
#include "AdminRest.hpp"
|
||||
|
||||
using namespace RakNet;
|
||||
using namespace std;
|
||||
|
||||
unique_ptr<RestServer> restServer;
|
||||
shared_ptr<MasterServer> masterServer;
|
||||
unique_ptr<AdminRest> restAdminServer;
|
||||
unique_ptr<MasterServer> masterServer;
|
||||
bool run = true;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
int main()
|
||||
{
|
||||
if (argc != 2)
|
||||
return 1;
|
||||
|
||||
string luaScript(argv[1]);
|
||||
|
||||
masterServer = make_shared<MasterServer>(luaScript);
|
||||
masterServer->luaStuff([](sol::state &state)
|
||||
{
|
||||
sol::table config = state["config"];
|
||||
sol::object restPort = config["restPort"];
|
||||
if (restPort.get_type() != sol::type::number)
|
||||
throw runtime_error("config.restPort is not correct");
|
||||
|
||||
|
||||
restServer = make_unique<RestServer>(restPort.as<unsigned short>(), masterServer->GetServers());
|
||||
|
||||
sol::object restAdminCert = config["restAdminCert"];
|
||||
if (restAdminCert.get_type() != sol::type::string)
|
||||
throw runtime_error("config.restAdminCert is not correct");
|
||||
|
||||
sol::object restAdminKey = config["restAdminKey"];
|
||||
if (restAdminKey.get_type() != sol::type::string)
|
||||
throw runtime_error("config.restAdminKey is not correct");
|
||||
|
||||
sol::object restAdminVerifyFile = config["restAdminVerifyFile"];
|
||||
if (restAdminVerifyFile.get_type() != sol::type::string)
|
||||
throw runtime_error("config.restAdminVerifyFile is not correct");
|
||||
|
||||
sol::object restAdminPort = config["restAdminPort"];
|
||||
if (restAdminPort.get_type() != sol::type::number)
|
||||
throw runtime_error("config.restAdminPort is not correct");
|
||||
|
||||
restAdminServer = make_unique<AdminRest>(restAdminCert.as<string>(), restAdminKey.as<string>(),
|
||||
restAdminVerifyFile.as<string>(), restAdminPort.as<unsigned short>(), masterServer);
|
||||
});
|
||||
masterServer.reset(new MasterServer(2000, 25560));
|
||||
restServer.reset(new RestServer(8080, masterServer->GetServers()));
|
||||
|
||||
auto onExit = [](int /*sig*/){
|
||||
restServer->stop();
|
||||
restAdminServer->stop();
|
||||
masterServer->luaStuff([](sol::state &state) {
|
||||
sol::protected_function func = state["OnExit"];
|
||||
if (func.valid())
|
||||
func.call();
|
||||
});
|
||||
masterServer->Stop(false);
|
||||
masterServer->Wait();
|
||||
run = false;
|
||||
};
|
||||
|
||||
signal(SIGINT, onExit);
|
||||
signal(SIGTERM, onExit);
|
||||
|
||||
masterServer->Start();
|
||||
restServer->start();
|
||||
restAdminServer->start();
|
||||
|
||||
thread server_thread([]() { restServer->start(); });
|
||||
|
||||
server_thread.join();
|
||||
masterServer->Wait();
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -874,7 +874,6 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co
|
|||
{
|
||||
std::vector<std::pair<std::time_t, boost::filesystem::path>> contentFiles;
|
||||
std::string baseGameFile("Game Files:GameFile");
|
||||
std::string gameFile("");
|
||||
std::time_t defaultTime = 0;
|
||||
ToUTF8::Utf8Encoder encoder(mEncoding);
|
||||
|
||||
|
@ -890,7 +889,7 @@ void MwIniImporter::importGameFiles(multistrmap &cfg, const multistrmap &ini, co
|
|||
multistrmap::const_iterator it = ini.begin();
|
||||
for (int i=0; it != ini.end(); i++)
|
||||
{
|
||||
gameFile = baseGameFile;
|
||||
std::string gameFile = baseGameFile;
|
||||
gameFile.append(std::to_string(i));
|
||||
|
||||
it = ini.find(gameFile);
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
#include <QLocalSocket>
|
||||
#include <QMessageBox>
|
||||
|
||||
|
||||
#include <components/crashcatcher/crashcatcher.hpp>
|
||||
|
||||
#include <components/fallback/validate.hpp>
|
||||
|
||||
#include <components/nifosg/nifloader.hpp>
|
||||
|
@ -18,12 +21,16 @@
|
|||
|
||||
using namespace Fallback;
|
||||
|
||||
CS::Editor::Editor ()
|
||||
CS::Editor::Editor (int argc, char **argv)
|
||||
: mSettingsState (mCfgMgr), mDocumentManager (mCfgMgr),
|
||||
mViewManager (mDocumentManager), mPid(""),
|
||||
mLock(), mMerge (mDocumentManager),
|
||||
mIpcServerName ("org.openmw.OpenCS"), mServer(NULL), mClientSocket(NULL)
|
||||
{
|
||||
// install the crash handler as soon as possible. note that the log path
|
||||
// does not depend on config being read.
|
||||
crashCatcherInstall(argc, argv, (mCfgMgr.getLogPath() / "openmw-cs-crash.log").string());
|
||||
|
||||
std::pair<Files::PathContainer, std::vector<std::string> > config = readConfig();
|
||||
|
||||
setupDataFiles (config.first);
|
||||
|
|
|
@ -66,7 +66,7 @@ namespace CS
|
|||
|
||||
public:
|
||||
|
||||
Editor ();
|
||||
Editor (int argc, char **argv);
|
||||
~Editor ();
|
||||
|
||||
bool makeIPCServer();
|
||||
|
|
|
@ -8,8 +8,9 @@
|
|||
#include <QIcon>
|
||||
#include <QMetaType>
|
||||
|
||||
#include "model/doc/messages.hpp"
|
||||
#include <components/misc/debugging.hpp>
|
||||
|
||||
#include "model/doc/messages.hpp"
|
||||
#include "model/world/universalid.hpp"
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
|
@ -41,45 +42,43 @@ class Application : public QApplication
|
|||
Application (int& argc, char *argv[]) : QApplication (argc, argv) {}
|
||||
};
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int runApplication(int argc, char *argv[])
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
setenv("OSG_GL_TEXTURE_STORAGE", "OFF", 0);
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
setenv("OSG_GL_TEXTURE_STORAGE", "OFF", 0);
|
||||
#endif
|
||||
|
||||
try
|
||||
// To allow background thread drawing in OSG
|
||||
QApplication::setAttribute(Qt::AA_X11InitThreads, true);
|
||||
|
||||
Q_INIT_RESOURCE (resources);
|
||||
|
||||
qRegisterMetaType<std::string> ("std::string");
|
||||
qRegisterMetaType<CSMWorld::UniversalId> ("CSMWorld::UniversalId");
|
||||
qRegisterMetaType<CSMDoc::Message> ("CSMDoc::Message");
|
||||
|
||||
Application application (argc, argv);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
QDir::setCurrent(dir.absolutePath());
|
||||
#endif
|
||||
|
||||
application.setWindowIcon (QIcon (":./openmw-cs.png"));
|
||||
|
||||
CS::Editor editor(argc, argv);
|
||||
|
||||
if(!editor.makeIPCServer())
|
||||
{
|
||||
// To allow background thread drawing in OSG
|
||||
QApplication::setAttribute(Qt::AA_X11InitThreads, true);
|
||||
|
||||
Q_INIT_RESOURCE (resources);
|
||||
|
||||
qRegisterMetaType<std::string> ("std::string");
|
||||
qRegisterMetaType<CSMWorld::UniversalId> ("CSMWorld::UniversalId");
|
||||
qRegisterMetaType<CSMDoc::Message> ("CSMDoc::Message");
|
||||
|
||||
Application application (argc, argv);
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QDir dir(QCoreApplication::applicationDirPath());
|
||||
QDir::setCurrent(dir.absolutePath());
|
||||
#endif
|
||||
|
||||
application.setWindowIcon (QIcon (":./openmw-cs.png"));
|
||||
|
||||
CS::Editor editor;
|
||||
|
||||
if(!editor.makeIPCServer())
|
||||
{
|
||||
editor.connectToIPCServer();
|
||||
return 0;
|
||||
}
|
||||
return editor.run();
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
std::cerr << "ERROR: " << e.what() << std::endl;
|
||||
editor.connectToIPCServer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
return editor.run();
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return wrapApplication(&runApplication, argc, argv, "/openmw-cs.log");
|
||||
}
|
||||
|
|
|
@ -320,12 +320,13 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
|||
connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool)));
|
||||
|
||||
connect (&mTools, SIGNAL (progress (int, int, int)), this, SLOT (progress (int, int, int)));
|
||||
connect (&mTools, SIGNAL (done (int, bool)), this, SLOT (operationDone (int, bool)));
|
||||
connect (&mTools, SIGNAL (done (int, bool)), this, SIGNAL (operationDone (int, bool)));
|
||||
connect (&mTools, SIGNAL (done (int, bool)), this, SLOT (operationDone2 (int, bool)));
|
||||
connect (&mTools, SIGNAL (mergeDone (CSMDoc::Document*)),
|
||||
this, SIGNAL (mergeDone (CSMDoc::Document*)));
|
||||
|
||||
connect (&mSaving, SIGNAL (progress (int, int, int)), this, SLOT (progress (int, int, int)));
|
||||
connect (&mSaving, SIGNAL (done (int, bool)), this, SLOT (operationDone (int, bool)));
|
||||
connect (&mSaving, SIGNAL (done (int, bool)), this, SLOT (operationDone2 (int, bool)));
|
||||
|
||||
connect (
|
||||
&mSaving, SIGNAL (reportMessage (const CSMDoc::Message&, int)),
|
||||
|
@ -437,7 +438,7 @@ void CSMDoc::Document::reportMessage (const CSMDoc::Message& message, int type)
|
|||
std::cout << message.mMessage << std::endl;
|
||||
}
|
||||
|
||||
void CSMDoc::Document::operationDone (int type, bool failed)
|
||||
void CSMDoc::Document::operationDone2 (int type, bool failed)
|
||||
{
|
||||
if (type==CSMDoc::State_Saving && !failed)
|
||||
mDirty = false;
|
||||
|
|
|
@ -168,13 +168,15 @@ namespace CSMDoc
|
|||
/// document. This signal must be handled to avoid a leak.
|
||||
void mergeDone (CSMDoc::Document *document);
|
||||
|
||||
void operationDone (int type, bool failed);
|
||||
|
||||
private slots:
|
||||
|
||||
void modificationStateChanged (bool clean);
|
||||
|
||||
void reportMessage (const CSMDoc::Message& message, int type);
|
||||
|
||||
void operationDone (int type, bool failed);
|
||||
void operationDone2 (int type, bool failed);
|
||||
|
||||
void runStateChanged();
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ void CSMPrefs::State::declare()
|
|||
declareEnum ("double-s", "Shift Double Click", actionRemove).addValues (reportValues);
|
||||
declareEnum ("double-c", "Control Double Click", actionEditAndRemove).addValues (reportValues);
|
||||
declareEnum ("double-sc", "Shift Control Double Click", actionNone).addValues (reportValues);
|
||||
declareBool("ignore-base-records", "Ignore base records in verifier", false);
|
||||
|
||||
declareCategory ("Search & Replace");
|
||||
declareInt ("char-before", "Characters before search string", 10).
|
||||
|
@ -200,6 +201,9 @@ void CSMPrefs::State::declare()
|
|||
declareDouble ("rotate-factor", "Free rotation factor", 0.007).setPrecision(4).setRange(0.0001, 0.1);
|
||||
|
||||
declareCategory ("Rendering");
|
||||
declareInt ("framerate-limit", "FPS limit", 60).
|
||||
setTooltip("Framerate limit in 3D preview windows. Zero value means \"unlimited\".").
|
||||
setRange(0, 10000);
|
||||
declareInt ("camera-fov", "Camera FOV", 90).setRange(10, 170);
|
||||
declareBool ("camera-ortho", "Orthographic projection for camera", false);
|
||||
declareInt ("camera-ortho-size", "Orthographic projection size parameter", 100).
|
||||
|
|
|
@ -5,14 +5,20 @@
|
|||
|
||||
#include <components/esm/loadbsgn.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::BirthsignCheckStage::BirthsignCheckStage (const CSMWorld::IdCollection<ESM::BirthSign>& birthsigns)
|
||||
: mBirthsigns (birthsigns)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::BirthsignCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mBirthsigns.getSize();
|
||||
}
|
||||
|
||||
|
@ -20,7 +26,8 @@ void CSMTools::BirthsignCheckStage::perform (int stage, CSMDoc::Messages& messag
|
|||
{
|
||||
const CSMWorld::Record<ESM::BirthSign>& record = mBirthsigns.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::BirthSign& birthsign = record.get();
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace CSMTools
|
|||
class BirthsignCheckStage : public CSMDoc::Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::BirthSign>& mBirthsigns;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "bodypartcheck.hpp"
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
CSMTools::BodyPartCheckStage::BodyPartCheckStage(
|
||||
const CSMWorld::IdCollection<ESM::BodyPart> &bodyParts,
|
||||
const CSMWorld::Resources &meshes,
|
||||
|
@ -7,10 +9,14 @@ CSMTools::BodyPartCheckStage::BodyPartCheckStage(
|
|||
mBodyParts(bodyParts),
|
||||
mMeshes(meshes),
|
||||
mRaces(races)
|
||||
{ }
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::BodyPartCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mBodyParts.getSize();
|
||||
}
|
||||
|
||||
|
@ -18,7 +24,8 @@ void CSMTools::BodyPartCheckStage::perform (int stage, CSMDoc::Messages &message
|
|||
{
|
||||
const CSMWorld::Record<ESM::BodyPart> &record = mBodyParts.getRecord(stage);
|
||||
|
||||
if ( record.isDeleted() )
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::BodyPart &bodyPart = record.get();
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace CSMTools
|
|||
const CSMWorld::IdCollection<ESM::BodyPart> &mBodyParts;
|
||||
const CSMWorld::Resources &mMeshes;
|
||||
const CSMWorld::IdCollection<ESM::Race> &mRaces;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
BodyPartCheckStage(
|
||||
|
|
|
@ -6,14 +6,20 @@
|
|||
#include <components/esm/loadclas.hpp>
|
||||
#include <components/esm/loadskil.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::ClassCheckStage::ClassCheckStage (const CSMWorld::IdCollection<ESM::Class>& classes)
|
||||
: mClasses (classes)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::ClassCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mClasses.getSize();
|
||||
}
|
||||
|
||||
|
@ -21,7 +27,8 @@ void CSMTools::ClassCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
{
|
||||
const CSMWorld::Record<ESM::Class>& record = mClasses.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Class& class_ = record.get();
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace CSMTools
|
|||
class ClassCheckStage : public CSMDoc::Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Class>& mClasses;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -6,14 +6,20 @@
|
|||
#include <components/esm/loadfact.hpp>
|
||||
#include <components/esm/loadskil.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::FactionCheckStage::FactionCheckStage (const CSMWorld::IdCollection<ESM::Faction>& factions)
|
||||
: mFactions (factions)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::FactionCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mFactions.getSize();
|
||||
}
|
||||
|
||||
|
@ -21,7 +27,8 @@ void CSMTools::FactionCheckStage::perform (int stage, CSMDoc::Messages& messages
|
|||
{
|
||||
const CSMWorld::Record<ESM::Faction>& record = mFactions.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Faction& faction = record.get();
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace CSMTools
|
|||
class FactionCheckStage : public CSMDoc::Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Faction>& mFactions;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -2,14 +2,20 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/defaultgmsts.hpp"
|
||||
|
||||
CSMTools::GmstCheckStage::GmstCheckStage(const CSMWorld::IdCollection<ESM::GameSetting>& gameSettings)
|
||||
: mGameSettings(gameSettings)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::GmstCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mGameSettings.getSize();
|
||||
}
|
||||
|
||||
|
@ -17,7 +23,8 @@ void CSMTools::GmstCheckStage::perform(int stage, CSMDoc::Messages& messages)
|
|||
{
|
||||
const CSMWorld::Record<ESM::GameSetting>& record = mGameSettings.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::GameSetting& gmst = record.get();
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace CSMTools
|
|||
private:
|
||||
|
||||
const CSMWorld::IdCollection<ESM::GameSetting>& mGameSettings;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
std::string varTypeToString(ESM::VarType);
|
||||
|
||||
|
|
|
@ -3,13 +3,19 @@
|
|||
#include <set>
|
||||
#include <sstream>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
CSMTools::JournalCheckStage::JournalCheckStage(const CSMWorld::IdCollection<ESM::Dialogue> &journals,
|
||||
const CSMWorld::InfoCollection& journalInfos)
|
||||
: mJournals(journals), mJournalInfos(journalInfos)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::JournalCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mJournals.getSize();
|
||||
}
|
||||
|
||||
|
@ -17,7 +23,8 @@ void CSMTools::JournalCheckStage::perform(int stage, CSMDoc::Messages& messages)
|
|||
{
|
||||
const CSMWorld::Record<ESM::Dialogue> &journalRecord = mJournals.getRecord(stage);
|
||||
|
||||
if (journalRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && journalRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || journalRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Dialogue &journal = journalRecord.get();
|
||||
|
@ -43,6 +50,10 @@ void CSMTools::JournalCheckStage::perform(int stage, CSMDoc::Messages& messages)
|
|||
statusNamedCount += 1;
|
||||
}
|
||||
|
||||
// Skip "Base" records (setting!)
|
||||
if (mIgnoreBaseRecords && infoRecord.mState == CSMWorld::RecordBase::State_BaseOnly)
|
||||
continue;
|
||||
|
||||
if (journalInfo.mResponse.empty())
|
||||
{
|
||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_JournalInfo, journalInfo.mId);
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace CSMTools
|
|||
|
||||
const CSMWorld::IdCollection<ESM::Dialogue>& mJournals;
|
||||
const CSMWorld::InfoCollection& mJournalInfos;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <components/misc/resourcehelpers.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/resources.hpp"
|
||||
#include "../world/data.hpp"
|
||||
|
||||
|
@ -77,16 +79,26 @@ CSMTools::MagicEffectCheckStage::MagicEffectCheckStage(const CSMWorld::IdCollect
|
|||
mReferenceables(referenceables),
|
||||
mIcons(icons),
|
||||
mTextures(textures)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::MagicEffectCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mMagicEffects.getSize();
|
||||
}
|
||||
|
||||
void CSMTools::MagicEffectCheckStage::perform(int stage, CSMDoc::Messages &messages)
|
||||
{
|
||||
ESM::MagicEffect effect = mMagicEffects.getRecord(stage).get();
|
||||
const CSMWorld::Record<ESM::MagicEffect> &record = mMagicEffects.getRecord(stage);
|
||||
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
ESM::MagicEffect effect = record.get();
|
||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_MagicEffect, effect.mId);
|
||||
|
||||
if (effect.mData.mBaseCost < 0.0f)
|
||||
|
|
|
@ -24,6 +24,7 @@ namespace CSMTools
|
|||
const CSMWorld::RefIdCollection &mReferenceables;
|
||||
const CSMWorld::Resources &mIcons;
|
||||
const CSMWorld::Resources &mTextures;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
private:
|
||||
bool isTextureExists(const std::string &texture, bool isIcon) const;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include <sstream>
|
||||
#include <algorithm>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
#include "../world/idcollection.hpp"
|
||||
#include "../world/subcellcollection.hpp"
|
||||
|
@ -10,10 +12,14 @@
|
|||
|
||||
CSMTools::PathgridCheckStage::PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids)
|
||||
: mPathgrids (pathgrids)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::PathgridCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mPathgrids.getSize();
|
||||
}
|
||||
|
||||
|
@ -21,7 +27,8 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
|
|||
{
|
||||
const CSMWorld::Record<CSMWorld::Pathgrid>& record = mPathgrids.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const CSMWorld::Pathgrid& pathgrid = record.get();
|
||||
|
|
|
@ -25,6 +25,7 @@ namespace CSMTools
|
|||
{
|
||||
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid,
|
||||
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& mPathgrids;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
#include <components/esm/loadrace.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
void CSMTools::RaceCheckStage::performPerRecord (int stage, CSMDoc::Messages& messages)
|
||||
|
@ -15,6 +17,14 @@ void CSMTools::RaceCheckStage::performPerRecord (int stage, CSMDoc::Messages& me
|
|||
|
||||
const ESM::Race& race = record.get();
|
||||
|
||||
// Consider mPlayable flag even when "Base" records are ignored
|
||||
if (race.mData.mFlags & 0x1)
|
||||
mPlayable = true;
|
||||
|
||||
// Skip "Base" records (setting!)
|
||||
if (mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly)
|
||||
return;
|
||||
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Race, race.mId);
|
||||
|
||||
// test for empty name and description
|
||||
|
@ -38,10 +48,6 @@ void CSMTools::RaceCheckStage::performPerRecord (int stage, CSMDoc::Messages& me
|
|||
if (race.mData.mWeight.mFemale<0)
|
||||
messages.push_back (std::make_pair (id, "female " + race.mId + " has negative weight"));
|
||||
|
||||
// remember playable flag
|
||||
if (race.mData.mFlags & 0x1)
|
||||
mPlayable = true;
|
||||
|
||||
/// \todo check data members that can't be edited in the table view
|
||||
}
|
||||
|
||||
|
@ -55,11 +61,15 @@ void CSMTools::RaceCheckStage::performFinal (CSMDoc::Messages& messages)
|
|||
|
||||
CSMTools::RaceCheckStage::RaceCheckStage (const CSMWorld::IdCollection<ESM::Race>& races)
|
||||
: mRaces (races), mPlayable (false)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::RaceCheckStage::setup()
|
||||
{
|
||||
mPlayable = false;
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mRaces.getSize()+1;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace CSMTools
|
|||
{
|
||||
const CSMWorld::IdCollection<ESM::Race>& mRaces;
|
||||
bool mPlayable;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
void performPerRecord (int stage, CSMDoc::Messages& messages);
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/record.hpp"
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
|
@ -18,6 +20,7 @@ CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(
|
|||
mScripts(scripts),
|
||||
mPlayerPresent(false)
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
void CSMTools::ReferenceableCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
||||
|
@ -228,6 +231,8 @@ void CSMTools::ReferenceableCheckStage::perform (int stage, CSMDoc::Messages& me
|
|||
int CSMTools::ReferenceableCheckStage::setup()
|
||||
{
|
||||
mPlayerPresent = false;
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mReferencables.getSize() + 1;
|
||||
}
|
||||
|
||||
|
@ -238,7 +243,8 @@ void CSMTools::ReferenceableCheckStage::bookCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Book& book = (dynamic_cast<const CSMWorld::Record<ESM::Book>& >(baseRecord)).get();
|
||||
|
@ -257,7 +263,8 @@ void CSMTools::ReferenceableCheckStage::activatorCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Activator& activator = (dynamic_cast<const CSMWorld::Record<ESM::Activator>& >(baseRecord)).get();
|
||||
|
@ -278,7 +285,8 @@ void CSMTools::ReferenceableCheckStage::potionCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Potion& potion = (dynamic_cast<const CSMWorld::Record<ESM::Potion>& >(baseRecord)).get();
|
||||
|
@ -299,7 +307,8 @@ void CSMTools::ReferenceableCheckStage::apparatusCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Apparatus& apparatus = (dynamic_cast<const CSMWorld::Record<ESM::Apparatus>& >(baseRecord)).get();
|
||||
|
@ -320,7 +329,8 @@ void CSMTools::ReferenceableCheckStage::armorCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Armor& armor = (dynamic_cast<const CSMWorld::Record<ESM::Armor>& >(baseRecord)).get();
|
||||
|
@ -347,7 +357,8 @@ void CSMTools::ReferenceableCheckStage::clothingCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Clothing& clothing = (dynamic_cast<const CSMWorld::Record<ESM::Clothing>& >(baseRecord)).get();
|
||||
|
@ -365,7 +376,8 @@ void CSMTools::ReferenceableCheckStage::containerCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Container& container = (dynamic_cast<const CSMWorld::Record<ESM::Container>& >(baseRecord)).get();
|
||||
|
@ -397,7 +409,8 @@ void CSMTools::ReferenceableCheckStage::creatureCheck (
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Creature& creature = (dynamic_cast<const CSMWorld::Record<ESM::Creature>&>(baseRecord)).get();
|
||||
|
@ -473,7 +486,8 @@ void CSMTools::ReferenceableCheckStage::doorCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Door& door = (dynamic_cast<const CSMWorld::Record<ESM::Door>&>(baseRecord)).get();
|
||||
|
@ -497,7 +511,8 @@ void CSMTools::ReferenceableCheckStage::ingredientCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Ingredient& ingredient = (dynamic_cast<const CSMWorld::Record<ESM::Ingredient>& >(baseRecord)).get();
|
||||
|
@ -516,10 +531,9 @@ void CSMTools::ReferenceableCheckStage::creaturesLevListCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
{
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
}
|
||||
|
||||
const ESM::CreatureLevList& CreatureLevList = (dynamic_cast<const CSMWorld::Record<ESM::CreatureLevList>& >(baseRecord)).get();
|
||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_CreatureLevelledList, CreatureLevList.mId); //CreatureLevList but Type_CreatureLevelledList :/
|
||||
|
@ -534,10 +548,9 @@ void CSMTools::ReferenceableCheckStage::itemLevelledListCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
{
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
}
|
||||
|
||||
const ESM::ItemLevList& ItemLevList = (dynamic_cast<const CSMWorld::Record<ESM::ItemLevList>& >(baseRecord)).get();
|
||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_ItemLevelledList, ItemLevList.mId);
|
||||
|
@ -551,7 +564,8 @@ void CSMTools::ReferenceableCheckStage::lightCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Light& light = (dynamic_cast<const CSMWorld::Record<ESM::Light>& >(baseRecord)).get();
|
||||
|
@ -574,7 +588,8 @@ void CSMTools::ReferenceableCheckStage::lockpickCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Lockpick& lockpick = (dynamic_cast<const CSMWorld::Record<ESM::Lockpick>& >(baseRecord)).get();
|
||||
|
@ -595,7 +610,8 @@ void CSMTools::ReferenceableCheckStage::miscCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Miscellaneous& miscellaneous = (dynamic_cast<const CSMWorld::Record<ESM::Miscellaneous>& >(baseRecord)).get();
|
||||
|
@ -619,6 +635,14 @@ void CSMTools::ReferenceableCheckStage::npcCheck (
|
|||
const ESM::NPC& npc = (dynamic_cast<const CSMWorld::Record<ESM::NPC>& >(baseRecord)).get();
|
||||
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Npc, npc.mId);
|
||||
|
||||
//Detect if player is present
|
||||
if (Misc::StringUtils::ciEqual(npc.mId, "player")) //Happy now, scrawl?
|
||||
mPlayerPresent = true;
|
||||
|
||||
// Skip "Base" records (setting!)
|
||||
if (mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly)
|
||||
return;
|
||||
|
||||
short level(npc.mNpdt.mLevel);
|
||||
char disposition(npc.mNpdt.mDisposition);
|
||||
char reputation(npc.mNpdt.mReputation);
|
||||
|
@ -626,10 +650,6 @@ void CSMTools::ReferenceableCheckStage::npcCheck (
|
|||
//Don't know what unknown is for
|
||||
int gold(npc.mNpdt.mGold);
|
||||
|
||||
//Detect if player is present
|
||||
if (Misc::StringUtils::ciEqual(npc.mId, "player")) //Happy now, scrawl?
|
||||
mPlayerPresent = true;
|
||||
|
||||
if (npc.mNpdtType == ESM::NPC::NPC_WITH_AUTOCALCULATED_STATS) //12 = autocalculated
|
||||
{
|
||||
if ((npc.mFlags & ESM::NPC::Autocalc) == 0) //0x0010 = autocalculated flag
|
||||
|
@ -728,7 +748,8 @@ void CSMTools::ReferenceableCheckStage::weaponCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord (stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Weapon& weapon = (dynamic_cast<const CSMWorld::Record<ESM::Weapon>& >(baseRecord)).get();
|
||||
|
@ -808,7 +829,8 @@ void CSMTools::ReferenceableCheckStage::probeCheck(
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord(stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Probe& probe = (dynamic_cast<const CSMWorld::Record<ESM::Probe>& >(baseRecord)).get();
|
||||
|
@ -827,7 +849,8 @@ void CSMTools::ReferenceableCheckStage::repairCheck (
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord (stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Repair& repair = (dynamic_cast<const CSMWorld::Record<ESM::Repair>& >(baseRecord)).get();
|
||||
|
@ -846,7 +869,8 @@ void CSMTools::ReferenceableCheckStage::staticCheck (
|
|||
{
|
||||
const CSMWorld::RecordBase& baseRecord = records.getRecord (stage);
|
||||
|
||||
if (baseRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && baseRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || baseRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Static& staticElement = (dynamic_cast<const CSMWorld::Record<ESM::Static>& >(baseRecord)).get();
|
||||
|
|
|
@ -82,6 +82,7 @@ namespace CSMTools
|
|||
const CSMWorld::IdCollection<ESM::Faction>& mFactions;
|
||||
const CSMWorld::IdCollection<ESM::Script>& mScripts;
|
||||
bool mPlayerPresent;
|
||||
bool mIgnoreBaseRecords;
|
||||
};
|
||||
}
|
||||
#endif // REFERENCEABLECHECKSTAGE_H
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "referencecheck.hpp"
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
CSMTools::ReferenceCheckStage::ReferenceCheckStage(
|
||||
const CSMWorld::RefCollection& references,
|
||||
const CSMWorld::RefIdCollection& referencables,
|
||||
|
@ -12,13 +14,15 @@ CSMTools::ReferenceCheckStage::ReferenceCheckStage(
|
|||
mCells(cells),
|
||||
mFactions(factions)
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &messages)
|
||||
{
|
||||
const CSMWorld::Record<CSMWorld::CellRef>& record = mReferences.getRecord(stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const CSMWorld::CellRef& cellRef = record.get();
|
||||
|
@ -100,5 +104,7 @@ void CSMTools::ReferenceCheckStage::perform(int stage, CSMDoc::Messages &message
|
|||
|
||||
int CSMTools::ReferenceCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mReferences.getSize();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace CSMTools
|
|||
const CSMWorld::RefIdData& mDataSet;
|
||||
const CSMWorld::IdCollection<CSMWorld::Cell>& mCells;
|
||||
const CSMWorld::IdCollection<ESM::Faction>& mFactions;
|
||||
bool mIgnoreBaseRecords;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,20 @@
|
|||
|
||||
#include <components/esm/loadregn.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::RegionCheckStage::RegionCheckStage (const CSMWorld::IdCollection<ESM::Region>& regions)
|
||||
: mRegions (regions)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::RegionCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mRegions.getSize();
|
||||
}
|
||||
|
||||
|
@ -20,7 +26,8 @@ void CSMTools::RegionCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
{
|
||||
const CSMWorld::Record<ESM::Region>& record = mRegions.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Region& region = record.get();
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace CSMTools
|
|||
class RegionCheckStage : public CSMDoc::Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Region>& mRegions;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -60,6 +60,8 @@ CSMTools::ScriptCheckStage::ScriptCheckStage (const CSMDoc::Document& document)
|
|||
|
||||
Compiler::registerExtensions (mExtensions);
|
||||
mContext.setExtensions (&mExtensions);
|
||||
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::ScriptCheckStage::setup()
|
||||
|
@ -78,17 +80,25 @@ int CSMTools::ScriptCheckStage::setup()
|
|||
mId.clear();
|
||||
Compiler::ErrorHandler::reset();
|
||||
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mDocument.getData().getScripts().getSize();
|
||||
}
|
||||
|
||||
void CSMTools::ScriptCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
||||
{
|
||||
const CSMWorld::Record<ESM::Script> &record = mDocument.getData().getScripts().getRecord(stage);
|
||||
|
||||
mId = mDocument.getData().getScripts().getId (stage);
|
||||
|
||||
if (mDocument.isBlacklisted (
|
||||
CSMWorld::UniversalId (CSMWorld::UniversalId::Type_Script, mId)))
|
||||
return;
|
||||
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
mMessages = &messages;
|
||||
|
||||
switch (mWarningMode)
|
||||
|
@ -100,10 +110,8 @@ void CSMTools::ScriptCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
|
||||
try
|
||||
{
|
||||
const CSMWorld::Data& data = mDocument.getData();
|
||||
|
||||
mFile = data.getScripts().getRecord (stage).get().mId;
|
||||
std::istringstream input (data.getScripts().getRecord (stage).get().mScriptText);
|
||||
mFile = record.get().mId;
|
||||
std::istringstream input (record.get().mScriptText);
|
||||
|
||||
Compiler::Scanner scanner (*this, input, mContext.getExtensions());
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace CSMTools
|
|||
std::string mFile;
|
||||
CSMDoc::Messages *mMessages;
|
||||
WarningMode mWarningMode;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
CSMDoc::Message::Severity getSeverity (Type type);
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ void CSMTools::Search::searchTextCell (const CSMWorld::IdTableBase *model,
|
|||
|
||||
int pos = 0;
|
||||
|
||||
while ((pos = text.indexOf (search, pos, Qt::CaseInsensitive))!=-1)
|
||||
Qt::CaseSensitivity caseSensitivity = mCase ? Qt::CaseSensitive : Qt::CaseInsensitive;
|
||||
while ((pos = text.indexOf (search, pos, caseSensitivity))!=-1)
|
||||
{
|
||||
std::ostringstream hint;
|
||||
hint
|
||||
|
@ -120,25 +121,26 @@ QString CSMTools::Search::flatten (const QString& text) const
|
|||
return flat;
|
||||
}
|
||||
|
||||
CSMTools::Search::Search() : mType (Type_None), mValue (0), mIdColumn (0), mTypeColumn (0),
|
||||
CSMTools::Search::Search() : mType (Type_None), mValue (0), mCase (false), mIdColumn (0), mTypeColumn (0),
|
||||
mPaddingBefore (10), mPaddingAfter (10) {}
|
||||
|
||||
CSMTools::Search::Search (Type type, const std::string& value)
|
||||
: mType (type), mText (value), mValue (0), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10)
|
||||
CSMTools::Search::Search (Type type, bool caseSensitive, const std::string& value)
|
||||
: mType (type), mText (value), mValue (0), mCase (caseSensitive), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10)
|
||||
{
|
||||
if (type!=Type_Text && type!=Type_Id)
|
||||
throw std::logic_error ("Invalid search parameter (string)");
|
||||
}
|
||||
|
||||
CSMTools::Search::Search (Type type, const QRegExp& value)
|
||||
: mType (type), mRegExp (value), mValue (0), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10)
|
||||
CSMTools::Search::Search (Type type, bool caseSensitive, const QRegExp& value)
|
||||
: mType (type), mRegExp (value), mValue (0), mCase (caseSensitive), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10)
|
||||
{
|
||||
mRegExp.setCaseSensitivity(mCase ? Qt::CaseSensitive : Qt::CaseInsensitive);
|
||||
if (type!=Type_TextRegEx && type!=Type_IdRegEx)
|
||||
throw std::logic_error ("Invalid search parameter (RegExp)");
|
||||
}
|
||||
|
||||
CSMTools::Search::Search (Type type, int value)
|
||||
: mType (type), mValue (value), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10)
|
||||
CSMTools::Search::Search (Type type, bool caseSensitive, int value)
|
||||
: mType (type), mValue (value), mCase (caseSensitive), mIdColumn (0), mTypeColumn (0), mPaddingBefore (10), mPaddingAfter (10)
|
||||
{
|
||||
if (type!=Type_RecordState)
|
||||
throw std::logic_error ("invalid search parameter (int)");
|
||||
|
|
|
@ -43,6 +43,7 @@ namespace CSMTools
|
|||
std::string mText;
|
||||
QRegExp mRegExp;
|
||||
int mValue;
|
||||
bool mCase;
|
||||
std::set<int> mColumns;
|
||||
int mIdColumn;
|
||||
int mTypeColumn;
|
||||
|
@ -67,11 +68,11 @@ namespace CSMTools
|
|||
|
||||
Search();
|
||||
|
||||
Search (Type type, const std::string& value);
|
||||
Search (Type type, bool caseSensitive, const std::string& value);
|
||||
|
||||
Search (Type type, const QRegExp& value);
|
||||
Search (Type type, bool caseSensitive, const QRegExp& value);
|
||||
|
||||
Search (Type type, int value);
|
||||
Search (Type type, bool caseSensitive, int value);
|
||||
|
||||
// Configure search for the specified model.
|
||||
void configure (const CSMWorld::IdTableBase *model);
|
||||
|
|
|
@ -4,14 +4,20 @@
|
|||
|
||||
#include <components/esm/loadskil.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::SkillCheckStage::SkillCheckStage (const CSMWorld::IdCollection<ESM::Skill>& skills)
|
||||
: mSkills (skills)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::SkillCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mSkills.getSize();
|
||||
}
|
||||
|
||||
|
@ -19,7 +25,8 @@ void CSMTools::SkillCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
{
|
||||
const CSMWorld::Record<ESM::Skill>& record = mSkills.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Skill& skill = record.get();
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace CSMTools
|
|||
class SkillCheckStage : public CSMDoc::Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Skill>& mSkills;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -4,14 +4,20 @@
|
|||
|
||||
#include <components/esm/loadskil.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::SoundCheckStage::SoundCheckStage (const CSMWorld::IdCollection<ESM::Sound>& sounds)
|
||||
: mSounds (sounds)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::SoundCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mSounds.getSize();
|
||||
}
|
||||
|
||||
|
@ -19,7 +25,8 @@ void CSMTools::SoundCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
{
|
||||
const CSMWorld::Record<ESM::Sound>& record = mSounds.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Sound& sound = record.get();
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace CSMTools
|
|||
class SoundCheckStage : public CSMDoc::Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Sound>& mSounds;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/refiddata.hpp"
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
|
@ -11,20 +13,24 @@ CSMTools::SoundGenCheckStage::SoundGenCheckStage(const CSMWorld::IdCollection<ES
|
|||
: mSoundGens(soundGens),
|
||||
mSounds(sounds),
|
||||
mReferenceables(referenceables)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::SoundGenCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mSoundGens.getSize();
|
||||
}
|
||||
|
||||
void CSMTools::SoundGenCheckStage::perform(int stage, CSMDoc::Messages &messages)
|
||||
{
|
||||
const CSMWorld::Record<ESM::SoundGenerator> &record = mSoundGens.getRecord(stage);
|
||||
if (record.isDeleted())
|
||||
{
|
||||
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
}
|
||||
|
||||
const ESM::SoundGenerator& soundGen = record.get();
|
||||
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_SoundGen, soundGen.mId);
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace CSMTools
|
|||
const CSMWorld::IdCollection<ESM::SoundGenerator> &mSoundGens;
|
||||
const CSMWorld::IdCollection<ESM::Sound> &mSounds;
|
||||
const CSMWorld::RefIdCollection &mReferenceables;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
SoundGenCheckStage(const CSMWorld::IdCollection<ESM::SoundGenerator> &soundGens,
|
||||
|
|
|
@ -5,14 +5,20 @@
|
|||
|
||||
#include <components/esm/loadspel.hpp>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/universalid.hpp"
|
||||
|
||||
CSMTools::SpellCheckStage::SpellCheckStage (const CSMWorld::IdCollection<ESM::Spell>& spells)
|
||||
: mSpells (spells)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::SpellCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mSpells.getSize();
|
||||
}
|
||||
|
||||
|
@ -20,7 +26,8 @@ void CSMTools::SpellCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|||
{
|
||||
const CSMWorld::Record<ESM::Spell>& record = mSpells.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
const ESM::Spell& spell = record.get();
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace CSMTools
|
|||
class SpellCheckStage : public CSMDoc::Stage
|
||||
{
|
||||
const CSMWorld::IdCollection<ESM::Spell>& mSpells;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
#include "startscriptcheck.hpp"
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
CSMTools::StartScriptCheckStage::StartScriptCheckStage (
|
||||
const CSMWorld::IdCollection<ESM::StartScript>& startScripts,
|
||||
const CSMWorld::IdCollection<ESM::Script>& scripts)
|
||||
: mStartScripts (startScripts), mScripts (scripts)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
void CSMTools::StartScriptCheckStage::perform(int stage, CSMDoc::Messages& messages)
|
||||
{
|
||||
const CSMWorld::Record<ESM::StartScript>& record = mStartScripts.getRecord (stage);
|
||||
|
||||
if (record.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
|
||||
return;
|
||||
|
||||
std::string scriptId = record.get().mId;
|
||||
|
@ -26,5 +31,7 @@ void CSMTools::StartScriptCheckStage::perform(int stage, CSMDoc::Messages& messa
|
|||
|
||||
int CSMTools::StartScriptCheckStage::setup()
|
||||
{
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mStartScripts.getSize();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace CSMTools
|
|||
{
|
||||
const CSMWorld::IdCollection<ESM::StartScript>& mStartScripts;
|
||||
const CSMWorld::IdCollection<ESM::Script>& mScripts;
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
#include "../prefs/state.hpp"
|
||||
|
||||
#include "../world/infoselectwrapper.hpp"
|
||||
|
||||
CSMTools::TopicInfoCheckStage::TopicInfoCheckStage(
|
||||
|
@ -29,7 +31,9 @@ CSMTools::TopicInfoCheckStage::TopicInfoCheckStage(
|
|||
mTopics(topics),
|
||||
mReferencables(referencables),
|
||||
mSoundFiles(soundFiles)
|
||||
{}
|
||||
{
|
||||
mIgnoreBaseRecords = false;
|
||||
}
|
||||
|
||||
int CSMTools::TopicInfoCheckStage::setup()
|
||||
{
|
||||
|
@ -67,6 +71,8 @@ int CSMTools::TopicInfoCheckStage::setup()
|
|||
}
|
||||
}
|
||||
|
||||
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
||||
|
||||
return mTopicInfos.getSize();
|
||||
}
|
||||
|
||||
|
@ -74,7 +80,8 @@ void CSMTools::TopicInfoCheckStage::perform(int stage, CSMDoc::Messages& message
|
|||
{
|
||||
const CSMWorld::Record<CSMWorld::Info>& infoRecord = mTopicInfos.getRecord(stage);
|
||||
|
||||
if (infoRecord.isDeleted())
|
||||
// Skip "Base" records (setting!) and "Deleted" records
|
||||
if ((mIgnoreBaseRecords && infoRecord.mState == CSMWorld::RecordBase::State_BaseOnly) || infoRecord.isDeleted())
|
||||
return;
|
||||
|
||||
const CSMWorld::Info& topicInfo = infoRecord.get();
|
||||
|
|
|
@ -65,6 +65,8 @@ namespace CSMTools
|
|||
|
||||
std::set<std::string> mCellNames;
|
||||
|
||||
bool mIgnoreBaseRecords;
|
||||
|
||||
// These return false when not successful and write an error
|
||||
bool verifyActor(const std::string& name, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
|
||||
bool verifyCell(const std::string& name, const CSMWorld::UniversalId& id, CSMDoc::Messages& messages);
|
||||
|
|
|
@ -88,6 +88,7 @@ namespace CSMWorld
|
|||
Display_UnsignedInteger8,
|
||||
Display_Integer,
|
||||
Display_Float,
|
||||
Display_Double,
|
||||
Display_Var,
|
||||
Display_GmstVarType,
|
||||
Display_GlobalVarType,
|
||||
|
|
|
@ -136,7 +136,7 @@ namespace CSMWorld
|
|||
struct VarTypeColumn : public Column<ESXRecordT>
|
||||
{
|
||||
VarTypeColumn (ColumnBase::Display display)
|
||||
: Column<ESXRecordT> (Columns::ColumnId_ValueType, display)
|
||||
: Column<ESXRecordT> (Columns::ColumnId_ValueType, display, ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh)
|
||||
{}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
|
@ -161,7 +161,7 @@ namespace CSMWorld
|
|||
template<typename ESXRecordT>
|
||||
struct VarValueColumn : public Column<ESXRecordT>
|
||||
{
|
||||
VarValueColumn() : Column<ESXRecordT> (Columns::ColumnId_Value, ColumnBase::Display_Var) {}
|
||||
VarValueColumn() : Column<ESXRecordT> (Columns::ColumnId_Value, ColumnBase::Display_Var, ColumnBase::Flag_Table | ColumnBase::Flag_Dialogue | ColumnBase::Flag_Dialogue_Refresh) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
|
@ -1371,7 +1371,7 @@ namespace CSMWorld
|
|||
RotColumn (ESM::Position ESXRecordT::* position, int index, bool door)
|
||||
: Column<ESXRecordT> (
|
||||
(door ? Columns::ColumnId_DoorPositionXRot : Columns::ColumnId_PositionXRot)+index,
|
||||
ColumnBase::Display_Float), mPosition (position), mIndex (index) {}
|
||||
ColumnBase::Display_Double), mPosition (position), mIndex (index) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const
|
||||
{
|
||||
|
|
|
@ -84,15 +84,28 @@ bool CSMWorld::IdTable::setData (const QModelIndex &index, const QVariant &value
|
|||
if (mIdCollection->getColumn (index.column()).isEditable() && role==Qt::EditRole)
|
||||
{
|
||||
mIdCollection->setData (index.row(), index.column(), value);
|
||||
emit dataChanged(index, index);
|
||||
|
||||
// Modifying a value can also change the Modified status of a record.
|
||||
int stateColumn = searchColumnIndex(Columns::ColumnId_Modification);
|
||||
if (stateColumn != -1)
|
||||
{
|
||||
QModelIndex stateIndex = this->index(index.row(), stateColumn);
|
||||
emit dataChanged(stateIndex, stateIndex);
|
||||
}
|
||||
if (index.column() == stateColumn)
|
||||
{
|
||||
// modifying the state column can modify other values. we need to tell
|
||||
// views that the whole row has changed.
|
||||
|
||||
emit dataChanged(this->index(index.row(), 0),
|
||||
this->index(index.row(), columnCount(index.parent())));
|
||||
|
||||
} else
|
||||
{
|
||||
emit dataChanged(index, index);
|
||||
|
||||
// Modifying a value can also change the Modified status of a record.
|
||||
QModelIndex stateIndex = this->index(index.row(), stateColumn);
|
||||
emit dataChanged(stateIndex, stateIndex);
|
||||
}
|
||||
} else
|
||||
emit dataChanged(index, index);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -184,11 +184,11 @@ CSMWorld::RefIdCollection::RefIdCollection()
|
|||
mColumns.back().addColumn(
|
||||
new RefIdColumn (Columns::ColumnId_PosZ, CSMWorld::ColumnBase::Display_Float));
|
||||
mColumns.back().addColumn(
|
||||
new RefIdColumn (Columns::ColumnId_RotX, CSMWorld::ColumnBase::Display_Float));
|
||||
new RefIdColumn (Columns::ColumnId_RotX, CSMWorld::ColumnBase::Display_Double));
|
||||
mColumns.back().addColumn(
|
||||
new RefIdColumn (Columns::ColumnId_RotY, CSMWorld::ColumnBase::Display_Float));
|
||||
new RefIdColumn (Columns::ColumnId_RotY, CSMWorld::ColumnBase::Display_Double));
|
||||
mColumns.back().addColumn(
|
||||
new RefIdColumn (Columns::ColumnId_RotZ, CSMWorld::ColumnBase::Display_Float));
|
||||
new RefIdColumn (Columns::ColumnId_RotZ, CSMWorld::ColumnBase::Display_Double));
|
||||
|
||||
// Nested table
|
||||
mColumns.push_back(RefIdColumn (Columns::ColumnId_AiPackageList,
|
||||
|
|
|
@ -101,15 +101,39 @@ void CSVDoc::View::setupFileMenu()
|
|||
file->addAction(exit);
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void updateUndoRedoAction(QAction *action, const std::string &settingsKey)
|
||||
{
|
||||
QKeySequence seq;
|
||||
CSMPrefs::State::get().getShortcutManager().getSequence(settingsKey, seq);
|
||||
action->setShortcut(seq);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CSVDoc::View::undoActionChanged()
|
||||
{
|
||||
updateUndoRedoAction(mUndo, "document-edit-undo");
|
||||
}
|
||||
|
||||
void CSVDoc::View::redoActionChanged()
|
||||
{
|
||||
updateUndoRedoAction(mRedo, "document-edit-redo");
|
||||
}
|
||||
|
||||
void CSVDoc::View::setupEditMenu()
|
||||
{
|
||||
QMenu *edit = menuBar()->addMenu (tr ("Edit"));
|
||||
|
||||
mUndo = mDocument->getUndoStack().createUndoAction (this, tr("Undo"));
|
||||
setupShortcut("document-edit-undo", mUndo);
|
||||
connect(mUndo, SIGNAL (changed ()), this, SLOT (undoActionChanged ()));
|
||||
edit->addAction (mUndo);
|
||||
|
||||
mRedo= mDocument->getUndoStack().createRedoAction (this, tr("Redo"));
|
||||
mRedo = mDocument->getUndoStack().createRedoAction (this, tr("Redo"));
|
||||
connect(mRedo, SIGNAL (changed ()), this, SLOT (redoActionChanged ()));
|
||||
setupShortcut("document-edit-redo", mRedo);
|
||||
edit->addAction (mRedo);
|
||||
|
||||
|
@ -622,6 +646,7 @@ void CSVDoc::View::addSubView (const CSMWorld::UniversalId& id, const std::strin
|
|||
}
|
||||
assert(view);
|
||||
view->setParent(this);
|
||||
view->setEditLock (mDocument->getState() & CSMDoc::State_Locked);
|
||||
mSubViews.append(view); // only after assert
|
||||
|
||||
int minWidth = windows["minimum-width"].toInt();
|
||||
|
|
|
@ -152,6 +152,10 @@ namespace CSVDoc
|
|||
|
||||
void settingChanged (const CSMPrefs::Setting *setting);
|
||||
|
||||
void undoActionChanged();
|
||||
|
||||
void redoActionChanged();
|
||||
|
||||
void newView();
|
||||
|
||||
void save();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue