mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-26 07:52:27 +00:00
Compare commits
2497 Commits
v1.1.1-rc3
...
profiler
| Author | SHA1 | Date | |
|---|---|---|---|
| b26d9c07f1 | |||
| 8e45fd2253 | |||
| 76cdedccb8 | |||
| d39e886459 | |||
| 7f65080c45 | |||
| c8acb7bd43 | |||
| 69d727cbe5 | |||
| 9daf572ea7 | |||
| f613d12c61 | |||
| 927e4f83ff | |||
| 82b9af3956 | |||
| 82933a80d1 | |||
| 543e265b0a | |||
| c4eb6e2881 | |||
| e6eb4e16d1 | |||
| 95b66583b3 | |||
| 45e7ff9193 | |||
| 48c65628d8 | |||
| 0521cae8d0 | |||
| 4629c7c8c4 | |||
| 8b925f549b | |||
| cb81d956f6 | |||
| 1149f04389 | |||
| 9aac1b0081 | |||
| 3392f4b1c3 | |||
| 20712ce0e6 | |||
| 9a15361e93 | |||
| 452b1a1eae | |||
| edbd055277 | |||
| 00eb526876 | |||
| 7bf054bd58 | |||
| 67ee327f5b | |||
| 63810d5c1b | |||
| d5047da637 | |||
| 9446d75444 | |||
| c9cd733d9a | |||
| 5a619bddaf | |||
| 5d64012d74 | |||
| 2bf2485b4c | |||
| b5d33c7cbe | |||
| 8acaa47b8f | |||
| bc6199a86f | |||
| 05df5c3e74 | |||
| ac1a3d0743 | |||
| 7fd3cc3483 | |||
| f26d303ee1 | |||
| b96e5a7f4d | |||
| 36d53f69d6 | |||
| ef5d475978 | |||
| dce6ccf4de | |||
| b169544711 | |||
| 1495eb42a3 | |||
| dd17597c92 | |||
| 54c3f9ab94 | |||
| ecd05d821e | |||
| 4bd2e04482 | |||
| cafd0eaba1 | |||
| facd7d357d | |||
| 8bc5e5eee1 | |||
| bfa6bd3458 | |||
| 33767aeb91 | |||
| ff8a19b1cb | |||
| 356316db84 | |||
| 379219aff1 | |||
| 5747b3460f | |||
| a677d40f6d | |||
| aed3d9ef85 | |||
| f2667cee23 | |||
| e1c49f93e2 | |||
| d2b9d4ab20 | |||
| 20c99e36d8 | |||
| 3ec39ce06b | |||
| 10e3c31ad6 | |||
| 4b08c75527 | |||
| 8aa8982b66 | |||
| 5daa29aa3f | |||
| 75c48e5800 | |||
| 6c982179bc | |||
| 02e56331ec | |||
| 774e429d87 | |||
| 3340d01902 | |||
| 180612bb21 | |||
| 8649ed1dcb | |||
| f9ba99e99f | |||
| 1d40f20da0 | |||
| cced57f56a | |||
| 614014a238 | |||
| 1ff2a043f4 | |||
| 115d0d14ac | |||
| 7df541ea1c | |||
| 73ac566c17 | |||
| cc4c6b6339 | |||
| b6a2ac05bf | |||
| b3ea1a9da7 | |||
| 5fcd3eb38e | |||
| e35205eaf4 | |||
| 081a61a948 | |||
| d75c632d73 | |||
| d9c47fcd41 | |||
| 387b445685 | |||
| 46ac254b3a | |||
| 5f64b1e1c8 | |||
| 5c729e65c9 | |||
| 4f4eee2b16 | |||
| ed9bdaf60c | |||
| 2c6eba93ae | |||
| 444b652c4f | |||
| b590eb2dc4 | |||
| 2acf84ce4a | |||
| 5be1bd2ffb | |||
| e135f46711 | |||
| b5d45effec | |||
| 96925f0dde | |||
| c06c69c420 | |||
| 17d276cd4e | |||
| 2763fe36a3 | |||
| 1e8916ee98 | |||
| fe6fa75385 | |||
| eb7d77bcac | |||
| a6b95aeceb | |||
| 0bdbc5f5c9 | |||
| 3c08af5ca1 | |||
| 7a3399e510 | |||
| 877d2cab4e | |||
| 39a47ceb93 | |||
| 8229a578ee | |||
| 0f1b504ed6 | |||
| 62197d7d33 | |||
| a18cb6f61e | |||
| 18fb507f24 | |||
| db948b3653 | |||
| e8553576f7 | |||
| 867b57bcf6 | |||
| ee57568c5d | |||
| d93f3bdd9e | |||
| ccbaf337f4 | |||
| b592d2e786 | |||
| 9a664476b0 | |||
| f388a605dd | |||
| 01c0a87cee | |||
| faaa98d3f0 | |||
| 769987ca33 | |||
| 8086eecfe2 | |||
| 8ec1cb949a | |||
| 5e1a886e8f | |||
| 0aba2d578a | |||
| dd980ab8ad | |||
| 30dbe34f78 | |||
| 5d465a4d49 | |||
| 0c934272c0 | |||
| 61e9160d47 | |||
| 7dbe6a7426 | |||
| 5f545df312 | |||
| 99164fe3f9 | |||
| 2211a63fe7 | |||
| 0f196cc995 | |||
| a12011ca1e | |||
| 7dcd12fb9d | |||
| d037bc9dcc | |||
| dd9f419735 | |||
| 62d1b0c2bd | |||
| 4832acde0b | |||
| f17fb2a8e1 | |||
| fab3a988ae | |||
| 6a43fd3b45 | |||
| 64c302b07a | |||
| 89f8006f11 | |||
| 5f3baf3649 | |||
| f67382c024 | |||
| e1e53b926f | |||
| 26a766335f | |||
| 03a27ca9ed | |||
| 6e295a1102 | |||
| a698eff106 | |||
| d63f137a9f | |||
| a5b77981b7 | |||
| 38aa7134ad | |||
| 9d9df6931e | |||
| d51271dc6d | |||
| 58b5f6b88f | |||
| 0c7a861caf | |||
| fc5266e115 | |||
| cad4ebc6f3 | |||
| 966acb25b3 | |||
| 60412276da | |||
| 22de30bab3 | |||
| 5266d7b25c | |||
| 4f19fe9f91 | |||
| 5e107a9936 | |||
| 6212045dcd | |||
| 1d462bfd0f | |||
| daa3b5d257 | |||
| 7b3d1c3252 | |||
| 60e17bbeaa | |||
| 06b8ce6017 | |||
| 968e936114 | |||
| 0af719e3a2 | |||
| 0ae5784c99 | |||
| 00ae27136c | |||
| e5f22f1f00 | |||
| 3b7ea7fe24 | |||
| f4a25b0331 | |||
| 00d3939ece | |||
| 5aadfc5577 | |||
| 003b56bc39 | |||
| 64192fa1d7 | |||
| 3428540d01 | |||
| 10ab806859 | |||
| 13af3e35e2 | |||
| 36e01cb9f1 | |||
| 9c92cbb780 | |||
| e7b4a38e69 | |||
| 5585b50601 | |||
| 8d30ca51ca | |||
| f39afc51c7 | |||
| 8ed1d5042a | |||
| 609cad72d9 | |||
| a31ad485e4 | |||
| 1b1c82a3e7 | |||
| ecf354e2c9 | |||
| 62d9de3074 | |||
| d3fb59b3e5 | |||
| 1a5b211d07 | |||
| cc1d7d54c2 | |||
| 7e980e1e7c | |||
| c16ad9e111 | |||
| 7e9d9b87b7 | |||
| 21c6688f0d | |||
| a3536ec7f7 | |||
| 04dadbf56e | |||
| 262ccf3d06 | |||
| 73c6a0bb1d | |||
| 8d30e4b8a6 | |||
| 854f7d6575 | |||
| 34bec5913b | |||
| 069572fe15 | |||
| 26018ec898 | |||
| 6300cbb6b8 | |||
| 91fe63537b | |||
| 7b6b3c8094 | |||
| dfeb6e62a4 | |||
| e24b67cbb4 | |||
| dbabd06ce5 | |||
| d0595e3794 | |||
| 04623b2c0c | |||
| e18a49a974 | |||
| 50ccb52465 | |||
| d7a2387f3d | |||
| 734a2c42b2 | |||
| b2dbc3923c | |||
| 5cb0fe0a6f | |||
| d5714cdcb0 | |||
| ce161c2583 | |||
| e1747c43b9 | |||
| 8ba8a1e6fa | |||
| 4e9cfa7c30 | |||
| 2d24b1f37e | |||
| c218419ecc | |||
| c88bf64bd5 | |||
| 377c071918 | |||
| d2011e58b4 | |||
| 384c041ea9 | |||
| d78b9ff2a1 | |||
| c28570f92e | |||
| 71f0d86767 | |||
| fcd4923938 | |||
| f18b9d79da | |||
| 2457f5f455 | |||
| acb78cec17 | |||
| 443e3bf8a7 | |||
| 66008f4475 | |||
| 010778f937 | |||
| 057f4ed1f4 | |||
| 669bca8da8 | |||
| a7710c027b | |||
| c822990213 | |||
| bfca9c0383 | |||
| 17af9e3808 | |||
| 06ff4823d3 | |||
| 143c0cf0f9 | |||
| 451983ffc9 | |||
| 269d56e1d0 | |||
| f702e953e7 | |||
| 03286f540a | |||
| 45ca5520fe | |||
| 7bfc3a48a8 | |||
| 65397cf03e | |||
| 908c7b1464 | |||
| ec121e5ec8 | |||
| 78a1926d72 | |||
| 82fb69eed4 | |||
| 570bd1bd00 | |||
| 7d70afd4c9 | |||
| 4f931c45fb | |||
| 90653a9d17 | |||
| d8926861b6 | |||
| 83e90ddc6d | |||
| 50b3c2e39f | |||
| 49409810df | |||
| ca3502758e | |||
| 26b91a0a97 | |||
| d25b750c2c | |||
| b93bbc64fd | |||
| b4ff915cbb | |||
| 376bba5156 | |||
| e1bfbfa30c | |||
| 9f25b52f9a | |||
| 46010fbfdf | |||
| b186b0538a | |||
| 43a9a4742c | |||
| ae5887b915 | |||
| 0cab51b68b | |||
| cb99f92287 | |||
| ab82fc1702 | |||
| 37b5442028 | |||
| 92737339b3 | |||
| 7ce5acf701 | |||
| 683a81a6c8 | |||
| c5447778a6 | |||
| 51b3ae9e0a | |||
| 1e59416f33 | |||
| 3d74035e24 | |||
| a59138d2d9 | |||
| ef0d383de9 | |||
| 47bb4c0b2b | |||
| 6cfe9e301b | |||
| d4460b94be | |||
| 1871c3f24f | |||
| 7101d84b27 | |||
| 38c94f6dda | |||
| c202b9e7b6 | |||
| 013216ff2b | |||
| a6a86f030c | |||
| 56b0a2aa4f | |||
| 07d2eab183 | |||
| 90dd9f8aeb | |||
| 32cba9083c | |||
| 26b65a05a9 | |||
| 0db638c8c0 | |||
| 456356d626 | |||
| 29fe791ad0 | |||
| 6c545a144c | |||
| 6e582fb68f | |||
| a19f7f702c | |||
| f44155a317 | |||
| 7fef8de50a | |||
| 440ca97a79 | |||
| 98f0d4df49 | |||
| ce3d4e678f | |||
| bd757417d5 | |||
| f7ca12f7cc | |||
| a71690b725 | |||
| ad711b0b5a | |||
| 1b91750902 | |||
| a84f480ffc | |||
| ee108b5b74 | |||
| 8ae2d86962 | |||
| f4847607fd | |||
| e4829225f6 | |||
| 9ae28d7619 | |||
| 01940ee5ed | |||
| ad5d1e4814 | |||
| a64c21eb96 | |||
| 7f2f6a8612 | |||
| 931134688a | |||
| e4797d04f0 | |||
| c730519e27 | |||
| 9bfe45ddbd | |||
| 0110755c47 | |||
| d5018029a4 | |||
| d191086d3e | |||
| 1bbbb28218 | |||
| cdde408602 | |||
| 8b096e65af | |||
| 42dffec4ae | |||
| e79c1c1a5a | |||
| b2ffcf1cf6 | |||
| aeff650649 | |||
| f09e1d037f | |||
| f5b1f678a1 | |||
| cc1735bc39 | |||
| 9faa2117d5 | |||
| e48234b2af | |||
| ff5e82c50f | |||
| 39626159a5 | |||
| 32437a21eb | |||
| 0bb013bafb | |||
| fc0e760b02 | |||
| ec2a8c4a1b | |||
| 29774d9765 | |||
| 3fbac46ee6 | |||
| 5ec3d58e32 | |||
| c5dbbd1f07 | |||
| 8ede80b69d | |||
| d3fdacf548 | |||
| e626bb527f | |||
| 40d23ab35a | |||
| f4c8eb6d88 | |||
| 5a8e45faab | |||
| b14c3c8674 | |||
| 2b091206bd | |||
| c9fd7e45e8 | |||
| 0092d0c894 | |||
| b77a586d14 | |||
| 1530bd7937 | |||
| 54868922ef | |||
| 00db3d270c | |||
| 4efa8a18eb | |||
| b800dd04c6 | |||
| 1c6a0f054a | |||
| c86fc62132 | |||
| 5fa42ce90f | |||
| 48caf1e413 | |||
| 3156efae63 | |||
| 3473e11376 | |||
| 78746a40fa | |||
| 9cbe0d4b34 | |||
| 032de7f6ce | |||
| de531af354 | |||
| c892bc4e2b | |||
| 835c7d0fce | |||
| 11357f7e91 | |||
| 7b7ddb25fa | |||
| a1895b9cb3 | |||
| a269aa4409 | |||
| 8186d43cad | |||
| 8d7de051c5 | |||
| c9ece3480c | |||
| a3dc49c504 | |||
| b4a6184c88 | |||
| 78bbb9b03d | |||
| f4fad223d0 | |||
| e127b01640 | |||
| 2c36b9070e | |||
| 8e64a8b1c5 | |||
| dbeef12a4f | |||
| cb18d3d1b5 | |||
| 8f96f52c04 | |||
| 245db04c4c | |||
| 56dfc97517 | |||
| d3f265116e | |||
| 5aba5c8473 | |||
| 4c3058b0d9 | |||
| 94e63885fb | |||
| edbed7184f | |||
| 77a2737ad0 | |||
| 8160768fcc | |||
| 992f99303e | |||
| 63682510a8 | |||
| 9574e91669 | |||
| c3233c02db | |||
| d46ede8db1 | |||
| 9f9253220c | |||
| ffed0514d2 | |||
| 28506839c0 | |||
| 04754c67a7 | |||
| 590fa78539 | |||
| efaff32153 | |||
| 396621e32e | |||
| abab487d7e | |||
| 539f216ca6 | |||
| ca21aa70cf | |||
| 8697b9a630 | |||
| a2514c9d64 | |||
| e2bc4ec647 | |||
| c765003ef2 | |||
| 00cfd77c26 | |||
| 5f34f7e1a2 | |||
| 9dd35679e5 | |||
| f1fd957e90 | |||
| 22feb20def | |||
| 04ed14f424 | |||
| 9d89ad53de | |||
| f15221784c | |||
| 3a3cc8a8f6 | |||
| 6dcbccc0b6 | |||
| 0313ab2ac2 | |||
| be4f8196c6 | |||
| 7f76ee04b0 | |||
| bdc3834f5a | |||
| 487c53794c | |||
| f0197219ab | |||
| 38723fc4bf | |||
| 0e229895ec | |||
| 71fee1ddb6 | |||
| 6decdb6788 | |||
| cb78ee6ccd | |||
| 7a90d52e62 | |||
| 611e6e7d4e | |||
| c82ada6dc4 | |||
| ef312b7b48 | |||
| fb03e8c67d | |||
| 60d7b59ac8 | |||
| 8ecbf7c4dc | |||
| e271049fad | |||
| d566bb4728 | |||
| 9ed412e056 | |||
| 5dfb66bd63 | |||
| dc44c1c361 | |||
| 2ccfc5b52d | |||
| 33a840a0e7 | |||
| 6243a53e5c | |||
| e4025545fe | |||
| f8300693b4 | |||
| ed4f2c7e14 | |||
| 69c4bc0dbd | |||
| bc84e4e80e | |||
| 146d7d46a9 | |||
| 725a2d29a2 | |||
| d5cdfdc33c | |||
| 40453f605d | |||
| bbbb63ecf5 | |||
| e7cfaf8bae | |||
| d5401b41de | |||
| 29a19b8f9e | |||
| 138436f46d | |||
| 04bd05162c | |||
| 236e3e0d72 | |||
| 767781bd0a | |||
| b746385e45 | |||
| 245351e351 | |||
| b31c8c7a8f | |||
| 63496fd33c | |||
| 5553c874ec | |||
| 53b866d35c | |||
| 965f8bbbba | |||
| db4426c435 | |||
| 6ba30c3fb2 | |||
| 562f7c1360 | |||
| 8594d3d550 | |||
| 34f1df1163 | |||
| 880b1e7a0d | |||
| b1497cac56 | |||
| 4c1227165c | |||
| f73f764f2a | |||
| ff9bc4e953 | |||
| afbc8b0765 | |||
| ce517f3bdc | |||
| 2e763a77f7 | |||
| 7c3502d5f2 | |||
| 6bf8c217ad | |||
| 072339d24c | |||
| 0fc5247279 | |||
| 2e4fd5f983 | |||
| 55cb66762c | |||
| 9c6ba3164d | |||
| c1dca8f6a9 | |||
| 63ab54bf1f | |||
| 36dda4ee0a | |||
| 467272c334 | |||
| cc9b0ff089 | |||
| afdaba60fe | |||
| db5778916e | |||
| cfe4aeb289 | |||
| b15656b32b | |||
| 4e19cf0b5d | |||
| 82c898f6bf | |||
| 84be3458b1 | |||
| 76586b5dbb | |||
| 3138f0f9bc | |||
| f29ca568df | |||
| c33ac2981b | |||
| 96a06f1cee | |||
| 1a2b3b50ce | |||
| 421ecf6fce | |||
| 91e9163602 | |||
| 2c191fce7c | |||
| f6e2829892 | |||
| dacad2e154 | |||
| fb5e988ed8 | |||
| b5fe23a4c3 | |||
| 4ffc09b306 | |||
| 47b0f6ca9e | |||
| 849ec2850f | |||
| b2e4c98848 | |||
| 716b377378 | |||
| 35fcc69639 | |||
| 951f98a63e | |||
| 4c18b96aa5 | |||
| 4a6305f8cb | |||
| 4b0f5064f6 | |||
| 1ad210ff29 | |||
| 1928be9dd3 | |||
| f239b113b9 | |||
| 45560f6654 | |||
| 5c56929a23 | |||
| e70e443950 | |||
| b96be9d5b8 | |||
| 52eb287082 | |||
| 9546023101 | |||
| 99dc83a9fd | |||
| acb677a4ba | |||
| 98a49ad086 | |||
| 99baba4762 | |||
| 5ab131dcd6 | |||
| f20ff5c6e3 | |||
| e4200abc4f | |||
| d608b5afd6 | |||
| 7c52755eac | |||
| 5930510274 | |||
| 28285d6c59 | |||
| f4e74705cf | |||
| 417777a6f1 | |||
| 9ad299fa68 | |||
| 315f5e0ca4 | |||
| cacf9df269 | |||
| 1e30a75cdc | |||
| 85659dd200 | |||
| 499364e9fe | |||
| b603344ecd | |||
| 3f3368e60c | |||
| 2ef8f79338 | |||
| 27d16a0a3e | |||
| bf7c40d7a5 | |||
| 6cde969780 | |||
| ca53c40899 | |||
| 626aa140da | |||
| 6ae05eef38 | |||
| f7f34d8d30 | |||
| 05aba517c2 | |||
| b8f7d88219 | |||
| 5df58973a8 | |||
| 02d034b046 | |||
| 9003276f23 | |||
| 056b172d7d | |||
| f43211afad | |||
| 6753517bb1 | |||
| 4de2c0e99b | |||
| e5dd2634f9 | |||
| 6f48d84b82 | |||
| beeba6c8be | |||
| e726c7356a | |||
| fac715012b | |||
| 1595395f69 | |||
| 729283ad01 | |||
| d4c0947280 | |||
| 30b87fb2ea | |||
| e15b551164 | |||
| 3f75eba5e0 | |||
| 75ea162c2b | |||
| 363a4b95c1 | |||
| af0e80fbf3 | |||
| 9d1da53d97 | |||
| ad70e4f051 | |||
| 06bef2fc6d | |||
| a04aecae0e | |||
| 99dd77cff0 | |||
| dfec624b8d | |||
| 2a3b9b65fc | |||
| 8c629529d7 | |||
| b866b98989 | |||
| a128c74090 | |||
| fa1e73fa03 | |||
| 102c0416f8 | |||
| 800378d944 | |||
| 430263de9c | |||
| c4ebfa8890 | |||
| 82951fb82d | |||
| 5bce113bd7 | |||
| 4ecbc5d2db | |||
| 5faeecd82b | |||
| 756e90b683 | |||
| ddae2f3d16 | |||
| 2ad99b8c23 | |||
| e74666fa3b | |||
| e549ae11f2 | |||
| 50fd74a2d2 | |||
| 04ae8b1707 | |||
| 405d025322 | |||
| 39c7d30e46 | |||
| 882e7a9802 | |||
| d800bd87c4 | |||
| 633b953fd3 | |||
| 912de7704d | |||
| 233320330f | |||
| a992ece323 | |||
| 17d51b3ff4 | |||
| 526075a767 | |||
| 590634ebef | |||
| 1661691bc9 | |||
| db65661a10 | |||
| 9561634ed8 | |||
| e406d1e20c | |||
| e88d0a8a2d | |||
| 3a91ae92ab | |||
| 7cceee14a1 | |||
| 51fc8d61cc | |||
| 30a351a3b8 | |||
| 7e4eedbebc | |||
| 63b2f706e4 | |||
| 6bf5b5a7fb | |||
| 598848f4fc | |||
| 21ad8e1e7c | |||
| be3acf583f | |||
| 2196053f8a | |||
| 650f7366ab | |||
| 69bb54fd9c | |||
| 4fadff785c | |||
| 9d7b3d0c08 | |||
| 86c82718ec | |||
| aae4691a6e | |||
| 4c804e8515 | |||
| 154bd186b1 | |||
| 48a43b0555 | |||
| 22fa5b6ce9 | |||
| 8e5541acce | |||
| 1b99e3e4d1 | |||
| 636f090ce3 | |||
| d9f492f4e2 | |||
| 9cb3762102 | |||
| 9d23f69a10 | |||
| 2ef9e342f7 | |||
| 7bf57fca87 | |||
| 6e5b8170c5 | |||
| bd6f6579ef | |||
| b312663fd1 | |||
| 7d27d1ccb1 | |||
| 4820288633 | |||
| 3040a8b1a1 | |||
| 65e9f571af | |||
| adf3a7ea0e | |||
| 09d32d92af | |||
| 5645d21082 | |||
| cec0b5760d | |||
| 6d3b9ae40b | |||
| 71497f0674 | |||
| 4bcfe5444b | |||
| 8756b976bb | |||
| d4b35740be | |||
| 2ae6050a77 | |||
| cdc449eb7c | |||
| 47752634c0 | |||
| e8824e5d14 | |||
| 71842c62de | |||
| d6ba9d7108 | |||
| 7878755831 | |||
| 8b5a623c75 | |||
| 72359b54f0 | |||
| 807dd5198c | |||
| 220daed2c8 | |||
| 5443e879a5 | |||
| 34269c5b69 | |||
| cf655a2907 | |||
| ca27159223 | |||
| 8ac846e32e | |||
| f57509113b | |||
| 8ccb1ca3e7 | |||
| 0133dd5688 | |||
| d3b00c142d | |||
| 380510ff44 | |||
| 0917eb00b1 | |||
| 52553e507f | |||
| 8cb8aed9b4 | |||
| 525a513871 | |||
| 1f8d483bad | |||
| 0b330b7312 | |||
| 19dfc9e92d | |||
| ee0a68fed2 | |||
| 2b3d14f0ba | |||
| 03b0fac838 | |||
| 50d0bb0d03 | |||
| 61a6edc1d0 | |||
| 384d9a4748 | |||
| 4d15ddfc8a | |||
| d8510e7876 | |||
| 382fdc5d18 | |||
| 9749d7c3af | |||
| 3f0fcefdb4 | |||
| c81eb674bb | |||
| fa4fb72263 | |||
| df9f031536 | |||
| e81b03917a | |||
| 9fdc22f78b | |||
| 0c5a902032 | |||
| 82af0550df | |||
| 346a1b2bb7 | |||
| ac2b53c94b | |||
| 9837e172ac | |||
| 41fc0f7f02 | |||
| 8df0ec05e1 | |||
| 6cd08b8f27 | |||
| be37525414 | |||
| de0de39e08 | |||
| 0491f22e2b | |||
| 43da95e784 | |||
| 381749933a | |||
| 209adc2828 | |||
| 0832361729 | |||
| b6b9e388b3 | |||
| 5bf3d40570 | |||
| 408baba7aa | |||
| 8494543164 | |||
| 34c6022101 | |||
| 3f8926d316 | |||
| 3c02cc454d | |||
| 32901297e1 | |||
| 2e8d9ed6a1 | |||
| 5604230b55 | |||
| 792cf68a1c | |||
| ed09893a0e | |||
| 53dce15822 | |||
| 56a4459aa8 | |||
| f9ba4739f5 | |||
| 0d9b6703a6 | |||
| 0b70706a64 | |||
| d41ba853cf | |||
| 045125d328 | |||
| 89b16512d5 | |||
| 62ff6453ef | |||
| fa83809130 | |||
| dda1806dfb | |||
| d7d1f9757b | |||
| 4d6c2be191 | |||
| 2a6a3e419c | |||
| 7503e29211 | |||
| d45bc6d26a | |||
| ab4595f56d | |||
| e428b373ac | |||
| abc2f9cace | |||
| b3eadea473 | |||
| 1c47e6b90d | |||
| af53666fed | |||
| b546848313 | |||
| 2f74f07be7 | |||
| 2ecb91d075 | |||
| 87e212046f | |||
| bf62d1fd26 | |||
| e554278811 | |||
| ee1c55a813 | |||
| 55d73f0b07 | |||
| 96820c4a31 | |||
| 5465d76d20 | |||
| f4224b296a | |||
| 8cde35ca88 | |||
| 53862713f9 | |||
| cc802f2e74 | |||
| 7374313fd9 | |||
| c471fbe38f | |||
| 0aefc0453d | |||
| 2ccac25004 | |||
| 97d7d69623 | |||
| ae4e1ef0d0 | |||
| 8a1e03ced4 | |||
| dc275b3b1e | |||
| 517c084657 | |||
| 99783fd871 | |||
| 69a6a6f3f8 | |||
| 90e011ad99 | |||
| f54c698ffe | |||
| f33eb9f8f3 | |||
| e58a022e25 | |||
| 8e112aac03 | |||
| 013518cdb5 | |||
| e728280c58 | |||
| 9c3b66df93 | |||
| 83413178c2 | |||
| e5ee13bde0 | |||
| 3f83bc7771 | |||
| bc4aa08adf | |||
| 9dc24735a4 | |||
| 39e059e256 | |||
| 46eab011f1 | |||
| d1572790b1 | |||
| 261feabb7d | |||
| c340fc9c39 | |||
| 095f5d2587 | |||
| 7c7250ee53 | |||
| 952459a313 | |||
| b6587cc9e2 | |||
| 4abe2fc6ff | |||
| c6b3060687 | |||
| a4e96b46ca | |||
| 0f1be1ecbf | |||
| 83906af9b6 | |||
| 4ced883373 | |||
| 3290ddaffa | |||
| 4431aa0197 | |||
| 8619a0b518 | |||
| d9b3d59729 | |||
| baf53890b9 | |||
| 121328b188 | |||
| 14bac9f8c0 | |||
| b3bedef7af | |||
| 3ed365cd43 | |||
| 94261700d9 | |||
| 53ad34b060 | |||
| 309240de43 | |||
| eac35f802a | |||
| 72bad478d6 | |||
| 5926c993be | |||
| 3c1ee5970e | |||
| dd70ee13a3 | |||
| a6ba08c598 | |||
| dd52259dcf | |||
| 9bd4007fd6 | |||
| 469b27890b | |||
| 7fac4d5f52 | |||
| 263c9b6d3f | |||
| f81a8b716b | |||
| 9dcdd93549 | |||
| a0d012a6d6 | |||
| 9eb05ff999 | |||
| e5f641d6b2 | |||
| b71f808cb8 | |||
| 3320867b10 | |||
| 1ae69aa180 | |||
| 467b359d0c | |||
| 6535690a69 | |||
| c025765283 | |||
| 37e4829ac4 | |||
| 1c048cb1d1 | |||
| af8ab89a36 | |||
| 864e9ba8ef | |||
| b15e5f7913 | |||
| 40d12d952e | |||
| 564bff07fe | |||
| 0926a5ded3 | |||
| 57ac6c0e98 | |||
| 063a9214ae | |||
| fccd767330 | |||
| 375f4af946 | |||
| b511857333 | |||
| f047ed232d | |||
| 40d0fba63f | |||
| ec7fd9b4e7 | |||
| 0088d353d3 | |||
| e691735a2d | |||
| 1bb4ff2d6a | |||
| b3fc0ab06d | |||
| 9aa46a9af2 | |||
| e9f8d5fa6d | |||
| c5f38ee700 | |||
| 975c298c85 | |||
| 81f36675b3 | |||
| 80941d23bd | |||
| a9c0920bc6 | |||
| fa50ab8a18 | |||
| dc2534e38c | |||
| a9c5f80968 | |||
| ef04c90d8e | |||
| 1496f14843 | |||
| 15bd08b365 | |||
| 7dbde36b03 | |||
| 55024a8615 | |||
| 30eb545b0b | |||
| d01f307edc | |||
| 126eca2ad6 | |||
| 0b687e4779 | |||
| 84c82ca4ab | |||
| 91221db4c9 | |||
| 726b3a33f5 | |||
| 58d0b86a67 | |||
| d45ed9befa | |||
| 7dce5c4e6f | |||
| 3f37aef41c | |||
| 8eea92654f | |||
| 93c5422966 | |||
| 4fa102cb24 | |||
| ef68b46c9c | |||
| 608809a5dc | |||
| e44d9ce77f | |||
| 2b72a50f91 | |||
| a5521badb1 | |||
| dc1db1fa0d | |||
| 0351ea2d33 | |||
| 6d7e8d7e9a | |||
| 4174036ce7 | |||
| 0c3efc3c4f | |||
| 80154d0661 | |||
| 6b979d1c5d | |||
| bcc4c1e4b6 | |||
| 6f209fd8b9 | |||
| 926cba2cdc | |||
| 6b3099daac | |||
| e54cdad85d | |||
| 8efb9e75f8 | |||
| 65bd2cf8ac | |||
| e8144cb3ee | |||
| 9400b860a3 | |||
| 78eb852ed3 | |||
| 1303a297c0 | |||
| 86639f924d | |||
| d71fc61511 | |||
| 815a208492 | |||
| 262ae383c9 | |||
| 64bd24d5f9 | |||
| f79bad8b4b | |||
| f43bf5542f | |||
| 254ec5997c | |||
| f1937335dd | |||
| eb2eaa4d68 | |||
| 1e2198f5f4 | |||
| 2d7297dc67 | |||
| bff17cddf9 | |||
| ee0b9edc21 | |||
| 8895dd599e | |||
| a60c37098c | |||
| 1bd4d38537 | |||
| 76afc11199 | |||
| a135a3d597 | |||
| 6e06110b75 | |||
| 77badffa29 | |||
| 2eaeb38138 | |||
| f1759421d1 | |||
| 70a9a4e7cd | |||
| 91b2e23e56 | |||
| e653a3943a | |||
| 9f8dad894c | |||
| 136dee691a | |||
| fd77fbf163 | |||
| 53f3fbfb4d | |||
| f9a7da61b8 | |||
| 7d14fad782 | |||
| 551aadd27a | |||
| 1069b13992 | |||
| bcaaaac090 | |||
| 3d5434b91d | |||
| d490209c9e | |||
| 483086dc3a | |||
| b0412101b0 | |||
| 0641be187d | |||
| 648494ec16 | |||
| a46c0ee7e2 | |||
| 5b41bdeec6 | |||
| 1405d9e114 | |||
| 6a567288ae | |||
| c9589dce21 | |||
| d4f2e0ce5f | |||
| 97e87f53db | |||
| 25642f924e | |||
| cae6a70a2c | |||
| aec39d2650 | |||
| b06d1b9050 | |||
| 647874d424 | |||
| 449c12d6c2 | |||
| a6c521a73e | |||
| 2bc6ed17c7 | |||
| d21466566e | |||
| 79ac3f9b44 | |||
| 7c78cf5ab7 | |||
| 50b686b162 | |||
| a4dbe13c3d | |||
| 5161cb6bd2 | |||
| d3de7c9237 | |||
| 1fcc1f6193 | |||
| ef4847555a | |||
| bfd73e5b96 | |||
| 7547d7610f | |||
| 0eb7eefcb5 | |||
| 4978999d78 | |||
| f410b270ad | |||
| 132fbbb0c6 | |||
| 5a3b40c503 | |||
| d1d26437e5 | |||
| 78e08e5327 | |||
| a1df2b8f64 | |||
| d9626e392e | |||
| 7173fc5db3 | |||
| 82407ba86d | |||
| 7c8e5645f0 | |||
| 168e6ec80d | |||
| 00bab96717 | |||
| c9e7e77d4c | |||
| 59f90aede9 | |||
| 2828d51308 | |||
| c10f5b2cbc | |||
| f957d27fa5 | |||
| 488e94df56 | |||
| 1e741c1b92 | |||
| edd871353d | |||
| 4851fe1791 | |||
| f760597684 | |||
| c23a5008e2 | |||
| bd4e15609a | |||
| ba2b91a548 | |||
| 3c9a2702b5 | |||
| bab8e2ef33 | |||
| 5902330bc5 | |||
| 0c905226e1 | |||
| d77ec9b466 | |||
| 08d05d8aae | |||
| 295fa30a35 | |||
| 5b51f69753 | |||
| d42a63b72d | |||
| 3c22b106ef | |||
| 04f13bbf4b | |||
| 32a3666170 | |||
| 2cb3a491e0 | |||
| af1fc55393 | |||
| cd7e9d40bf | |||
| 055f1523c7 | |||
| e69486d905 | |||
| cdc249dde3 | |||
| 829dd8ddaf | |||
| 73b54ffabb | |||
| 0b661a6347 | |||
| 2fb50fa5cc | |||
| 70fbf23d27 | |||
| 0d2c396680 | |||
| 44b65d1ee5 | |||
| 3a24372009 | |||
| 362de5084f | |||
| dbdfb23cc3 | |||
| 723b87bba4 | |||
| 1e10e088ad | |||
| 6eae464211 | |||
| 636a259c4c | |||
| 75501fbb5d | |||
| 8f3ffe4e6e | |||
| c4c86fd057 | |||
| d694940b80 | |||
| 2f32950364 | |||
| aa405df0e9 | |||
| bdd170df6c | |||
| af42bfdb02 | |||
| 87bf191fad | |||
| d64b1ed457 | |||
| ea7453946c | |||
| 99a0012bdd | |||
| 72b53ee2a5 | |||
| 4bf2bfc8e3 | |||
| e0602efca2 | |||
| b219d73163 | |||
| 733159923a | |||
| 6d8f64da57 | |||
| ae6bf5a227 | |||
| 44b6e9aa3f | |||
| 509bd2d652 | |||
| 53db4771f7 | |||
| 463b358992 | |||
| eaf2da1171 | |||
| 3693868acf | |||
| 683ff1ea60 | |||
| 3390164aea | |||
| 49ecd69b34 | |||
| 4c50025f13 | |||
| 40d32fc1e5 | |||
| f26f49c2a1 | |||
| c288ca5204 | |||
| 6c0e2631dc | |||
| 6e11baf308 | |||
| bc02d7c31a | |||
| 34f30b974e | |||
| ffdce868c1 | |||
| 390681e0d0 | |||
| 4811631127 | |||
| b1939aaa3e | |||
| ec4d96ea79 | |||
| e84cebe375 | |||
| 9d355f0f99 | |||
| 5cb2b14645 | |||
| a6148565e5 | |||
| d5b24543e8 | |||
| 08a23265f8 | |||
| fac1361d36 | |||
| 2e397b1383 | |||
| 489f24a80a | |||
| 51fe41bf51 | |||
| f612082f5d | |||
| 3c53d907da | |||
| 2c97d98963 | |||
| d6bc32f7fd | |||
| 48199f3744 | |||
| 21e5ccdf88 | |||
| 7794ea4a33 | |||
| add346b8dc | |||
| 73c29fc2f0 | |||
| 5c761d3a57 | |||
| 756d4f4c5c | |||
| 8f1c227125 | |||
| c84dc13d53 | |||
| 855f7ac2a0 | |||
| d57d463818 | |||
| 108d3110b6 | |||
| 2159a56b17 | |||
| b1fbcc51e0 | |||
| ce0a5cf7b8 | |||
| 17d9b9199c | |||
| 167e11426f | |||
| 7e7c59967c | |||
| b2a1597e73 | |||
| d459c144fe | |||
| fc76e5c8ac | |||
| 7a9860fdd1 | |||
| b7ade8bf1b | |||
| 26b550dd0d | |||
| 18c837c398 | |||
| 4bf74348a1 | |||
| a92233240c | |||
| fdbd76e4ad | |||
| b76e179d75 | |||
| 6844645dfb | |||
| dadae1a71f | |||
| ebb2659630 | |||
| 9e4ef74dd5 | |||
| 84741e4cb1 | |||
| b8ed29c600 | |||
| 01ca81a177 | |||
| f4e33f6faa | |||
| bbb3e1a1bd | |||
| ce54071296 | |||
| 5b4cf79b04 | |||
| 2aacc7323e | |||
| 80d11d4ca9 | |||
| 5b78acc45e | |||
| 00ba6e761e | |||
| 999a6501e0 | |||
| f799b8ef68 | |||
| bf8f70342b | |||
| 7e72f10a3b | |||
| b398d65eb8 | |||
| bf9b126eef | |||
| f3f9997adf | |||
| 1b8711bce9 | |||
| b0e59e112d | |||
| c6388d8c5d | |||
| e87a3096f4 | |||
| ca0a8fd974 | |||
| c9a75dcf64 | |||
| 7e2661bbc1 | |||
| 8f18672690 | |||
| 6b75e03d72 | |||
| 1770862b10 | |||
| 3df27a9379 | |||
| da13affebc | |||
| 446b085d6c | |||
| 0956575292 | |||
| 0ed10ec102 | |||
| 81a48cac6c | |||
| bb37dd1b16 | |||
| c2936a893e | |||
| 64be231fe6 | |||
| 28680a4695 | |||
| 502bb6ca79 | |||
| 09f37323d1 | |||
| b34b26c423 | |||
| 1873b1d739 | |||
| c33973f20a | |||
| 4c9653d204 | |||
| f6166bcb94 | |||
| cd9ca65587 | |||
| 4808dcadcf | |||
| 4fde4bba72 | |||
| 4f643c7201 | |||
| 784a6974d1 | |||
| 732fa17afb | |||
| be381b4e56 | |||
| 94be9e9162 | |||
| c8278608a3 | |||
| 77f9cf9f63 | |||
| 3b2fbd337f | |||
| a83d536712 | |||
| a6dd14b09f | |||
| 0552220f00 | |||
| 2e55c98e90 | |||
| 66cc498421 | |||
| b27737bfcd | |||
| 2c43e6f68d | |||
| 6717014601 | |||
| 364f2f6bf8 | |||
| cde406a496 | |||
| f1a73d4da2 | |||
| 668823eaf2 | |||
| 4b133c808c | |||
| 7557cfd845 | |||
| 179f47dbe3 | |||
| ac09636a73 | |||
| 8491e3ce9b | |||
| a56e9ccda6 | |||
| 9419bc8d54 | |||
| 85a27cdd74 | |||
| a75db63cbc | |||
| f8b6ee296c | |||
| 09d76605f5 | |||
| 6897aef4b5 | |||
| 77b8e9ec6e | |||
| ea6ab5b10f | |||
| 9b8598c566 | |||
| 1b5db0684e | |||
| 3da3b5641f | |||
| 7cbefa4ec2 | |||
| 6a2260f106 | |||
| a8d28cbed5 | |||
| 3c6c5b9732 | |||
| f0d2fb796f | |||
| fc544e164c | |||
| d93edd7393 | |||
| 16a8d15909 | |||
| 5df65427b1 | |||
| 72823182f6 | |||
| 81dfffadf6 | |||
| 33e88bffe9 | |||
| dab3d1181e | |||
| 4fb1a3ff3f | |||
| 2dadc9ff24 | |||
| 4af3834715 | |||
| 18f9a06f06 | |||
| 4f65066274 | |||
| 8983953d7d | |||
| 73fe229e25 | |||
| 21ce6efc73 | |||
| 3a488e3a61 | |||
| 7ecea56caf | |||
| 9666f1e25e | |||
| 05c943779d | |||
| b63dbd50a8 | |||
| d7b529d2af | |||
| 00ac9a05d5 | |||
| 47e98a4b62 | |||
| d9dc2eb4e3 | |||
| 270fe3389c | |||
| 15fbb722eb | |||
| 8522542ae2 | |||
| 811872c17f | |||
| baf2f23ce6 | |||
| bc25d90441 | |||
| 13a3349614 | |||
| c48d2d9888 | |||
| f6dc138dc8 | |||
| 1329a2f9ba | |||
| 3bb816ad1d | |||
| a0972e7564 | |||
| 8c3751befa | |||
| 27fe90d02d | |||
| a0c99647fa | |||
| 7742892377 | |||
| 5e34b06952 | |||
| c10bccebdb | |||
| cdd624e7a8 | |||
| 34ab3e10f5 | |||
| ed257b0ef3 | |||
| b072f5873d | |||
| cba68645a8 | |||
| d454763cd1 | |||
| 36c1f50e1b | |||
| 6e192b1794 | |||
| ce3d513ca0 | |||
| 62ae7ba1de | |||
| cfbecc1d1b | |||
| a4febbb648 | |||
| 18fb86a560 | |||
| b9fab9bc1b | |||
| a7cdb4c0af | |||
| de3f9f7276 | |||
| cee7a9a0fd | |||
| f409d39f1a | |||
| f588c54d52 | |||
| 7d95f3f582 | |||
| df342d419c | |||
| b682a2f97a | |||
| 812ad530d1 | |||
| 4ef3c7a9f4 | |||
| cedec3d872 | |||
| d4506363b8 | |||
| da75007b0f | |||
| dabe550966 | |||
| ef287bc857 | |||
| fce52d7186 | |||
| 1261aac036 | |||
| 8aea6da7df | |||
| ba5e5058f9 | |||
| 45e71ff6d1 | |||
| ce9bcef620 | |||
| fe4872c921 | |||
| 7dad77c080 | |||
| d721580c9f | |||
| 4f242f01c1 | |||
| cd33307975 | |||
| 26e87c999b | |||
| 29ef1527e7 | |||
| d69552d4df | |||
| ad61eda7e0 | |||
| a14f8058da | |||
| ab5d0ad43f | |||
| 5099010840 | |||
| fc306bbc1d | |||
| 7d39ea59e8 | |||
| ad8e834fe8 | |||
| 0b89c95ab2 | |||
| 5b49ecf072 | |||
| 25ee643aeb | |||
| ef3d4ae51a | |||
| f4609101d5 | |||
| 6b485273d1 | |||
| 40377447ac | |||
| a55b2ca557 | |||
| b687fb2439 | |||
| f3ebb2e5d8 | |||
| 12206c0e50 | |||
| 689f95b430 | |||
| 62d8fb538b | |||
| fab6b602a8 | |||
| 1c665653ea | |||
| 5c903c6ee3 | |||
| ffe447859a | |||
| c1e5d8b7dc | |||
| f8a1825845 | |||
| de32970d6f | |||
| e9b72e0f7d | |||
| 7887511589 | |||
| 6d0b44d69e | |||
| edec2ad24c | |||
| 20200fd028 | |||
| 0c21f56ff3 | |||
| 3d8777084c | |||
| a612f289e7 | |||
| 6f747c3678 | |||
| bbea7f4f53 | |||
| e048c5cf17 | |||
| 968b0adc1d | |||
| 5e31b8f96e | |||
| 1a6a50c810 | |||
| 677c6b5750 | |||
| 41f6349804 | |||
| 359bbb8df1 | |||
| b1623cf696 | |||
| e5f300baaf | |||
| 5af34a9245 | |||
| 453dcd8af3 | |||
| 3edda155c6 | |||
| 00d145199b | |||
| 53b9f8d0fd | |||
| a3a1f05718 | |||
| 7f1ba17894 | |||
| def95b6584 | |||
| c646a6c43a | |||
| 9ef0fa13c7 | |||
| de243cd5d7 | |||
| b5c60d8123 | |||
| 6a6e91abc5 | |||
| 6fd2c2915a | |||
| 8ebfa36f00 | |||
| 537af79c8e | |||
| a9226c00d8 | |||
| c5c33f6f49 | |||
| e218ebb92f | |||
| 856eadc628 | |||
| 1ec2ce7e26 | |||
| 020dfbf538 | |||
| b945729d1a | |||
| 24f9e8d181 | |||
| c25e17f3bc | |||
| 34ce09afd1 | |||
| c43377100e | |||
| 87fd99a3e7 | |||
| e7911df851 | |||
| 7dc69b7755 | |||
| 24503bd0ee | |||
| 250d9d1fb5 | |||
| 631d8cb015 | |||
| 0e581f38d2 | |||
| c1baade00f | |||
| d44e982eaf | |||
| ec43a9248b | |||
| 21b6001351 | |||
| 200027bf89 | |||
| 782b6fee94 | |||
| 55b495826c | |||
| 8584895427 | |||
| 85b7cc6330 | |||
| 95c95525ba | |||
| abe471af64 | |||
| b733e96aea | |||
| 1fcb8235c5 | |||
| 756e5ee139 | |||
| 494e250514 | |||
| 430f04775b | |||
| 9cbaedc64f | |||
| 4be92db77a | |||
| 9e4605d528 | |||
| c5d23c5f1b | |||
| 1c7acbdbd9 | |||
| 5b6eb885a0 | |||
| b90897c513 | |||
| d20c9c9ac6 | |||
| 905961d278 | |||
| 0fd87d344c | |||
| ed63c92839 | |||
| ee4935566b | |||
| 123da175e1 | |||
| 62181ff08c | |||
| 026d5e71fa | |||
| c85cbb2f08 | |||
| 250ad31038 | |||
| 9056008342 | |||
| 80a67f9ebc | |||
| 118d587064 | |||
| 0e54019fd5 | |||
| d9a1bcb3fd | |||
| 820f99067d | |||
| 2d1999c961 | |||
| 4c9befee22 | |||
| 362bfc79d6 | |||
| 37951d09c7 | |||
| 4161ab3051 | |||
| 4047c70de1 | |||
| 7e7ec8e3d2 | |||
| 449b1f9d35 | |||
| ba2aefc572 | |||
| 8df6e7e26b | |||
| 2a33da248b | |||
| 9db39b5eec | |||
| a4df155219 | |||
| 70f570dbd9 | |||
| f81f62670e | |||
| afd3b9acdc | |||
| 3e73df2c72 | |||
| eed666c8c2 | |||
| 6b9a408b46 | |||
| 5713dc2de1 | |||
| 4138e6f82c | |||
| 206bbe9e62 | |||
| 97a34b5793 | |||
| f0e22c9ff9 | |||
| 2aa287fe3c | |||
| ce7a995223 | |||
| 51b997aa27 | |||
| 1ac92c603e | |||
| 57a196a50c | |||
| 100eca203f | |||
| 60563aead6 | |||
| a201a3e837 | |||
| 2d070ff1c0 | |||
| 4e257d43b2 | |||
| 7cb1a2e7e4 | |||
| e2bc79401b | |||
| 26589835e5 | |||
| e65bf63e51 | |||
| f6bddb9502 | |||
| d071bd2e7c | |||
| 921433f998 | |||
| 48be7c508d | |||
| f1260a598d | |||
| 36c945a77c | |||
| 0a8f3554e9 | |||
| af42af7869 | |||
| 65dcfd55a7 | |||
| 052b41fbb2 | |||
| 5998cf8a3c | |||
| fc282f86c0 | |||
| 804421095a | |||
| bc53ca3b71 | |||
| ff5eb54331 | |||
| 523562c152 | |||
| f00cddd67e | |||
| ff1942245b | |||
| e64e131c9c | |||
| 0275e9646c | |||
| 75c1a302c9 | |||
| 7c211e1e11 | |||
| ad506ece4d | |||
| 2b7ecfdb2c | |||
| e58dc94b2c | |||
| 6206133729 | |||
| 2da6dfa931 | |||
| cafa266c89 | |||
| 275f2aa80f | |||
| 4243ce8582 | |||
| 76210e1f0e | |||
| d22f136eea | |||
| 361b4d1c62 | |||
| eb6c963c70 | |||
| f6c98132f0 | |||
| 4daf4ab507 | |||
| 2e0cfa86bf | |||
| 0ad62461f0 | |||
| 3791c38f97 | |||
| 7a74df5ff1 | |||
| dd5265dc02 | |||
| efc4ba0e27 | |||
| 23698c1373 | |||
| 04e24ddce4 | |||
| 0a0260b75b | |||
| 9636ef3499 | |||
| dc0eb0f6b5 | |||
| 9d6a89c65d | |||
| 7ce7af05f3 | |||
| 525eb518f6 | |||
| 2995b20d62 | |||
| 70dd447156 | |||
| 14608c972a | |||
| c3333a46c9 | |||
| 40ec1f805f | |||
| 52eb4d2d4e | |||
| 24ea7a0d45 | |||
| faaebc2806 | |||
| 6f867ebca3 | |||
| cbadd8bde1 | |||
| f5a94ed07b | |||
| b06647b763 | |||
| feac1728dc | |||
| 395be050a3 | |||
| fb9d76f851 | |||
| 81d2e7d242 | |||
| a59cdc2c89 | |||
| 2fe80d32f9 | |||
| 31d32682b0 | |||
| c98964a9e8 | |||
| 5af1998167 | |||
| f973d256dc | |||
| 0a685d316d | |||
| fb1d5842ea | |||
| e31c95670a | |||
| 54f3f7f343 | |||
| 8b7a09dbc1 | |||
| c8063c31ed | |||
| 4c5117cabe | |||
| c3471ed88e | |||
| d54215ea18 | |||
| 4f03ebb3af | |||
| 7ac9a5c5a6 | |||
| 7239a1339e | |||
| a70eadecf4 | |||
| 40d26b5bcf | |||
| 95f7bd94f3 | |||
| 9f62f0e485 | |||
| 70d26a532c | |||
| 98a8ddbb21 | |||
| 381dc7574f | |||
| 6b1b083802 | |||
| 708b4f3bfb | |||
| 1054bfe476 | |||
| 51d6ea622e | |||
| 2546c6c226 | |||
| 54bc1b06e4 | |||
| 0570722b3b | |||
| e6d23228e5 | |||
| 7198e670ae | |||
| 2e6711916e | |||
| 4a7984f04d | |||
| 69dbdb2485 | |||
| f9036ddc6a | |||
| c060723762 | |||
| 4b71d28747 | |||
| c0b546921e | |||
| 6ffd7203ff | |||
| de84065cde | |||
| 8dfd61bbcf | |||
| e04496188b | |||
| 82cc830297 | |||
| 705dd4d7df | |||
| 0d0917b779 | |||
| 4b48ed7cbc | |||
| ad2fd9e4d5 | |||
| e8ae28b439 | |||
| 607e28dcbf | |||
| 11ecf77c85 | |||
| fde9517247 | |||
| 4a597a2b38 | |||
| 34b1950820 | |||
| 5562030594 | |||
| 9821c7da65 | |||
| c7a79d81ca | |||
| f5ba442ba6 | |||
| 2d052a7a28 | |||
| 3577ff5a81 | |||
| 88984a3960 | |||
| 6d52f3c02a | |||
| cb6948b6fd | |||
| ad603fd213 | |||
| b06fec6ad0 | |||
| 7db731a47d | |||
| 35e9c3ad98 | |||
| 904ae416c5 | |||
| 4faca5543a | |||
| 5d5c3fbfd1 | |||
| 251e940fe8 | |||
| e833f457a1 | |||
| 6d763256f1 | |||
| 8da864bada | |||
| 82e96d7014 | |||
| 700de3f518 | |||
| ad9c0df552 | |||
| ca3b5a3221 | |||
| 8cd19670ab | |||
| 84fa042c75 | |||
| 3d83f647bf | |||
| 67863e364b | |||
| ac0933719a | |||
| b7c19e4034 | |||
| 94a0cb3522 | |||
| 28ad768c0a | |||
| baa7a1feb9 | |||
| 6b45b2bc52 | |||
| cf1370b9e2 | |||
| 6f67577115 | |||
| 191aa575f8 | |||
| 4e3842b9d8 | |||
| f0881d4aa9 | |||
| 521106e286 | |||
| 12ea532a7a | |||
| 98c21635c2 | |||
| 5b783e84e9 | |||
| 4094d43c49 | |||
| 2f203fa6bb | |||
| 5140e6fabf | |||
| ef18458480 | |||
| 6cd614a05e | |||
| 29573d7d19 | |||
| d8692c1dc7 | |||
| c0faaa9c20 | |||
| f9e65acf78 | |||
| c465b8c8c3 | |||
| cfa05587fc | |||
| d9d89ba9b3 | |||
| f63c5ab6ba | |||
| 56a96dc817 | |||
| 32a034bd58 | |||
| 2814130aad | |||
| 408fdc7178 | |||
| c5c778f575 | |||
| 75543e68e3 | |||
| a6177859ff | |||
| daec5bde66 | |||
| ee7f88d247 | |||
| 09f75c09b8 | |||
| cab1f986f1 | |||
| d25c5b1fa0 | |||
| 5c5cde7fe5 | |||
| 08e787da59 | |||
| b43cfa126f | |||
| 65ad5b5c99 | |||
| fbaae2b1e4 | |||
| 5115a29bb7 | |||
| 0598f7e87c | |||
| 096cbaf1bb | |||
| 53602e3c61 | |||
| 640aea24bc | |||
| b4862dea45 | |||
| 09e13d0034 | |||
| bee04c1b53 | |||
| 2fbe6b304c | |||
| 02e82f1cfc | |||
| a2bef4d999 | |||
| 50a69a8e20 | |||
| a5207b58e1 | |||
| 3c2b8d13b9 | |||
| 2f1191b263 | |||
| e4f45d7b35 | |||
| f4d024fd47 | |||
| c30850f00a | |||
| ce248d83d6 | |||
| 3ca282abfa | |||
| 5c0fbac7b0 | |||
| ce4c6b0c8a | |||
| 6b67c3736b | |||
| 3266ed98e6 | |||
| 5970b0ee41 | |||
| 3b51aebb51 | |||
| 12ceac4c02 | |||
| 7fa1256c5d | |||
| f328853251 | |||
| d1b0564698 | |||
| 111fb84041 | |||
| 79a70271d5 | |||
| 1ca397f426 | |||
| d49426f763 | |||
| c5a90adb39 | |||
| 3573686976 | |||
| cab071b544 | |||
| f1701aae9f | |||
| 96a0cc37e0 | |||
| 2330285b04 | |||
| ac463fe9aa | |||
| fdd78e41da | |||
| 4ad8500a3e | |||
| b5c6b47639 | |||
| 62e22d1aea | |||
| 1973a065c5 | |||
| 6c5248b9a9 | |||
| 1ed9c3082c | |||
| 37936b63c4 | |||
| 4a83b4acb9 | |||
| e7681f1b49 | |||
| 4f38dba334 | |||
| 67a9779d5b | |||
| 5b85aa6550 | |||
| 6a5b3ef4fe | |||
| 9570412991 | |||
| c506e33018 | |||
| 8f32a9949b | |||
| d7e05de556 | |||
| 1e13d43b71 | |||
| a6b9e6cb3c | |||
| 0b44f58518 | |||
| c749155ad2 | |||
| 9d6248886c | |||
| de16db5a2f | |||
| 251d4fa3e3 | |||
| 9324bdf107 | |||
| e3e63efd68 | |||
| 071367b6a9 | |||
| 2e8d7b09af | |||
| eee65b8c22 | |||
| e11fa4a278 | |||
| 650aa566b0 | |||
| bd48efcdd5 | |||
| 9ac79f1071 | |||
| fc48a109fd | |||
| 0017951a74 | |||
| 959319f91f | |||
| 41cbe5fb01 | |||
| 71d72a02a9 | |||
| 01c580224d | |||
| 0355af310d | |||
| 94231b62a3 | |||
| fe364a0798 | |||
| 30922afd08 | |||
| 73e398b0f4 | |||
| 10ae97e42f | |||
| 96242f6c5e | |||
| 5dc3a5ab20 | |||
| 44bfdfebc2 | |||
| d33b320436 | |||
| 51b6db977f | |||
| e02e6099aa | |||
| 8e20f3e7dc | |||
| 5434c47d1f | |||
| cbc8e652b9 | |||
| 4a26466b2b | |||
| 6c7a4edae3 | |||
| 8c8cec29d4 | |||
| 9de4f84f22 | |||
| 563a39c2d9 | |||
| 741eca17f4 | |||
| b32f59a40d | |||
| 352d6fd83c | |||
| 738fa38047 | |||
| fabe93e548 | |||
| 16f72be898 | |||
| 9c22de9eb2 | |||
| f0f5262e3e | |||
| 8594148496 | |||
| dd869695c4 | |||
| 7943a73cfb | |||
| 59bcd031c8 | |||
| 22cc86e6a0 | |||
| a763fc08b6 | |||
| 8ae234aedf | |||
| 793487b825 | |||
| bb5ae7447d | |||
| 0370156179 | |||
| 39cab761eb | |||
| 720e80377e | |||
| 3d44050959 | |||
| d5efa0f23c | |||
| e63b310058 | |||
| 384d8c6167 | |||
| d23608964e | |||
| d656db843a | |||
| 0ed1e539ae | |||
| d8a8b8e6dc | |||
| 77f0e7919e | |||
| 587ddc0fdd | |||
| efdc177b78 | |||
| 275e1144ad | |||
| d987ccf289 | |||
| fe7774ab75 | |||
| 19e6a6909f | |||
| 4446a1ed08 | |||
| b4e4d94061 | |||
| f81f8ea5d6 | |||
| 7476ae2a82 | |||
| 0c4a32246b | |||
| b8b43c7149 | |||
| b4286b87db | |||
| cb0d5ac7d0 | |||
| 957f05860b | |||
| d4139b98e3 | |||
| 29d614421f | |||
| beff1caf4f | |||
| 29ec6db345 | |||
| 8efc652c10 | |||
| 29079a7ec2 | |||
| 3ac0f1506c | |||
| 38f1e8847c | |||
| cff9e05626 | |||
| 29a36008d1 | |||
| 51958b991c | |||
| 771279128d | |||
| 385d70b294 | |||
| 4bd41b3678 | |||
| 527293d2f2 | |||
| d754e24a02 | |||
| b4576435e3 | |||
| 5e1500c93b | |||
| c9073b10a1 | |||
| a9f7af59a2 | |||
| 728399e372 | |||
| 51a3302288 | |||
| 5decde0af9 | |||
| 3620ac4eaf | |||
| 43e906e3c8 | |||
| 39bb2aa811 | |||
| acab4dd443 | |||
| 45ff2cddb7 | |||
| 1619324d06 | |||
| 7b0045290d | |||
| 441ddf233a | |||
| 306c641c72 | |||
| b417e23d97 | |||
| 481492cb59 | |||
| d3fbd026b4 | |||
| 2d77adeeb8 | |||
| f84130fc7c | |||
| 57f8f61094 | |||
| 5ec0b9993a | |||
| 65cb049a38 | |||
| 3247137ef2 | |||
| adb8175654 | |||
| 5afd6b8628 | |||
| 4cb6a5635e | |||
| b54411e533 | |||
| 7f85d8c8a2 | |||
| c95b18da85 | |||
| a062c27e1a | |||
| c5df59a2f0 | |||
| d538b48fbc | |||
| 0a27273d64 | |||
| 22170527c4 | |||
| f0f920d0e8 | |||
| 193f7b0fe3 | |||
| c81491f97e | |||
| bb91265b2b | |||
| affb735c38 | |||
| 3db2332821 | |||
| a6ae2ca635 | |||
| 466eecacc4 | |||
| a327c91bac | |||
| cef2aa64d9 | |||
| 69a124e11f | |||
| 3f056462d6 | |||
| e8eb774458 | |||
| 223d06645d | |||
| 2db5dc2ed7 | |||
| 6d95fc2547 | |||
| b10062452a | |||
| 9c72533264 | |||
| f805ddf319 | |||
| 2267881d52 | |||
| 7ca23d14c7 | |||
| 4cf845e6ff | |||
| 9c6ab05659 | |||
| 0f9cfc0615 | |||
| 6028dbb4e5 | |||
| fc8cb2b5b7 | |||
| 594657f2c7 | |||
| 09e1155a26 | |||
| e824f81670 | |||
| 69c0405004 | |||
| e38abaa32a | |||
| c002f834d4 | |||
| e53a91f5c3 | |||
| ef5e93b71b | |||
| 6f00a69850 | |||
| 41938fbe72 | |||
| d1561c28d9 | |||
| be0621de42 | |||
| 15cec40ed5 | |||
| ea734c90b5 | |||
| 6c5b569c29 | |||
| e5f3f4c552 | |||
| f097eaf3cd | |||
| 48eba3c092 | |||
| bdba6219ac | |||
| d86912a7bb | |||
| 362366a333 | |||
| 35049d530e | |||
| 66cfb2e32b | |||
| 3e1c917f11 | |||
| ea4c23efcf | |||
| c328829610 | |||
| 28ac586ed8 | |||
| ee71fa0d56 | |||
| f3e04bfe4c | |||
| a8c23d25f3 | |||
| 41f2d71c7c | |||
| e338f801ea | |||
| 6221c1f8ab | |||
| 5dac9a944b | |||
| 97c1c479f9 | |||
| 21d6865e8c | |||
| e2894ef2aa | |||
| 7656b9b928 | |||
| 0fde0fbd23 | |||
| d5955da08c | |||
| e2333e671b | |||
| 1da70ee6ed | |||
| 0d8cbca016 | |||
| 1a4b794ce4 | |||
| fca359bf51 | |||
| 5f11e91da2 | |||
| 2c275f603a | |||
| ad921d01d8 | |||
| e3e2b266f2 | |||
| e2d52ec3e5 | |||
| a325380884 | |||
| b6294a28cb | |||
| 69336d1e53 | |||
| 2df5506d82 | |||
| 2dacb523fc | |||
| 6474e1353f | |||
| 45ef740244 | |||
| 48299b6024 | |||
| be7d2e9457 | |||
| a90babbae1 | |||
| 4b1d3592d4 | |||
| 77cfd116e0 | |||
| 67c8949cd4 | |||
| b66b7a5fd2 | |||
| b0d358cda8 | |||
| 8553278759 | |||
| 7a3f7602a5 | |||
| 11e08c9b67 | |||
| dfcddac2ef | |||
| 73b2987700 | |||
| 5781821ab3 | |||
| 9183541825 | |||
| 7870081716 | |||
| 0438042844 | |||
| 2bee906784 | |||
| cab41487d5 | |||
| 66448feece | |||
| 65127ad756 | |||
| 1261c228a3 | |||
| 5be8e710a9 | |||
| 3ad7ab625d | |||
| b6be6c3709 | |||
| 8ff4e59d20 | |||
| ad116af59d | |||
| fa1fe55e01 | |||
| 4f2dbb37d2 | |||
| 7dc1da21f0 | |||
| 806a9fbb99 | |||
| f4203d0621 | |||
| bf6b9aaef8 | |||
| d5f5b38d26 | |||
| 6a078279eb | |||
| a61b930bd9 | |||
| 6be2f6a7e4 | |||
| 1d08b1687f | |||
| e2382137e6 | |||
| f1039ab0e9 | |||
| ce3532aa19 | |||
| 1b1c5b5f9f | |||
| 9c3f1937a7 | |||
| 81a641c96c | |||
| 037df28b7c | |||
| fe1c67b8b4 | |||
| c7c9218210 | |||
| 6d6516d80d | |||
| 528f16bdaf | |||
| 64641a3390 | |||
| 74b8f38030 | |||
| c7faf8a03c | |||
| aa9601352d | |||
| 81b9d9a57e | |||
| cecd9b89ba | |||
| 938322a3d1 | |||
| 1c04dccf53 | |||
| 0622f02470 | |||
| 1366774931 | |||
| 5cbae2b833 | |||
| c12805acce | |||
| e2c84c5f39 | |||
| e19db3f447 | |||
| 7d0b316e74 | |||
| 0ef428d286 | |||
| 2a73a572d3 | |||
| 638d121b75 | |||
| 3b75d4fa8f | |||
| cb897786bc | |||
| aa780ceb8c | |||
| 4a3f94e688 | |||
| 211b3a135e | |||
| cbce5e5eb6 | |||
| a3347579e6 | |||
| 2fbd170188 | |||
| 95208eb24e | |||
| bcf282da91 | |||
| edc2567b10 | |||
| b379bdd36e | |||
| eeb9a6ab65 | |||
| c4de954b15 | |||
| 2d8e9bf058 | |||
| 0b352ff0f7 | |||
| 28ec84a6c9 | |||
| 7f5f805c10 | |||
| b3789c261b | |||
| d86fc1c141 | |||
| accedf7184 | |||
| 5f5fba1117 | |||
| 61cd48ff44 | |||
| ca2c2ccfac | |||
| 905a264744 | |||
| 114d0ae11b | |||
| 4d768474e8 | |||
| e753685ceb | |||
| e0e3059498 | |||
| 61545beff2 | |||
| 16c5ead887 | |||
| 3a270dd96a | |||
| bb2bed7b00 | |||
| 0438dee22e | |||
| b3d8e22539 | |||
| 968127c414 | |||
| 272180ff0f | |||
| 03fed0f42d | |||
| 54fae508c5 | |||
| fab091da2d | |||
| c7417d4b54 | |||
| d8c6c69450 | |||
| 1024e327b5 | |||
| e38268230f | |||
| c7760d8dae | |||
| 8d050b8f3f | |||
| 7800cbbe96 | |||
| 50233b9a8c | |||
| a722e3f112 | |||
| be52d413db | |||
| 1dfd3349b7 | |||
| cf8363f62e | |||
| 7326a3ea7a | |||
| cb49bae53c | |||
| 31f891dda5 | |||
| 38572fe393 | |||
| 83367ee806 | |||
| f117aafc45 | |||
| 0cd320dd75 | |||
| 3e0c1bc02e | |||
| f13a1d6351 | |||
| 725c5633f6 | |||
| fdde64dcc3 | |||
| f5fa07c8db | |||
| 5ffb6bdee7 | |||
| 8035c6c558 | |||
| fc1eca0f31 | |||
| 28e49801b7 | |||
| 66c171b61b | |||
| 3be7d45d36 | |||
| ef082b9144 | |||
| 7fed01ddea | |||
| e5822a0c4a | |||
| b05dd45d62 | |||
| 9f64092606 | |||
| d2acd0505c | |||
| 05ed577e23 | |||
| 7831162235 | |||
| 8567fd928a | |||
| 73a23e9f9d | |||
| f232bf1ccd | |||
| acc6926448 | |||
| 837ce8ab4a | |||
| 2497c719ee | |||
| 31b46efcac | |||
| 9f3a0a3f95 | |||
| 179400c777 | |||
| 0f12a74074 | |||
| 61b784e96e | |||
| 723e5d536a | |||
| 225929d937 | |||
| 763ed7f7a3 | |||
| ea6ef4c283 | |||
| e5a0cc9ef7 | |||
| a79ea9b850 | |||
| 039e321dde | |||
| c57292a9dd | |||
| 9561a3fd3e | |||
| aa021addc1 | |||
| c0cbbf3a65 | |||
| a73ac9cfe8 | |||
| ec8c46abfe | |||
| b9b92762b5 | |||
| 7feb531ff7 | |||
| e67423bba7 | |||
| 531e4b0207 | |||
| 34496c49b4 | |||
| a445d7e39f | |||
| 0d12715d77 | |||
| 9878459049 | |||
| 9be0d3b090 | |||
| 16ba3eb11e | |||
| 973aa94cb5 | |||
| 4cbccfdce2 | |||
| a5e6fa3479 | |||
| 3712d36867 | |||
| 17291e9977 | |||
| 15f57e4a4c | |||
| e58d63bf35 | |||
| f89add9f64 | |||
| e039f6d2c6 | |||
| 7cef4d8fe9 | |||
| 7b85b09f24 | |||
| 413538f1b5 | |||
| c03a70651c | |||
| ec01e6c69b | |||
| 11773208df | |||
| 1f155690d8 | |||
| 36a29dbb9f | |||
| c160b8716f | |||
| 7ffce01260 | |||
| 1170b57fd5 | |||
| fee8a1214a | |||
| c26a6959e4 | |||
| 837b9b7ec7 | |||
| a5a8bfb0f4 | |||
| 69bddef5a0 | |||
| 7d242045ec | |||
| c3035fdf41 | |||
| e34c47414f | |||
| 909dda7c09 | |||
| 22ab145f19 | |||
| cd8e30a2ec | |||
| 03be6b2b6b | |||
| cda2217634 | |||
| 4525b512ac | |||
| db0d1116f8 | |||
| 3ef5d8ef0a | |||
| 4ed88e348e | |||
| ad29fa9cfa | |||
| 388c4bc574 | |||
| b4f3993616 | |||
| f9366553a3 | |||
| 9733f04c9c | |||
| 7140a2054f | |||
| 1049e48aca | |||
| 33b79a3588 | |||
| f82699c39b | |||
| 15eaf4e6d1 | |||
| 7621882b4e | |||
| 9b70b73759 | |||
| 8e43134bda | |||
| 52608d9b2d | |||
| d26782b093 | |||
| a2368b4ea7 | |||
| 3d6bb964df | |||
| 347ae1bc34 | |||
| 64f5bfd5ce | |||
| 3cb02e3b86 | |||
| 34c3b8628e | |||
| 8f921ce919 | |||
| 6754dfdf6d | |||
| 81722962cf | |||
| d169d95ab0 | |||
| 63ca4cac5e | |||
| f30ae9dd5a | |||
| eb49707779 | |||
| 86c1420f6e | |||
| 364ed921ce | |||
| 85e1518856 | |||
| 87bb5deb5c | |||
| 11ce399e0d | |||
| ec0989454d | |||
| e9f6031936 | |||
| 03485ef1e0 | |||
| e256175ce6 | |||
| 0f662bf70c | |||
| 4c959159c2 | |||
| d51241720a | |||
| 873d343529 | |||
| 95969ce67b | |||
| bd5cdf502e | |||
| c6a7d5a96c | |||
| 6bc4ecf390 | |||
| c94ceb5b1d | |||
| e390531dcd | |||
| bb702335e8 | |||
| 863c0c5b58 | |||
| 76e280da4e | |||
| bcca35b7b7 | |||
| 65abaade88 | |||
| 8020e921aa | |||
| f2f5b4c1ad | |||
| 5c6f9fcdc4 | |||
| d7dc733480 | |||
| 9e243a2426 | |||
| 9a889802d3 | |||
| 1420987c4c | |||
| ed4d954ba8 | |||
| 881f937a35 | |||
| ed4e762f03 | |||
| fa1e33783a | |||
| 0c38b46bf1 | |||
| 899cf32e6b | |||
| 2fa31799f6 | |||
| 6c3d5c713c | |||
| f16beddf6e | |||
| 506b3ca4a0 | |||
| 80242bd250 | |||
| 7f7f99cbe3 | |||
| 579294fbf0 | |||
| a3b54e5cae | |||
| b392d16808 | |||
| 1f9597a9e2 | |||
| 54c89d69f6 | |||
| a14371ba5c | |||
| 616e13acac | |||
| b50f660339 | |||
| 4c12d31e4a | |||
| e50cf5c4be | |||
| 84310ec8f0 | |||
| ffed5a9e22 | |||
| 92c9ff6e53 | |||
| 986a424322 | |||
| c3e7c48939 | |||
| b2aa3262a9 | |||
| b1587f0326 | |||
| ca7dd7d741 | |||
| 281b321237 | |||
| ba0e4bfc1d | |||
| 3cda62acf4 | |||
| 2ef43212e1 | |||
| f69eccc42b | |||
| a1e425f936 | |||
| 59618e0038 | |||
| ef1f1562f0 | |||
| 31177b7dc7 | |||
| 5b7aaff150 | |||
| b525a32b6e | |||
| 99fe610f72 | |||
| b5ec35e672 | |||
| 6186c3d866 | |||
| 1d0a6bdc71 | |||
| 15fa2b371c | |||
| 0799b47c9c | |||
| a216672443 | |||
| d755aa48bc | |||
| f7ecfe7257 | |||
| 89a0bbb8bf | |||
| 822c8425bd | |||
| a6b57a3423 | |||
| 6d4f7413a5 | |||
| 3e041052ee | |||
| 444174ef57 | |||
| 970f7e01a9 | |||
| 4432c07081 | |||
| 221c667a23 | |||
| b710c41c34 | |||
| 8825218361 | |||
| 1bb5c4e0d8 | |||
| 58343480ff | |||
| 399bf96a0c | |||
| b7c409e11b | |||
| fd08e9f2ad | |||
| 9a4d01da8f | |||
| 81cf748b2b | |||
| 7d8d96c049 | |||
| 081905dbc3 | |||
| a8b8f71092 | |||
| 36c1d88eac | |||
| 6eba672013 | |||
| 091c8ea5f1 | |||
| f5e49441b6 | |||
| 610f3ed37f | |||
| f215874486 | |||
| 8e529105cf | |||
| 95dc0c5fc8 | |||
| 73c8d3d09d | |||
| 049a0bf787 | |||
| 2095380ba4 | |||
| 081192d29e | |||
| 2429980fd5 | |||
| 0ac238d762 | |||
| 45320fd8ec | |||
| 6d33a13e23 | |||
| 52d64d03a6 | |||
| fe6e289606 | |||
| 26569ac51d | |||
| 38d04931ba | |||
| 96cf3d967f | |||
| 36325226eb | |||
| 6410f52c9c | |||
| 7ae14fffd0 | |||
| d213e3b106 | |||
| ba612f91c7 | |||
| 8312a8cf3b | |||
| 390dcc9a88 | |||
| cd1b45f0d6 | |||
| b8caa5dc31 | |||
| 53572b4d13 | |||
| cf0c773002 | |||
| 515fe8d9e5 | |||
| 06d1bd632b | |||
| 89f34246f0 | |||
| 7d8e128b5f | |||
| 14c642a3f7 | |||
| a67255475c | |||
| 04045dfc27 | |||
| 510a51e564 | |||
| 54b2c50109 | |||
| fe753f05df | |||
| ab76783f8b | |||
| 364a51b119 | |||
| a486db5e95 | |||
| c8e7d9e005 | |||
| 93aa690a6d | |||
| 87f1f78b67 | |||
| 0574a3db86 | |||
| 0178f3c9bb | |||
| 9eb3907d45 | |||
| 118c2a9db9 | |||
| 0a9222e1ee | |||
| e0db3c0b60 | |||
| e0a99730e5 | |||
| 6497bdf45a | |||
| ca430e2494 | |||
| f8439fd6e6 | |||
| 8dda7ddd04 | |||
| 5d8ea5752d | |||
| 4071d88290 | |||
| 0996570b78 | |||
| 0a9732a267 | |||
| 1bc06c9c24 | |||
| e0acc937b3 | |||
| 3a10a0129a | |||
| 18dbcf16cc | |||
| bed8dc7d34 | |||
| a0fc9844fd | |||
| 5cf748d135 | |||
| 9ddb56088e | |||
| 44dcf7af7d | |||
| 3262bee6c5 | |||
| 2dbd616725 | |||
| eb98563fa1 | |||
| 7f92e96ae7 | |||
| a48138dfd6 | |||
| 46980e5260 | |||
| 44f9e5495e | |||
| 97f59282cf | |||
| 2a4a5b1beb | |||
| 8369570b50 | |||
| 9ff0c414c1 | |||
| 850d1e7c28 | |||
| 2df823d2db | |||
| 2e84781594 | |||
| 833227f7f6 | |||
| e731cfd48d | |||
| cf7574d9b8 | |||
| 10d384f131 | |||
| 00b8c8ce47 | |||
| cab43f41be | |||
| fc0d589f12 | |||
| 743175d4ff | |||
| b497b07fed | |||
| aab5ed2267 | |||
| 46c9fe46e9 | |||
| e8c92c6fcc | |||
| 765eaf7f4f | |||
| 699c8cc1eb | |||
| 5839921e08 | |||
| a3bde6e1f1 | |||
| 0ece5bf178 | |||
| fbefad9eaf | |||
| 351a7a52fe | |||
| 8441ffda31 | |||
| e79747c919 | |||
| 8525d819c1 | |||
| fe600bb084 | |||
| babaff1985 | |||
| 909ca5440d | |||
| e25f64d03b | |||
| 2df66bd625 | |||
| 2028a5846c | |||
| 2fd2cd4cec | |||
| 17b175daa4 | |||
| 5cabe109da | |||
| c6e82448b6 | |||
| b846d89b5d | |||
| 322cea7342 | |||
| 205e1d404e | |||
| 9769a96ebd | |||
| 74d3192c2e | |||
| 41769a3fa8 | |||
| a7efa9d4e4 | |||
| 9ed69999a5 | |||
| e19a59b269 | |||
| d234016224 | |||
| c160d6d929 | |||
| 62ad60b4ad | |||
| d44d7c6bbd | |||
| efd97bad14 | |||
| bc884f5daf | |||
| 0f47b73a64 | |||
| e9c6e96452 | |||
| 09713311f6 | |||
| c666d9c553 | |||
| 3777e8d1ce | |||
| e60658c684 | |||
| 046da9efae | |||
| 09332f6c26 | |||
| ce507d891a | |||
| 96f122f901 | |||
| 3479525f39 | |||
| 4f9d4b0023 | |||
| bcdfd32bc0 | |||
| 693dde04e3 | |||
| f1bb019933 |
+3
-1
@@ -8,7 +8,9 @@ script:
|
||||
- make
|
||||
- ./bin/tests
|
||||
branches:
|
||||
only: master
|
||||
only:
|
||||
- master
|
||||
- stable
|
||||
notifications:
|
||||
email: false
|
||||
irc:
|
||||
|
||||
+27
-10
@@ -24,13 +24,14 @@
|
||||
#EQEMU_DISABLE_LOGSYS
|
||||
#EQEMU_COMMANDS_LOGGING
|
||||
#EQEMU_BUILD_SERVER
|
||||
#EQEMU_BUILD_LOGIN
|
||||
#EQEMU_BUILD_TESTS
|
||||
#EQEMU_BUILD_LOGIN
|
||||
#EQEMU_BUILD_TESTS
|
||||
#EQEMU_BUILD_PERL
|
||||
#EQEMU_BUILD_LUA
|
||||
#EQEMU_SANITIZE_LUA_LIBS
|
||||
#EQEMU_BUILD_CLIENT_FILES
|
||||
#EQEMU_MAP_DIR
|
||||
#EQEMU_ENABLE_PROFILING
|
||||
|
||||
#We set a fairly new version (as of 2013) because I found finding perl was a bit... buggy on older ones
|
||||
#Can change this if you really want but you should upgrade!
|
||||
@@ -103,7 +104,7 @@ IF(MSVC)
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} /SAFESEH:NO")
|
||||
SET(CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO} /SAFESEH:NO")
|
||||
ENDIF(EQEMU_DISABLE_SAFESEH)
|
||||
|
||||
|
||||
OPTION(EQEMU_BUILD_MSVC_MP "Enable build with multiple processes." ON)
|
||||
IF(EQEMU_BUILD_MSVC_MP)
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
@@ -115,7 +116,7 @@ IF(MSVC)
|
||||
STRING(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
||||
ENDIF(${flag_var} MATCHES "/MD")
|
||||
ENDFOREACH(flag_var)
|
||||
|
||||
|
||||
ADD_DEFINITIONS(-DNOMINMAX)
|
||||
ELSE(MSVC)
|
||||
#Normally set by perl but we don't use the perl flags anymore so we set it.
|
||||
@@ -126,6 +127,7 @@ ENDIF(MSVC)
|
||||
IF(UNIX)
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
ADD_DEFINITIONS(-DFREEBSD)
|
||||
ADD_DEFINITIONS(-D_GLIBCXX_USE_C99)
|
||||
SET(FREEBSD TRUE)
|
||||
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
@@ -256,10 +258,14 @@ OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
|
||||
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
|
||||
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
|
||||
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
|
||||
OPTION(EQEMU_ENABLE_PROFILING "Enable CPU profiler. Note: will slow down execution time." OFF)
|
||||
|
||||
#C++11 stuff
|
||||
IF(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
||||
IF("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-reserved-user-defined-literal")
|
||||
ENDIF()
|
||||
ENDIF(NOT MSVC)
|
||||
|
||||
#Various definitions
|
||||
@@ -289,6 +295,7 @@ ADD_DEFINITIONS(-DLOG_LEVEL_DEBUG=${EQEMU_LOG_LEVEL_DEBUG})
|
||||
ADD_DEFINITIONS(-DLOG_LEVEL_QUEST=${EQEMU_LOG_LEVEL_QUEST})
|
||||
ADD_DEFINITIONS(-DLOG_LEVEL_COMMANDS=${EQEMU_LOG_LEVEL_COMMANDS})
|
||||
ADD_DEFINITIONS(-DLOG_LEVEL_CRASH=${EQEMU_LOG_LEVEL_CRASH})
|
||||
ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
|
||||
|
||||
IF(EQEMU_STREAM_RETRANSMIT_ACKED_PACKETS)
|
||||
ADD_DEFINITIONS(-DRETRANSMIT_ACKED_PACKETS=true)
|
||||
@@ -301,31 +308,41 @@ FIND_PACKAGE(ZLIB REQUIRED)
|
||||
FIND_PACKAGE(MySQL REQUIRED)
|
||||
IF(EQEMU_BUILD_PERL)
|
||||
FIND_PACKAGE(PerlLibs REQUIRED)
|
||||
INCLUDE_DIRECTORIES("${PERL_INCLUDE_PATH}")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${PERL_INCLUDE_PATH}")
|
||||
ENDIF(EQEMU_BUILD_PERL)
|
||||
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
FIND_PACKAGE(EQLua51 REQUIRED)
|
||||
SET(Boost_USE_STATIC_LIBS OFF)
|
||||
SET(Boost_USE_MULTITHREADED ON)
|
||||
SET(Boost_USE_MULTITHREADED ON)
|
||||
SET(Boost_USE_STATIC_RUNTIME OFF)
|
||||
SET(BOOST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/boost")
|
||||
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}" "luabind")
|
||||
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${LUA_INCLUDE_DIR}" "${Boost_INCLUDE_DIRS}" "luabind")
|
||||
|
||||
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
|
||||
IF(EQEMU_SANITIZE_LUA_LIBS)
|
||||
ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS)
|
||||
ENDIF(EQEMU_SANITIZE_LUA_LIBS)
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
|
||||
INCLUDE_DIRECTORIES("${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm/glm")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_INCLUDE_DIRS}" "${MySQL_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/common/glm")
|
||||
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
ADD_SUBDIRECTORY(luabind)
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
|
||||
IF(EQEMU_ENABLE_PROFILING)
|
||||
ADD_DEFINITIONS(-DEQPERF_ENABLED)
|
||||
ADD_DEFINITIONS(-DEQP_MULTITHREAD)
|
||||
INCLUDE_DIRECTORIES("eqperf")
|
||||
ADD_SUBDIRECTORY(eqperf)
|
||||
SET(PERF_LIBS eqperf)
|
||||
ELSE(EQEMU_ENABLE_PROFILING)
|
||||
SET(PERF_LIBS "")
|
||||
ENDIF(EQEMU_ENABLE_PROFILING)
|
||||
|
||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
||||
ADD_SUBDIRECTORY(common)
|
||||
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
||||
|
||||
+680
@@ -1,5 +1,685 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
== 02/09/2015 ==
|
||||
Trevius: (RoF+) Setting Alt flag on characters in the Guild Management Window is now saved and functional for filtering.
|
||||
Trevius: (RoF+) Guild Invites between RoF+ and previous Clients is now functional.
|
||||
|
||||
== 02/08/2015 ==
|
||||
Kayen: Implemented npc specialability (44) COUNTER_AVOID_DAMAGE which when applied to the ATTACKING NPC will make their attacks more difficult to be avoided by riposte/dodge/parry/block.
|
||||
Parama0: Negative modifer value that affects ALL avoid damage types dodge/parry/riposte/block) chance on defender. Ie (44,50 = 50 pct reduction to ALL)
|
||||
Parama1: Negative modifer value that affects RIPOSTE chance on defender. Ie (44,1,0,50 = 50 pct reduction to riposte chance)
|
||||
Parama2: Negative modifer value that affects PARRY chance on defender. Ie (44,1,0,0,50 = 50 pct reduction to parry chance)
|
||||
Parama3: Negative modifer value that affects BLOCK chance on defender. Ie (44,1,0,0,0,50 = 50 pct reduction to block chance)
|
||||
Parama4: Negative modifer value that affects DODGE chance on defender. e (44,1,0,0,0,0,50 = 50 pct reduction to dodge chance)
|
||||
Example of usage: Player has Improved Dodge V (+50 pct dodge chance), you want to negate this bonus you would set 44,1,0,0,0,0,50 on your NPC.
|
||||
|
||||
== 02/07/2015 ==
|
||||
Akkadius: Reduced #repop time dramatically by taking down hundreds of individual SELECT/DELETE/INSERT queries in routines and bringing it down to very few
|
||||
See: https://www.youtube.com/watch?v=9kSFbyTBuAk
|
||||
|
||||
== 02/06/2015 ==
|
||||
Uleat: Updated returns for Inventory and ItemInst const iterators. (const == const)
|
||||
Uleat: Replaced 'iter_inst' and 'iter_contents' typedefs with their stl definitions
|
||||
Uleat: Removed 'limbo' from the 'HasItem' series of checks - including lore checks. The client excludes this range and it causes issues when performing item searches - dupe lore checks were added to account for this.
|
||||
Uleat: Updated command #iteminfo to show light source information and a few other things
|
||||
|
||||
== 02/05/2015 ==
|
||||
Trevius: Fixed Environmental Damage for RoF2.
|
||||
|
||||
== 02/03/2015 ==
|
||||
Trevius: Crashfix for TempName() when numbers are passed at the end of the name.
|
||||
Uleat: Tweaking of item type exclusions to alleviate strobing conditions with light sources
|
||||
|
||||
== 02/02/2015 ==
|
||||
Akkadius: Implement Packet logs with dumps
|
||||
- Category: 41: Packet: Server -> Client With Dump
|
||||
- Category: 42: Packet: Server -> Client With Dump
|
||||
See: http://wiki.eqemulator.org/p?Logging_System_Overhaul#packet-logging-levels
|
||||
|
||||
== 02/01/2015 ==
|
||||
demonstar55: Add quest debugging to lua
|
||||
eq.debug("Test debug level implicit 1")
|
||||
eq.debug("Test debug level explicit 1", 1)
|
||||
eq.debug("Test debug level explicit 2", 2)
|
||||
eq.debug("Test debug level explicit 3", 3)
|
||||
Akkadius: Add Packet Logging Categories
|
||||
- 5 - Packet: Client -> Server - Logs::Client_Server_Packet
|
||||
- 39 - Packet: Server -> Client - Logs::Server_Client_Packet
|
||||
- 40 - Packet: Client -> Server Unhandled - Logs::Client_Server_Packet_Unhandled
|
||||
See: http://wiki.eqemulator.org/p?Logging_System_Overhaul#packet-logging
|
||||
|
||||
== 01/31/2015 ==
|
||||
Trevius: Fixed FindGroundZ() and GetGroundZ() to once again utilize the X and Y arguments that are passed to them.
|
||||
|
||||
== 01/30/2015 ==
|
||||
Akkadius: Implemented event type "EVENT_ENVIRONMENTAL_DAMAGE"
|
||||
- This event triggers when taking any sort of environmental damage. Example use:
|
||||
sub EVENT_ENVIRONMENTAL_DAMAGE{
|
||||
quest::debug("EVENT_ENVIRONMENTAL_DAMAGE");
|
||||
quest::debug("env_damage is " . $env_damage);
|
||||
quest::debug("env_damage_type is " . $env_damage_type);
|
||||
quest::debug("env_final_damage is " . $env_final_damage);
|
||||
}
|
||||
Result: (Test falling in Velks): http://i.imgur.com/tPRL7yL.png
|
||||
- Implemented LUA counterpart of this same implementation above
|
||||
Akkadius (Bobaski): Add PoK New Merchant sql/git/optional/2015_01_30_poknowledge_spell_vendors.sql
|
||||
|
||||
== 01/29/2015 ==
|
||||
Trevius: Added more information to Mercenary Logging.
|
||||
Trevius: Added potential fix for Mercenaries that fail to unsuspend.
|
||||
Trevius: Added a new "statscale" field to the merc_stats table that can be used to quickly balance Mercenary Stats based on Level.
|
||||
Trevius: The new "statscale" field now combines with the Mercs::ScaleRate rule value (default 100 percent for both).
|
||||
|
||||
== 01/28/2015 ==
|
||||
Akkadius: Added Logs::DebugQuest category per request from Trevius (Great idea)
|
||||
- Exported quest::debug(log_message, [debug_level = 1)
|
||||
- Example:
|
||||
quest::debug("This is a test debug message, level 1 (default)");
|
||||
quest::debug("This is a test debug message, level 1", 1);
|
||||
quest::debug("This is a test debug message, level 2", 2);
|
||||
quest::debug("This is a test debug message, level 3", 3);
|
||||
|
||||
Result: http://i.imgur.com/6VoafGE.png
|
||||
- Uses traditional logging system to output this category
|
||||
- Required MySQL Source in Database version 9070
|
||||
|
||||
== 01/27/2015 ==
|
||||
Trevius: Removed "Mercenary Debug:" from the Mercenary Log entries.
|
||||
Trevius: Resolved duplicate "You have no Mercenaries" messages when zoning without owning a Mercenary.
|
||||
Trevius: Mercenaries should now always be able to unsuspend if the timer is up.
|
||||
Trevius: More work on Mercenaries and Grouping to reduce bugs and redundant queries.
|
||||
Uleat: Finished ClientVersion update to include patch file and namespace updates - don't forget to copy the renamed 'patch_UF.conf' into your eqemu directory.)
|
||||
|
||||
== 01/26/2015 ==
|
||||
Uleat: Changed Corpse::MoveItemToCorpse() to allow 'by address' passing of removed item slot list. Fixed a bug that kept soul-bound items inside of bags from attuning properly
|
||||
|
||||
== 01/25/2015 ==
|
||||
Trevius: Fixed an issue where Mercenaries were causing several DB queries per second while suspended.
|
||||
Trevius: Added Logs::Mercenaries to the new Logging System. Logging of Mercenary information is off by default with the required SQL.
|
||||
|
||||
== 01/24/2015 ==
|
||||
Uleat: Added equipment light source functionality to all mob derived classes (may still need tweaking...)
|
||||
Notes:
|
||||
- In addition to equipment light sources, innate npc_type light sources have already been activated
|
||||
- Valid light source values are 0 thru 15 (values are bitmask checked and limited to 0x0F)
|
||||
- Not all classes handle equipment light sources the same way due to their equipment/loot list configurations
|
||||
- Spell (casting?) light sources may be implemented at some point..more information is needed
|
||||
- Currently, loot list (general inventory) light sources are limited to ItemTypeMisc and ItemTypeLight to avoid issues with worn-specific light sources emitting
|
||||
- Augment light sources are not recognized by the client and, therefore, not implemented in the server code
|
||||
|
||||
== 01/22/2015 ==
|
||||
Akkadius: Massive Log System overhaul, see: http://wiki.eqemulator.org/p?Logging_System_Overhaul&frm=Main
|
||||
|
||||
== 01/21/2015 ==
|
||||
Uleat: Added `light` field to npc_types load query (all six clients tested positive for functionality.)
|
||||
Note: This only affects 'innate' light. Equipment (other) light is still in-work.
|
||||
Optional SQL: utils/sql/git/optional/2015_01_21_NPC_Types_Light_Field_Primer.sql
|
||||
|
||||
== 01/20/2015 ==
|
||||
Uleat: Fix for Inventory::_HasItemByUse(bucket) using the parent container when searching for bag container items.
|
||||
|
||||
== 01/19/2015 ==
|
||||
Uleat: Changed 'enum EQClientVersion' to 'enum class ClientVersion.' Other light modifications were made to accommodate this namespace. Added 'RoF2' to the lua client version enumeration.
|
||||
|
||||
== 01/15/2015 ==
|
||||
Uleat: Attempted fix for elusive inventory bug:
|
||||
- Removed 'iter_queue' typedef and converted lcast to explicit or auto defines
|
||||
- Reworked several functions that manipulate the cursor queue
|
||||
- Found/corrected one occurrence of post-processing iterator incrementing in an ItemInstQueue handler
|
||||
- Added many scope declarations in code that handles inventory manipulation (loose macros are bad...)
|
||||
Uleat: Added Item_Struct pointer checks to ItemInst methods that did not have them
|
||||
Uleat: Changed IsEquippable(race,class) to use bit-wise 'and' (&) over '(x%2)==1' in conditional check.
|
||||
Uleat: Changed DyeArmor() assignment of 'armor_color' to use bit-wise 'or' and bit-shifting (|,<<) over multiplication and addition (*,+).
|
||||
|
||||
== 01/13/2015 ==
|
||||
Uleat: Placed an upper limit on the cursor queue save loop.
|
||||
Trevius: (RoF2) Guild invites now add new members as members instead of recruits, and /guild chat works properly.
|
||||
Trevius: (RoF2) Guild Promote is now functional.
|
||||
|
||||
== 01/12/2015 ==
|
||||
Uleat: Fix for OP_FormattedMessage text link server crashes
|
||||
Uleat: Added text link translators for OP_TaskDescription (RoF+ -- all clients current)
|
||||
Uleat: Fix for load_bots.sql using '\\' as a delimiter (Changed to '$$')
|
||||
|
||||
== 01/11/2015 ==
|
||||
Uleat: Added text link translators for OP_TaskDescription (Ti thru UF..RoF+ in-work)
|
||||
|
||||
== 01/10/2015 ==
|
||||
Uleat: Added text link translators for OP_Emote
|
||||
|
||||
== 01/09/2015 ==
|
||||
Uleat: Added text link translators for OP_FormattedMessage
|
||||
|
||||
== 01/08/2015 ==
|
||||
Trevius: Added some extra checks and clean-up related to Groups and Mercenaries.
|
||||
|
||||
== 01/07/2015 ==
|
||||
Uleat: Excluded text link body from message scrambling in Client::GarbleMessage()
|
||||
Trevius: Mercenaries now load directly from tables only. The vwMercNpcTypes view is no longer required and can be deleted.
|
||||
Trevius: Query fix for group_leaders table. This may resolve some crashes/bugs related to Mercs/Bots and Groups.
|
||||
|
||||
== 01/06/2015 ==
|
||||
Trevius: Changed the pet command #defines to be based on RoF2 list of pet commands and added decodes to Titanium, SoF and SoD.
|
||||
Trevius: (RoF+) The /pet focus on/off and /pet hold on/off commands are now functional.
|
||||
Trevius: Added defines for all remaining pet commands and some support for them as well.
|
||||
|
||||
== 01/05/2015 ==
|
||||
Uleat: Fixed (added translators for) item/text links. Only 'OP_ChannelMessage' and 'OP_SpecialMesg' are currently handled..more text channels will be added as the need arises.
|
||||
|
||||
== 01/03/2015 ==
|
||||
Trevius: (RoF2) /shield (shielding) and /key (key ring) are both now functional after opcode updates.
|
||||
|
||||
== 01/02/2015 ==
|
||||
Trevius: (RoF2) *Hopefully* Fixed looting incorrect items from NPCs. Please report any issues!
|
||||
Trevius: (RoF2) Now able to loot items past the 10th slot on NPC corpses.
|
||||
Trevius: Attuned Items can now be auto-looted and will equip properly.
|
||||
Trevius: Mercenaries and Bots will no longer take a share from /split or /autosplit.
|
||||
|
||||
== 12/30/2014 ==
|
||||
Trevius: (RoF2) Aug Type 21 no longer shows the "Buy Now" button in the aug slot of items.
|
||||
Trevius: (RoF2) Identified the "Copied" item flag with the help of Uleat.
|
||||
|
||||
== 12/29/2014 ==
|
||||
Trevius: (RoF2) Identified a few Item Fields and resolved an issue with cloth armor not accepting certain augments that they should.
|
||||
Akkadius: Updated $client->UpdateTaskActivity to have optional argument ignore_quest_update IE: Client::UpdateTaskActivity(THIS, TaskID, ActivityID, Count, [ignore_quest_update])
|
||||
Akkadius: Also updated internal UpdateTaskActivity methods to optionally ignore quest based task updates to prevent feedback
|
||||
|
||||
== 12/28/2014 ==
|
||||
Uleat: Implemented class Client::TextLink as a replacement for the dozens of individual link formatters.
|
||||
|
||||
== 12/27/2014 ==
|
||||
Akkadius: Add option to automatic database upgrade script 5) Download latest Opcodes from Github
|
||||
Trevius: (RoF2) Fixed dropping items on the ground so they go to ground level instead of camera height.
|
||||
Trevius: Show Helm Option should be functional again.
|
||||
Kayen: Implemened npc special ability (43) CASTING_RESIST_DIFF which sets innate resist modifier on
|
||||
ALL spells used by that NPC. Ie. 43,1,-200 will set a -200 innate resist diff, so if your npc cast
|
||||
a spell that has a -10 resist modifier the final resist diff would be -210.
|
||||
|
||||
== 12/25/2014 ==
|
||||
Uleat: Updated 'links' code for all clients
|
||||
|
||||
== 12/24/2014 ==
|
||||
Trevius: (RoF+) Added herosforgemodel field to the npc_types table.
|
||||
Trevius: (RoF2) Updated item links from #npcstat command output.
|
||||
Trevius: (RoF+) Implemented Hero's Forge Armor for NPCs. Set the herosforgemodel field in npc_types table to the model (example: 84 for full set, or 12107 for robe).
|
||||
Trevius: (RoF+) Hero's Forge Armor now overrides NPC texture settings. To display Hero's Forge Armor Helms, set helmtexture field to anything other than 0.
|
||||
|
||||
== 12/23/2014 ==
|
||||
Uleat: Tidied up some ItemInst* declarations and added some nullptr checks.
|
||||
Trevius: (RoF+) Added support for Hero's Forge Robe Models. Set herosforgemodel field in items table to exact model such as 11607, 11707, etc.
|
||||
|
||||
== 12/22/2014 ==
|
||||
Trevius: (RoF2) Fixed Tracking.
|
||||
Trevius: (RoF+) Added a work-around for the cursor buffer issue.
|
||||
|
||||
== 12/21/2014 ==
|
||||
Trevius: (RoF2) Fixed Extended Targets Window by correcting opcodes.
|
||||
Trevius: (RoF/RoF2) Fixed Guild Rank in the Player Profile, which prevents the guild rank message on login/zone.
|
||||
|
||||
== 12/20/2014 ==
|
||||
Akkadius: Updated #cvs to display RoF2 Client Stream count
|
||||
|
||||
== 12/19/2014 ==
|
||||
Trevius: (RoF2) Fixed Leadership AA Purchasing and Recipe Search by correcting opcodes.
|
||||
Trevius: Fixed Armor Tinting (players and NPCs) that was broken during a previous update.
|
||||
Trevius: (RoF2) Fixed Rest Timer, Show Helm Option, Auto-Consent Options, and identified Krono in the PP.
|
||||
Trevius: Fixed Selling for Alternate Currency Merchants for RoF and RoF2.
|
||||
|
||||
== 12/18/2014 ==
|
||||
Trevius: Finished lining up the RoF2 Player Profile Struct. Zone times are now normal, and everything from the PP is accurate in game now.
|
||||
Trevius: Fixed zoning after death for RoF2.
|
||||
|
||||
== 12/17/2014 ==
|
||||
demonstar55: Use vectors for route stuff, should be more CPU cache friendly so faster
|
||||
Secrets: EQStream changes as recommended by a community member in private.
|
||||
|
||||
== 12/15/2014 ==
|
||||
Trevius: (RoF+) Implemented the 6th Augment Slot for Items.
|
||||
Trevius: Player Corpses now saved attuned settings for Items.
|
||||
|
||||
Required SQL: utils/sql/git/required/2014_12_15_multiple_table_updates.sql
|
||||
|
||||
== 12/13/2014 ==
|
||||
demonstar55: Fix guild rank spam on zone (needed to be in OP_PP).
|
||||
Trevius: (RoF+) Implemented Armor Ornamentation using Hero's Forge Armor Models. To use, create an ornamentation augment and set the herosforgemodel field in the items table.
|
||||
Trevius: (RoF+) Added command #heromodel (#hm for short) - Usage: #heromodel [hero forge model] [ [slot] ] (example: #heromodel 63)
|
||||
|
||||
Be sure to run this or there will be item loss:
|
||||
Required SQL: utils/sql/git/required/2014_12_13_inventory_table_update.sql
|
||||
|
||||
== 12/12/2014 ==
|
||||
demonstar55: Add special attack 42, Ignore Root Aggro Rules. This allows you to root a mob and have them still use the normal aggro rules (so they will attack the one with most hate, not closest)
|
||||
|
||||
== 12/09/2014 ==
|
||||
Trevius: (RoF+) Implemented Hero's Forge Armor Models for Items. To use, set herosforgemodel field in the item table to a model number such as 63 (for example).
|
||||
demonstar55: SoF+ swarm pets will no longer be F8able (without a hack!)
|
||||
|
||||
== 12/08/2014 ==
|
||||
Secrets: Added a feature that allows an EQ client to log in directly to World without having to enter the LoginServer, provided the 'password' field is set in WorldServer.
|
||||
|
||||
== 12/04/2014 ==
|
||||
Kayen: Ranged attacks will now more accurately check MAX firing range, fixing the issue where you would
|
||||
hit ranged attack and nothing would happpen due to incorrect server side range checks.
|
||||
Trevius: Initial addition of the RoF2 client from May 10th 2013 (currently available on Steam as the F2P client).
|
||||
Trevius: RoF2 is disabled by default, but you can enable by editing /common/patches/patches.cpp (see comments)
|
||||
|
||||
== 12/01/2014 ==
|
||||
Trevius: Mercenaries now spawn as the same Gender and Size of the Merchant they are purchased from.
|
||||
Trevius: Mercenaries now spawn with randomized facial features when purchased.
|
||||
Trevius: Setting a lastname for NPCs will now override any hard coded lastname (such as GM Trainers).
|
||||
|
||||
Required SQL: utils/sql/git/required/2014_12_01_mercs_table_update.sql
|
||||
|
||||
== 11/28/2014 ==
|
||||
Trevius: Fixed a zone crash related to numhits for spells.
|
||||
Trevius: Fixed a query related to group leaders logging in.
|
||||
Trevius (Natedog): Fixed a world crash related to attempting to join an adventure with Mercenaries.
|
||||
|
||||
== 11/27/2014 ==
|
||||
Kayen: Projectiles (ie Arrows) fired from archery will now do damage upon impact instead of instantly (consistent w/ live).
|
||||
Optional SQL: utils/sql/git/optional/2014_11_27_ProjectileDmgOnImpact.sql
|
||||
|
||||
== 11/25/2014 ==
|
||||
Trevius: Spells that modify model size are now limited to 2 size adjustments from the base size.
|
||||
Trevius: Fix to prevent Mercenaries from being set as Group Leader.
|
||||
|
||||
== 11/24/2014 ==
|
||||
Trevius: Added Rule NPC:EnableMeritBasedFaction (disabled by default) - Allows faction gain to work similar to experience.
|
||||
|
||||
== 11/22/2014 ==
|
||||
Trevius: Grouping with Mercenaries is now considerably less buggy.
|
||||
Trevius: Fixed an issue with Spell Globals related to high Character IDs.
|
||||
Trevius: Crash fix for Swarm Pets.
|
||||
|
||||
== 11/19/2014 ==
|
||||
Trevius: Mercenaries now Dismiss, Suspend, Unsuspend, and Die correctly.
|
||||
|
||||
== 11/18/2014 ==
|
||||
Trevius: Mercenaries can now zone once again.
|
||||
|
||||
== 11/17/2014 ==
|
||||
demonstar55: Correct OP_AugmentInfo reply. This fixes RoF display issue with Adventurer's Stone. Still issues with UF/SoF/SoD though.
|
||||
|
||||
== 11/16/2014 ==
|
||||
demonstar55: fix size issue with ControlBoat_Struct and exploit fix in OP_BoardBoat
|
||||
|
||||
Akkadius: Implemented Automatic Database update and versioning system
|
||||
Akkadius: Created database revision define, this is located in version.h in common #define CURRENT_BINARY_DATABASE_VERSION 9057
|
||||
- This revision define will need to be incremented each time a database update is made
|
||||
- Along with a revision define increment, you will need to update the db_update manifest located in:
|
||||
- https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt
|
||||
- An entry needs to be made at the bottom of the manifest, the entry is quite simple
|
||||
- Example: 9057|2014_11_13_spells_new_updates.sql|SHOW COLUMNS FROM `spells_new` LIKE 'disallow_sit'|empty|
|
||||
- This latest example is checking to see if the spells_new table contains the column 'disallow_sit', if its empty, the update needs to be ran
|
||||
- More examples of match types below:
|
||||
# Example: Version|Filename.sql|Query_to_Check_Condition_For_Needed_Update|match type|text to match
|
||||
# 0 = Database Version
|
||||
# 1 = Filename.sql
|
||||
# 2 = Query_to_Check_Condition_For_Needed_Update
|
||||
# 3 = Match Type - If condition from match type to Value 4 is true, update will flag for needing to be ran
|
||||
# contains = If query results contains text from 4th value
|
||||
# match = If query results matches text from 4th value
|
||||
# missing = If query result is missing text from 4th value
|
||||
# empty = If the query results in no results
|
||||
# not_empty = If the query is not empty
|
||||
# 4 = Text to match
|
||||
- The manifest contains all database updates 'Required' to be made to the schema, and it will contain a working backport all the way back to SVN -
|
||||
currently it is tested and backported through the beginning of our Github repo
|
||||
- On world bootup or standalone run of db_update.pl, users will be prompted with a simple menu that we will expand upon later:
|
||||
|
||||
============================================================
|
||||
EQEmu: Automatic Database Upgrade Check
|
||||
============================================================
|
||||
Operating System is: MSWin32
|
||||
(Windows) MySQL is in system path
|
||||
Path = C:\Program Files\MariaDB 10.0\bin/mysql
|
||||
============================================================
|
||||
Binary Database Version: (9057)
|
||||
Local Database Version: (9057)
|
||||
|
||||
Database up to Date: Continuing World Bootup...
|
||||
============================================================
|
||||
Retrieving latest database manifest...
|
||||
URL: https://raw.githubusercontent.com/EQEmu/Server/master/utils/sql/db_update_manifest.txt
|
||||
Saved: db_update/db_update_manifest.txt
|
||||
|
||||
Database Management Menu (Please Select):
|
||||
1) Backup Database - (Saves to Backups folder)
|
||||
Ideal to perform before performing updates
|
||||
2) Backup Database Compressed - (Saves to Backups folder)
|
||||
Ideal to perform before performing updates
|
||||
3) Check for pending Database updates
|
||||
Stages updates for automatic upgrade...
|
||||
0) Exit
|
||||
|
||||
Akkadius: Created db_update.pl, placed in utils/scripts folder, used for the automatic database update routine (Linux/Windows)
|
||||
- db_update.pl script created db_version table if not created, if old one is present it will remove it
|
||||
Akkadius: Created db_dumper.pl, placed in utils/scripts folder, used for the automatic database update routine backups and standalone backups (Linux/Windows)
|
||||
Akkadius: World will now check the db_update.pl script on bootup, if the db_update.pl script is not present, it will fetch it remotely before running -
|
||||
when db_update.pl is done running, world will continue with bootup
|
||||
|
||||
== 11/15/2014 ==
|
||||
Uleat(Natedog): A better fix for OP_ShopPlayerBuy - doesn't cause the issues that I introduced
|
||||
Kayen: Implemented NPC Special Ability 41 'Allow To Tank', gives NPC opportunity to take aggro over a client in melee range.
|
||||
Kayen: Updated swarm pet AI to be consistent with live.
|
||||
|
||||
*OLD AI: Swarm pet would lock on to target until target died, then depop as soon as target died.
|
||||
|
||||
*NEW AI: Swarm pet will attack cast on target, NOT perma locked it can change targets if attacked
|
||||
by something else that generate more hate. When target dies swarm pet will follow owner, if owner is
|
||||
attacked by something else the swarm pet will attack it (until duration timer despawns the pet).
|
||||
|
||||
Kayen: Updated perl quest function: MakeTempPet(Tspell_id, name=nullptr, duration=0, target=nullptr, sticktarg=0)
|
||||
Kayen: Implemented perl quest function: Mob::TypesTempPet(npctypesid, name=nullptr, duration=0, follow=0, target=nullptr, sticktarg=0)
|
||||
Note: 'sticktarg' field will cause the swarm pet to use the OLD AI
|
||||
|
||||
Rule to use OLD AI only - default is disabled.
|
||||
Optional SQL: utils/sql/git/optional/2014_11_15_SwarmPetTargetLock.sql
|
||||
|
||||
== 11/14/2014 ==
|
||||
Secrets: Identified object size and solidtype as flags. Exported them as functions to Perl.
|
||||
demonstar55: Don't use the hack for charms that doesn't work on RoF
|
||||
demonstar55: UF too
|
||||
demonstar55: Tit
|
||||
demonstar55: SoF
|
||||
demonstar55: SoD
|
||||
demonstar55: 62 (untested)
|
||||
|
||||
== 11/13/2014 ==
|
||||
Kayen: Implemented target type (44) 'Beams' (which projects an AE infront of caster with a specified length and width).
|
||||
Kayen: Implemented target type (32) AE Target HateList
|
||||
Kayen: Implemented target type (36) Area Client Only
|
||||
Kayen: Implemented target type (37) Area PC Only
|
||||
Kayen: Implemented target type (39) Group No Pet
|
||||
Uleat: PlayerLogMerchantTransactions does not support partial stack purchase logging at this time
|
||||
|
||||
== 11/12/2014 ==
|
||||
Uleat: Changed 'GMTrainee' struct to reflect the actual client hard-coded max skill count (100) - applies to all currently supported clients (6.2->RoF)
|
||||
|
||||
== 11/11/2014 ==
|
||||
Uleat: Third attempt at a fix for GM trainer zone crashes... (this is starting to look like a KLS fix...)
|
||||
|
||||
== 11/10/2014 ==
|
||||
Uleat: Fix for GM Trainer crashing server (really!)
|
||||
JJ: Yellow faction messages.
|
||||
|
||||
== 11/09/2014 ==
|
||||
Kayen: Implemented support for spell target type (45) 'Target Rings' on Underfoot (does work earlier expansions). Thanks to Lecht for figuring out the op_code side.
|
||||
JJ: Implement new Live-like faction adjustment message using rule Client:UseLiveFactionMessage.
|
||||
Optional SQL: utils/sql/git/optional/2014_11_09_LiveFactionMessages.sql
|
||||
|
||||
== 11/06/2014 ==
|
||||
demonstar55: Tracking default sort will now be correct order
|
||||
Trevius: Fixed dynamic merchant list loading. Allows any merchant to be used in any zone.
|
||||
|
||||
== 11/03/2014 ==
|
||||
Secrets: Fixed an overflow in melee lifetap calculations (int16 vs int32)
|
||||
Secrets: Fixed overflow on AC and ATK values that can go out of range.
|
||||
Secrets: Merc/Bot fixes for previous updates.
|
||||
Secrets: Changed a lot of int16s for stat-related functions to int32 because they were causing combat formula overflows (int16/int32 mismatch).
|
||||
Secrets: Linux fix?
|
||||
|
||||
== 11/02/2014 ==
|
||||
Akkadius: Added out of range checking for Spell Save/Loads
|
||||
|
||||
== 11/01/2014 ==
|
||||
Trevius: Fixed potential crash related to Pets/Mercs buffs when targeting themselves.
|
||||
JJ: (noudess) Revamped faction system. See https://github.com/EQEmu/Server/pull/256
|
||||
|
||||
== 10/28/2014 ==
|
||||
Uleat: Added Client::InterrogateInventory(). Can be invoked by #interrogateinv and is also called when Handle_OP_MoveItem() calls for SwapItemResync()
|
||||
|
||||
== 10/22/2014 ==
|
||||
Uleat: Fix for stacking items in a world object..added a new command option: #peekinv world - will show world container contents, if one is in use by target.
|
||||
|
||||
== 10/20/2014 ==
|
||||
demonstar55: Inspect Buffs rank 1 will now show NPC buffs in target window (SoD+)
|
||||
|
||||
== 10/19/2014 ==
|
||||
Uleat: Updated command #peekinv to display item links properly in RoF clients
|
||||
demonstar55: Group Mentoring in raids
|
||||
demonstar55: Inspect Buffs (text only version) works in raid groups
|
||||
demonstar55: Make use of the Inspect Buffs op/packet. 62 SOL until someone finds its op
|
||||
|
||||
== 10/18/2014==
|
||||
demonstar55: Implement group mentor, sharing leadership exp (SoF+ only)
|
||||
demonstar55: Add gaining of group leadership while in raids
|
||||
|
||||
== 10/16/2014 ==
|
||||
Uleat: Fixed the auto-conversion view naming error and renamed the views in the script files. Added a fix sql for databases that auto-converted.
|
||||
Fix SQL: ../sql/git/bots/deprecated/2014_10_16_Lower_Case_View_Fix.sql
|
||||
|
||||
== 10/15/2014 ==
|
||||
Uleat: Cleaned up load/drop bots sqls, added '../utils/sql/git/bots/deprecated' and '../deprecated/load_bots_old.sql' (use this file on pre-player blob conversion databases.)
|
||||
Notes: I modifed the behavior of both load and drop bots to fail on the first operation if their modifications have been performed already.
|
||||
'load_bots.sql' will explicitly add bot schema, while 'drop_bots.sql' will explicitly drop it. I also added a few lines to change
|
||||
a few altered tables back to their original state - as of the date in the file.
|
||||
|
||||
== 10/13/2014 ==
|
||||
demonstar55: Partially implement leadership and raids
|
||||
Currently working: client side only effects and stat bonuses.
|
||||
Not working: Mark NPC, and other stuff that need extra server side support
|
||||
Currently only UF tested (Tit and 62 may just work, others need packet work)
|
||||
|
||||
== 10/12/2014 ==
|
||||
Akkadius: Fix for LDON Character Stat load
|
||||
|
||||
== 10/11/2014 ==
|
||||
demonstar55: Implement Raid MOTD for UF
|
||||
Don't forget 2014_10_11_RaidMOTD.sql!
|
||||
|
||||
== 10/09/2014 ==
|
||||
Uleat: Added 'BOTS' conversion code to supplement the database 'PlayerProfile' blob conversion that Akkadius recently implemented.
|
||||
Note: This automatic conversion uses the view `vwbotcharactermobs` as an update vector. If you need/would like for the converter to run on
|
||||
previously and/or manually changed code, or just have a need for it to re-run, change the following in the database view and save:
|
||||
"c.`last_login`," to "c.`timelaston`,"
|
||||
"c.`zone_id`" to "c.`zoneid`"
|
||||
"FROM `character_data` AS c" to "FROM `character_old` AS c"
|
||||
** This will only work if you haven't deleted your `character_old` table **
|
||||
|
||||
== 10/07/2014 ==
|
||||
demonstar55: Identified tutorial flag in all charcreate packets, reworked logic to correctly set homes binds
|
||||
|
||||
== 10/05/2014 ==
|
||||
Uleat: Added Server<->Corpse slot translators needed for re-enumeration (inactive until phased in)
|
||||
|
||||
== 10/03/2014 ==
|
||||
Uleat: Fixed Ti(6.2) OP_AugmentInfo translation that I broke (does not currently need and I mis-read a process)
|
||||
Uleat: Moved client patch OP_LootItem slot translation to external handlers
|
||||
|
||||
== 10/02/2014 ==
|
||||
Kayen: Exported to PERL $client->SendSpellAnim(targetid, spellid)
|
||||
This function sends the spell graphic of a spell without actually having to cast the spell.
|
||||
|
||||
== 10/02/2014 ==
|
||||
Uleat: First round of Ti/6.2 translators added - needed for re-enumeration
|
||||
|
||||
== 10/01/2014 ==
|
||||
Kayen: Exported to PERL $client->SendColoredText(color, msg)
|
||||
demonstar55: Exported SendColoredText to lua
|
||||
|
||||
== 09/30/2014 ==
|
||||
Uleat: Implemented click-casting from bag slots for clients that natively support it (RoF)
|
||||
|
||||
== 09/28/2014 ==
|
||||
demonstar55: Add support for post June 18, 2014 Hundred Hands Effect spells (they changed the formula and stuff)
|
||||
set Spells:Jun182014HundredHandsRevamp to true if you're using a spell file from June 18, 2014+
|
||||
|
||||
== 09/27/2014 ==
|
||||
Kayen: Implemented perl function $mob->GetSpellStat(spell_id, identifier, slot);
|
||||
Note: identifier is the stat field in spells_new, slot is used for certain effects like effectid, base,base2, max ect.
|
||||
Example $mob->GetSpellStat(121, "range"); //Returns spell range
|
||||
Example $mob->GetSpellStat(121, "effectid", 1); //Returns the the value of effectid1
|
||||
This will allow you to pull almost all the data for any spell in quest files.
|
||||
demonstar55: Move the client's SetAttackTimer to the end of Client::CalcBonuses to keep the haste in sync
|
||||
demonstar55: Correct haste/slow "stacking" rules
|
||||
demonstar55: Correct SE_AttackSpeed4 to respect unslowable
|
||||
demonstar55: Make the haste be between 1-225 like the client (<100 = slow, >100 = haste) to ...
|
||||
demonstar55: Correct Hundred Hands effect and use formula provided by devs
|
||||
|
||||
== 09/24/2014 ==
|
||||
Uleat: Re-ordered server opcodes and handlers to give them some predictability of location (I need this for the inventory re-enumeration.)
|
||||
demonstar55: Added helper function bool EQEmu::IsTradeskill(uint32 skill)
|
||||
|
||||
== 09/23/2014 ==
|
||||
Kayen: Spell recourse effects will now be applied AFTER the base spells effects have been applied (consistent with live).
|
||||
Kayen: SE_ApplySpell and SE_TriggerSpell will now be applied based on which effect slot they are used in (instead of always before all spell effects are checked).
|
||||
Note: If a spell has multiple SE_TriggerSpell effects within it. Only one will be able to trigger. (If you want multiple spells use SE_ApplySpell)
|
||||
|
||||
== 09/22/2014 ==
|
||||
Akkadius: #resetaa now covers the function of #resetaa and #refundaa
|
||||
- #resetaa will wipe all AA data, refund the spent points into the available points and send character to character select properly
|
||||
Akkadius: Removed #refundaa
|
||||
Akkadius: Removed a lot of debug code for blob conversion
|
||||
Akkadius: Changed status logging for loads/saves to Debug category
|
||||
|
||||
== 09/21/2014 ==
|
||||
Akkadius: Player Profile Blob to Database Conversion
|
||||
- Summary: HUGE difference in database speeds reads/writes and 1:10 datasize difference
|
||||
- The new character storage engine unlike the character_ table before, is able to properly index data and make use of
|
||||
proper MySQL/MariaDB caching optimizations and performance has increased phenominally
|
||||
PERFORMANCE AND STATISTICS FIGURES (Varies on hardware):
|
||||
- EZ Server Character data size of 2.6GB `character_` table alone now takes up approx 600MB
|
||||
- Character Data Loads take approx .03 seconds BEFORE MySQL/MariaDB cache
|
||||
- Character Data Loads take approx .001-.0035 seconds AFTER MySQL/MariaDB cache
|
||||
- Character Data Saves take approx .0001 - .003 for any particular save operation
|
||||
- Database Auto Conversion: When the 'character_' table exists, World boot-up will queue an auto-conversion prompt and convert all of your characters, BACKUP
|
||||
YOUR DATABASE BEFORE CONVERTING, here is an EASY backup script: http://wiki.eqemulator.org/p?MySQL_DB_Backup_Script
|
||||
- On auto conversion, the following tables are created automatically:
|
||||
- Table: `character_skills` - Stores Character Skills
|
||||
- Table: `character_languages` - Stores Character Language
|
||||
- Table: `character_bind` - Stores Character Bind point and Home Bind point designated by is_home bool field
|
||||
- Table: `character_alternate_abilities` - Stores all Character AA
|
||||
- Table: `character_currency` - Stores all Platinum/Gold/Silver/Copper and character related currencies
|
||||
- Table: `character_data` - Stores basic character data (Fields from `character_` table migrated to this table)
|
||||
- Table: `character_spells` - Stores character spells
|
||||
- Table: `character_memmed_spells` - Stores character memorized spells
|
||||
- Table: `character_disciplines` - Stores character disciplines
|
||||
- Table: `character_material` - Stores character armor dye textures
|
||||
- Table: `character_tribute` - Stores character tributes
|
||||
- Table: `character_bandolier` - Stores character bandoliers
|
||||
- Table: `character_inspect_messages` - Stores character inspection messages (Moved from `character_` table)
|
||||
- Table: `character_leadership_abilities` - Stores character Leadership AAs
|
||||
- Loads: Majority of Player profile loads now occur at Client::Handle_Connect_OP_ZoneEntry
|
||||
LoadCharacterFactionValues(uint32 character_id, faction_map & val_list);
|
||||
LoadCharacterSpellBook(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterMemmedSpells(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterLanguages(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterDisciplines(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterSkills(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterData(uint32 character_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp);
|
||||
LoadCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterBindPoint(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterMaterialColor(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterBandolier(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterPotions(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
LoadCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
- Saves: Occur all over the code now instead of calling full saves
|
||||
SaveCharacterBindPoint(uint32 character_id, uint32 zone_id, uint32 instance_id, float x, float y, float z, float heading, uint8 is_home);
|
||||
SaveCharacterCurrency(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
SaveCharacterData(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp, ExtendedProfile_Struct* m_epp);
|
||||
SaveCharacterAA(uint32 character_id, uint32 aa_id, uint32 current_level);
|
||||
SaveCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
|
||||
SaveCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
|
||||
SaveCharacterMaterialColor(uint32 character_id, uint32 slot_id, uint32 color);
|
||||
SaveCharacterSkill(uint32 character_id, uint32 skill_id, uint32 value);
|
||||
SaveCharacterLanguage(uint32 character_id, uint32 lang_id, uint32 value);
|
||||
SaveCharacterDisc(uint32 character_id, uint32 slot_id, uint32 disc_id);
|
||||
SaveCharacterTribute(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
SaveCharacterBandolier(uint32 character_id, uint8 bandolier_id, uint8 bandolier_slot, uint32 item_id, uint32 icon, const char* bandolier_name);
|
||||
SaveCharacterPotionBelt(uint32 character_id, uint8 potion_id, uint32 item_id, uint32 icon);
|
||||
SaveCharacterLeadershipAA(uint32 character_id, PlayerProfile_Struct* pp);
|
||||
- Deletes:
|
||||
DeleteCharacterSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
|
||||
DeleteCharacterMemorizedSpell(uint32 character_id, uint32 spell_id, uint32 slot_id);
|
||||
DeleteCharacterDisc(uint32 character_id, uint32 slot_id);
|
||||
DeleteCharacterBandolier(uint32 character_id, uint32 band_id);
|
||||
DeleteCharacterLeadershipAAs(uint32 character_id);
|
||||
- Now occur all over the code and only trigger when necessary
|
||||
- Two FULL saves when looting a corpse, this has been reduced to just currency saves on initial loot and trimmed to one save since AddToMoneyPP did it already
|
||||
- Every time a player moves coin with any situation (Splits/Trades/Merchant/Skills/Bank Coin Exchange/Coin Moves), a full save is made, this is now just a currency save
|
||||
- Every time a player skilled up at a skill vendor, a full blob save hit was made, this is not just a currency hit
|
||||
- Every time an AA was purchased, a full save was made
|
||||
- Every time a spell was scribed/swapped, disc was trained
|
||||
- When a client exists a zone, when a client enters a zone
|
||||
- NOTE: These amount of excessive saves have caused scalability issues that cause the `character_` table to hang which causes process hangs that affect the whole server
|
||||
because of the slowness of the `character_` table and the blob not allowing any indexing to occur
|
||||
- All functions that once depended on the `character_` table are now rewritten to appropriately read from the `character_data` table
|
||||
- Database query errors that occur during conversion or from and load/save/delete character functions are now leveraged via ThrowDBError and logs now go to
|
||||
Server_Folder_Root/eqemu_query_error_log.txt (You cannot log errors natively through MySQL)
|
||||
- DBASYNC IS NOW COMPLETELY REMOVED - This was mainly for Character data async loads/saves and merchantlist loads
|
||||
- Side implementations:
|
||||
Perl Exports:
|
||||
- quest::crosszonesetentityvariablebynpctypeid(npctype_id, id, m_var) - Sets entity variables world wide with specified npctype_id
|
||||
- quest::crosszonesignalnpcbynpctypeid(npctype_id, data) - Signals all NPC entities world wide with specified npctype_id
|
||||
- $client->GetTaskActivityDoneCount(TaskID, ActivityID) - Gets task activity done count by task id and activity id for client entity
|
||||
|
||||
VIEW TABLE SIZE AFTER CONVERT:
|
||||
|
||||
SELECT CONCAT(table_schema, '.', table_name) as table_name,
|
||||
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows,
|
||||
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA,
|
||||
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx,
|
||||
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size,
|
||||
ROUND(index_length / data_length, 2) idxfrac
|
||||
FROM information_schema.TABLES
|
||||
WHERE `table_name` LIKE 'character_%'
|
||||
ORDER BY DATA DESC;
|
||||
|
||||
== 09/20/2014 ==
|
||||
demonstar55: Fix crash in SendEnterWorld on illegally long names
|
||||
demonstar55: The client only lets you enter 15 characters for your name (UF at least)
|
||||
demonstar55: Add rule Spells:SHDProcIDOffByOne for pre-UF spell file, set to true, UF+ set to false
|
||||
KLS: #suspend and #ban now have required messages to record the reason for the ban/suspension.
|
||||
|
||||
== 09/19/2014 ==
|
||||
demonstar55: Added Client::Tell_StringID (used in tell queue messages)
|
||||
demonstar55: Tell queues (and offline) messages now show correctly
|
||||
demonstar55: Fix starting with capital check
|
||||
|
||||
== 09/18/2014==
|
||||
demonstar55: Implement tell queues
|
||||
Currently set to a limit of 20 by default (World:TellQueueSize) I was unable to hit the limit on live though (100+)
|
||||
The required SQL nukes the old tell queue table, which may or may not be in your DB
|
||||
Optional SQL adds the rule to the DB to allow easy of change
|
||||
Note: this does not play well with multiple sessions with the same name on (crash and relog and have multiple sessions) but normal tells don't play well either
|
||||
|
||||
== 09/16/2014 ==
|
||||
demonstar55: Implement spell formula 137 (BER AA Desperation)
|
||||
Uleat (NateDog): Fix for LoadBuffs() crash when a spell with a non-persistent Illusion effect was loaded.
|
||||
demonstar55: Fix some effect calcs + implement more (derived from the client)
|
||||
|
||||
== 09/15/2014 ==
|
||||
Kayen: Nimbus effects will now be reapplied after zoning and will be removed when associated buff fades.
|
||||
|
||||
== 09/13/2014 ==
|
||||
demonstar55: Fix rogues not having Thieves' Cant
|
||||
|
||||
== 09/09/2014 ==
|
||||
demonstar55: Incrase Mob kick/bash timer by 3
|
||||
see: http://www.eqemulator.org/forums/showthread.php?t=38734
|
||||
demonstar55: Fix slow effect on NPC special attack reuse timers
|
||||
see: http://www.eqemulator.org/forums/showthread.php?t=38734
|
||||
demonstar55: Slow fixes to bots!
|
||||
demonstar55: Revamped how NPC attack rate is set
|
||||
SQL: 2014_09_09_attack_delay.sql
|
||||
demonstar55: Added attackdelay to #npcedit
|
||||
|
||||
== 09/08/2014 ==
|
||||
demonstar55: Fix slow calc
|
||||
see: http://www.eqemulator.org/forums/showthread.php?t=38734
|
||||
|
||||
== 09/07/2014 ==
|
||||
Akkadius: Fixed ROF Augment item dupe with not checking for available slots properly and adding items to the virtual instance
|
||||
|
||||
== 09/06/2014 ==
|
||||
Uleat: Tweaked 'Smart' trading code to return main slots before sub slots in stackable and free space search processes. (If enough people ask for it, I'll add an optional rule to allow 'bag packing' - the original implementation behavior)
|
||||
|
||||
== 09/05/2014 ==
|
||||
Uleat: Fix for cursor item loss when zoning. (Thanks to the other devs who traced and fixed the 'macro' issue!)
|
||||
demonstar55: Fix size getting nuked with lua's SendIllusionPacket
|
||||
|
||||
== 09/03/2014 ==
|
||||
Secrets: Identified the routines needed to augment items in RoF. Currently, only Insert and Remove are supported. Swap and Destroy do not work due to missing functions related to the cursor.
|
||||
demonstar55: Added work around command to show numhits on your buffs (#shownumhits)
|
||||
|
||||
@@ -11,15 +11,17 @@ ADD_EXECUTABLE(export_client_files ${export_sources} ${export_headers})
|
||||
|
||||
INSTALL(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(export_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(export_client_files common ${PERF_LIBS} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(export_client_files PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
TARGET_LINK_LIBRARIES(export_client_files "Ws2_32.lib")
|
||||
TARGET_LINK_LIBRARIES(export_client_files "rpcrt4")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(MINGW)
|
||||
TARGET_LINK_LIBRARIES(export_client_files "WS2_32")
|
||||
TARGET_LINK_LIBRARIES(export_client_files "rpcrt4")
|
||||
ENDIF(MINGW)
|
||||
|
||||
IF(UNIX)
|
||||
@@ -30,6 +32,7 @@ IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(export_client_files "rt")
|
||||
ENDIF(NOT DARWIN)
|
||||
TARGET_LINK_LIBRARIES(export_client_files "pthread")
|
||||
TARGET_LINK_LIBRARIES(export_client_files "uuid")
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
ENDIF(UNIX)
|
||||
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../../common/debug.h"
|
||||
|
||||
#include "../../common/eqemu_logsys.h"
|
||||
#include "../../common/global_define.h"
|
||||
#include "../../common/shareddb.h"
|
||||
#include "../../common/eqemu_config.h"
|
||||
#include "../../common/platform.h"
|
||||
@@ -25,47 +27,53 @@
|
||||
#include "../../common/rulesys.h"
|
||||
#include "../../common/string_util.h"
|
||||
|
||||
EQEmuLogSys Log;
|
||||
|
||||
void ExportSpells(SharedDatabase *db);
|
||||
void ExportSkillCaps(SharedDatabase *db);
|
||||
void ExportBaseData(SharedDatabase *db);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
LogFile->write(EQEMuLog::Status, "Client Files Export Utility");
|
||||
Log.Out(Logs::General, Logs::Status, "Client Files Export Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to load configuration file.");
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||
LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
}
|
||||
|
||||
SharedDatabase database;
|
||||
LogFile->write(EQEMuLog::Status, "Connecting to database...");
|
||||
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Register Log System and Settings */
|
||||
database.LoadLogSettings(Log.log_settings);
|
||||
Log.StartFileLogs();
|
||||
|
||||
ExportSpells(&database);
|
||||
ExportSkillCaps(&database);
|
||||
ExportBaseData(&database);
|
||||
|
||||
Log.CloseFileLogs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ExportSpells(SharedDatabase *db) {
|
||||
LogFile->write(EQEMuLog::Status, "Exporting Spells...");
|
||||
Log.Out(Logs::General, Logs::Status, "Exporting Spells...");
|
||||
|
||||
FILE *f = fopen("export/spells_us.txt", "w");
|
||||
if(!f) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/spells_us.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -89,7 +97,6 @@ void ExportSpells(SharedDatabase *db) {
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ExportSpells query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
@@ -103,7 +110,6 @@ bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) {
|
||||
class_id, skill_id);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in skill_usable query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -123,7 +129,6 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
class_id, skill_id, level);
|
||||
auto results = db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in get_skill query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -135,11 +140,11 @@ int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
|
||||
}
|
||||
|
||||
void ExportSkillCaps(SharedDatabase *db) {
|
||||
LogFile->write(EQEMuLog::Status, "Exporting Skill Caps...");
|
||||
Log.Out(Logs::General, Logs::Status, "Exporting Skill Caps...");
|
||||
|
||||
FILE *f = fopen("export/SkillCaps.txt", "w");
|
||||
if(!f) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/SkillCaps.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -164,11 +169,11 @@ void ExportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ExportBaseData(SharedDatabase *db) {
|
||||
LogFile->write(EQEMuLog::Status, "Exporting Base Data...");
|
||||
Log.Out(Logs::General, Logs::Status, "Exporting Base Data...");
|
||||
|
||||
FILE *f = fopen("export/BaseData.txt", "w");
|
||||
if(!f) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open export/BaseData.txt to write, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -190,7 +195,6 @@ void ExportBaseData(SharedDatabase *db) {
|
||||
fprintf(f, "%s\n", line.c_str());
|
||||
}
|
||||
} else {
|
||||
LogFile->write(EQEMuLog::Error, "Error in ExportBaseData query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
@@ -11,15 +11,17 @@ ADD_EXECUTABLE(import_client_files ${import_sources} ${import_headers})
|
||||
|
||||
INSTALL(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
TARGET_LINK_LIBRARIES(import_client_files common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(import_client_files common ${PERF_LIBS} debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(import_client_files PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
TARGET_LINK_LIBRARIES(import_client_files "Ws2_32.lib")
|
||||
TARGET_LINK_LIBRARIES(import_client_files "rpcrt4")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(MINGW)
|
||||
TARGET_LINK_LIBRARIES(import_client_files "WS2_32")
|
||||
TARGET_LINK_LIBRARIES(import_client_files "rpcrt4")
|
||||
ENDIF(MINGW)
|
||||
|
||||
IF(UNIX)
|
||||
@@ -30,6 +32,7 @@ IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(import_client_files "rt")
|
||||
ENDIF(NOT DARWIN)
|
||||
TARGET_LINK_LIBRARIES(import_client_files "pthread")
|
||||
TARGET_LINK_LIBRARIES(import_client_files "uuid")
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
ENDIF(UNIX)
|
||||
|
||||
|
||||
@@ -16,7 +16,8 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../../common/debug.h"
|
||||
#include "../../common/eqemu_logsys.h"
|
||||
#include "../../common/global_define.h"
|
||||
#include "../../common/shareddb.h"
|
||||
#include "../../common/eqemu_config.h"
|
||||
#include "../../common/platform.h"
|
||||
@@ -24,38 +25,43 @@
|
||||
#include "../../common/rulesys.h"
|
||||
#include "../../common/string_util.h"
|
||||
|
||||
EQEmuLogSys Log;
|
||||
|
||||
void ImportSpells(SharedDatabase *db);
|
||||
void ImportSkillCaps(SharedDatabase *db);
|
||||
void ImportBaseData(SharedDatabase *db);
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
LogFile->write(EQEMuLog::Status, "Client Files Import Utility");
|
||||
Log.Out(Logs::General, Logs::Status, "Client Files Import Utility");
|
||||
if(!EQEmuConfig::LoadConfig()) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to load configuration file.");
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to load configuration file.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
const EQEmuConfig *config = EQEmuConfig::get();
|
||||
if(!load_log_settings(config->LogSettingsFile.c_str())) {
|
||||
LogFile->write(EQEMuLog::Error, "Warning: unable to read %s.", config->LogSettingsFile.c_str());
|
||||
}
|
||||
|
||||
SharedDatabase database;
|
||||
LogFile->write(EQEMuLog::Status, "Connecting to database...");
|
||||
Log.Out(Logs::General, Logs::Status, "Connecting to database...");
|
||||
if(!database.Connect(config->DatabaseHost.c_str(), config->DatabaseUsername.c_str(),
|
||||
config->DatabasePassword.c_str(), config->DatabaseDB.c_str(), config->DatabasePort)) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to connect to the database, cannot continue without a "
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to connect to the database, cannot continue without a "
|
||||
"database connection");
|
||||
return 1;
|
||||
}
|
||||
|
||||
database.LoadLogSettings(Log.log_settings);
|
||||
Log.StartFileLogs();
|
||||
|
||||
ImportSpells(&database);
|
||||
ImportSkillCaps(&database);
|
||||
ImportBaseData(&database);
|
||||
|
||||
Log.CloseFileLogs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -64,18 +70,35 @@ int GetSpellColumns(SharedDatabase *db) {
|
||||
const std::string query = "DESCRIBE spells_new";
|
||||
auto results = db->QueryDatabase(query);
|
||||
if(!results.Success()) {
|
||||
LogFile->write(EQEMuLog::Error, "Error in GetSpellColumns query '%s' %s", query.c_str(), results.ErrorMessage().c_str());
|
||||
return 0;
|
||||
}
|
||||
|
||||
return results.RowCount();
|
||||
}
|
||||
|
||||
bool IsStringField(int i) {
|
||||
switch(i)
|
||||
{
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void ImportSpells(SharedDatabase *db) {
|
||||
LogFile->write(EQEMuLog::Status, "Importing Spells...");
|
||||
Log.Out(Logs::General, Logs::Status, "Importing Spells...");
|
||||
FILE *f = fopen("import/spells_us.txt", "r");
|
||||
if(!f) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/spells_us.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,7 +131,12 @@ void ImportSpells(SharedDatabase *db) {
|
||||
sql += "'";
|
||||
}
|
||||
|
||||
sql += split[i];
|
||||
if(split[i].compare("") == 0 && !IsStringField(i)) {
|
||||
sql += "0";
|
||||
}
|
||||
else {
|
||||
sql += split[i];
|
||||
}
|
||||
sql += "'";
|
||||
}
|
||||
|
||||
@@ -123,7 +151,12 @@ void ImportSpells(SharedDatabase *db) {
|
||||
sql += "'";
|
||||
}
|
||||
|
||||
sql += split[i];
|
||||
if(split[i].compare("") == 0 && !IsStringField(i)) {
|
||||
sql += "0";
|
||||
} else {
|
||||
sql += split[i];
|
||||
}
|
||||
|
||||
sql += "'";
|
||||
}
|
||||
|
||||
@@ -138,23 +171,23 @@ void ImportSpells(SharedDatabase *db) {
|
||||
|
||||
spells_imported++;
|
||||
if(spells_imported % 1000 == 0) {
|
||||
LogFile->write(EQEMuLog::Status, "%d spells imported.", spells_imported);
|
||||
Log.Out(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
}
|
||||
|
||||
if(spells_imported % 1000 != 0) {
|
||||
LogFile->write(EQEMuLog::Status, "%d spells imported.", spells_imported);
|
||||
Log.Out(Logs::General, Logs::Status, "%d spells imported.", spells_imported);
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void ImportSkillCaps(SharedDatabase *db) {
|
||||
LogFile->write(EQEMuLog::Status, "Importing Skill Caps...");
|
||||
Log.Out(Logs::General, Logs::Status, "Importing Skill Caps...");
|
||||
|
||||
FILE *f = fopen("import/SkillCaps.txt", "r");
|
||||
if(!f) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/SkillCaps.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -186,11 +219,11 @@ void ImportSkillCaps(SharedDatabase *db) {
|
||||
}
|
||||
|
||||
void ImportBaseData(SharedDatabase *db) {
|
||||
LogFile->write(EQEMuLog::Status, "Importing Base Data...");
|
||||
Log.Out(Logs::General, Logs::Status, "Importing Base Data...");
|
||||
|
||||
FILE *f = fopen("import/BaseData.txt", "r");
|
||||
if(!f) {
|
||||
LogFile->write(EQEMuLog::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
Log.Out(Logs::General, Logs::Error, "Unable to open import/BaseData.txt to read, skipping.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+38
-43
@@ -8,9 +8,9 @@ SET(common_sources
|
||||
crc16.cpp
|
||||
crc32.cpp
|
||||
database.cpp
|
||||
dbasync.cpp
|
||||
database_conversions.cpp
|
||||
database_instances.cpp
|
||||
dbcore.cpp
|
||||
debug.cpp
|
||||
emu_opcodes.cpp
|
||||
emu_tcp_connection.cpp
|
||||
emu_tcp_server.cpp
|
||||
@@ -19,7 +19,7 @@ SET(common_sources
|
||||
eqdb_res.cpp
|
||||
eqemu_exception.cpp
|
||||
eqemu_config.cpp
|
||||
eqemu_error.cpp
|
||||
eqemu_logsys.cpp
|
||||
eq_packet.cpp
|
||||
eq_stream.cpp
|
||||
eq_stream_factory.cpp
|
||||
@@ -32,17 +32,13 @@ SET(common_sources
|
||||
guilds.cpp
|
||||
ipc_mutex.cpp
|
||||
item.cpp
|
||||
logsys.cpp
|
||||
logsys_eqemu.cpp
|
||||
md5.cpp
|
||||
memory_mapped_file.cpp
|
||||
misc.cpp
|
||||
misc_functions.cpp
|
||||
moremath.cpp
|
||||
mutex.cpp
|
||||
mysql_request_result.cpp
|
||||
mysql_request_row.cpp
|
||||
opcode_map.cpp
|
||||
opcodemgr.cpp
|
||||
packet_dump.cpp
|
||||
packet_dump_file.cpp
|
||||
@@ -52,28 +48,29 @@ SET(common_sources
|
||||
proc_launcher.cpp
|
||||
ptimer.cpp
|
||||
races.cpp
|
||||
rdtsc.cpp
|
||||
rulesys.cpp
|
||||
serverinfo.cpp
|
||||
shareddb.cpp
|
||||
skills.cpp
|
||||
spdat.cpp
|
||||
string_util.cpp
|
||||
string_util.cpp
|
||||
struct_strategy.cpp
|
||||
tcp_connection.cpp
|
||||
tcp_server.cpp
|
||||
timeoutmgr.cpp
|
||||
timer.cpp
|
||||
unix.cpp
|
||||
uuid.cpp
|
||||
worldconn.cpp
|
||||
xml_parser.cpp
|
||||
platform.cpp
|
||||
patches/client62.cpp
|
||||
patches/patches.cpp
|
||||
patches/sod.cpp
|
||||
patches/sof.cpp
|
||||
patches/rof.cpp
|
||||
patches/rof2.cpp
|
||||
patches/titanium.cpp
|
||||
patches/underfoot.cpp
|
||||
patches/uf.cpp
|
||||
SocketLib/Base64.cpp
|
||||
SocketLib/File.cpp
|
||||
SocketLib/HttpdCookies.cpp
|
||||
@@ -97,16 +94,14 @@ SET(common_headers
|
||||
base_packet.h
|
||||
base_data.h
|
||||
bodytypes.h
|
||||
breakdowns.h
|
||||
classes.h
|
||||
condition.h
|
||||
crash.h
|
||||
crc16.h
|
||||
crc32.h
|
||||
data_verification.h
|
||||
database.h
|
||||
dbasync.h
|
||||
dbcore.h
|
||||
debug.h
|
||||
deity.h
|
||||
emu_opcodes.h
|
||||
emu_oplist.h
|
||||
@@ -120,7 +115,7 @@ SET(common_headers
|
||||
eqemu_exception.h
|
||||
eqemu_config.h
|
||||
eqemu_config_elements.h
|
||||
eqemu_error.h
|
||||
eqemu_logsys.h
|
||||
eq_packet.h
|
||||
eq_stream.h
|
||||
eq_stream_factory.h
|
||||
@@ -136,6 +131,7 @@ SET(common_headers
|
||||
features.h
|
||||
fixed_memory_hash_set.h
|
||||
fixed_memory_variable_hash_set.h
|
||||
global_define.h
|
||||
guild_base.h
|
||||
guilds.h
|
||||
ipc_mutex.h
|
||||
@@ -144,15 +140,12 @@ SET(common_headers
|
||||
item_struct.h
|
||||
languages.h
|
||||
linked_list.h
|
||||
logsys.h
|
||||
logtypes.h
|
||||
loottable.h
|
||||
mail_oplist.h
|
||||
md5.h
|
||||
memory_mapped_file.h
|
||||
misc.h
|
||||
misc_functions.h
|
||||
moremath.h
|
||||
mutex.h
|
||||
mysql_request_result.h
|
||||
mysql_request_row.h
|
||||
@@ -164,11 +157,10 @@ SET(common_headers
|
||||
packet_functions.h
|
||||
platform.h
|
||||
proc_launcher.h
|
||||
profiler.h
|
||||
ptimer.h
|
||||
queue.h
|
||||
races.h
|
||||
rdtsc.h
|
||||
random.h
|
||||
rulesys.h
|
||||
ruletypes.h
|
||||
seperator.h
|
||||
@@ -187,15 +179,11 @@ SET(common_headers
|
||||
types.h
|
||||
unix.h
|
||||
useperl.h
|
||||
uuid.h
|
||||
version.h
|
||||
worldconn.h
|
||||
xml_parser.h
|
||||
zone_numbers.h
|
||||
patches/client62.h
|
||||
patches/client62_constants.h
|
||||
patches/client62_itemfields.h
|
||||
patches/client62_ops.h
|
||||
patches/client62_structs.h
|
||||
patches/patches.h
|
||||
patches/sod.h
|
||||
patches/sod_constants.h
|
||||
@@ -216,16 +204,21 @@ SET(common_headers
|
||||
patches/rof_itemfields.h
|
||||
patches/rof_ops.h
|
||||
patches/rof_structs.h
|
||||
patches/rof2.h
|
||||
patches/rof2_constants.h
|
||||
patches/rof2_itemfields.h
|
||||
patches/rof2_ops.h
|
||||
patches/rof2_structs.h
|
||||
patches/titanium.h
|
||||
patches/titanium_constants.h
|
||||
patches/titanium_itemfields.h
|
||||
patches/titanium_ops.h
|
||||
patches/titanium_structs.h
|
||||
patches/underfoot.h
|
||||
patches/underfoot_constants.h
|
||||
patches/underfoot_itemfields.h
|
||||
patches/underfoot_ops.h
|
||||
patches/underfoot_structs.h
|
||||
patches/uf.h
|
||||
patches/uf_constants.h
|
||||
patches/uf_itemfields.h
|
||||
patches/uf_ops.h
|
||||
patches/uf_structs.h
|
||||
SocketLib/Base64.h
|
||||
SocketLib/File.h
|
||||
SocketLib/HttpdCookies.h
|
||||
@@ -244,11 +237,6 @@ SET(common_headers
|
||||
)
|
||||
|
||||
SOURCE_GROUP(Patches FILES
|
||||
patches/client62.h
|
||||
patches/client62_itemfields.h
|
||||
patches/client62_ops.h
|
||||
patches/client62_constants.h
|
||||
patches/client62_structs.h
|
||||
patches/patches.h
|
||||
patches/sod.h
|
||||
patches/sod_itemfields.h
|
||||
@@ -269,23 +257,28 @@ SOURCE_GROUP(Patches FILES
|
||||
patches/rof_ops.h
|
||||
patches/rof_constants.h
|
||||
patches/rof_structs.h
|
||||
patches/rof2.h
|
||||
patches/rof2_itemfields.h
|
||||
patches/rof2_ops.h
|
||||
patches/rof2_constants.h
|
||||
patches/rof2_structs.h
|
||||
patches/titanium.h
|
||||
patches/titanium_itemfields.h
|
||||
patches/titanium_ops.h
|
||||
patches/titanium_constants.h
|
||||
patches/titanium_structs.h
|
||||
patches/underfoot.h
|
||||
patches/underfoot_itemfields.h
|
||||
patches/underfoot_ops.h
|
||||
patches/underfoot_constants.h
|
||||
patches/underfoot_structs.h
|
||||
patches/client62.cpp
|
||||
patches/uf.h
|
||||
patches/uf_itemfields.h
|
||||
patches/uf_ops.h
|
||||
patches/uf_constants.h
|
||||
patches/uf_structs.h
|
||||
patches/patches.cpp
|
||||
patches/sod.cpp
|
||||
patches/sof.cpp
|
||||
patches/rof.cpp
|
||||
patches/rof2.cpp
|
||||
patches/titanium.cpp
|
||||
patches/underfoot.cpp
|
||||
patches/uf.cpp
|
||||
)
|
||||
|
||||
SOURCE_GROUP(SocketLib FILES
|
||||
@@ -334,7 +327,9 @@ ADD_LIBRARY(common ${common_sources} ${common_headers})
|
||||
|
||||
IF(UNIX)
|
||||
ADD_DEFINITIONS(-fPIC)
|
||||
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/underfoot.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
||||
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
|
||||
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
||||
ENDIF(UNIX)
|
||||
|
||||
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
@@ -40,7 +40,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
#include "../debug.h"
|
||||
#include "../global_define.h"
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include <stdarg.h>
|
||||
|
||||
@@ -26,7 +26,7 @@ along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "../debug.h"
|
||||
#include "../global_define.h"
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
|
||||
@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
#include "../debug.h"
|
||||
#include "../global_define.h"
|
||||
#include "Utility.h"
|
||||
#include "HttpdCookies.h"
|
||||
#include "HttpdForm.h"
|
||||
@@ -194,7 +194,6 @@ void HttpdSocket::OnHeaderComplete()
|
||||
|
||||
void HttpdSocket::OnData(const char *p,size_t l)
|
||||
{
|
||||
//printf("Got %d bytes: %.*s\n", l, l, p);
|
||||
if (m_file)
|
||||
{
|
||||
m_file -> fwrite(p,1,l);
|
||||
|
||||
@@ -110,7 +110,6 @@ size_t MemFile::fread(char *ptr, size_t size, size_t nmemb)
|
||||
size_t sz = size * nmemb;
|
||||
if (p + sz < BLOCKSIZE)
|
||||
{
|
||||
//printf("Read @ %d(%d). %d bytes. (%c)\n", m_read_ptr, p, sz, *(m_current_read -> data + p));
|
||||
memcpy(ptr, m_current_read -> data + p, sz);
|
||||
m_read_ptr += sz;
|
||||
}
|
||||
@@ -142,7 +141,6 @@ size_t MemFile::fwrite(const char *ptr, size_t size, size_t nmemb)
|
||||
size_t sz = size * nmemb;
|
||||
if (p + sz < BLOCKSIZE)
|
||||
{
|
||||
//printf("Write @ %d(%d). %d bytes.\n", m_write_ptr, p, sz);
|
||||
memcpy(m_current_write -> data + p, ptr, sz);
|
||||
m_write_ptr += sz;
|
||||
}
|
||||
|
||||
@@ -1128,7 +1128,6 @@ BOOL __stdcall StackWalker::myReadProcMem(
|
||||
SIZE_T st;
|
||||
BOOL bRet = ReadProcessMemory(hProcess, (LPVOID) qwBaseAddress, lpBuffer, nSize, &st);
|
||||
*lpNumberOfBytesRead = (DWORD) st;
|
||||
//printf("ReadMemory: hProcess: %p, baseAddr: %p, buffer: %p, size: %d, read: %d, result: %d\n", hProcess, (LPVOID) qwBaseAddress, lpBuffer, nSize, (DWORD) st, (DWORD) bRet);
|
||||
return bRet;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -15,13 +15,12 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "debug.h"
|
||||
|
||||
#include "global_define.h"
|
||||
#include "base_packet.h"
|
||||
#include "misc.h"
|
||||
#include "packet_dump.h"
|
||||
|
||||
|
||||
|
||||
BasePacket::BasePacket(const unsigned char *buf, uint32 len)
|
||||
{
|
||||
this->pBuffer=nullptr;
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "types.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <time.h>
|
||||
|
||||
@@ -1,134 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef BREAKDOWNS_H_
|
||||
#define BREAKDOWNS_H_
|
||||
|
||||
#include "types.h"
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
struct uint16_breakdown {
|
||||
union {
|
||||
uint16 all;
|
||||
struct {
|
||||
uint8 b1;
|
||||
uint8 b2;
|
||||
} bytes;
|
||||
};
|
||||
inline uint16& operator=(const uint16& val) { return (all=val); }
|
||||
inline uint16* operator&() { return &all; }
|
||||
inline operator uint16&() { return all; }
|
||||
inline uint8& b1() { return bytes.b1; }
|
||||
inline uint8& b2() { return bytes.b2; }
|
||||
};
|
||||
|
||||
struct uint32_breakdown {
|
||||
union {
|
||||
uint32 all;
|
||||
struct {
|
||||
uint16 w1;
|
||||
uint16 w2;
|
||||
} words;
|
||||
struct {
|
||||
uint8 b1;
|
||||
union {
|
||||
struct {
|
||||
uint8 b2;
|
||||
uint8 b3;
|
||||
} middle;
|
||||
uint16 w2_3; // word bytes 2 to 3
|
||||
};
|
||||
uint8 b4;
|
||||
} bytes;
|
||||
};
|
||||
inline uint32& operator=(const uint32& val) { return (all=val); }
|
||||
inline uint32* operator&() { return &all; }
|
||||
inline operator uint32&() { return all; }
|
||||
|
||||
inline uint16& w1() { return words.w1; }
|
||||
inline uint16& w2() { return words.w2; }
|
||||
inline uint16& w2_3() { return bytes.w2_3; }
|
||||
inline uint8& b1() { return bytes.b1; }
|
||||
inline uint8& b2() { return bytes.middle.b2; }
|
||||
inline uint8& b3() { return bytes.middle.b3; }
|
||||
inline uint8& b4() { return bytes.b4; }
|
||||
};
|
||||
/*
|
||||
struct uint64_breakdown {
|
||||
union {
|
||||
uint64 all;
|
||||
struct {
|
||||
uint16 w1; // 1 2
|
||||
uint16 w2; // 3 4
|
||||
uint16 w3; // 5 6
|
||||
uint16 w4; // 7 8
|
||||
};
|
||||
struct {
|
||||
uint32 dw1; // 1 4
|
||||
uint32 dw2; // 5 6
|
||||
};
|
||||
struct {
|
||||
uint8 b1;
|
||||
union {
|
||||
struct {
|
||||
uint16 w2_3;
|
||||
uint16 w4_5;
|
||||
uint16 w6_7;
|
||||
};
|
||||
uint32 dw2_5;
|
||||
struct {
|
||||
uint8 b2;
|
||||
union {
|
||||
uint32 dw3_6;
|
||||
struct {
|
||||
uint8 b3;
|
||||
union {
|
||||
uint32 dw4_7;
|
||||
struct {
|
||||
uint8 b4;
|
||||
uint8 b5;
|
||||
uint8 b6;
|
||||
uint8 b7;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
inline uint64* operator&() { return &all; }
|
||||
inline operator uint64&() { return all; }
|
||||
};
|
||||
*/
|
||||
#pragma pack()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /*BREAKDOWNS_H_*/
|
||||
+2
-49
@@ -14,8 +14,8 @@
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "../common/debug.h"
|
||||
*/
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/classes.h"
|
||||
|
||||
const char* GetEQClassName(uint8 class_, uint8 level) {
|
||||
@@ -290,50 +290,3 @@ const char* GetEQClassName(uint8 class_, uint8 level) {
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetArrayEQClass(uint8 eqclass) {
|
||||
switch (eqclass) {
|
||||
case WARRIOR:
|
||||
return WARRIOR;
|
||||
case CLERIC:
|
||||
return CLERIC;
|
||||
case PALADIN:
|
||||
return PALADIN;
|
||||
case RANGER:
|
||||
return RANGER;
|
||||
case SHADOWKNIGHT:
|
||||
return SHADOWKNIGHT;
|
||||
case DRUID:
|
||||
return DRUID;
|
||||
case MONK:
|
||||
return MONK;
|
||||
case BARD:
|
||||
return BARD;
|
||||
case ROGUE:
|
||||
return ROGUE;
|
||||
case SHAMAN:
|
||||
return SHAMAN;
|
||||
case NECROMANCER:
|
||||
return NECROMANCER;
|
||||
case WIZARD:
|
||||
return WIZARD;
|
||||
case MAGICIAN:
|
||||
return MAGICIAN;
|
||||
case ENCHANTER:
|
||||
return ENCHANTER;
|
||||
case BEASTLORD:
|
||||
return BEASTLORD;
|
||||
case BERSERKER:
|
||||
return BERSERKER;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
uint8 GetEQArrayEQClass(uint8 eqclass) {
|
||||
if (eqclass >= WARRIOR && eqclass <= BERSERKER)
|
||||
return eqclass - WARRIOR;
|
||||
if (eqclass >= WARRIORGM && eqclass <= BERSERKERGM)
|
||||
return eqclass - WARRIORGM;
|
||||
return WARRIOR;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,7 +86,5 @@
|
||||
#define call_1 65536
|
||||
|
||||
const char* GetEQClassName(uint8 class_, uint8 level = 0);
|
||||
uint32 GetArrayEQClass(uint8 eqclass);
|
||||
uint8 GetEQArrayEQClass(uint8 eqclass);
|
||||
#endif
|
||||
|
||||
|
||||
+58
-23
@@ -1,42 +1,77 @@
|
||||
#ifndef CLIENTVERSIONS_H
|
||||
#define CLIENTVERSIONS_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
static const uint32 BIT_Client62 = 1;
|
||||
static const uint32 BIT_Titanium = 2;
|
||||
static const uint32 BIT_SoF = 4;
|
||||
static const uint32 BIT_SoD = 8;
|
||||
static const uint32 BIT_Underfoot = 16;
|
||||
static const uint32 BIT_UF = 16;
|
||||
static const uint32 BIT_RoF = 32;
|
||||
static const uint32 BIT_RoF2 = 64;
|
||||
|
||||
static const uint32 BIT_TitaniumAndEarlier = 0x00000003;
|
||||
static const uint32 BIT_SoFAndLater = 0xFFFFFFFC;
|
||||
static const uint32 BIT_SoDAndLater = 0xFFFFFFF8;
|
||||
static const uint32 BIT_UnderfootAndLater = 0xFFFFFFF0;
|
||||
static const uint32 BIT_UFAndLater = 0xFFFFFFF0;
|
||||
static const uint32 BIT_RoFAndLater = 0xFFFFFFE0;
|
||||
static const uint32 BIT_RoF2AndLater = 0xFFFFFFC0;
|
||||
static const uint32 BIT_AllClients = 0xFFFFFFFF;
|
||||
|
||||
typedef enum {
|
||||
EQClientUnknown = 0,
|
||||
EQClient62, // Build: 'Aug 4 2005 15:40:59'
|
||||
EQClientTitanium, // Build: 'Oct 31 2005 10:33:37'
|
||||
EQClientSoF, // Build: 'Sep 7 2007 09:11:49'
|
||||
EQClientSoD, // Build: 'Dec 19 2008 15:22:49'
|
||||
EQClientUnderfoot, // Build: 'Jun 8 2010 16:44:32'
|
||||
EQClientRoF, // Build: 'Dec 10 2012 17:35:44'
|
||||
EQClientRoF2, // Build: 'May 10 2013 23:30:08'
|
||||
|
||||
_EQClientCount, // place new clients before this point (preferably, in release/attribute order)
|
||||
|
||||
// Values below are not implemented, as yet...
|
||||
|
||||
EmuNPC = _EQClientCount,
|
||||
EmuMerc,
|
||||
EmuBot,
|
||||
EmuPet,
|
||||
|
||||
_EmuClientCount // array size for EQLimits
|
||||
} EQClientVersion;
|
||||
enum class ClientVersion
|
||||
{
|
||||
Unknown = 0,
|
||||
Client62, // Build: 'Aug 4 2005 15:40:59'
|
||||
Titanium, // Build: 'Oct 31 2005 10:33:37'
|
||||
SoF, // Build: 'Sep 7 2007 09:11:49'
|
||||
SoD, // Build: 'Dec 19 2008 15:22:49'
|
||||
UF, // Build: 'Jun 8 2010 16:44:32'
|
||||
RoF, // Build: 'Dec 10 2012 17:35:44'
|
||||
RoF2, // Build: 'May 10 2013 23:30:08'
|
||||
|
||||
MobNPC,
|
||||
MobMerc,
|
||||
MobBot,
|
||||
MobPet,
|
||||
};
|
||||
|
||||
#define CLIENT_VERSION_COUNT 12
|
||||
#define LAST_PC_CLIENT ClientVersion::RoF2
|
||||
#define LAST_NPC_CLIENT ClientVersion::MobPet
|
||||
|
||||
|
||||
static const char* ClientVersionName(ClientVersion version)
|
||||
{
|
||||
switch (version)
|
||||
{
|
||||
case ClientVersion::Unknown:
|
||||
return "ClientVersion::Unknown";
|
||||
case ClientVersion::Client62:
|
||||
return "ClientVersion::Client62";
|
||||
case ClientVersion::Titanium:
|
||||
return "ClientVersion::Titanium";
|
||||
case ClientVersion::SoF:
|
||||
return "ClientVersion::SoF";
|
||||
case ClientVersion::SoD:
|
||||
return "ClientVersion::SoD";
|
||||
case ClientVersion::UF:
|
||||
return "ClientVersion::UF";
|
||||
case ClientVersion::RoF:
|
||||
return "ClientVersion::RoF";
|
||||
case ClientVersion::RoF2:
|
||||
return "ClientVersion::RoF2";
|
||||
case ClientVersion::MobNPC:
|
||||
return "ClientVersion::MobNPC";
|
||||
case ClientVersion::MobMerc:
|
||||
return "ClientVersion::MobMerc";
|
||||
case ClientVersion::MobBot:
|
||||
return "ClientVersion::MobBot";
|
||||
case ClientVersion::MobPet:
|
||||
return "ClientVersion::MobPet";
|
||||
default:
|
||||
return "<ERROR> Invalid ClientVersion";
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* CLIENTVERSIONS_H */
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include "condition.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
|
||||
+2
-1
@@ -18,7 +18,8 @@
|
||||
#ifndef __CONDITION_H
|
||||
#define __CONDITION_H
|
||||
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "mutex.h"
|
||||
#ifndef WIN32
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
+24
-23
@@ -1,4 +1,5 @@
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "crash.h"
|
||||
|
||||
#if defined(_WINDOWS) && defined(CRASH_LOGGING)
|
||||
@@ -24,7 +25,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
LogFile->write(EQEMuLog::Crash, buffer);
|
||||
Log.Out(Logs::General, Logs::Crash, buffer);
|
||||
StackWalker::OnOutput(szText);
|
||||
}
|
||||
};
|
||||
@@ -34,67 +35,67 @@ LONG WINAPI windows_exception_handler(EXCEPTION_POINTERS *ExceptionInfo)
|
||||
switch(ExceptionInfo->ExceptionRecord->ExceptionCode)
|
||||
{
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ACCESS_VIOLATION");
|
||||
break;
|
||||
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ARRAY_BOUNDS_EXCEEDED");
|
||||
break;
|
||||
case EXCEPTION_BREAKPOINT:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_BREAKPOINT");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_BREAKPOINT");
|
||||
break;
|
||||
case EXCEPTION_DATATYPE_MISALIGNMENT:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_DATATYPE_MISALIGNMENT");
|
||||
break;
|
||||
case EXCEPTION_FLT_DENORMAL_OPERAND:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_DENORMAL_OPERAND");
|
||||
break;
|
||||
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_DIVIDE_BY_ZERO");
|
||||
break;
|
||||
case EXCEPTION_FLT_INEXACT_RESULT:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_INEXACT_RESULT");
|
||||
break;
|
||||
case EXCEPTION_FLT_INVALID_OPERATION:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_INVALID_OPERATION");
|
||||
break;
|
||||
case EXCEPTION_FLT_OVERFLOW:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_OVERFLOW");
|
||||
break;
|
||||
case EXCEPTION_FLT_STACK_CHECK:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_STACK_CHECK");
|
||||
break;
|
||||
case EXCEPTION_FLT_UNDERFLOW:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_FLT_UNDERFLOW");
|
||||
break;
|
||||
case EXCEPTION_ILLEGAL_INSTRUCTION:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_ILLEGAL_INSTRUCTION");
|
||||
break;
|
||||
case EXCEPTION_IN_PAGE_ERROR:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_IN_PAGE_ERROR");
|
||||
break;
|
||||
case EXCEPTION_INT_DIVIDE_BY_ZERO:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INT_DIVIDE_BY_ZERO");
|
||||
break;
|
||||
case EXCEPTION_INT_OVERFLOW:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INT_OVERFLOW");
|
||||
break;
|
||||
case EXCEPTION_INVALID_DISPOSITION:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_INVALID_DISPOSITION");
|
||||
break;
|
||||
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_NONCONTINUABLE_EXCEPTION");
|
||||
break;
|
||||
case EXCEPTION_PRIV_INSTRUCTION:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_PRIV_INSTRUCTION");
|
||||
break;
|
||||
case EXCEPTION_SINGLE_STEP:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_SINGLE_STEP");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_SINGLE_STEP");
|
||||
break;
|
||||
case EXCEPTION_STACK_OVERFLOW:
|
||||
LogFile->write(EQEMuLog::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||
Log.Out(Logs::General, Logs::Crash, "EXCEPTION_STACK_OVERFLOW");
|
||||
break;
|
||||
default:
|
||||
LogFile->write(EQEMuLog::Crash, "Unknown Exception");
|
||||
Log.Out(Logs::General, Logs::Crash, "Unknown Exception");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
Copyright (C) 2001-2014 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -15,26 +15,34 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef COMMON_DATA_VERIFICATION_H
|
||||
#define COMMON_DATA_VERIFICATION_H
|
||||
|
||||
#include "debug.h"
|
||||
#include "logsys.h"
|
||||
#include "string_util.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
namespace EQEmu
|
||||
{
|
||||
|
||||
#include <string>
|
||||
|
||||
void log_message(LogType type, const char *fmt, ...) {
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
log_messageVA(type, fmt, args);
|
||||
va_end(args);
|
||||
template <typename T>
|
||||
T Clamp(const T& value, const T& lower, const T& upper) {
|
||||
return std::max(lower, std::min(value, upper));
|
||||
}
|
||||
|
||||
void log_messageVA(LogType type, const char *fmt, va_list args) {
|
||||
std::string prefix_buffer = StringFormat("[%s] ", log_type_info[type].name);
|
||||
|
||||
LogFile->writePVA(EQEMuLog::Debug, prefix_buffer.c_str(), fmt, args);
|
||||
template <typename T>
|
||||
T ClampLower(const T& value, const T& lower) {
|
||||
return std::max(lower, value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T ClampUpper(const T& value, const T& upper) {
|
||||
return std::min(value, upper);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool ValueWithin(const T& value, const T& lower, const T& upper) {
|
||||
return value >= lower && value <= upper;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
+876
-1159
File diff suppressed because it is too large
Load Diff
+133
-141
@@ -21,17 +21,14 @@
|
||||
#define AUTHENTICATION_TIMEOUT 60
|
||||
#define INVALID_ID 0xFFFFFFFF
|
||||
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "types.h"
|
||||
#include "dbcore.h"
|
||||
#include "linked_list.h"
|
||||
#include "eq_packet_structs.h"
|
||||
/*#include "eq_stream.h"
|
||||
#include "guilds.h"
|
||||
#include "misc_functions.h"
|
||||
#include "mutex.h"
|
||||
#include "item.h"
|
||||
#include "extprofile.h"*/
|
||||
|
||||
#include <cmath>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
@@ -39,22 +36,9 @@
|
||||
//atoi is not uint32 or uint32 safe!!!!
|
||||
#define atoul(str) strtoul(str, nullptr, 10)
|
||||
|
||||
//class Spawn;
|
||||
class Corpse;
|
||||
class Spawn2;
|
||||
class NPC;
|
||||
class SpawnGroupList;
|
||||
class Petition;
|
||||
class Client;
|
||||
class Merc;
|
||||
struct Combine_Struct;
|
||||
//struct Faction;
|
||||
//struct FactionMods;
|
||||
//struct FactionValue;
|
||||
struct ZonePoint;
|
||||
struct NPCType;
|
||||
class Inventory;
|
||||
class ItemInst;
|
||||
class MySQLRequestResult;
|
||||
class Client;
|
||||
|
||||
struct EventLogDetails_Struct {
|
||||
uint32 id;
|
||||
@@ -69,36 +53,36 @@ struct EventLogDetails_Struct {
|
||||
};
|
||||
|
||||
struct CharacterEventLog_Struct {
|
||||
uint32 count;
|
||||
uint8 eventid;
|
||||
EventLogDetails_Struct eld[255];
|
||||
uint32 count;
|
||||
uint8 eventid;
|
||||
EventLogDetails_Struct eld[255];
|
||||
};
|
||||
|
||||
|
||||
// Added By Hogie
|
||||
// INSERT into variables (varname,value) values('decaytime [minlevel] [maxlevel]','[number of seconds]');
|
||||
// IE: decaytime 1 54 = Levels 1 through 54
|
||||
// decaytime 55 100 = Levels 55 through 100
|
||||
// It will always put the LAST time for the level (I think) from the Database
|
||||
struct npcDecayTimes_Struct {
|
||||
uint16 minlvl;
|
||||
uint16 maxlvl;
|
||||
uint32 seconds;
|
||||
};
|
||||
// Added By Hogie -- End
|
||||
|
||||
|
||||
struct VarCache_Struct {
|
||||
char varname[26]; // varname is char(25) in database
|
||||
char varname[26];
|
||||
char value[0];
|
||||
};
|
||||
|
||||
struct PlayerProfile_Struct;
|
||||
struct GuildRankLevel_Struct;
|
||||
struct GuildRanks_Struct;
|
||||
struct ExtendedProfile_Struct;
|
||||
struct GuildMember_Struct;
|
||||
class PTimerList;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#if _MSC_VER > 1700 // greater than 2012 (2013+)
|
||||
# define _ISNAN_(a) std::isnan(a)
|
||||
#else
|
||||
# include <float.h>
|
||||
# define _ISNAN_(a) _isnan(a)
|
||||
#endif
|
||||
#else
|
||||
# define _ISNAN_(a) std::isnan(a)
|
||||
#endif
|
||||
|
||||
class Database : public DBcore {
|
||||
public:
|
||||
Database();
|
||||
@@ -106,153 +90,166 @@ public:
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
~Database();
|
||||
|
||||
/*
|
||||
* General Character Related Stuff
|
||||
*/
|
||||
/* Character Creation */
|
||||
|
||||
bool AddToNameFilter(const char* name);
|
||||
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
|
||||
bool DeleteCharacter(char* name);
|
||||
bool MoveCharacterToZone(const char* charname, const char* zonename);
|
||||
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
|
||||
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
|
||||
bool UpdateName(const char* oldname, const char* newname);
|
||||
bool ReserveName(uint32 account_id, char* name);
|
||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
||||
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
|
||||
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
|
||||
bool AddToNameFilter(const char* name);
|
||||
bool ReserveName(uint32 account_id, char* name);
|
||||
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
|
||||
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv, ExtendedProfile_Struct *ext);
|
||||
bool DeleteCharacter(char* name);
|
||||
uint8 CopyCharacter(const char* oldname, const char* newname, uint32 acctid);
|
||||
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, Inventory* inv);
|
||||
bool UpdateName(const char* oldname, const char* newname);
|
||||
|
||||
/*
|
||||
* General Information Getting Queries
|
||||
*/
|
||||
/* General Information Queries */
|
||||
|
||||
bool AddBannedIP(char* bannedIP, const char* notes); //Add IP address to the Banned_IPs table.
|
||||
bool AddGMIP(char* ip_address, char* name);
|
||||
bool CheckBannedIPs(const char* loginIP); //Check incoming connection against banned IP table.
|
||||
bool CheckGMIPs(const char* loginIP, uint32 account_id);
|
||||
bool CheckNameFilter(const char* name, bool surname = false);
|
||||
bool CheckUsedName(const char* name);
|
||||
|
||||
uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0);
|
||||
uint32 GetAccountIDByChar(uint32 char_id);
|
||||
uint32 GetAccountIDByName(const char* accname, int16* status = 0, uint32* lsid = 0);
|
||||
uint32 GetCharacterID(const char *name);
|
||||
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0, float* oX = 0, float* oY = 0, float* oZ = 0);
|
||||
uint32 GetGuildIDByCharID(uint32 char_id);
|
||||
|
||||
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
|
||||
void GetCharName(uint32 char_id, char* name);
|
||||
uint32 GetCharacterInfo(const char* iName, uint32* oAccID = 0, uint32* oZoneID = 0, uint32* oInstanceID = 0,float* oX = 0, float* oY = 0, float* oZ = 0);
|
||||
uint32 GetCharacterID(const char *name);
|
||||
bool CheckBannedIPs(const char* loginIP); //Lieka Edit: Check incomming connection against banned IP table.
|
||||
bool AddBannedIP(char* bannedIP, const char* notes); //Lieka Edit: Add IP address to the Banned_IPs table.
|
||||
bool CheckGMIPs(const char* loginIP, uint32 account_id);
|
||||
bool AddGMIP(char* ip_address, char* name);
|
||||
void LoginIP(uint32 AccountID, const char* LoginIP);
|
||||
|
||||
/*
|
||||
* Instancing Stuff
|
||||
*/
|
||||
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
|
||||
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
|
||||
bool CharacterInInstanceGroup(uint16 instance_id, uint32 char_id);
|
||||
void DeleteInstance(uint16 instance_id);
|
||||
bool CheckInstanceExpired(uint16 instance_id);
|
||||
uint32 ZoneIDFromInstanceID(uint16 instance_id);
|
||||
uint32 VersionFromInstanceID(uint16 instance_id);
|
||||
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
|
||||
bool GetUnusedInstanceID(uint16 &instance_id);
|
||||
bool CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration);
|
||||
void PurgeExpiredInstances();
|
||||
/* Instancing */
|
||||
|
||||
bool AddClientToInstance(uint16 instance_id, uint32 char_id);
|
||||
bool CharacterInInstanceGroup(uint16 instance_id, uint32 char_id);
|
||||
bool CheckInstanceExists(uint16 instance_id);
|
||||
bool CheckInstanceExpired(uint16 instance_id);
|
||||
bool CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration);
|
||||
bool GetUnusedInstanceID(uint16 &instance_id);
|
||||
bool GlobalInstance(uint16 instance_id);
|
||||
bool RemoveClientFromInstance(uint16 instance_id, uint32 char_id);
|
||||
bool RemoveClientsFromInstance(uint16 instance_id);
|
||||
bool CheckInstanceExists(uint16 instance_id);
|
||||
void BuryCorpsesInInstance(uint16 instance_id);
|
||||
uint16 GetInstanceVersion(uint16 instance_id);
|
||||
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
|
||||
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
|
||||
|
||||
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
|
||||
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
|
||||
void GetCharactersInInstance(uint16 instance_id, std::list<uint32> &charid_list);
|
||||
uint16 GetInstanceVersion(uint16 instance_id);
|
||||
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
|
||||
uint32 VersionFromInstanceID(uint16 instance_id);
|
||||
uint32 ZoneIDFromInstanceID(uint16 instance_id);
|
||||
|
||||
void AssignGroupToInstance(uint32 gid, uint32 instance_id);
|
||||
void AssignRaidToInstance(uint32 rid, uint32 instance_id);
|
||||
void BuryCorpsesInInstance(uint16 instance_id);
|
||||
void DeleteInstance(uint16 instance_id);
|
||||
void FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 charid, uint32 gid);
|
||||
void FlagInstanceByRaidLeader(uint32 zone, int16 version, uint32 charid, uint32 rid);
|
||||
void GetCharactersInInstance(uint16 instance_id, std::list<uint32> &charid_list);
|
||||
void PurgeExpiredInstances();
|
||||
void SetInstanceDuration(uint16 instance_id, uint32 new_duration);
|
||||
bool GlobalInstance(uint16 instance_id);
|
||||
|
||||
/*
|
||||
* Adventure related.
|
||||
*/
|
||||
/* Adventure related. */
|
||||
|
||||
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
|
||||
bool GetAdventureStats(uint32 char_id, uint32 &guk_w, uint32 &mir_w, uint32 &mmc_w, uint32 &ruj_w, uint32 &tak_w,
|
||||
uint32 &guk_l, uint32 &mir_l, uint32 &mmc_l, uint32 &ruj_l, uint32 &tak_l);
|
||||
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
|
||||
|
||||
/* Account Related */
|
||||
|
||||
/*
|
||||
* Account Related
|
||||
*/
|
||||
uint32 GetMiniLoginAccount(char* ip);
|
||||
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
||||
uint32 CheckLogin(const char* name, const char* password, int16* oStatus = 0);
|
||||
int16 CheckStatus(uint32 account_id);
|
||||
uint32 CreateAccount(const char* name, const char* password, int16 status, uint32 lsaccount_id = 0);
|
||||
bool DeleteAccount(const char* name);
|
||||
bool GetLiveChar(uint32 account_id, char* cname);
|
||||
bool SetAccountStatus(const char* name, int16 status);
|
||||
bool SetLocalPassword(uint32 accid, const char* password);
|
||||
bool UpdateLiveChar(char* charname, uint32 lsaccount_id);
|
||||
|
||||
int16 CheckStatus(uint32 account_id);
|
||||
|
||||
uint32 CheckLogin(const char* name, const char* password, int16* oStatus = 0);
|
||||
uint32 CreateAccount(const char* name, const char* password, int16 status, uint32 lsaccount_id = 0);
|
||||
uint32 GetAccountIDFromLSID(uint32 iLSID, char* oAccountName = 0, int16* oStatus = 0);
|
||||
bool UpdateLiveChar(char* charname,uint32 lsaccount_id);
|
||||
bool GetLiveChar(uint32 account_id, char* cname);
|
||||
uint32 GetMiniLoginAccount(char* ip);
|
||||
uint8 GetAgreementFlag(uint32 acctid);
|
||||
|
||||
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
|
||||
void SetAgreementFlag(uint32 acctid);
|
||||
|
||||
/*
|
||||
* Groups
|
||||
*/
|
||||
uint32 GetGroupID(const char* name);
|
||||
void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false);
|
||||
void ClearGroup(uint32 gid = 0);
|
||||
char* GetGroupLeaderForLogin(const char* name,char* leaderbuf);
|
||||
|
||||
void SetGroupLeaderName(uint32 gid, const char* name);
|
||||
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr,
|
||||
GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||
void ClearGroupLeader(uint32 gid = 0);
|
||||
/* Groups */
|
||||
|
||||
char* GetGroupLeaderForLogin(const char* name,char* leaderbuf);
|
||||
char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||
|
||||
uint32 GetGroupID(const char* name);
|
||||
|
||||
void ClearGroup(uint32 gid = 0);
|
||||
void ClearGroupLeader(uint32 gid = 0);
|
||||
void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false);
|
||||
void SetGroupLeaderName(uint32 gid, const char* name);
|
||||
|
||||
/* Raids */
|
||||
|
||||
/*
|
||||
* Raids
|
||||
*/
|
||||
void ClearRaid(uint32 rid = 0);
|
||||
void ClearRaidDetails(uint32 rid = 0);
|
||||
uint32 GetRaidID(const char* name);
|
||||
const char *GetRaidLeaderName(uint32 rid);
|
||||
|
||||
/*
|
||||
* Database Variables
|
||||
*/
|
||||
uint32 GetRaidID(const char* name);
|
||||
|
||||
void ClearRaid(uint32 rid = 0);
|
||||
void ClearRaidDetails(uint32 rid = 0);
|
||||
void ClearRaidLeader(uint32 gid = 0xFFFFFFFF, uint32 rid = 0);
|
||||
void GetGroupLeadershipInfo(uint32 gid, uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
|
||||
void GetRaidLeadershipInfo(uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, RaidLeadershipAA_Struct* RLAA = nullptr);
|
||||
void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid);
|
||||
|
||||
/* Database Conversions 'database_conversions.cpp' */
|
||||
|
||||
bool CheckDatabaseConversions();
|
||||
bool CheckDatabaseConvertBotsPostPPDeblob();
|
||||
bool CheckDatabaseConvertCorpseDeblob();
|
||||
bool CheckDatabaseConvertPPDeblob();
|
||||
|
||||
/* Database Variables */
|
||||
|
||||
bool GetVariable(const char* varname, char* varvalue, uint16 varvalue_len);
|
||||
bool SetVariable(const char* varname, const char* varvalue);
|
||||
bool LoadVariables();
|
||||
uint32 LoadVariables_MQ(char** query);
|
||||
bool LoadVariables_result(MySQLRequestResult results);
|
||||
|
||||
/*
|
||||
* General Queries
|
||||
*/
|
||||
bool LoadZoneNames();
|
||||
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
|
||||
uint32 GetZoneID(const char* zonename);
|
||||
uint8 GetPEQZone(uint32 zoneID, uint32 version);
|
||||
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
|
||||
uint8 GetServerType();
|
||||
/* General Queries */
|
||||
|
||||
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
|
||||
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
|
||||
uint8 GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level);
|
||||
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
|
||||
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
|
||||
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
|
||||
bool LoadPTimers(uint32 charid, PTimerList &into);
|
||||
void ClearPTimers(uint32 charid);
|
||||
void ClearMerchantTemp();
|
||||
void SetLFP(uint32 CharID, bool LFP);
|
||||
void SetLFG(uint32 CharID, bool LFG);
|
||||
void SetFirstLogon(uint32 CharID, uint8 firstlogon);
|
||||
void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon);
|
||||
bool LoadZoneNames();
|
||||
|
||||
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
|
||||
|
||||
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
|
||||
uint32 GetZoneID(const char* zonename);
|
||||
|
||||
uint8 GetPEQZone(uint32 zoneID, uint32 version);
|
||||
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
|
||||
uint8 GetServerType();
|
||||
uint8 GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level);
|
||||
|
||||
void AddReport(std::string who, std::string against, std::string lines);
|
||||
void ClearMerchantTemp();
|
||||
void ClearPTimers(uint32 charid);
|
||||
void SetFirstLogon(uint32 CharID, uint8 firstlogon);
|
||||
void SetLFG(uint32 CharID, bool LFG);
|
||||
void SetLFP(uint32 CharID, bool LFP);
|
||||
void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon);
|
||||
|
||||
|
||||
protected:
|
||||
void HandleMysqlError(uint32 errnum);
|
||||
/* EQEmuLogSys */
|
||||
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
|
||||
|
||||
private:
|
||||
void DBInitVars();
|
||||
@@ -264,19 +261,14 @@ private:
|
||||
VarCache_Struct** varcache_array;
|
||||
uint32 varcache_lastupdate;
|
||||
|
||||
|
||||
/*
|
||||
* Groups, utility methods.
|
||||
*/
|
||||
/* Groups, utility methods. */
|
||||
void ClearAllGroupLeaders();
|
||||
void ClearAllGroups();
|
||||
|
||||
|
||||
/*
|
||||
* Raid, utility methods.
|
||||
*/
|
||||
/* Raid, utility methods. */
|
||||
void ClearAllRaids();
|
||||
void ClearAllRaidDetails();
|
||||
void ClearAllRaidLeaders();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,562 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/string_util.h"
|
||||
#include "../common/timer.h"
|
||||
|
||||
#include "database.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
|
||||
// Disgrace: for windows compile
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
#include "unix.h"
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
bool Database::AddClientToInstance(uint16 instance_id, uint32 char_id)
|
||||
{
|
||||
std::string query = StringFormat(
|
||||
"REPLACE INTO `instance_list_player` (id, charid) "
|
||||
"VALUES "
|
||||
"(%lu, %lu)",
|
||||
(unsigned long)instance_id,
|
||||
(unsigned long)char_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
bool Database::CharacterInInstanceGroup(uint16 instance_id, uint32 char_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT charid FROM instance_list_player where id=%u AND charid=%u", instance_id, char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() != 1)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::CheckInstanceExists(uint16 instance_id) {
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"`id` "
|
||||
"FROM "
|
||||
"`instance_list` "
|
||||
"WHERE "
|
||||
"`id` = %u",
|
||||
instance_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::CheckInstanceExpired(uint16 instance_id)
|
||||
{
|
||||
|
||||
int32 start_time = 0;
|
||||
int32 duration = 0;
|
||||
uint32 never_expires = 0;
|
||||
|
||||
std::string query = StringFormat("SELECT start_time, duration, never_expires FROM instance_list WHERE id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return true;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return true;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
start_time = atoi(row[0]);
|
||||
duration = atoi(row[1]);
|
||||
never_expires = atoi(row[2]);
|
||||
|
||||
if (never_expires == 1)
|
||||
return false;
|
||||
|
||||
timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
|
||||
if ((start_time + duration) <= tv.tv_sec)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration)
|
||||
{
|
||||
std::string query = StringFormat("INSERT INTO instance_list (id, zone, version, start_time, duration)"
|
||||
" values(%lu, %lu, %lu, UNIX_TIMESTAMP(), %lu)",
|
||||
(unsigned long)instance_id, (unsigned long)zone_id, (unsigned long)version, (unsigned long)duration);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
bool Database::GetUnusedInstanceID(uint16 &instance_id)
|
||||
{
|
||||
uint32 count = RuleI(Zone, ReservedInstances);
|
||||
uint32 max = 65535;
|
||||
|
||||
std::string query = StringFormat("SELECT IFNULL(MAX(id),%u)+1 FROM instance_list WHERE id > %u", count, count);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
if (atoi(row[0]) <= max)
|
||||
{
|
||||
instance_id = atoi(row[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
query = StringFormat("SELECT id FROM instance_list where id > %u ORDER BY id", count);
|
||||
results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
count++;
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
if (count < atoi(row[0]))
|
||||
{
|
||||
instance_id = count;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (count > max)
|
||||
{
|
||||
instance_id = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
instance_id = count;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::GlobalInstance(uint16 instance_id)
|
||||
{
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"is_global "
|
||||
"FROM "
|
||||
"instance_list "
|
||||
"WHERE "
|
||||
"id = %u "
|
||||
"LIMIT 1 ",
|
||||
instance_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return (atoi(row[0]) == 1) ? true : false;
|
||||
}
|
||||
|
||||
bool Database::RemoveClientFromInstance(uint16 instance_id, uint32 char_id)
|
||||
{
|
||||
std::string query = StringFormat("DELETE FROM instance_list_player WHERE id=%lu AND charid=%lu",
|
||||
(unsigned long)instance_id, (unsigned long)char_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
|
||||
bool Database::RemoveClientsFromInstance(uint16 instance_id)
|
||||
{
|
||||
std::string query = StringFormat("DELETE FROM instance_list_player WHERE id=%lu", (unsigned long)instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
return results.Success();
|
||||
}
|
||||
|
||||
bool Database::VerifyInstanceAlive(uint16 instance_id, uint32 char_id)
|
||||
{
|
||||
//we are not saved to this instance so set our instance to 0
|
||||
if (!GlobalInstance(instance_id) && !CharacterInInstanceGroup(instance_id, char_id))
|
||||
return false;
|
||||
|
||||
if (CheckInstanceExpired(instance_id))
|
||||
{
|
||||
DeleteInstance(instance_id);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT id FROM instance_list where id=%u AND zone=%u", instance_id, zone_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return false;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 version) {
|
||||
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"instance_list.id "
|
||||
"FROM "
|
||||
"instance_list, "
|
||||
"instance_list_player "
|
||||
"WHERE "
|
||||
"instance_list.zone = %u "
|
||||
"AND instance_list.version = %u "
|
||||
"AND instance_list.id = instance_list_player.id "
|
||||
"AND instance_list_player.charid = %u "
|
||||
"LIMIT 1 ",
|
||||
GetZoneID(zone),
|
||||
version,
|
||||
character_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version)
|
||||
{
|
||||
if (!zone)
|
||||
return 0;
|
||||
|
||||
std::string query = StringFormat(
|
||||
"SELECT "
|
||||
"instance_list.id "
|
||||
"FROM "
|
||||
"instance_list, "
|
||||
"instance_list_player "
|
||||
"WHERE "
|
||||
"instance_list.zone = %u "
|
||||
"AND instance_list.version = %u "
|
||||
"AND instance_list.id = instance_list_player.id "
|
||||
"AND instance_list_player.charid = %u "
|
||||
"LIMIT 1; ",
|
||||
zone,
|
||||
version,
|
||||
character_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint16 Database::GetInstanceVersion(uint16 instance_id) {
|
||||
if (instance_id == 0)
|
||||
return 0;
|
||||
|
||||
std::string query = StringFormat("SELECT version FROM instance_list where id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint32 Database::GetTimeRemainingInstance(uint16 instance_id, bool &is_perma)
|
||||
{
|
||||
uint32 start_time = 0;
|
||||
uint32 duration = 0;
|
||||
uint32 never_expires = 0;
|
||||
|
||||
std::string query = StringFormat("SELECT start_time, duration, never_expires FROM instance_list WHERE id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
{
|
||||
is_perma = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
{
|
||||
is_perma = false;
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
start_time = atoi(row[0]);
|
||||
duration = atoi(row[1]);
|
||||
never_expires = atoi(row[2]);
|
||||
|
||||
if (never_expires == 1)
|
||||
{
|
||||
is_perma = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
is_perma = false;
|
||||
|
||||
timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
return ((start_time + duration) - tv.tv_sec);
|
||||
}
|
||||
|
||||
uint32 Database::VersionFromInstanceID(uint16 instance_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT version FROM instance_list where id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
uint32 Database::ZoneIDFromInstanceID(uint16 instance_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("SELECT zone FROM instance_list where id=%u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return 0;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return 0;
|
||||
|
||||
auto row = results.begin();
|
||||
|
||||
return atoi(row[0]);
|
||||
}
|
||||
|
||||
void Database::AssignGroupToInstance(uint32 group_id, uint32 instance_id)
|
||||
{
|
||||
|
||||
uint32 zone_id = ZoneIDFromInstanceID(instance_id);
|
||||
uint16 version = VersionFromInstanceID(instance_id);
|
||||
|
||||
std::string query = StringFormat("SELECT `charid` FROM `group_id` WHERE `groupid` = %u", group_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
uint32 charid = atoi(row[0]);
|
||||
if (GetInstanceID(zone_id, charid, version) == 0)
|
||||
AddClientToInstance(instance_id, charid);
|
||||
}
|
||||
}
|
||||
|
||||
void Database::AssignRaidToInstance(uint32 raid_id, uint32 instance_id)
|
||||
{
|
||||
|
||||
uint32 zone_id = ZoneIDFromInstanceID(instance_id);
|
||||
uint16 version = VersionFromInstanceID(instance_id);
|
||||
|
||||
std::string query = StringFormat("SELECT `charid` FROM `raid_members` WHERE `raidid` = %u", raid_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
{
|
||||
uint32 charid = atoi(row[0]);
|
||||
if (GetInstanceID(zone_id, charid, version) == 0)
|
||||
AddClientToInstance(instance_id, charid);
|
||||
}
|
||||
}
|
||||
|
||||
void Database::BuryCorpsesInInstance(uint16 instance_id) {
|
||||
std::string query = StringFormat(
|
||||
"UPDATE `character_corpses` "
|
||||
"SET `is_buried` = 1, "
|
||||
"`instance_id` = 0 "
|
||||
"WHERE "
|
||||
"`instance_id` = %u ",
|
||||
instance_id
|
||||
);
|
||||
auto results = QueryDatabase(query);
|
||||
}
|
||||
|
||||
void Database::DeleteInstance(uint16 instance_id)
|
||||
{
|
||||
|
||||
std::string query = StringFormat("DELETE FROM instance_list WHERE id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
query = StringFormat("DELETE FROM respawn_times WHERE instance_id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id);
|
||||
QueryDatabase(query);
|
||||
|
||||
BuryCorpsesInInstance(instance_id);
|
||||
}
|
||||
|
||||
void Database::FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 charid, uint32 gid)
|
||||
{
|
||||
uint16 id = GetInstanceID(zone, charid, version);
|
||||
if (id != 0)
|
||||
return;
|
||||
|
||||
char ln[128];
|
||||
memset(ln, 0, 128);
|
||||
strcpy(ln, GetGroupLeadershipInfo(gid, ln));
|
||||
uint32 l_charid = GetCharacterID((const char*)ln);
|
||||
uint16 l_id = GetInstanceID(zone, l_charid, version);
|
||||
|
||||
if (l_id == 0)
|
||||
return;
|
||||
|
||||
AddClientToInstance(l_id, charid);
|
||||
}
|
||||
|
||||
void Database::FlagInstanceByRaidLeader(uint32 zone, int16 version, uint32 charid, uint32 rid)
|
||||
{
|
||||
uint16 id = GetInstanceID(zone, charid, version);
|
||||
if (id != 0)
|
||||
return;
|
||||
|
||||
uint32 l_charid = GetCharacterID(GetRaidLeaderName(rid));
|
||||
uint16 l_id = GetInstanceID(zone, l_charid, version);
|
||||
|
||||
if (l_id == 0)
|
||||
return;
|
||||
|
||||
AddClientToInstance(l_id, charid);
|
||||
}
|
||||
|
||||
void Database::GetCharactersInInstance(uint16 instance_id, std::list<uint32> &charid_list) {
|
||||
|
||||
std::string query = StringFormat("SELECT `charid` FROM `instance_list_player` WHERE `id` = %u", instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
charid_list.push_back(atoi(row[0]));
|
||||
}
|
||||
|
||||
void Database::PurgeExpiredInstances()
|
||||
{
|
||||
std::string query("SELECT id FROM instance_list where (start_time+duration) <= UNIX_TIMESTAMP() and never_expires = 0");
|
||||
auto results = QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
return;
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return;
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row)
|
||||
DeleteInstance(atoi(row[0]));
|
||||
}
|
||||
|
||||
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
|
||||
{
|
||||
std::string query = StringFormat("UPDATE `instance_list` SET start_time=UNIX_TIMESTAMP(), "
|
||||
"duration=%u WHERE id=%u", new_duration, instance_id);
|
||||
auto results = QueryDatabase(query);
|
||||
}
|
||||
@@ -1,669 +0,0 @@
|
||||
#include "debug.h"
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
#include <iostream>
|
||||
#include "dbasync.h"
|
||||
#include "database.h"
|
||||
#include <errmsg.h>
|
||||
#include <mysqld_error.h>
|
||||
#include <limits.h>
|
||||
#include "dbcore.h"
|
||||
#include <string.h>
|
||||
//#include "../common/misc_functions.h"
|
||||
#include "string_util.h"
|
||||
#define ASYNC_LOOP_GRANULARITY 4 //# of ms between checking our work
|
||||
|
||||
bool DBAsyncCB_LoadVariables(DBAsyncWork* iWork) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES* result = 0;
|
||||
DBAsyncQuery* dbaq = iWork->PopAnswer();
|
||||
if (dbaq->GetAnswer(errbuf, &result))
|
||||
iWork->GetDB()->LoadVariables_result(result);
|
||||
else
|
||||
std::cout << "Error: DBAsyncCB_LoadVariables failed: !GetAnswer: '" << errbuf << "'" << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
void AsyncLoadVariables(DBAsync *dba, Database *db) {
|
||||
char* query = 0;
|
||||
DBAsyncWork* dbaw = new DBAsyncWork(db, &DBAsyncCB_LoadVariables, 0, DBAsync::Read);
|
||||
dbaw->AddQuery(0, &query, db->LoadVariables_MQ(&query));
|
||||
dba->AddWork(&dbaw);
|
||||
}
|
||||
|
||||
|
||||
//we only need to do anything when somebody puts work on the queue
|
||||
//so instead of checking all the time, we will wait on a condition
|
||||
//which will get signaled when somebody puts something on the queue
|
||||
ThreadReturnType DBAsyncLoop(void* tmp) {
|
||||
DBAsync* dba = (DBAsync*) tmp;
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Starting DBAsyncLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
dba->MLoopRunning.lock();
|
||||
while (dba->RunLoop()) {
|
||||
//wait before working so we check the loop condition
|
||||
//as soon as were done working
|
||||
dba->CInList.Wait();
|
||||
//we could check dba->RunLoop() again to see if we
|
||||
//got turned off while we were waiting
|
||||
{
|
||||
dba->Process();
|
||||
}
|
||||
}
|
||||
dba->MLoopRunning.unlock();
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Ending DBAsyncLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
THREAD_RETURN(nullptr);
|
||||
}
|
||||
|
||||
DBAsync::DBAsync(DBcore* iDBC)
|
||||
: Timeoutable(10000)
|
||||
{
|
||||
pDBC = iDBC;
|
||||
pRunLoop = true;
|
||||
pNextID = 1;
|
||||
#ifdef _WINDOWS
|
||||
_beginthread(DBAsyncLoop, 0, this);
|
||||
#else
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, nullptr, DBAsyncLoop, this);
|
||||
#endif
|
||||
}
|
||||
|
||||
DBAsync::~DBAsync() {
|
||||
StopThread();
|
||||
}
|
||||
|
||||
bool DBAsync::StopThread() {
|
||||
bool ret;
|
||||
MRunLoop.lock();
|
||||
ret = pRunLoop;
|
||||
pRunLoop = false;
|
||||
MRunLoop.unlock();
|
||||
|
||||
//signal the condition so we exit the loop if were waiting
|
||||
CInList.Signal();
|
||||
|
||||
//this effectively waits for the processing thread to finish
|
||||
MLoopRunning.lock();
|
||||
MLoopRunning.unlock();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32 DBAsync::AddWork(DBAsyncWork** iWork, uint32 iDelay) {
|
||||
MInList.lock();
|
||||
uint32 ret = GetNextID();
|
||||
if (!(*iWork)->SetWorkID(ret)) {
|
||||
MInList.unlock();
|
||||
return 0;
|
||||
}
|
||||
InList.Append(*iWork);
|
||||
(*iWork)->SetStatus(Queued);
|
||||
if (iDelay)
|
||||
(*iWork)->pExecuteAfter = Timer::GetCurrentTime() + iDelay;
|
||||
#if DEBUG_MYSQL_QUERIES >= 2
|
||||
std::cout << "Adding AsyncWork #" << (*iWork)->GetWorkID() << std::endl;
|
||||
std::cout << "ExecuteAfter = " << (*iWork)->pExecuteAfter << " (" << Timer::GetCurrentTime() << " + " << iDelay << ")" << std::endl;
|
||||
#endif
|
||||
*iWork = 0;
|
||||
MInList.unlock();
|
||||
|
||||
//wake up the processing thread and tell it to get to work.
|
||||
CInList.Signal();
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool DBAsync::CancelWork(uint32 iWorkID) {
|
||||
if (iWorkID == 0)
|
||||
return false;
|
||||
#if DEBUG_MYSQL_QUERIES >= 2
|
||||
std::cout << "DBAsync::CancelWork: " << iWorkID << std::endl;
|
||||
#endif
|
||||
MCurrentWork.lock();
|
||||
if (CurrentWork && CurrentWork->GetWorkID() == iWorkID) {
|
||||
CurrentWork->Cancel();
|
||||
MCurrentWork.unlock();
|
||||
return true;
|
||||
}
|
||||
MCurrentWork.unlock();
|
||||
MInList.lock();
|
||||
LinkedListIterator<DBAsyncWork*> iterator(InList);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->GetWorkID() == iWorkID) {
|
||||
iterator.RemoveCurrent(true);
|
||||
MInList.unlock();
|
||||
return true;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
MInList.unlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool DBAsync::RunLoop() {
|
||||
bool ret;
|
||||
MRunLoop.lock();
|
||||
ret = pRunLoop;
|
||||
MRunLoop.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
DBAsyncWork* DBAsync::InListPop() {
|
||||
DBAsyncWork* ret = 0;
|
||||
MInList.lock();
|
||||
LinkedListIterator<DBAsyncWork*> iterator(InList);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->pExecuteAfter <= Timer::GetCurrentTime()) {
|
||||
ret = iterator.GetData();
|
||||
#if DEBUG_MYSQL_QUERIES >= 2
|
||||
std::cout << "Poping AsyncWork #" << ret->GetWorkID() << std::endl;
|
||||
std::cout << ret->pExecuteAfter << " <= " << Timer::GetCurrentTime() << std::endl;
|
||||
#endif
|
||||
iterator.RemoveCurrent(false);
|
||||
break;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
MInList.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
DBAsyncWork* DBAsync::InListPopWrite() {
|
||||
MInList.lock();
|
||||
LinkedListIterator<DBAsyncWork*> iterator(InList);
|
||||
|
||||
DBAsyncWork* ret = 0;
|
||||
DBAsync::Type tmpType;
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
tmpType = iterator.GetData()->Type();
|
||||
if (tmpType == Write || tmpType == Both) {
|
||||
ret = iterator.GetData();
|
||||
iterator.RemoveCurrent(false);
|
||||
break;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
MInList.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DBAsync::AddFQ(DBAsyncFinishedQueue* iDBAFQ) {
|
||||
MFQList.lock();
|
||||
DBAsyncFinishedQueue** tmp = new DBAsyncFinishedQueue*;
|
||||
*tmp = iDBAFQ;
|
||||
FQList.Append(tmp);
|
||||
MFQList.unlock();
|
||||
}
|
||||
|
||||
void DBAsync::Process() {
|
||||
DBAsyncWork* tmpWork;
|
||||
MCurrentWork.lock();
|
||||
while ((CurrentWork = InListPop())) {
|
||||
MCurrentWork.unlock();
|
||||
//move from queued to executing
|
||||
Status tmpStatus = CurrentWork->SetStatus(Executing);
|
||||
if (tmpStatus == Queued) {
|
||||
//execute the work
|
||||
ProcessWork(CurrentWork);
|
||||
tmpWork = CurrentWork;
|
||||
MCurrentWork.lock();
|
||||
CurrentWork = 0;
|
||||
MCurrentWork.unlock();
|
||||
//move from executing to finished
|
||||
tmpStatus = tmpWork->SetStatus(DBAsync::Finished);
|
||||
if (tmpStatus != Executing) {
|
||||
if (tmpStatus != Canceled) {
|
||||
std::cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::Process #1" << std::endl;
|
||||
}
|
||||
MCurrentWork.lock();
|
||||
safe_delete(tmpWork);
|
||||
}
|
||||
else {
|
||||
//call callbacks or put results on finished queue
|
||||
DispatchWork(tmpWork);
|
||||
Sleep(25);
|
||||
MCurrentWork.lock();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (tmpStatus != Canceled) {
|
||||
std::cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::Process #2" << std::endl;
|
||||
}
|
||||
MCurrentWork.lock();
|
||||
safe_delete(CurrentWork);
|
||||
}
|
||||
}
|
||||
MCurrentWork.unlock();
|
||||
}
|
||||
|
||||
void DBAsync::CheckTimeout() {
|
||||
try{
|
||||
MFQList.lock();
|
||||
LinkedListIterator<DBAsyncFinishedQueue**> iterator(FQList);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
(*iterator.GetData())->CheckTimeouts();
|
||||
iterator.Advance();
|
||||
}
|
||||
MFQList.unlock();
|
||||
}
|
||||
catch(...){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void DBAsync::CommitWrites() {
|
||||
#if DEBUG_MYSQL_QUERIES >= 2
|
||||
std::cout << "DBAsync::CommitWrites() called." << std::endl;
|
||||
#endif
|
||||
DBAsyncWork* tmpWork;
|
||||
while ((tmpWork = InListPopWrite())) {
|
||||
Status tmpStatus = tmpWork->SetStatus(Executing);
|
||||
if (tmpStatus == Queued) {
|
||||
ProcessWork(tmpWork);
|
||||
tmpStatus = tmpWork->SetStatus(DBAsync::Finished);
|
||||
if (tmpStatus != Executing) {
|
||||
if (tmpStatus != Canceled) {
|
||||
std::cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::CommitWrites #1" << std::endl;
|
||||
}
|
||||
safe_delete(tmpWork);
|
||||
}
|
||||
else {
|
||||
DispatchWork(tmpWork);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (tmpStatus != Canceled) {
|
||||
std::cout << "Error: Unexpected DBAsyncWork->Status in DBAsync::CommitWrites #2" << std::endl;
|
||||
}
|
||||
safe_delete(tmpWork);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DBAsync::ProcessWork(DBAsyncWork* iWork, bool iSleep) {
|
||||
DBAsyncQuery* CurrentQuery;
|
||||
while ((CurrentQuery = iWork->PopQuery())) {
|
||||
CurrentQuery->Process(pDBC);
|
||||
iWork->PushAnswer(CurrentQuery);
|
||||
if (iSleep)
|
||||
Sleep(1);
|
||||
}
|
||||
}
|
||||
|
||||
void DBAsync::DispatchWork(DBAsyncWork* iWork) {
|
||||
//if this work has a callback, call it
|
||||
//otherwise, stick the work on the finish queue
|
||||
if (iWork->pCB) {
|
||||
if (iWork->pCB(iWork))
|
||||
safe_delete(iWork);
|
||||
}
|
||||
else {
|
||||
if (!iWork->pDBAFQ->Push(iWork))
|
||||
safe_delete(iWork);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
DBAsyncFinishedQueue::DBAsyncFinishedQueue(uint32 iTimeout) {
|
||||
pTimeout = iTimeout;
|
||||
}
|
||||
|
||||
DBAsyncFinishedQueue::~DBAsyncFinishedQueue() {
|
||||
}
|
||||
|
||||
void DBAsyncFinishedQueue::CheckTimeouts() {
|
||||
if (pTimeout == 0xFFFFFFFF)
|
||||
return;
|
||||
MLock.lock();
|
||||
LinkedListIterator<DBAsyncWork*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->CheckTimeout(pTimeout))
|
||||
iterator.RemoveCurrent(true);
|
||||
iterator.Advance();
|
||||
}
|
||||
MLock.unlock();
|
||||
}
|
||||
|
||||
DBAsyncWork* DBAsyncFinishedQueue::Pop() {
|
||||
DBAsyncWork* ret = 0;
|
||||
MLock.lock();
|
||||
ret = list.Pop();
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
DBAsyncWork* DBAsyncFinishedQueue::Find(uint32 iWorkID) {
|
||||
DBAsyncWork* ret = 0;
|
||||
MLock.lock();
|
||||
LinkedListIterator<DBAsyncWork*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->GetWorkID() == iWorkID) {
|
||||
ret = iterator.GetData();
|
||||
iterator.RemoveCurrent(false);
|
||||
break;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
DBAsyncWork* DBAsyncFinishedQueue::PopByWPT(uint32 iWPT) {
|
||||
DBAsyncWork* ret = 0;
|
||||
MLock.lock();
|
||||
LinkedListIterator<DBAsyncWork*> iterator(list);
|
||||
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()->WPT() == iWPT) {
|
||||
ret = iterator.GetData();
|
||||
iterator.RemoveCurrent(false);
|
||||
break;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool DBAsyncFinishedQueue::Push(DBAsyncWork* iDBAW) {
|
||||
if (!this)
|
||||
return false;
|
||||
MLock.lock();
|
||||
list.Append(iDBAW);
|
||||
MLock.unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
DBAsyncWork::DBAsyncWork(Database *db, DBAsyncFinishedQueue* iDBAFQ, uint32 iWPT, DBAsync::Type iType, uint32 iTimeout)
|
||||
: m_db(db)
|
||||
{
|
||||
pstatus = DBAsync::AddingWork;
|
||||
pType = iType;
|
||||
pExecuteAfter = 0;
|
||||
pWorkID = 0;
|
||||
pDBAFQ = iDBAFQ;
|
||||
pCB = 0;
|
||||
pWPT = iWPT;
|
||||
pQuestionCount = 0;
|
||||
pAnswerCount = 0;
|
||||
pTimeout = iTimeout;
|
||||
pTSFinish = 0;
|
||||
}
|
||||
|
||||
DBAsyncWork::DBAsyncWork(Database *db, DBWorkCompleteCallBack iCB, uint32 iWPT, DBAsync::Type iType, uint32 iTimeout)
|
||||
: m_db(db)
|
||||
{
|
||||
pstatus = DBAsync::AddingWork;
|
||||
pType = iType;
|
||||
pExecuteAfter = 0;
|
||||
pWorkID = 0;
|
||||
pDBAFQ = 0;
|
||||
pCB = iCB;
|
||||
pWPT = iWPT;
|
||||
pQuestionCount = 0;
|
||||
pAnswerCount = 0;
|
||||
pTimeout = iTimeout;
|
||||
pTSFinish = 0;
|
||||
}
|
||||
|
||||
DBAsyncWork::~DBAsyncWork() {
|
||||
DBAsyncQuery* dbaq = 0;
|
||||
while ((dbaq = todo.pop()))
|
||||
safe_delete(dbaq);
|
||||
while ((dbaq = done.pop()))
|
||||
safe_delete(dbaq);
|
||||
while ((dbaq = todel.pop()))
|
||||
safe_delete(dbaq);
|
||||
}
|
||||
|
||||
bool DBAsyncWork::AddQuery(DBAsyncQuery** iDBAQ) {
|
||||
bool ret;
|
||||
MLock.lock();
|
||||
if (pstatus != DBAsync::AddingWork)
|
||||
ret = false;
|
||||
else {
|
||||
ret = true;
|
||||
pQuestionCount++;
|
||||
todo.push(*iDBAQ);
|
||||
(*iDBAQ)->pstatus = DBAsync::Queued;
|
||||
*iDBAQ = 0;
|
||||
}
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool DBAsyncWork::AddQuery(uint32 iQPT, char** iQuery, uint32 iQueryLen, bool iGetResultSet, bool iGetErrbuf) {
|
||||
DBAsyncQuery* DBAQ = new DBAsyncQuery(iQPT, iQuery, iQueryLen, iGetResultSet, iGetErrbuf);
|
||||
if (AddQuery(&DBAQ))
|
||||
return true;
|
||||
else {
|
||||
safe_delete(DBAQ);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool DBAsyncWork::SetWorkID(uint32 iWorkID) {
|
||||
bool ret = true;
|
||||
MLock.lock();
|
||||
if (pWorkID)
|
||||
ret = false;
|
||||
else
|
||||
pWorkID = iWorkID;
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32 DBAsyncWork::GetWorkID() {
|
||||
uint32 ret;
|
||||
MLock.lock();
|
||||
ret = pWorkID;
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint32 DBAsyncWork::WPT() {
|
||||
uint32 ret;
|
||||
MLock.lock();
|
||||
ret = pWPT;
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
DBAsync::Type DBAsyncWork::Type() {
|
||||
DBAsync::Type ret;
|
||||
MLock.lock();
|
||||
ret = pType;
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
DBAsyncQuery* DBAsyncWork::PopAnswer() {
|
||||
DBAsyncQuery* ret;
|
||||
MLock.lock();
|
||||
ret = done.pop();
|
||||
if (ret)
|
||||
pAnswerCount--;
|
||||
todel.push(ret);
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool DBAsyncWork::CheckTimeout(uint32 iFQTimeout) {
|
||||
if (pTimeout == 0xFFFFFFFF)
|
||||
return false;
|
||||
bool ret = false;
|
||||
MLock.lock();
|
||||
if (pTimeout > iFQTimeout)
|
||||
iFQTimeout = pTimeout;
|
||||
if (Timer::GetCurrentTime() > (pTSFinish + iFQTimeout))
|
||||
ret = true;
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
//sets the work's status to the supplied value and returns
|
||||
//the revious status
|
||||
DBAsync::Status DBAsyncWork::SetStatus(DBAsync::Status iStatus) {
|
||||
DBAsync::Status ret;
|
||||
MLock.lock();
|
||||
if (iStatus == DBAsync::Finished)
|
||||
pTSFinish = Timer::GetCurrentTime();
|
||||
ret = pstatus;
|
||||
pstatus = iStatus;
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool DBAsyncWork::Cancel() {
|
||||
bool ret;
|
||||
MLock.lock();
|
||||
if (pstatus != DBAsync::Finished) {
|
||||
pstatus = DBAsync::Canceled;
|
||||
ret = true;
|
||||
}
|
||||
else
|
||||
ret = false;
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool DBAsyncWork::IsCancled() {
|
||||
bool ret;
|
||||
MLock.lock();
|
||||
ret = (bool) (pstatus == DBAsync::Canceled);
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
DBAsyncQuery* DBAsyncWork::PopQuery() {
|
||||
DBAsyncQuery* ret = 0;
|
||||
MLock.lock();
|
||||
ret = todo.pop();
|
||||
if (ret)
|
||||
pQuestionCount--;
|
||||
MLock.unlock();
|
||||
return ret;
|
||||
}
|
||||
|
||||
void DBAsyncWork::PushAnswer(DBAsyncQuery* iDBAQ) {
|
||||
MLock.lock();
|
||||
done.push(iDBAQ);
|
||||
pAnswerCount++;
|
||||
MLock.unlock();
|
||||
}
|
||||
|
||||
|
||||
DBAsyncQuery::DBAsyncQuery(uint32 iQPT, char** iQuery, uint32 iQueryLen, bool iGetResultSet, bool iGetErrbuf) {
|
||||
if (iQueryLen == 0xFFFFFFFF)
|
||||
pQueryLen = strlen(*iQuery);
|
||||
else
|
||||
pQueryLen = iQueryLen;
|
||||
pQuery = *iQuery;
|
||||
*iQuery = 0;
|
||||
Init(iQPT, iGetResultSet, iGetErrbuf);
|
||||
}
|
||||
|
||||
DBAsyncQuery::DBAsyncQuery(uint32 iQPT, const char* iQuery, uint32 iQueryLen, bool iGetResultSet, bool iGetErrbuf) {
|
||||
if (iQueryLen == 0xFFFFFFFF)
|
||||
pQueryLen = strlen(iQuery);
|
||||
else
|
||||
pQueryLen = iQueryLen;
|
||||
pQuery = strn0cpy(new char[pQueryLen+1], iQuery, pQueryLen+1);
|
||||
Init(iQPT, iGetResultSet, iGetErrbuf);
|
||||
}
|
||||
|
||||
void DBAsyncQuery::Init(uint32 iQPT, bool iGetResultSet, bool iGetErrbuf) {
|
||||
pstatus = DBAsync::AddingWork;
|
||||
pQPT = iQPT;
|
||||
pGetResultSet = iGetResultSet;
|
||||
pGetErrbuf = iGetErrbuf;
|
||||
|
||||
pmysqlsuccess = false;
|
||||
perrbuf = 0;
|
||||
perrnum = 0;
|
||||
presult = 0;
|
||||
paffected_rows = 0;
|
||||
plast_insert_id = 0;
|
||||
}
|
||||
|
||||
DBAsyncQuery::~DBAsyncQuery() {
|
||||
safe_delete_array(perrbuf);
|
||||
safe_delete_array(pQuery);
|
||||
if (presult)
|
||||
mysql_free_result(presult);
|
||||
}
|
||||
|
||||
bool DBAsyncQuery::GetAnswer(char* errbuf, MYSQL_RES** result, uint32* affected_rows, uint32* last_insert_id, uint32* errnum) {
|
||||
if (pstatus != DBAsync::Finished) {
|
||||
if (errbuf)
|
||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "Error: Query not finished.");
|
||||
if (errnum)
|
||||
*errnum = UINT_MAX;
|
||||
return false;
|
||||
}
|
||||
if (errbuf) {
|
||||
if (pGetErrbuf) {
|
||||
if (perrbuf)
|
||||
strn0cpy(errbuf, perrbuf, MYSQL_ERRMSG_SIZE);
|
||||
else
|
||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "Error message should've been saved, but hasnt. errno: %u", perrnum);
|
||||
}
|
||||
else
|
||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "Error message not saved. errno: %u", perrnum);
|
||||
}
|
||||
if (errnum)
|
||||
*errnum = perrnum;
|
||||
if (affected_rows)
|
||||
*affected_rows = paffected_rows;
|
||||
if (last_insert_id)
|
||||
*last_insert_id = plast_insert_id;
|
||||
if (result)
|
||||
*result = presult;
|
||||
return pmysqlsuccess;
|
||||
}
|
||||
|
||||
void DBAsyncQuery::Process(DBcore* iDBC) {
|
||||
pstatus = DBAsync::Executing;
|
||||
if (pGetErrbuf)
|
||||
perrbuf = new char[MYSQL_ERRMSG_SIZE];
|
||||
MYSQL_RES** resultPP = 0;
|
||||
if (pGetResultSet)
|
||||
resultPP = &presult;
|
||||
pmysqlsuccess = iDBC->RunQuery(pQuery, pQueryLen, perrbuf, resultPP, &paffected_rows, &plast_insert_id, &perrnum);
|
||||
pstatus = DBAsync::Finished;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,176 +0,0 @@
|
||||
#ifndef DBASYNC_H
|
||||
#define DBASYNC_H
|
||||
#include "../common/dbcore.h"
|
||||
#include "../common/timeoutmgr.h"
|
||||
|
||||
|
||||
class DBAsyncFinishedQueue;
|
||||
class DBAsyncWork;
|
||||
class DBAsyncQuery;
|
||||
class Database;
|
||||
|
||||
// Big daddy that owns the threads and does the work
|
||||
class DBAsync : private Timeoutable {
|
||||
public:
|
||||
enum Status { AddingWork, Queued, Executing, Finished, Canceled };
|
||||
enum Type { Read, Write, Both };
|
||||
|
||||
DBAsync(DBcore* iDBC);
|
||||
~DBAsync();
|
||||
bool StopThread();
|
||||
|
||||
uint32 AddWork(DBAsyncWork** iWork, uint32 iDelay = 0);
|
||||
bool CancelWork(uint32 iWorkID);
|
||||
void CommitWrites();
|
||||
|
||||
void AddFQ(DBAsyncFinishedQueue* iDBAFQ);
|
||||
protected:
|
||||
//things related to the processing thread:
|
||||
friend ThreadReturnType DBAsyncLoop(void* tmp);
|
||||
Mutex MLoopRunning;
|
||||
Condition CInList;
|
||||
bool RunLoop();
|
||||
void Process();
|
||||
|
||||
private:
|
||||
virtual void CheckTimeout();
|
||||
|
||||
void ProcessWork(DBAsyncWork* iWork, bool iSleep = true);
|
||||
void DispatchWork(DBAsyncWork* iWork);
|
||||
inline uint32 GetNextID() { return pNextID++; }
|
||||
DBAsyncWork* InListPop();
|
||||
DBAsyncWork* InListPopWrite(); // Ignores delay
|
||||
void OutListPush(DBAsyncWork* iDBAW);
|
||||
|
||||
Mutex MRunLoop;
|
||||
bool pRunLoop;
|
||||
|
||||
DBcore* pDBC;
|
||||
uint32 pNextID;
|
||||
Mutex MInList;
|
||||
LinkedList<DBAsyncWork*> InList;
|
||||
|
||||
Mutex MFQList;
|
||||
LinkedList<DBAsyncFinishedQueue**> FQList;
|
||||
|
||||
// Mutex for outside access to current work & when current work is being changed.
|
||||
// NOT locked when CurrentWork is being accessed by the DBAsync thread.
|
||||
// Never change pointer from outside DBAsync thread!
|
||||
// Only here for access to thread-safe DBAsyncWork functions.
|
||||
Mutex MCurrentWork;
|
||||
DBAsyncWork* CurrentWork;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
DB Work Complete Callback:
|
||||
This will be called under the DBAsync thread! Never access any non-threadsafe
|
||||
data/functions/classes. (ie: zone, entitylist, client, etc are not threadsafe)
|
||||
Function prototype:
|
||||
return value: true if we should delete the data, false if we should keep it
|
||||
*/
|
||||
typedef bool(*DBWorkCompleteCallBack)(DBAsyncWork*);
|
||||
|
||||
class DBAsyncFinishedQueue {
|
||||
public:
|
||||
DBAsyncFinishedQueue(uint32 iTimeout = 90000);
|
||||
~DBAsyncFinishedQueue();
|
||||
|
||||
DBAsyncWork* Pop();
|
||||
DBAsyncWork* PopByWPT(uint32 iWPT);
|
||||
DBAsyncWork* Find(uint32 iWPT);
|
||||
bool Push(DBAsyncWork* iDBAW);
|
||||
|
||||
void CheckTimeouts();
|
||||
private:
|
||||
Mutex MLock;
|
||||
uint32 pTimeout;
|
||||
LinkedList<DBAsyncWork*> list;
|
||||
};
|
||||
|
||||
// Container class for multiple queries
|
||||
class DBAsyncWork {
|
||||
public:
|
||||
DBAsyncWork(Database *db, DBAsyncFinishedQueue* iDBAFQ, uint32 iWPT = 0, DBAsync::Type iType = DBAsync::Both, uint32 iTimeout = 0);
|
||||
DBAsyncWork(Database *db, DBWorkCompleteCallBack iCB, uint32 iWPT = 0, DBAsync::Type iType = DBAsync::Both, uint32 iTimeout = 0);
|
||||
~DBAsyncWork();
|
||||
|
||||
bool AddQuery(DBAsyncQuery** iDBAQ);
|
||||
bool AddQuery(uint32 iQPT, char** iQuery, uint32 iQueryLen = 0xFFFFFFFF, bool iGetResultSet = true, bool iGetErrbuf = true);
|
||||
uint32 WPT();
|
||||
DBAsync::Type Type();
|
||||
|
||||
// Pops finished queries off the work
|
||||
DBAsyncQuery* PopAnswer();
|
||||
uint32 QueryCount();
|
||||
|
||||
Database *GetDB() const { return(m_db); }
|
||||
|
||||
bool CheckTimeout(uint32 iFQTimeout);
|
||||
bool SetWorkID(uint32 iWorkID);
|
||||
uint32 GetWorkID();
|
||||
protected:
|
||||
friend class DBAsync;
|
||||
DBAsync::Status SetStatus(DBAsync::Status iStatus);
|
||||
bool Cancel();
|
||||
bool IsCancled();
|
||||
DBAsyncQuery* PopQuery(); // Get query to be run
|
||||
void PushAnswer(DBAsyncQuery* iDBAQ); // Push answer back into workset
|
||||
|
||||
// not mutex'd cause only to be accessed from dbasync class
|
||||
uint32 pExecuteAfter;
|
||||
private:
|
||||
Mutex MLock;
|
||||
uint32 pQuestionCount;
|
||||
uint32 pAnswerCount;
|
||||
uint32 pWorkID;
|
||||
uint32 pWPT;
|
||||
uint32 pTimeout;
|
||||
uint32 pTSFinish; // timestamp when finished
|
||||
DBAsyncFinishedQueue* pDBAFQ; //we do now own this pointer
|
||||
DBWorkCompleteCallBack pCB;
|
||||
DBAsync::Status pstatus;
|
||||
DBAsync::Type pType;
|
||||
MyQueue<DBAsyncQuery> todo;
|
||||
MyQueue<DBAsyncQuery> done;
|
||||
MyQueue<DBAsyncQuery> todel;
|
||||
Database *const m_db; //we do now own this pointer
|
||||
};
|
||||
|
||||
// Container class for the query information
|
||||
class DBAsyncQuery {
|
||||
public:
|
||||
DBAsyncQuery(uint32 iQPT, char** iQuery, uint32 iQueryLen = 0xFFFFFFFF, bool iGetResultSet = true, bool iGetErrbuf = true);
|
||||
DBAsyncQuery(uint32 iQPT, const char* iQuery, uint32 iQueryLen = 0xFFFFFFFF, bool iGetResultSet = true, bool iGetErrbuf = true);
|
||||
~DBAsyncQuery();
|
||||
|
||||
bool GetAnswer(char* errbuf = 0, MYSQL_RES** result = 0, uint32* affected_rows = 0, uint32* last_insert_id = 0, uint32* errnum = 0);
|
||||
inline uint32 QPT() { return pQPT; }
|
||||
protected:
|
||||
friend class DBAsyncWork;
|
||||
uint32 pQPT;
|
||||
|
||||
friend class DBAsync;
|
||||
void Process(DBcore* iDBC);
|
||||
|
||||
void Init(uint32 iQPT, bool iGetResultSet, bool iGetErrbuf);
|
||||
DBAsync::Status pstatus;
|
||||
char* pQuery;
|
||||
uint32 pQueryLen;
|
||||
bool pGetResultSet;
|
||||
bool pGetErrbuf;
|
||||
|
||||
bool pmysqlsuccess;
|
||||
char* perrbuf;
|
||||
uint32 perrnum;
|
||||
uint32 paffected_rows;
|
||||
uint32 plast_insert_id;
|
||||
MYSQL_RES* presult;
|
||||
};
|
||||
|
||||
|
||||
void AsyncLoadVariables(DBAsync *dba, Database *db);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
+27
-116
@@ -1,17 +1,17 @@
|
||||
#include "../common/debug.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <errmsg.h>
|
||||
#include <mysqld_error.h>
|
||||
#include <limits.h>
|
||||
#include "dbcore.h"
|
||||
#include <string.h>
|
||||
#include "../common/misc_functions.h"
|
||||
#include <cstdlib>
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
#include "dbcore.h"
|
||||
|
||||
#include <errmsg.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <mysqld_error.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
@@ -102,17 +102,18 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
||||
|
||||
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
|
||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||
|
||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, (uint32)mysql_errno(&mysql), errorBuffer);
|
||||
}
|
||||
|
||||
char *errorBuffer = new char[MYSQL_ERRMSG_SIZE];
|
||||
snprintf(errorBuffer, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
|
||||
#ifdef _EQDEBUG
|
||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||
#endif
|
||||
/* Implement Logging at the Root */
|
||||
if (mysql_errno(&mysql) > 0 && strlen(query) > 0){
|
||||
if (Log.log_settings[Logs::MySQLError].is_category_enabled == 1)
|
||||
Log.Out(Logs::General, Logs::MySQLError, "%i: %s \n %s", mysql_errno(&mysql), mysql_error(&mysql), query);
|
||||
}
|
||||
|
||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(&mysql),errorBuffer);
|
||||
|
||||
}
|
||||
@@ -125,113 +126,23 @@ MySQLRequestResult DBcore::QueryDatabase(const char* query, uint32 querylen, boo
|
||||
rowCount = (uint32)mysql_num_rows(res);
|
||||
|
||||
MySQLRequestResult requestResult(res, (uint32)mysql_affected_rows(&mysql), rowCount, (uint32)mysql_field_count(&mysql), (uint32)mysql_insert_id(&mysql));
|
||||
|
||||
|
||||
#if DEBUG_MYSQL_QUERIES >= 1
|
||||
if (requestResult.Success())
|
||||
{
|
||||
std::cout << "query successful";
|
||||
if (requestResult.Result())
|
||||
std::cout << ", " << (int) mysql_num_rows(requestResult.Result()) << " rows returned";
|
||||
|
||||
std::cout << ", " << requestResult.RowCount() << " rows affected";
|
||||
std::cout<< std::endl;
|
||||
}
|
||||
else {
|
||||
std::cout << "QUERY: query FAILED" << std::endl;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (Log.log_settings[Logs::MySQLQuery].is_category_enabled == 1)
|
||||
Log.Out(Logs::General, Logs::MySQLQuery, "%s (%u rows returned)", query, rowCount, requestResult.RowCount());
|
||||
|
||||
return requestResult;
|
||||
}
|
||||
|
||||
bool DBcore::RunQuery(const char* query, uint32 querylen, char* errbuf, MYSQL_RES** result, uint32* affected_rows, uint32* last_insert_id, uint32* errnum, bool retry) {
|
||||
if (errnum)
|
||||
*errnum = 0;
|
||||
if (errbuf)
|
||||
errbuf[0] = 0;
|
||||
bool ret = false;
|
||||
LockMutex lock(&MDatabase);
|
||||
if (pStatus != Connected)
|
||||
Open();
|
||||
void DBcore::TransactionBegin() {
|
||||
QueryDatabase("START TRANSACTION");
|
||||
}
|
||||
|
||||
if (mysql_real_query(&mysql, query, querylen)) {
|
||||
if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR)
|
||||
pStatus = Error;
|
||||
if (mysql_errno(&mysql) == CR_SERVER_LOST || mysql_errno(&mysql) == CR_SERVER_GONE_ERROR) {
|
||||
if (retry) {
|
||||
std::cout << "Database Error: Lost connection, attempting to recover...." << std::endl;
|
||||
ret = RunQuery(query, querylen, errbuf, result, affected_rows, last_insert_id, errnum, false);
|
||||
if (ret)
|
||||
std::cout << "Reconnection to database successful." << std::endl;
|
||||
}
|
||||
else {
|
||||
pStatus = Error;
|
||||
if (errnum)
|
||||
*errnum = mysql_errno(&mysql);
|
||||
if (errbuf)
|
||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (errnum)
|
||||
*errnum = mysql_errno(&mysql);
|
||||
if (errbuf)
|
||||
snprintf(errbuf, MYSQL_ERRMSG_SIZE, "#%i: %s", mysql_errno(&mysql), mysql_error(&mysql));
|
||||
#ifdef _EQDEBUG
|
||||
std::cout << "DB Query Error #" << mysql_errno(&mysql) << ": " << mysql_error(&mysql) << std::endl;
|
||||
#endif
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (result && mysql_field_count(&mysql)) {
|
||||
*result = mysql_store_result(&mysql);
|
||||
#ifdef _EQDEBUG
|
||||
DBMemLeak::Alloc(*result, query);
|
||||
#endif
|
||||
}
|
||||
else if (result)
|
||||
*result = 0;
|
||||
if (affected_rows)
|
||||
*affected_rows = mysql_affected_rows(&mysql);
|
||||
if (last_insert_id)
|
||||
*last_insert_id = (uint32)mysql_insert_id(&mysql);
|
||||
if (result) {
|
||||
if (*result) {
|
||||
ret = true;
|
||||
}
|
||||
else {
|
||||
#ifdef _EQDEBUG
|
||||
std::cout << "DB Query Error: No Result" << std::endl;
|
||||
#endif
|
||||
if (errnum)
|
||||
*errnum = UINT_MAX;
|
||||
if (errbuf)
|
||||
strcpy(errbuf, "DBcore::RunQuery: No Result");
|
||||
ret = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
#if DEBUG_MYSQL_QUERIES >= 1
|
||||
if (ret) {
|
||||
std::cout << "query successful";
|
||||
if (result && (*result))
|
||||
std::cout << ", " << (int) mysql_num_rows(*result) << " rows returned";
|
||||
if (affected_rows)
|
||||
std::cout << ", " << (*affected_rows) << " rows affected";
|
||||
std::cout<< std::endl;
|
||||
}
|
||||
else {
|
||||
std::cout << "QUERY: query FAILED" << std::endl;
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
void DBcore::TransactionCommit() {
|
||||
QueryDatabase("COMMIT");
|
||||
}
|
||||
|
||||
void DBcore::TransactionRollback() {
|
||||
QueryDatabase("ROLLBACK");
|
||||
}
|
||||
|
||||
uint32 DBcore::DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen) {
|
||||
|
||||
+7
-8
@@ -6,15 +6,12 @@
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#include "../common/mutex.h"
|
||||
#include "../common/mysql_request_result.h"
|
||||
#include "../common/types.h"
|
||||
|
||||
#include <mysql.h>
|
||||
#include <string.h>
|
||||
#include "../common/types.h"
|
||||
#include "../common/mutex.h"
|
||||
#include "../common/linked_list.h"
|
||||
#include "../common/queue.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/condition.h"
|
||||
#include "../common/mysql_request_result.h"
|
||||
|
||||
class DBcore {
|
||||
public:
|
||||
@@ -23,9 +20,11 @@ public:
|
||||
DBcore();
|
||||
~DBcore();
|
||||
eStatus GetStatus() { return pStatus; }
|
||||
bool RunQuery(const char* query, uint32 querylen, char* errbuf = 0, MYSQL_RES** result = 0, uint32* affected_rows = 0, uint32* last_insert_id = 0, uint32* errnum = 0, bool retry = true);
|
||||
MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true);
|
||||
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
|
||||
void TransactionBegin();
|
||||
void TransactionCommit();
|
||||
void TransactionRollback();
|
||||
uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen);
|
||||
void ping();
|
||||
MYSQL* getMySQL(){ return &mysql; }
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
// Doors
|
||||
#ifdef SHAREMEM
|
||||
int32 Database::GetDoorsCount(uint32* oMaxID) {
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
query = new char[256];
|
||||
strcpy(query, "SELECT MAX(id), count(*) FROM doors");
|
||||
if (RunQuery(query, strlen(query), errbuf, &result)) {
|
||||
safe_delete(query);
|
||||
row = mysql_fetch_row(result);
|
||||
if (row && row[1]) {
|
||||
int32 ret = atoi(row[1]);
|
||||
if (oMaxID) {
|
||||
if (row[0])
|
||||
*oMaxID = atoi(row[0]);
|
||||
else
|
||||
*oMaxID = 0;
|
||||
}
|
||||
mysql_free_result(result);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
else {
|
||||
cerr << "Error in GetDoorsCount query '" << query << "' " << errbuf << endl;
|
||||
delete[] query;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
extern "C" bool extDBLoadDoors(uint32 iDoorCount, uint32 iMaxDoorID) { return database.DBLoadDoors(iDoorCount, iMaxDoorID); }
|
||||
const Door* Database::GetDoor(uint8 door_id, const char* zone_name) {
|
||||
for(uint32 i=0; i<max_door_type; i++) {
|
||||
const Door* door = GetDoorDBID(i);
|
||||
if(door && door->door_id == door_id && strcasecmp(door->zone_name, zone_name) == 0)
|
||||
return door;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const Door* Database::GetDoorDBID(uint32 db_id) {
|
||||
return EMuShareMemDLL.Doors.GetDoor(db_id);
|
||||
}
|
||||
|
||||
bool Database::LoadDoors() {
|
||||
if (!EMuShareMemDLL.Load())
|
||||
return false;
|
||||
int32 tmp_max_door_type = -1;
|
||||
uint32 tmp = 0;
|
||||
tmp_max_door_type = GetDoorsCount(&tmp);
|
||||
if (tmp_max_door_type < 0) {
|
||||
cout << "Error: Database::LoadDoors-ShareMem: GetDoorsCount() returned < 0" << endl;
|
||||
return false;
|
||||
}
|
||||
max_door_type = tmp_max_door_type;
|
||||
bool ret = EMuShareMemDLL.Doors.DLLLoadDoors(&extDBLoadDoors, sizeof(Door), max_door_type, tmp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Database::DBLoadDoors(uint32 iDoorCount, uint32 iMaxDoorID) {
|
||||
cout << "Loading Doors from database..." << endl;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
char *query = 0;
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
query = new char[256];
|
||||
strcpy(query, "SELECT MAX(id), Count(*) FROM doors");
|
||||
if (RunQuery(query, strlen(query), errbuf, &result))
|
||||
{
|
||||
safe_delete(query);
|
||||
row = mysql_fetch_row(result);
|
||||
if (row && row[0]) {
|
||||
if (atoi(row[0]) > iMaxDoorID) {
|
||||
cout << "Error: Insufficient shared memory to load doors." << endl;
|
||||
cout << "Max(id): " << atoi(row[0]) << ", iMaxDoorID: " << iMaxDoorID << endl;
|
||||
cout << "Fix this by increasing the MMF_MAX_Door_ID define statement" << endl;
|
||||
return false;
|
||||
}
|
||||
if (atoi(row[1]) != iDoorCount) {
|
||||
cout << "Error: Insufficient shared memory to load doors." << endl;
|
||||
cout << "Count(*): " << atoi(row[1]) << ", iDoorCount: " << iDoorCount << endl;
|
||||
return false;
|
||||
}
|
||||
max_door_type = atoi(row[0]);
|
||||
mysql_free_result(result);
|
||||
Door tmpDoor;
|
||||
MakeAnyLenString(&query, "SELECT id,doorid,zone,name,pos_x,pos_y,pos_z,heading,opentype,guild,lockpick,keyitem,triggerdoor,triggertype from doors");//WHERE zone='%s'", zone_name
|
||||
if (RunQuery(query, strlen(query), errbuf, &result))
|
||||
{
|
||||
safe_delete(query);
|
||||
while((row = mysql_fetch_row(result))) {
|
||||
memset(&tmpDoor, 0, sizeof(Door));
|
||||
tmpDoor.db_id = atoi(row[0]);
|
||||
tmpDoor.door_id = atoi(row[1]);
|
||||
strn0cpy(tmpDoor.zone_name,row[2],32);
|
||||
strn0cpy(tmpDoor.door_name,row[3],32);
|
||||
tmpDoor.pos_x = (float)atof(row[4]);
|
||||
tmpDoor.pos_y = (float)atof(row[5]);
|
||||
tmpDoor.pos_z = (float)atof(row[6]);
|
||||
tmpDoor.heading = atoi(row[7]);
|
||||
tmpDoor.opentype = atoi(row[8]);
|
||||
tmpDoor.guild_id = atoi(row[9]);
|
||||
tmpDoor.lockpick = atoi(row[10]);
|
||||
tmpDoor.keyitem = atoi(row[11]);
|
||||
tmpDoor.trigger_door = atoi(row[12]);
|
||||
tmpDoor.trigger_type = atoi(row[13]);
|
||||
EMuShareMemDLL.Doors.cbAddDoor(tmpDoor.db_id, &tmpDoor);
|
||||
Sleep(0);
|
||||
}
|
||||
mysql_free_result(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
cerr << "Error in DBLoadDoors query '" << query << "' " << errbuf << endl;
|
||||
delete[] query;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1,441 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <cstdarg>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <process.h>
|
||||
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
|
||||
#else
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
#include "string_util.h"
|
||||
#include "misc_functions.h"
|
||||
#include "platform.h"
|
||||
|
||||
#ifndef va_copy
|
||||
#define va_copy(d,s) ((d) = (s))
|
||||
#endif
|
||||
|
||||
static volatile bool logFileValid = false;
|
||||
static EQEMuLog realLogFile;
|
||||
EQEMuLog *LogFile = &realLogFile;
|
||||
|
||||
static const char* FileNames[EQEMuLog::MaxLogID] = { "logs/eqemu", "logs/eqemu", "logs/eqemu_error", "logs/eqemu_debug", "logs/eqemu_quest", "logs/eqemu_commands", "logs/crash" };
|
||||
static const char* LogNames[EQEMuLog::MaxLogID] = { "Status", "Normal", "Error", "Debug", "Quest", "Command", "Crash" };
|
||||
|
||||
EQEMuLog::EQEMuLog() {
|
||||
for (int i=0; i<MaxLogID; i++) {
|
||||
fp[i] = 0;
|
||||
logCallbackFmt[i] = nullptr;
|
||||
logCallbackBuf[i] = nullptr;
|
||||
logCallbackPva[i] = nullptr;
|
||||
}
|
||||
|
||||
pLogStatus[Status] = LOG_LEVEL_STATUS;
|
||||
pLogStatus[Normal] = LOG_LEVEL_NORMAL;
|
||||
pLogStatus[Error] = LOG_LEVEL_ERROR;
|
||||
pLogStatus[Debug] = LOG_LEVEL_DEBUG;
|
||||
pLogStatus[Quest] = LOG_LEVEL_QUEST;
|
||||
pLogStatus[Commands] = LOG_LEVEL_COMMANDS;
|
||||
pLogStatus[Crash] = LOG_LEVEL_CRASH;
|
||||
logFileValid = true;
|
||||
}
|
||||
|
||||
EQEMuLog::~EQEMuLog() {
|
||||
logFileValid = false;
|
||||
for (int i=0; i<MaxLogID; i++) {
|
||||
LockMutex lock(&MLog[i]); //to prevent termination race
|
||||
if (fp[i])
|
||||
fclose(fp[i]);
|
||||
}
|
||||
}
|
||||
|
||||
bool EQEMuLog::open(LogIDs id) {
|
||||
if (!logFileValid) {
|
||||
return false;
|
||||
}
|
||||
if (id >= MaxLogID) {
|
||||
return false;
|
||||
}
|
||||
LockMutex lock(&MOpen);
|
||||
if (pLogStatus[id] & 4) {
|
||||
return false;
|
||||
}
|
||||
if (fp[id]) {
|
||||
//cerr<<"Warning: LogFile already open"<<endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
char exename[200] = "";
|
||||
const EQEmuExePlatform &platform = GetExecutablePlatform();
|
||||
if(platform == ExePlatformWorld) {
|
||||
snprintf(exename, sizeof(exename), "_world");
|
||||
} else if(platform == ExePlatformZone) {
|
||||
snprintf(exename, sizeof(exename), "_zone");
|
||||
} else if(platform == ExePlatformLaunch) {
|
||||
snprintf(exename, sizeof(exename), "_launch");
|
||||
} else if(platform == ExePlatformUCS) {
|
||||
snprintf(exename, sizeof(exename), "_ucs");
|
||||
} else if(platform == ExePlatformQueryServ) {
|
||||
snprintf(exename, sizeof(exename), "_queryserv");
|
||||
} else if(platform == ExePlatformSharedMemory) {
|
||||
snprintf(exename, sizeof(exename), "_shared_memory");
|
||||
} else if(platform == ExePlatformClientImport) {
|
||||
snprintf(exename, sizeof(exename), "_import");
|
||||
} else if(platform == ExePlatformClientExport) {
|
||||
snprintf(exename, sizeof(exename), "_export");
|
||||
}
|
||||
|
||||
char filename[200];
|
||||
#ifndef NO_PIDLOG
|
||||
snprintf(filename, sizeof(filename), "%s%s_%04i.log", FileNames[id], exename, getpid());
|
||||
#else
|
||||
snprintf(filename, sizeof(filename), "%s%s.log", FileNames[id], exename);
|
||||
#endif
|
||||
fp[id] = fopen(filename, "a");
|
||||
if (!fp[id]) {
|
||||
std::cerr << "Failed to open log file: " << filename << std::endl;
|
||||
pLogStatus[id] |= 4; // set file state to error
|
||||
return false;
|
||||
}
|
||||
fputs("---------------------------------------------\n",fp[id]);
|
||||
write(id, "Starting Log: %s", filename);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEMuLog::write(LogIDs id, const char *fmt, ...) {
|
||||
if (!logFileValid) {
|
||||
return false;
|
||||
}
|
||||
if (id >= MaxLogID) {
|
||||
return false;
|
||||
}
|
||||
bool dofile = false;
|
||||
if (pLogStatus[id] & 1) {
|
||||
dofile = open(id);
|
||||
}
|
||||
if (!(dofile || pLogStatus[id] & 2))
|
||||
return false;
|
||||
LockMutex lock(&MLog[id]);
|
||||
if (!logFileValid)
|
||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||
|
||||
time_t aclock;
|
||||
struct tm *newtime;
|
||||
|
||||
time( &aclock ); /* Get time in seconds */
|
||||
newtime = localtime( &aclock ); /* Convert time to struct */
|
||||
|
||||
if (dofile)
|
||||
#ifndef NO_PIDLOG
|
||||
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||
#else
|
||||
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||
#endif
|
||||
|
||||
va_list argptr, tmpargptr;
|
||||
va_start(argptr, fmt);
|
||||
if (dofile) {
|
||||
va_copy(tmpargptr, argptr);
|
||||
vfprintf( fp[id], fmt, tmpargptr );
|
||||
}
|
||||
if(logCallbackFmt[id]) {
|
||||
msgCallbackFmt p = logCallbackFmt[id];
|
||||
va_copy(tmpargptr, argptr);
|
||||
p(id, fmt, tmpargptr );
|
||||
}
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8) {
|
||||
fprintf(stderr, "[%s] ", LogNames[id]);
|
||||
vfprintf( stderr, fmt, argptr );
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, "[%s] ", LogNames[id]);
|
||||
vfprintf( stdout, fmt, argptr );
|
||||
}
|
||||
}
|
||||
va_end(argptr);
|
||||
if (dofile)
|
||||
fprintf(fp[id], "\n");
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8) {
|
||||
fprintf(stderr, "\n");
|
||||
fflush(stderr);
|
||||
} else {
|
||||
fprintf(stdout, "\n");
|
||||
fflush(stdout);
|
||||
}
|
||||
}
|
||||
if(dofile)
|
||||
fflush(fp[id]);
|
||||
return true;
|
||||
}
|
||||
|
||||
//write with Prefix and a VA_list
|
||||
bool EQEMuLog::writePVA(LogIDs id, const char *prefix, const char *fmt, va_list argptr) {
|
||||
if (!logFileValid) {
|
||||
return false;
|
||||
}
|
||||
if (id >= MaxLogID) {
|
||||
return false;
|
||||
}
|
||||
bool dofile = false;
|
||||
if (pLogStatus[id] & 1) {
|
||||
dofile = open(id);
|
||||
}
|
||||
if (!(dofile || pLogStatus[id] & 2)) {
|
||||
return false;
|
||||
}
|
||||
LockMutex lock(&MLog[id]);
|
||||
if (!logFileValid)
|
||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||
|
||||
time_t aclock;
|
||||
struct tm *newtime;
|
||||
|
||||
time( &aclock ); /* Get time in seconds */
|
||||
newtime = localtime( &aclock ); /* Convert time to struct */
|
||||
|
||||
va_list tmpargptr;
|
||||
|
||||
if (dofile) {
|
||||
#ifndef NO_PIDLOG
|
||||
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] %s", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
|
||||
#else
|
||||
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] %s", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec, prefix);
|
||||
#endif
|
||||
va_copy(tmpargptr, argptr);
|
||||
vfprintf( fp[id], fmt, tmpargptr );
|
||||
}
|
||||
if(logCallbackPva[id]) {
|
||||
msgCallbackPva p = logCallbackPva[id];
|
||||
va_copy(tmpargptr, argptr);
|
||||
p(id, prefix, fmt, tmpargptr );
|
||||
}
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8) {
|
||||
fprintf(stderr, "[%s] %s", LogNames[id], prefix);
|
||||
vfprintf( stderr, fmt, argptr );
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, "[%s] %s", LogNames[id], prefix);
|
||||
vfprintf( stdout, fmt, argptr );
|
||||
}
|
||||
}
|
||||
va_end(argptr);
|
||||
if (dofile)
|
||||
fprintf(fp[id], "\n");
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8)
|
||||
fprintf(stderr, "\n");
|
||||
else
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
if(dofile)
|
||||
fflush(fp[id]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEMuLog::writebuf(LogIDs id, const char *buf, uint8 size, uint32 count) {
|
||||
if (!logFileValid) {
|
||||
return false;
|
||||
}
|
||||
if (id >= MaxLogID) {
|
||||
return false;
|
||||
}
|
||||
bool dofile = false;
|
||||
if (pLogStatus[id] & 1) {
|
||||
dofile = open(id);
|
||||
}
|
||||
if (!(dofile || pLogStatus[id] & 2))
|
||||
return false;
|
||||
LockMutex lock(&MLog[id]);
|
||||
if (!logFileValid)
|
||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||
|
||||
time_t aclock;
|
||||
struct tm *newtime;
|
||||
|
||||
time( &aclock ); /* Get time in seconds */
|
||||
newtime = localtime( &aclock ); /* Convert time to struct */
|
||||
|
||||
if (dofile)
|
||||
#ifndef NO_PIDLOG
|
||||
fprintf(fp[id], "[%02d.%02d. - %02d:%02d:%02d] ", newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||
#else
|
||||
fprintf(fp[id], "%04i [%02d.%02d. - %02d:%02d:%02d] ", getpid(), newtime->tm_mon+1, newtime->tm_mday, newtime->tm_hour, newtime->tm_min, newtime->tm_sec);
|
||||
#endif
|
||||
|
||||
if (dofile) {
|
||||
fwrite(buf, size, count, fp[id]);
|
||||
fprintf(fp[id], "\n");
|
||||
}
|
||||
if(logCallbackBuf[id]) {
|
||||
msgCallbackBuf p = logCallbackBuf[id];
|
||||
p(id, buf, size, count);
|
||||
}
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8) {
|
||||
fprintf(stderr, "[%s] ", LogNames[id]);
|
||||
fwrite(buf, size, count, stderr);
|
||||
fprintf(stderr, "\n");
|
||||
} else {
|
||||
fprintf(stdout, "[%s] ", LogNames[id]);
|
||||
fwrite(buf, size, count, stdout);
|
||||
fprintf(stdout, "\n");
|
||||
}
|
||||
}
|
||||
if(dofile)
|
||||
fflush(fp[id]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool EQEMuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) {
|
||||
va_list argptr, tmpargptr;
|
||||
va_start(argptr, fmt);
|
||||
if (dofile) {
|
||||
va_copy(tmpargptr, argptr);
|
||||
vfprintf( fp[id], fmt, tmpargptr );
|
||||
}
|
||||
if (pLogStatus[id] & 2) {
|
||||
if (pLogStatus[id] & 8)
|
||||
vfprintf( stderr, fmt, argptr );
|
||||
else
|
||||
vfprintf( stdout, fmt, argptr );
|
||||
}
|
||||
va_end(argptr);
|
||||
return true;
|
||||
};
|
||||
|
||||
bool EQEMuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) {
|
||||
if (!logFileValid) {
|
||||
#if EQDEBUG >= 10
|
||||
std::cerr << "Error: Dump() from null pointer" << std::endl;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
if (size == 0)
|
||||
return true;
|
||||
if (!LogFile)
|
||||
return false;
|
||||
if (id >= MaxLogID)
|
||||
return false;
|
||||
bool dofile = false;
|
||||
if (pLogStatus[id] & 1) {
|
||||
dofile = open(id);
|
||||
}
|
||||
if (!(dofile || pLogStatus[id] & 2))
|
||||
return false;
|
||||
LockMutex lock(&MLog[id]);
|
||||
if (!logFileValid)
|
||||
return false; //check again for threading race reasons (to avoid two mutexes)
|
||||
|
||||
write(id, "Dumping Packet: %i", size);
|
||||
// Output as HEX
|
||||
|
||||
int beginningOfLineOffset = 0;
|
||||
uint32 indexInData;
|
||||
std::string asciiOutput;
|
||||
|
||||
for(indexInData=skip; indexInData<size; indexInData++) {
|
||||
if ((indexInData-skip)%cols==0) {
|
||||
if (indexInData != skip)
|
||||
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
||||
writeNTS(id, dofile, "%4i: ", indexInData-skip);
|
||||
asciiOutput.clear();
|
||||
beginningOfLineOffset = 0;
|
||||
}
|
||||
else if ((indexInData-skip)%(cols/2) == 0) {
|
||||
writeNTS(id, dofile, "- ");
|
||||
}
|
||||
writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]);
|
||||
|
||||
if (data[indexInData] >= 32 && data[indexInData] < 127)
|
||||
{
|
||||
// According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx
|
||||
// Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long
|
||||
// version.
|
||||
asciiOutput.append(std::to_string((long long)data[indexInData]));
|
||||
}
|
||||
else
|
||||
{
|
||||
asciiOutput.append(".");
|
||||
}
|
||||
}
|
||||
uint32 k = ((indexInData-skip)-1)%cols;
|
||||
if (k < 8)
|
||||
writeNTS(id, dofile, " ");
|
||||
for (uint32 h = k+1; h < cols; h++) {
|
||||
writeNTS(id, dofile, " ");
|
||||
}
|
||||
writeNTS(id, dofile, " | %s\n", asciiOutput.c_str());
|
||||
if (dofile)
|
||||
fflush(fp[id]);
|
||||
return true;
|
||||
}
|
||||
|
||||
void EQEMuLog::SetCallback(LogIDs id, msgCallbackFmt proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
if (id >= MaxLogID) {
|
||||
return;
|
||||
}
|
||||
logCallbackFmt[id] = proc;
|
||||
}
|
||||
|
||||
void EQEMuLog::SetCallback(LogIDs id, msgCallbackBuf proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
if (id >= MaxLogID) {
|
||||
return;
|
||||
}
|
||||
logCallbackBuf[id] = proc;
|
||||
}
|
||||
|
||||
void EQEMuLog::SetCallback(LogIDs id, msgCallbackPva proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
if (id >= MaxLogID) {
|
||||
return;
|
||||
}
|
||||
logCallbackPva[id] = proc;
|
||||
}
|
||||
|
||||
void EQEMuLog::SetAllCallbacks(msgCallbackFmt proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
int r;
|
||||
for(r = Status; r < MaxLogID; r++) {
|
||||
SetCallback((LogIDs)r, proc);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEMuLog::SetAllCallbacks(msgCallbackBuf proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
int r;
|
||||
for(r = Status; r < MaxLogID; r++) {
|
||||
SetCallback((LogIDs)r, proc);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEMuLog::SetAllCallbacks(msgCallbackPva proc) {
|
||||
if (!logFileValid)
|
||||
return;
|
||||
int r;
|
||||
for(r = Status; r < MaxLogID; r++) {
|
||||
SetCallback((LogIDs)r, proc);
|
||||
}
|
||||
}
|
||||
|
||||
-147
@@ -1,147 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
// Debug Levels
|
||||
#ifndef EQDEBUG
|
||||
#define EQDEBUG 1
|
||||
#else
|
||||
////// File/Console options
|
||||
// 0 <= Quiet mode Errors to file Status and Normal ignored
|
||||
// 1 >= Status and Normal to console, Errors to file
|
||||
// 2 >= Status, Normal, and Error to console and logfile
|
||||
// 3 >= Lite debug
|
||||
// 4 >= Medium debug
|
||||
// 5 >= Debug release (Anything higher is not recommended for regular use)
|
||||
// 6 == (Reserved for special builds) Login opcode debug All packets dumped
|
||||
// 7 == (Reserved for special builds) Chat Opcode debug All packets dumped
|
||||
// 8 == (Reserved for special builds) World opcode debug All packets dumped
|
||||
// 9 == (Reserved for special builds) Zone Opcode debug All packets dumped
|
||||
// 10 >= More than you ever wanted to know
|
||||
//
|
||||
/////
|
||||
// Add more below to reserve for file's functions ect.
|
||||
/////
|
||||
// Any setup code based on defines should go here
|
||||
//
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(_DEBUG) && defined(WIN32)
|
||||
#ifndef _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EQDEBUG_H
|
||||
#define EQDEBUG_H
|
||||
|
||||
#ifndef _WINDOWS
|
||||
#define DebugBreak() if(0) {}
|
||||
#endif
|
||||
|
||||
#define _WINSOCKAPI_ //stupid windows, trying to fix the winsock2 vs. winsock issues
|
||||
#if defined(WIN32) && ( defined(PACKETCOLLECTOR) || defined(COLLECTOR) )
|
||||
// Packet Collector on win32 requires winsock.h due to latest pcap.h
|
||||
// winsock.h must come before windows.h
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#include <winsock2.h>
|
||||
#endif
|
||||
|
||||
#include "logsys.h"
|
||||
|
||||
#include "../common/mutex.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
class EQEMuLog {
|
||||
public:
|
||||
EQEMuLog();
|
||||
~EQEMuLog();
|
||||
|
||||
enum LogIDs {
|
||||
Status = 0, //this must stay the first entry in this list
|
||||
Normal,
|
||||
Error,
|
||||
Debug,
|
||||
Quest,
|
||||
Commands,
|
||||
Crash,
|
||||
MaxLogID
|
||||
};
|
||||
|
||||
//these are callbacks called for each
|
||||
typedef void (* msgCallbackBuf)(LogIDs id, const char *buf, uint8 size, uint32 count);
|
||||
typedef void (* msgCallbackFmt)(LogIDs id, const char *fmt, va_list ap);
|
||||
typedef void (* msgCallbackPva)(LogIDs id, const char *prefix, const char *fmt, va_list ap);
|
||||
|
||||
void SetAllCallbacks(msgCallbackFmt proc);
|
||||
void SetAllCallbacks(msgCallbackBuf proc);
|
||||
void SetAllCallbacks(msgCallbackPva proc);
|
||||
void SetCallback(LogIDs id, msgCallbackFmt proc);
|
||||
void SetCallback(LogIDs id, msgCallbackBuf proc);
|
||||
void SetCallback(LogIDs id, msgCallbackPva proc);
|
||||
|
||||
bool writebuf(LogIDs id, const char *buf, uint8 size, uint32 count);
|
||||
bool write(LogIDs id, const char *fmt, ...);
|
||||
bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args);
|
||||
bool Dump(LogIDs id, uint8* data, uint32 size, uint32 cols=16, uint32 skip=0);
|
||||
private:
|
||||
bool open(LogIDs id);
|
||||
bool writeNTS(LogIDs id, bool dofile, const char *fmt, ...); // no error checking, assumes is open, no locking, no timestamp, no newline
|
||||
|
||||
Mutex MOpen;
|
||||
Mutex MLog[MaxLogID];
|
||||
FILE* fp[MaxLogID];
|
||||
/* LogStatus: bitwise variable
|
||||
1 = output to file
|
||||
2 = output to stdout
|
||||
4 = fopen error, dont retry
|
||||
8 = use stderr instead (2 must be set)
|
||||
*/
|
||||
uint8 pLogStatus[MaxLogID];
|
||||
|
||||
msgCallbackFmt logCallbackFmt[MaxLogID];
|
||||
msgCallbackBuf logCallbackBuf[MaxLogID];
|
||||
msgCallbackPva logCallbackPva[MaxLogID];
|
||||
};
|
||||
|
||||
extern EQEMuLog* LogFile;
|
||||
|
||||
#ifdef _EQDEBUG
|
||||
class PerformanceMonitor {
|
||||
public:
|
||||
PerformanceMonitor(int64* ip) {
|
||||
p = ip;
|
||||
QueryPerformanceCounter(&tmp);
|
||||
}
|
||||
~PerformanceMonitor() {
|
||||
LARGE_INTEGER tmp2;
|
||||
QueryPerformanceCounter(&tmp2);
|
||||
*p += tmp2.QuadPart - tmp.QuadPart;
|
||||
}
|
||||
LARGE_INTEGER tmp;
|
||||
int64* p;
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
@@ -16,7 +16,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 04111-1307 USA
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "emu_opcodes.h"
|
||||
|
||||
const char *OpcodeNames[_maxEmuOpcode+1] = {
|
||||
|
||||
+509
-502
File diff suppressed because it is too large
Load Diff
@@ -23,17 +23,14 @@ crap into its own subclass of this object, it will clean things up
|
||||
tremendously.
|
||||
*/
|
||||
|
||||
#include "../common/debug.h"
|
||||
#include "../common/global_define.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <iomanip>
|
||||
|
||||
#include "emu_tcp_connection.h"
|
||||
#include "emu_tcp_server.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/packet_dump.h"
|
||||
|
||||
#ifdef FREEBSD //Timothy Whitman - January 7, 2003
|
||||
#define MSG_NOSIGNAL 0
|
||||
@@ -53,6 +50,7 @@ EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, SOCKET in_s
|
||||
keepalive_timer(SERVER_TIMEOUT),
|
||||
timeout_timer(SERVER_TIMEOUT * 2)
|
||||
{
|
||||
_eqp
|
||||
id = 0;
|
||||
Server = nullptr;
|
||||
pOldFormat = iOldFormat;
|
||||
@@ -79,6 +77,7 @@ EmuTCPConnection::EmuTCPConnection(bool iOldFormat, EmuTCPServer* iRelayServer,
|
||||
keepalive_timer(SERVER_TIMEOUT),
|
||||
timeout_timer(SERVER_TIMEOUT * 2)
|
||||
{
|
||||
_eqp
|
||||
Server = iRelayServer;
|
||||
if (Server)
|
||||
RelayServer = true;
|
||||
@@ -101,13 +100,14 @@ EmuTCPConnection::EmuTCPConnection(uint32 ID, EmuTCPServer* iServer, EmuTCPConne
|
||||
keepalive_timer(SERVER_TIMEOUT),
|
||||
timeout_timer(SERVER_TIMEOUT * 2)
|
||||
{
|
||||
_eqp
|
||||
Server = iServer;
|
||||
RelayLink = iRelayLink;
|
||||
RelayServer = true;
|
||||
RelayCount = 0;
|
||||
RemoteID = iRemoteID;
|
||||
pOldFormat = false;
|
||||
ConnectionType = Incomming;
|
||||
ConnectionType = Incoming;
|
||||
TCPMode = modePacket;
|
||||
PacketMode = packetModeZone;
|
||||
#if TCPN_DEBUG_Memory >= 7
|
||||
@@ -120,6 +120,7 @@ EmuTCPConnection::~EmuTCPConnection() {
|
||||
}
|
||||
|
||||
EmuTCPNetPacket_Struct* EmuTCPConnection::MakePacket(ServerPacket* pack, uint32 iDestination) {
|
||||
_eqp
|
||||
int32 size = sizeof(EmuTCPNetPacket_Struct) + pack->size;
|
||||
if (pack->compressed) {
|
||||
size += 4;
|
||||
@@ -147,6 +148,7 @@ EmuTCPNetPacket_Struct* EmuTCPConnection::MakePacket(ServerPacket* pack, uint32
|
||||
}
|
||||
|
||||
SPackSendQueue* EmuTCPConnection::MakeOldPacket(ServerPacket* pack) {
|
||||
_eqp
|
||||
SPackSendQueue* spsq = (SPackSendQueue*) new uchar[sizeof(SPackSendQueue) + pack->size + 4];
|
||||
if (pack->pBuffer != 0 && pack->size != 0)
|
||||
memcpy((char *) &spsq->buffer[4], (char *) pack->pBuffer, pack->size);
|
||||
@@ -157,6 +159,7 @@ SPackSendQueue* EmuTCPConnection::MakeOldPacket(ServerPacket* pack) {
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::SendPacket(ServerPacket* pack, uint32 iDestination) {
|
||||
_eqp
|
||||
if (!Connected())
|
||||
return false;
|
||||
eTCPMode tmp = GetMode();
|
||||
@@ -217,6 +220,7 @@ bool EmuTCPConnection::SendPacket(ServerPacket* pack, uint32 iDestination) {
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::SendPacket(EmuTCPNetPacket_Struct* tnps) {
|
||||
_eqp
|
||||
if (RemoteID)
|
||||
return false;
|
||||
if (!Connected())
|
||||
@@ -257,6 +261,7 @@ bool EmuTCPConnection::SendPacket(EmuTCPNetPacket_Struct* tnps) {
|
||||
}
|
||||
|
||||
ServerPacket* EmuTCPConnection::PopPacket() {
|
||||
_eqp
|
||||
ServerPacket* ret;
|
||||
if (!MOutQueueLock.trylock())
|
||||
return nullptr;
|
||||
@@ -266,12 +271,14 @@ ServerPacket* EmuTCPConnection::PopPacket() {
|
||||
}
|
||||
|
||||
void EmuTCPConnection::InModeQueuePush(EmuTCPNetPacket_Struct* tnps) {
|
||||
_eqp
|
||||
MSendQueue.lock();
|
||||
InModeQueue.push(tnps);
|
||||
MSendQueue.unlock();
|
||||
}
|
||||
|
||||
void EmuTCPConnection::OutQueuePush(ServerPacket* pack) {
|
||||
_eqp
|
||||
MOutQueueLock.lock();
|
||||
OutQueue.push(pack);
|
||||
MOutQueueLock.unlock();
|
||||
@@ -279,6 +286,7 @@ void EmuTCPConnection::OutQueuePush(ServerPacket* pack) {
|
||||
|
||||
|
||||
bool EmuTCPConnection::LineOutQueuePush(char* line) {
|
||||
_eqp
|
||||
#if defined(GOTFRAGS) && 0
|
||||
if (strcmp(line, "**CRASHME**") == 0) {
|
||||
int i = 0;
|
||||
@@ -372,6 +380,7 @@ bool EmuTCPConnection::LineOutQueuePush(char* line) {
|
||||
}
|
||||
|
||||
void EmuTCPConnection::Disconnect(bool iSendRelayDisconnect) {
|
||||
_eqp
|
||||
TCPConnection::Disconnect();
|
||||
|
||||
if (RelayLink) {
|
||||
@@ -381,6 +390,7 @@ void EmuTCPConnection::Disconnect(bool iSendRelayDisconnect) {
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) {
|
||||
_eqp
|
||||
if(!TCPConnection::ConnectIP(irIP, irPort, errbuf))
|
||||
return(false);
|
||||
|
||||
@@ -435,6 +445,7 @@ bool EmuTCPConnection::ConnectIP(uint32 irIP, uint16 irPort, char* errbuf) {
|
||||
}
|
||||
|
||||
void EmuTCPConnection::ClearBuffers() {
|
||||
_eqp
|
||||
TCPConnection::ClearBuffers();
|
||||
|
||||
LockMutex lock2(&MOutQueueLock);
|
||||
@@ -451,6 +462,7 @@ void EmuTCPConnection::ClearBuffers() {
|
||||
}
|
||||
|
||||
void EmuTCPConnection::SendNetErrorPacket(const char* reason) {
|
||||
_eqp
|
||||
#if TCPC_DEBUG >= 1
|
||||
struct in_addr in;
|
||||
in.s_addr = GetrIP();
|
||||
@@ -472,6 +484,7 @@ void EmuTCPConnection::SendNetErrorPacket(const char* reason) {
|
||||
}
|
||||
|
||||
void EmuTCPConnection::RemoveRelay(EmuTCPConnection* relay, bool iSendRelayDisconnect) {
|
||||
_eqp
|
||||
if (iSendRelayDisconnect) {
|
||||
ServerPacket* pack = new ServerPacket(0, 5);
|
||||
pack->pBuffer[0] = 3;
|
||||
@@ -485,6 +498,7 @@ void EmuTCPConnection::RemoveRelay(EmuTCPConnection* relay, bool iSendRelayDisco
|
||||
|
||||
|
||||
bool EmuTCPConnection::ProcessReceivedData(char* errbuf) {
|
||||
_eqp
|
||||
if (errbuf)
|
||||
errbuf[0] = 0;
|
||||
timeout_timer.Start();
|
||||
@@ -508,6 +522,7 @@ bool EmuTCPConnection::ProcessReceivedData(char* errbuf) {
|
||||
|
||||
|
||||
bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) {
|
||||
_eqp
|
||||
if (errbuf)
|
||||
errbuf[0] = 0;
|
||||
int32 base = 0;
|
||||
@@ -624,6 +639,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsPackets(char* errbuf) {
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::ProcessReceivedDataAsOldPackets(char* errbuf) {
|
||||
_eqp
|
||||
int32 base = 0;
|
||||
int32 size = 4;
|
||||
uchar* buffer;
|
||||
@@ -698,6 +714,7 @@ bool EmuTCPConnection::ProcessReceivedDataAsOldPackets(char* errbuf) {
|
||||
}
|
||||
|
||||
void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
||||
_eqp
|
||||
uint8 opcode = pack->pBuffer[0];
|
||||
uint8* data = &pack->pBuffer[1];
|
||||
switch (opcode) {
|
||||
@@ -717,7 +734,7 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
||||
SendNetErrorPacket("Switch to RelayServer mode by a Relay Client");
|
||||
break;
|
||||
}
|
||||
if (ConnectionType != Incomming) {
|
||||
if (ConnectionType != Incoming) {
|
||||
SendNetErrorPacket("Switch to RelayServer mode on outgoing connection");
|
||||
break;
|
||||
}
|
||||
@@ -738,7 +755,7 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
||||
SendNetErrorPacket("New RelayClient: wrong size, expected 11");
|
||||
break;
|
||||
}
|
||||
if (ConnectionType != Incomming) {
|
||||
if (ConnectionType != Incoming) {
|
||||
SendNetErrorPacket("New RelayClient: illegal on outgoing connection");
|
||||
break;
|
||||
}
|
||||
@@ -758,7 +775,7 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
||||
}
|
||||
EmuTCPConnection* con = Server->FindConnection(*((uint32*)data));
|
||||
if (con) {
|
||||
if (ConnectionType == Incomming) {
|
||||
if (ConnectionType == Incoming) {
|
||||
if (con->GetRelayLink() != this) {
|
||||
SendNetErrorPacket("Delete RelayClient: RelayLink != this");
|
||||
break;
|
||||
@@ -783,6 +800,7 @@ void EmuTCPConnection::ProcessNetworkLayerPacket(ServerPacket* pack) {
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) {
|
||||
_eqp
|
||||
sent_something = false;
|
||||
if(!TCPConnection::SendData(sent_something, errbuf))
|
||||
return(false);
|
||||
@@ -802,6 +820,7 @@ bool EmuTCPConnection::SendData(bool &sent_something, char* errbuf) {
|
||||
}
|
||||
|
||||
bool EmuTCPConnection::RecvData(char* errbuf) {
|
||||
_eqp
|
||||
if(!TCPConnection::RecvData(errbuf)) {
|
||||
if (OutQueue.count())
|
||||
return(true);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
struct SPackSendQueue;
|
||||
class EmuTCPServer;
|
||||
class ServerPacket;
|
||||
|
||||
class EmuTCPConnection : public TCPConnection {
|
||||
public:
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "emu_tcp_server.h"
|
||||
#include "emu_tcp_connection.h"
|
||||
|
||||
@@ -9,6 +9,7 @@ EmuTCPServer::EmuTCPServer(uint16 iPort, bool iOldFormat)
|
||||
}
|
||||
|
||||
EmuTCPServer::~EmuTCPServer() {
|
||||
_eqp
|
||||
MInQueue.lock();
|
||||
while(!m_InQueue.empty()) {
|
||||
delete m_InQueue.front();
|
||||
@@ -18,23 +19,27 @@ EmuTCPServer::~EmuTCPServer() {
|
||||
}
|
||||
|
||||
void EmuTCPServer::Process() {
|
||||
_eqp
|
||||
CheckInQueue();
|
||||
TCPServer<EmuTCPConnection>::Process();
|
||||
}
|
||||
|
||||
void EmuTCPServer::CreateNewConnection(uint32 ID, SOCKET in_socket, uint32 irIP, uint16 irPort)
|
||||
{
|
||||
_eqp
|
||||
EmuTCPConnection *conn = new EmuTCPConnection(ID, this, in_socket, irIP, irPort, pOldFormat);
|
||||
AddConnection(conn);
|
||||
}
|
||||
|
||||
|
||||
void EmuTCPServer::SendPacket(ServerPacket* pack) {
|
||||
_eqp
|
||||
EmuTCPNetPacket_Struct* tnps = EmuTCPConnection::MakePacket(pack);
|
||||
SendPacket(&tnps);
|
||||
}
|
||||
|
||||
void EmuTCPServer::SendPacket(EmuTCPNetPacket_Struct** tnps) {
|
||||
_eqp
|
||||
MInQueue.lock();
|
||||
m_InQueue.push(*tnps);
|
||||
MInQueue.unlock();
|
||||
@@ -42,6 +47,7 @@ void EmuTCPServer::SendPacket(EmuTCPNetPacket_Struct** tnps) {
|
||||
}
|
||||
|
||||
void EmuTCPServer::CheckInQueue() {
|
||||
_eqp
|
||||
EmuTCPNetPacket_Struct* tnps = 0;
|
||||
|
||||
while (( tnps = InQueuePop() )) {
|
||||
@@ -57,6 +63,7 @@ void EmuTCPServer::CheckInQueue() {
|
||||
}
|
||||
|
||||
EmuTCPNetPacket_Struct* EmuTCPServer::InQueuePop() {
|
||||
_eqp
|
||||
EmuTCPNetPacket_Struct* ret = nullptr;
|
||||
MInQueue.lock();
|
||||
if(!m_InQueue.empty()) {
|
||||
@@ -69,6 +76,7 @@ EmuTCPNetPacket_Struct* EmuTCPServer::InQueuePop() {
|
||||
|
||||
|
||||
EmuTCPConnection *EmuTCPServer::FindConnection(uint32 iID) {
|
||||
_eqp
|
||||
vitr cur, end;
|
||||
cur = m_list.begin();
|
||||
end = m_list.end();
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define EQ_CONSTANTS_H
|
||||
|
||||
#include "skills.h"
|
||||
#include "types.h"
|
||||
|
||||
/*
|
||||
** Item attributes
|
||||
@@ -367,7 +368,7 @@ enum {
|
||||
#define AT_DamageState 44 // The damage state of a destructible object (0 through 4)
|
||||
//#define AT_Trader 300 // Bazzar Trader Mode
|
||||
|
||||
// solar: animations for AT_Anim
|
||||
// animations for AT_Anim
|
||||
#define ANIM_FREEZE 102
|
||||
#define ANIM_STAND 0x64
|
||||
#define ANIM_SIT 0x6e
|
||||
@@ -968,4 +969,6 @@ namespace legacy {
|
||||
} InventorySlot;
|
||||
}
|
||||
|
||||
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
|
||||
|
||||
#endif
|
||||
|
||||
+136
-326
@@ -25,8 +25,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// class EmuConstants
|
||||
//
|
||||
uint16 EmuConstants::InventoryMapSize(int16 map) {
|
||||
switch (map) {
|
||||
uint16 EmuConstants::InventoryMapSize(int16 indexMap) {
|
||||
switch (indexMap) {
|
||||
case MapPossessions:
|
||||
return MAP_POSSESSIONS_SIZE;
|
||||
case MapBank:
|
||||
@@ -91,8 +91,8 @@ std::string EmuConstants::InventoryLocationName(Location_Struct location) {
|
||||
}
|
||||
*/
|
||||
|
||||
std::string EmuConstants::InventoryMapName(int16 map) {
|
||||
switch (map) {
|
||||
std::string EmuConstants::InventoryMapName(int16 indexMap) {
|
||||
switch (indexMap) {
|
||||
case INVALID_INDEX:
|
||||
return "Invalid Map";
|
||||
case MapPossessions:
|
||||
@@ -150,8 +150,8 @@ std::string EmuConstants::InventoryMapName(int16 map) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string EmuConstants::InventoryMainName(int16 main) {
|
||||
switch (main) {
|
||||
std::string EmuConstants::InventoryMainName(int16 indexMain) {
|
||||
switch (indexMain) {
|
||||
case INVALID_INDEX:
|
||||
return "Invalid Main";
|
||||
case MainCharm:
|
||||
@@ -229,293 +229,83 @@ std::string EmuConstants::InventoryMainName(int16 main) {
|
||||
}
|
||||
}
|
||||
|
||||
std::string EmuConstants::InventorySubName(int16 sub) {
|
||||
if (sub == INVALID_INDEX)
|
||||
std::string EmuConstants::InventorySubName(int16 indexSub) {
|
||||
if (indexSub == INVALID_INDEX)
|
||||
return "Invalid Sub";
|
||||
|
||||
if ((uint16)sub >= ITEM_CONTAINER_SIZE)
|
||||
if ((uint16)indexSub >= ITEM_CONTAINER_SIZE)
|
||||
return "Unknown Sub";
|
||||
|
||||
std::string ret_str;
|
||||
ret_str = StringFormat("Container %i", (sub + 1)); // zero-based index..but, count starts at one
|
||||
ret_str = StringFormat("Container %i", (indexSub + 1)); // zero-based index..but, count starts at one
|
||||
|
||||
return ret_str;
|
||||
}
|
||||
|
||||
std::string EmuConstants::InventoryAugName(int16 aug) {
|
||||
if (aug == INVALID_INDEX)
|
||||
std::string EmuConstants::InventoryAugName(int16 indexAug) {
|
||||
if (indexAug == INVALID_INDEX)
|
||||
return "Invalid Aug";
|
||||
|
||||
if ((uint16)aug >= ITEM_COMMON_SIZE)
|
||||
if ((uint16)indexAug >= ITEM_COMMON_SIZE)
|
||||
return "Unknown Aug";
|
||||
|
||||
std::string ret_str;
|
||||
ret_str = StringFormat("Augment %i", (aug + 1)); // zero-based index..but, count starts at one
|
||||
ret_str = StringFormat("Augment %i", (indexAug + 1)); // zero-based index..but, count starts at one
|
||||
|
||||
return ret_str;
|
||||
}
|
||||
|
||||
// legacy-related functions
|
||||
//
|
||||
// these should work for the first-stage coversions..but, once the new system is up and going..conversions will be incompatible
|
||||
// without limiting server functions and other aspects, such as augment control, bag size, etc. A complete remapping will be
|
||||
// required when bag sizes over 10 and direct manipulation of augments are implemented, due to the massive increase in range usage.
|
||||
//
|
||||
// (current personal/cursor bag range {251..340}, or 90 slots ... conversion translated range would be {10000..12804}, or 2805 slots...
|
||||
// these would have to be hard-coded into all perl code to allow access to full range of the new system - actual limits would be
|
||||
// less, based on bag size..but, the range must be full and consistent to avoid translation issues -- similar changes to other ranges
|
||||
// (240 versus 6120 slots for bank bags, for example...))
|
||||
/*
|
||||
int EmuConstants::ServerToPerlSlot(int server_slot) { // set r/s
|
||||
switch (server_slot) {
|
||||
case legacy::SLOT_CURSOR_END:
|
||||
return legacy::SLOT_CURSOR_END;
|
||||
case INVALID_INDEX:
|
||||
return legacy::SLOT_INVALID;
|
||||
case MainPowerSource:
|
||||
return legacy::SLOT_POWER_SOURCE;
|
||||
case MainAmmo:
|
||||
return legacy::SLOT_AMMO;
|
||||
case MainCursor:
|
||||
return legacy::SLOT_CURSOR;
|
||||
case legacy::SLOT_TRADESKILL:
|
||||
return legacy::SLOT_TRADESKILL;
|
||||
case legacy::SLOT_AUGMENT:
|
||||
return legacy::SLOT_AUGMENT;
|
||||
default:
|
||||
int perl_slot = legacy::SLOT_INVALID;
|
||||
|
||||
// activate the internal checks as needed
|
||||
if (server_slot >= EmuConstants::EQUIPMENT_BEGIN && server_slot <= MainWaist) {
|
||||
perl_slot = server_slot;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::GENERAL_BEGIN && server_slot <= EmuConstants::GENERAL_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_PERSONAL_BEGIN - EmuConstants::GENERAL_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_PERSONAL_BEGIN || perl_slot > legacy::SLOT_PERSONAL_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::GENERAL_BAGS_BEGIN && server_slot <= EmuConstants::GENERAL_BAGS_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_PERSONAL_BAGS_BEGIN - EmuConstants::GENERAL_BAGS_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_PERSONAL_BAGS_BEGIN || perl_slot > legacy::SLOT_PERSONAL_BAGS_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::CURSOR_BAG_BEGIN && server_slot <= EmuConstants::CURSOR_BAG_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_CURSOR_BAG_BEGIN - EmuConstants::CURSOR_BAG_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_CURSOR_BAG_BEGIN || perl_slot > legacy::SLOT_CURSOR_BAG_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::TRIBUTE_BEGIN && server_slot <= EmuConstants::TRIBUTE_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_TRIBUTE_BEGIN - EmuConstants::TRADE_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_TRIBUTE_BEGIN || perl_slot > legacy::SLOT_TRIBUTE_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::BANK_BEGIN && server_slot <= EmuConstants::BANK_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_BANK_BEGIN - EmuConstants::BANK_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_BANK_BEGIN || perl_slot > legacy::SLOT_BANK_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::BANK_BAGS_BEGIN && server_slot <= EmuConstants::BANK_BAGS_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_BANK_BAGS_BEGIN - EmuConstants::BANK_BAGS_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_BANK_BAGS_BEGIN || perl_slot > legacy::SLOT_BANK_BAGS_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::SHARED_BANK_BEGIN && server_slot <= EmuConstants::SHARED_BANK_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_SHARED_BANK_BEGIN - EmuConstants::SHARED_BANK_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_SHARED_BANK_BEGIN || perl_slot > legacy::SLOT_SHARED_BANK_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::SHARED_BANK_BAGS_BEGIN && server_slot <= EmuConstants::SHARED_BANK_BAGS_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_SHARED_BANK_BAGS_BEGIN - EmuConstants::SHARED_BANK_BAGS_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_SHARED_BANK_BAGS_BEGIN || perl_slot > legacy::SLOT_SHARED_BANK_BAGS_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::TRADE_BEGIN && server_slot <= EmuConstants::TRADE_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_TRADE_BEGIN - EmuConstants::TRADE_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_TRADE_BEGIN || perl_slot > legacy::SLOT_TRADE_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::TRADE_BAGS_BEGIN && server_slot <= EmuConstants::TRADE_BAGS_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_TRADE_BAGS_BEGIN - EmuConstants::TRADE_BAGS_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_TRADE_BAGS_BEGIN || perl_slot > legacy::SLOT_TRADE_BAGS_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= EmuConstants::WORLD_BEGIN && server_slot <= EmuConstants::WORLD_END) {
|
||||
perl_slot = server_slot;// + legacy::SLOT_WORLD_BEGIN - EmuConstants::WORLD_BEGIN;
|
||||
//if (perl_slot < legacy::SLOT_WORLD_BEGIN || perl_slot > legacy::SLOT_WORLD_END)
|
||||
// perl_slot = legacy::SLOT_INVALID;
|
||||
}
|
||||
else if (server_slot >= 8000 && server_slot <= 8999) { // this range may be limited to 36 in the future (client size)
|
||||
perl_slot = server_slot;
|
||||
}
|
||||
|
||||
return perl_slot;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
int EmuConstants::PerlToServerSlot(int perl_slot) { // set r/s
|
||||
switch (perl_slot) {
|
||||
case legacy::SLOT_CURSOR_END:
|
||||
return legacy::SLOT_CURSOR_END;
|
||||
case legacy::SLOT_INVALID:
|
||||
return INVALID_INDEX;
|
||||
case legacy::SLOT_POWER_SOURCE:
|
||||
return MainPowerSource;
|
||||
case legacy::SLOT_AMMO:
|
||||
return MainAmmo;
|
||||
case legacy::SLOT_CURSOR:
|
||||
return MainCursor;
|
||||
case legacy::SLOT_TRADESKILL:
|
||||
return legacy::SLOT_TRADESKILL;
|
||||
case legacy::SLOT_AUGMENT:
|
||||
return legacy::SLOT_AUGMENT;
|
||||
default:
|
||||
int server_slot = INVALID_INDEX;
|
||||
|
||||
// activate the internal checks as needed
|
||||
if (perl_slot >= legacy::SLOT_EQUIPMENT_BEGIN && perl_slot <= legacy::SLOT_WAIST) {
|
||||
server_slot = perl_slot;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_PERSONAL_BEGIN && perl_slot <= legacy::SLOT_PERSONAL_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::GENERAL_BEGIN - legacy::SLOT_PERSONAL_BEGIN;
|
||||
//if (server_slot < EmuConstants::GENERAL_BEGIN || server_slot > EmuConstants::GENERAL_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_PERSONAL_BAGS_BEGIN && perl_slot <= legacy::SLOT_PERSONAL_BAGS_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::GENERAL_BAGS_BEGIN - legacy::SLOT_PERSONAL_BAGS_BEGIN;
|
||||
//if (server_slot < EmuConstants::GENERAL_BAGS_BEGIN || server_slot > EmuConstants::GENERAL_BAGS_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_CURSOR_BAG_BEGIN && perl_slot <= legacy::SLOT_CURSOR_BAG_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::CURSOR_BAG_BEGIN - legacy::SLOT_CURSOR_BAG_BEGIN;
|
||||
//if (server_slot < EmuConstants::CURSOR_BAG_BEGIN || server_slot > EmuConstants::CURSOR_BAG_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_TRIBUTE_BEGIN && perl_slot <= legacy::SLOT_TRIBUTE_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::TRIBUTE_BEGIN - legacy::SLOT_TRIBUTE_BEGIN;
|
||||
//if (server_slot < EmuConstants::TRIBUTE_BEGIN || server_slot > EmuConstants::TRIBUTE_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_BANK_BEGIN && perl_slot <= legacy::SLOT_BANK_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::BANK_BEGIN - legacy::SLOT_BANK_BEGIN;
|
||||
//if (server_slot < EmuConstants::BANK_BEGIN || server_slot > EmuConstants::BANK_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_BANK_BAGS_BEGIN && perl_slot <= legacy::SLOT_BANK_BAGS_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::BANK_BAGS_BEGIN - legacy::SLOT_BANK_BAGS_BEGIN;
|
||||
//if (server_slot < EmuConstants::BANK_BAGS_BEGIN || server_slot > EmuConstants::BANK_BAGS_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_SHARED_BANK_BEGIN && perl_slot <= legacy::SLOT_SHARED_BANK_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::SHARED_BANK_BEGIN - legacy::SLOT_SHARED_BANK_BEGIN;
|
||||
//if (server_slot < EmuConstants::SHARED_BANK_BEGIN || server_slot > EmuConstants::SHARED_BANK_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_SHARED_BANK_BAGS_BEGIN && perl_slot <= legacy::SLOT_SHARED_BANK_BAGS_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::SHARED_BANK_BAGS_BEGIN - legacy::SLOT_SHARED_BANK_BAGS_END;
|
||||
//if (server_slot < EmuConstants::SHARED_BANK_BAGS_BEGIN || server_slot > EmuConstants::SHARED_BANK_BAGS_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_TRADE_BEGIN && perl_slot <= legacy::SLOT_TRADE_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::TRADE_BEGIN - legacy::SLOT_TRADE_BEGIN;
|
||||
//if (server_slot < EmuConstants::TRADE_BEGIN || server_slot > EmuConstants::TRADE_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_TRADE_BAGS_BEGIN && perl_slot <= legacy::SLOT_TRADE_BAGS_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::TRADE_BAGS_BEGIN - legacy::SLOT_TRADE_BAGS_BEGIN;
|
||||
//if (server_slot < EmuConstants::TRADE_BAGS_BEGIN || server_slot > EmuConstants::TRADE_BAGS_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= legacy::SLOT_WORLD_BEGIN && perl_slot <= legacy::SLOT_WORLD_END) {
|
||||
server_slot = perl_slot;// + EmuConstants::WORLD_BEGIN - legacy::SLOT_WORLD_BEGIN;
|
||||
//if (server_slot < EmuConstants::WORLD_BEGIN || server_slot > EmuConstants::WORLD_END)
|
||||
// server_slot = INVALID_INDEX;
|
||||
}
|
||||
else if (perl_slot >= 8000 && perl_slot <= 8999) { // this range may be limited to 36 in the future (client size)
|
||||
server_slot = perl_slot;
|
||||
}
|
||||
|
||||
return server_slot;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// class EQLimits
|
||||
//
|
||||
// client validation
|
||||
bool EQLimits::IsValidClientVersion(uint32 version) {
|
||||
if (version < _EQClientCount)
|
||||
bool EQLimits::IsValidPCClientVersion(ClientVersion clientVersion) {
|
||||
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 EQLimits::ValidateClientVersion(uint32 version) {
|
||||
if (version < _EQClientCount)
|
||||
return version;
|
||||
ClientVersion EQLimits::ValidatePCClientVersion(ClientVersion clientVersion) {
|
||||
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_PC_CLIENT)
|
||||
return clientVersion;
|
||||
|
||||
return EQClientUnknown;
|
||||
}
|
||||
|
||||
EQClientVersion EQLimits::ValidateClientVersion(EQClientVersion version) {
|
||||
if (version >= EQClientUnknown)
|
||||
if (version < _EQClientCount)
|
||||
return version;
|
||||
|
||||
return EQClientUnknown;
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
|
||||
// npc validation
|
||||
bool EQLimits::IsValidNPCVersion(uint32 version) {
|
||||
if (version >= _EQClientCount)
|
||||
if (version < _EmuClientCount)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 EQLimits::ValidateNPCVersion(uint32 version) {
|
||||
if (version >= _EQClientCount)
|
||||
if (version < _EmuClientCount)
|
||||
return version;
|
||||
|
||||
return EQClientUnknown;
|
||||
}
|
||||
|
||||
EQClientVersion EQLimits::ValidateNPCVersion(EQClientVersion version) {
|
||||
if (version >= _EQClientCount)
|
||||
if (version < _EmuClientCount)
|
||||
return version;
|
||||
|
||||
return EQClientUnknown;
|
||||
}
|
||||
|
||||
// mob validation
|
||||
bool EQLimits::IsValidMobVersion(uint32 version) {
|
||||
if (version < _EmuClientCount)
|
||||
bool EQLimits::IsValidNPCClientVersion(ClientVersion clientVersion) {
|
||||
if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 EQLimits::ValidateMobVersion(uint32 version) {
|
||||
if (version < _EmuClientCount)
|
||||
return version;
|
||||
ClientVersion EQLimits::ValidateNPCClientVersion(ClientVersion clientVersion) {
|
||||
if (clientVersion > LAST_PC_CLIENT && clientVersion <= LAST_NPC_CLIENT)
|
||||
return clientVersion;
|
||||
|
||||
return EQClientUnknown;
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
|
||||
EQClientVersion EQLimits::ValidateMobVersion(EQClientVersion version) {
|
||||
if (version >= EQClientUnknown)
|
||||
if (version < _EmuClientCount)
|
||||
return version;
|
||||
// mob validation
|
||||
bool EQLimits::IsValidMobClientVersion(ClientVersion clientVersion) {
|
||||
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT)
|
||||
return true;
|
||||
|
||||
return EQClientUnknown;
|
||||
return false;
|
||||
}
|
||||
|
||||
ClientVersion EQLimits::ValidateMobClientVersion(ClientVersion clientVersion) {
|
||||
if (clientVersion > ClientVersion::Unknown && clientVersion <= LAST_NPC_CLIENT)
|
||||
return clientVersion;
|
||||
|
||||
return ClientVersion::Unknown;
|
||||
}
|
||||
|
||||
// inventory
|
||||
uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
uint16 EQLimits::InventoryMapSize(int16 indexMap, ClientVersion clientVersion) {
|
||||
// not all maps will have an instantiated container..some are references for queue generators (i.e., bazaar, mail, etc...)
|
||||
// a zero '0' indicates a needed value..otherwise, change to '_NOTUSED' for a null value so indices requiring research can be identified
|
||||
// ALL of these values need to be verified before pushing to live
|
||||
@@ -527,7 +317,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
//
|
||||
// when setting NPC-based values, try to adhere to an EmuConstants::<property> or NOT_USED value to avoid unnecessary issues
|
||||
|
||||
static const uint16 local[_MapCount][_EmuClientCount] = {
|
||||
static const uint16 local[_MapCount][CLIENT_VERSION_COUNT] = {
|
||||
// server and database are sync'd to current MapPossessions's client as set in 'using namespace RoF::slots;' and
|
||||
// 'EmuConstants::MAP_POSSESSIONS_SIZE' - use/update EquipmentBitmask(), GeneralBitmask() and CursorBitmask()
|
||||
// for partial range validation checks and 'EmuConstants::MAP_POSSESSIONS_SIZE' for full range iterations
|
||||
@@ -539,7 +329,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
|
||||
/*NPC*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
/*Merc*/ EmuConstants::MAP_POSSESSIONS_SIZE,
|
||||
@@ -548,13 +338,13 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
},
|
||||
{ // local[MapBank]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ Client62::consts::MAP_BANK_SIZE,
|
||||
/*62*/ NOT_USED,
|
||||
/*Titanium*/ Titanium::consts::MAP_BANK_SIZE,
|
||||
/*SoF*/ EmuConstants::MAP_BANK_SIZE,
|
||||
/*SoD*/ EmuConstants::MAP_BANK_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_BANK_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_BANK_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_BANK_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
@@ -569,7 +359,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_SHARED_BANK_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
@@ -584,7 +374,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_TRADE_SIZE,
|
||||
|
||||
/*NPC*/ 4,
|
||||
/*Merc*/ 4,
|
||||
@@ -599,7 +389,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_WORLD_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
@@ -614,7 +404,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_LIMBO_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
@@ -629,7 +419,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_TRIBUTE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -644,7 +434,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_TROPHY_TRIBUTE_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_TROPHY_TRIBUTE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -659,7 +449,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_GUILD_TRIBUTE_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_GUILD_TRIBUTE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -674,7 +464,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_MERCHANT_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_MERCHANT_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -689,7 +479,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_DELETED_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_DELETED_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -698,13 +488,13 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
},
|
||||
{ // local[MapCorpse]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ Client62::consts::MAP_CORPSE_SIZE,
|
||||
/*62*/ NOT_USED,
|
||||
/*Titanium*/ Titanium::consts::MAP_CORPSE_SIZE,
|
||||
/*SoF*/ SoF::consts::MAP_CORPSE_SIZE,
|
||||
/*SoD*/ SoD::consts::MAP_CORPSE_SIZE,
|
||||
/*Underfoot*/ Underfoot::consts::MAP_CORPSE_SIZE,
|
||||
/*Underfoot*/ UF::consts::MAP_CORPSE_SIZE,
|
||||
/*RoF*/ RoF::consts::MAP_CORPSE_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ RoF2::consts::MAP_CORPSE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -719,7 +509,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
/*Underfoot*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
/*RoF*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_BAZAAR_SIZE,
|
||||
|
||||
/*NPC*/ 0, // this may need to be 'EmuConstants::MAP_BAZAAR_SIZE' if offline client traders respawn as an npc
|
||||
/*Merc*/ 0,
|
||||
@@ -728,13 +518,13 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
},
|
||||
{ // local[MapInspect]
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ Client62::consts::MAP_INSPECT_SIZE,
|
||||
/*62*/ NOT_USED,
|
||||
/*Titanium*/ Titanium::consts::MAP_INSPECT_SIZE,
|
||||
/*SoF*/ SoF::consts::MAP_INSPECT_SIZE,
|
||||
/*SoD*/ SoD::consts::MAP_INSPECT_SIZE,
|
||||
/*Underfoot*/ Underfoot::consts::MAP_INSPECT_SIZE,
|
||||
/*Underfoot*/ UF::consts::MAP_INSPECT_SIZE,
|
||||
/*RoF*/ RoF::consts::MAP_INSPECT_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ RoF2::consts::MAP_INSPECT_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
@@ -749,7 +539,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_REAL_ESTATE_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_REAL_ESTATE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -764,7 +554,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_VIEW_MOD_PC_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_VIEW_MOD_PC_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -779,7 +569,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_VIEW_MOD_BANK_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_VIEW_MOD_BANK_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -794,7 +584,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_VIEW_MOD_SHARED_BANK_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_VIEW_MOD_SHARED_BANK_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -809,7 +599,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_VIEW_MOD_LIMBO_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_VIEW_MOD_LIMBO_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -824,7 +614,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_ALT_STORAGE_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_ALT_STORAGE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -839,7 +629,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_ARCHIVED_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_ARCHIVED_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -854,7 +644,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_MAIL_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_MAIL_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -869,7 +659,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_GUILD_TROPHY_TRIBUTE_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_GUILD_TROPHY_TRIBUTE_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -884,7 +674,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ NOT_USED,
|
||||
/*Underfoot*/ NOT_USED,
|
||||
/*RoF*/ EmuConstants::MAP_KRONO_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_KRONO_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -899,7 +689,7 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
/*SoD*/ 0,
|
||||
/*Underfoot*/ 0,
|
||||
/*RoF*/ EmuConstants::MAP_OTHER_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::MAP_OTHER_SIZE,
|
||||
|
||||
/*NPC*/ 0,
|
||||
/*Merc*/ 0,
|
||||
@@ -908,19 +698,19 @@ uint16 EQLimits::InventoryMapSize(int16 map, uint32 version) {
|
||||
}
|
||||
};
|
||||
|
||||
if ((uint16)map < _MapCount)
|
||||
return local[map][ValidateMobVersion(version)];
|
||||
if ((uint16)indexMap < _MapCount)
|
||||
return local[indexMap][static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
|
||||
return NOT_USED;
|
||||
}
|
||||
|
||||
uint64 EQLimits::PossessionsBitmask(uint32 version) {
|
||||
uint64 EQLimits::PossessionsBitmask(ClientVersion clientVersion) {
|
||||
// these are for the new inventory system (RoF)..not the current (Ti) one...
|
||||
// 0x0000000000200000 is SlotPowerSource (SoF+)
|
||||
// 0x0000000080000000 is SlotGeneral9 (RoF+)
|
||||
// 0x0000000100000000 is SlotGeneral10 (RoF+)
|
||||
|
||||
static const uint64 local[_EmuClientCount] = {
|
||||
static const uint64 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0x000000027FDFFFFF,
|
||||
/*Titanium*/ 0x000000027FDFFFFF,
|
||||
@@ -937,11 +727,11 @@ uint64 EQLimits::PossessionsBitmask(uint32 version) {
|
||||
};
|
||||
|
||||
return NOT_USED;
|
||||
//return local[ValidateMobVersion(version)];
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint64 EQLimits::EquipmentBitmask(uint32 version) {
|
||||
static const uint64 local[_EmuClientCount] = {
|
||||
uint64 EQLimits::EquipmentBitmask(ClientVersion clientVersion) {
|
||||
static const uint64 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0x00000000005FFFFF,
|
||||
/*Titanium*/ 0x00000000005FFFFF,
|
||||
@@ -958,11 +748,11 @@ uint64 EQLimits::EquipmentBitmask(uint32 version) {
|
||||
};
|
||||
|
||||
return NOT_USED;
|
||||
//return local[ValidateMobVersion(version)];
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint64 EQLimits::GeneralBitmask(uint32 version) {
|
||||
static const uint64 local[_EmuClientCount] = {
|
||||
uint64 EQLimits::GeneralBitmask(ClientVersion clientVersion) {
|
||||
static const uint64 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0x000000007F800000,
|
||||
/*Titanium*/ 0x000000007F800000,
|
||||
@@ -979,11 +769,11 @@ uint64 EQLimits::GeneralBitmask(uint32 version) {
|
||||
};
|
||||
|
||||
return NOT_USED;
|
||||
//return local[ValidateMobVersion(version)];
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint64 EQLimits::CursorBitmask(uint32 version) {
|
||||
static const uint64 local[_EmuClientCount] = {
|
||||
uint64 EQLimits::CursorBitmask(ClientVersion clientVersion) {
|
||||
static const uint64 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ 0x0000000200000000,
|
||||
/*Titanium*/ 0x0000000200000000,
|
||||
@@ -1000,19 +790,19 @@ uint64 EQLimits::CursorBitmask(uint32 version) {
|
||||
};
|
||||
|
||||
return NOT_USED;
|
||||
//return local[ValidateMobVersion(version)];
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
bool EQLimits::AllowsEmptyBagInBag(uint32 version) {
|
||||
static const bool local[_EmuClientCount] = {
|
||||
bool EQLimits::AllowsEmptyBagInBag(ClientVersion clientVersion) {
|
||||
static const bool local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ false,
|
||||
/*62*/ Client62::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*62*/ false,
|
||||
/*Titanium*/ Titanium::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*SoF*/ SoF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*SoD*/ SoD::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*Underfoot*/ Underfoot::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*Underfoot*/ UF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*RoF*/ RoF::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
/*RoF2*/ false,
|
||||
/*RoF2*/ RoF2::limits::ALLOWS_EMPTY_BAG_IN_BAG,
|
||||
|
||||
/*NPC*/ false,
|
||||
/*Merc*/ false,
|
||||
@@ -1021,12 +811,32 @@ bool EQLimits::AllowsEmptyBagInBag(uint32 version) {
|
||||
};
|
||||
|
||||
return false; // not implemented
|
||||
//return local[ValidateMobVersion(version)];
|
||||
//return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
bool EQLimits::AllowsClickCastFromBag(ClientVersion clientVersion) {
|
||||
static const bool local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ false,
|
||||
/*62*/ false,
|
||||
/*Titanium*/ Titanium::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*SoF*/ SoF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*SoD*/ SoD::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*Underfoot*/ UF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*RoF*/ RoF::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
/*RoF2*/ RoF2::limits::ALLOWS_CLICK_CAST_FROM_BAG,
|
||||
|
||||
/*NPC*/ false,
|
||||
/*Merc*/ false,
|
||||
/*Bot*/ false,
|
||||
/*Pet*/ false
|
||||
};
|
||||
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
// items
|
||||
uint16 EQLimits::ItemCommonSize(uint32 version) {
|
||||
static const uint16 local[_EmuClientCount] = {
|
||||
uint16 EQLimits::ItemCommonSize(ClientVersion clientVersion) {
|
||||
static const uint16 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*Titanium*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
@@ -1034,7 +844,7 @@ uint16 EQLimits::ItemCommonSize(uint32 version) {
|
||||
/*SoD*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*Underfoot*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*RoF*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
|
||||
/*NPC*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
/*Merc*/ EmuConstants::ITEM_COMMON_SIZE,
|
||||
@@ -1042,11 +852,11 @@ uint16 EQLimits::ItemCommonSize(uint32 version) {
|
||||
/*Pet*/ EmuConstants::ITEM_COMMON_SIZE
|
||||
};
|
||||
|
||||
return local[ValidateMobVersion(version)];
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint16 EQLimits::ItemContainerSize(uint32 version) {
|
||||
static const uint16 local[_EmuClientCount] = {
|
||||
uint16 EQLimits::ItemContainerSize(ClientVersion clientVersion) {
|
||||
static const uint16 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*Titanium*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
@@ -1054,7 +864,7 @@ uint16 EQLimits::ItemContainerSize(uint32 version) {
|
||||
/*SoD*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*Underfoot*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*RoF*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
|
||||
/*NPC*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
/*Merc*/ EmuConstants::ITEM_CONTAINER_SIZE,
|
||||
@@ -1062,19 +872,19 @@ uint16 EQLimits::ItemContainerSize(uint32 version) {
|
||||
/*Pet*/ EmuConstants::ITEM_CONTAINER_SIZE
|
||||
};
|
||||
|
||||
return local[ValidateMobVersion(version)];
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
bool EQLimits::CoinHasWeight(uint32 version) {
|
||||
static const bool local[_EmuClientCount] = {
|
||||
bool EQLimits::CoinHasWeight(ClientVersion clientVersion) {
|
||||
static const bool local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ true,
|
||||
/*62*/ Client62::limits::COIN_HAS_WEIGHT,
|
||||
/*62*/ true,
|
||||
/*Titanium*/ Titanium::limits::COIN_HAS_WEIGHT,
|
||||
/*SoF*/ SoF::limits::COIN_HAS_WEIGHT,
|
||||
/*SoD*/ SoD::limits::COIN_HAS_WEIGHT,
|
||||
/*Underfoot*/ Underfoot::limits::COIN_HAS_WEIGHT,
|
||||
/*Underfoot*/ UF::limits::COIN_HAS_WEIGHT,
|
||||
/*RoF*/ RoF::limits::COIN_HAS_WEIGHT,
|
||||
/*RoF2*/ true,
|
||||
/*RoF2*/ RoF::limits::COIN_HAS_WEIGHT,
|
||||
|
||||
/*NPC*/ true,
|
||||
/*Merc*/ true,
|
||||
@@ -1082,11 +892,11 @@ bool EQLimits::CoinHasWeight(uint32 version) {
|
||||
/*Pet*/ true
|
||||
};
|
||||
|
||||
return local[ValidateMobVersion(version)];
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint32 EQLimits::BandoliersCount(uint32 version) {
|
||||
static const uint32 local[_EmuClientCount] = {
|
||||
uint32 EQLimits::BandoliersCount(ClientVersion clientVersion) {
|
||||
static const uint32 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::BANDOLIERS_COUNT,
|
||||
/*Titanium*/ EmuConstants::BANDOLIERS_COUNT,
|
||||
@@ -1094,7 +904,7 @@ uint32 EQLimits::BandoliersCount(uint32 version) {
|
||||
/*SoD*/ EmuConstants::BANDOLIERS_COUNT,
|
||||
/*Underfoot*/ EmuConstants::BANDOLIERS_COUNT,
|
||||
/*RoF*/ EmuConstants::BANDOLIERS_COUNT,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::BANDOLIERS_COUNT,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
@@ -1102,11 +912,11 @@ uint32 EQLimits::BandoliersCount(uint32 version) {
|
||||
/*Pet*/ NOT_USED
|
||||
};
|
||||
|
||||
return local[ValidateMobVersion(version)];
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint32 EQLimits::BandolierSize(uint32 version) {
|
||||
static const uint32 local[_EmuClientCount] = {
|
||||
uint32 EQLimits::BandolierSize(ClientVersion clientVersion) {
|
||||
static const uint32 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::BANDOLIER_SIZE,
|
||||
/*Titanium*/ EmuConstants::BANDOLIER_SIZE,
|
||||
@@ -1114,7 +924,7 @@ uint32 EQLimits::BandolierSize(uint32 version) {
|
||||
/*SoD*/ EmuConstants::BANDOLIER_SIZE,
|
||||
/*Underfoot*/ EmuConstants::BANDOLIER_SIZE,
|
||||
/*RoF*/ EmuConstants::BANDOLIER_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::BANDOLIER_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
@@ -1122,11 +932,11 @@ uint32 EQLimits::BandolierSize(uint32 version) {
|
||||
/*Pet*/ NOT_USED
|
||||
};
|
||||
|
||||
return local[ValidateMobVersion(version)];
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
uint32 EQLimits::PotionBeltSize(uint32 version) {
|
||||
static const uint32 local[_EmuClientCount] = {
|
||||
uint32 EQLimits::PotionBeltSize(ClientVersion clientVersion) {
|
||||
static const uint32 local[CLIENT_VERSION_COUNT] = {
|
||||
/*Unknown*/ NOT_USED,
|
||||
/*62*/ EmuConstants::POTION_BELT_SIZE,
|
||||
/*Titanium*/ EmuConstants::POTION_BELT_SIZE,
|
||||
@@ -1134,7 +944,7 @@ uint32 EQLimits::PotionBeltSize(uint32 version) {
|
||||
/*SoD*/ EmuConstants::POTION_BELT_SIZE,
|
||||
/*Underfoot*/ EmuConstants::POTION_BELT_SIZE,
|
||||
/*RoF*/ EmuConstants::POTION_BELT_SIZE,
|
||||
/*RoF2*/ 0,
|
||||
/*RoF2*/ EmuConstants::POTION_BELT_SIZE,
|
||||
|
||||
/*NPC*/ NOT_USED,
|
||||
/*Merc*/ NOT_USED,
|
||||
@@ -1142,5 +952,5 @@ uint32 EQLimits::PotionBeltSize(uint32 version) {
|
||||
/*Pet*/ NOT_USED
|
||||
};
|
||||
|
||||
return local[ValidateMobVersion(version)];
|
||||
return local[static_cast<unsigned int>(ValidateMobClientVersion(clientVersion))];
|
||||
}
|
||||
|
||||
+32
-33
@@ -26,13 +26,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include "eq_constants.h"
|
||||
#include "clientversions.h"
|
||||
#include <string>
|
||||
#include "../common/patches/client62_constants.h"
|
||||
#include "../common/patches/titanium_constants.h"
|
||||
#include "../common/patches/sof_constants.h"
|
||||
#include "../common/patches/sod_constants.h"
|
||||
#include "../common/patches/underfoot_constants.h"
|
||||
#include "../common/patches/uf_constants.h"
|
||||
#include "../common/patches/rof_constants.h"
|
||||
//#include "../common/patches/rof2_constants.h"
|
||||
#include "../common/patches/rof2_constants.h"
|
||||
|
||||
// *** DO NOT CHANGE without a full understanding of the consequences..the server is set up to use these settings explicitly!! ***
|
||||
// *** You will cause compilation failures and corrupt your database if partial or incorrect attempts to change them are made!! ***
|
||||
@@ -47,15 +46,15 @@ class EmuConstants {
|
||||
// an immutable value is required to initialize arrays, etc... use this class as a repository for those
|
||||
public:
|
||||
// database
|
||||
static const EQClientVersion CHARACTER_CREATION_CLIENT = EQClientRoF; // adjust according to starting item placement and target client
|
||||
static const ClientVersion CHARACTER_CREATION_CLIENT = ClientVersion::RoF2; // adjust according to starting item placement and target client
|
||||
|
||||
// inventory
|
||||
static uint16 InventoryMapSize(int16 map);
|
||||
static uint16 InventoryMapSize(int16 indexMap);
|
||||
//static std::string InventoryLocationName(Location_Struct location);
|
||||
static std::string InventoryMapName(int16 map);
|
||||
static std::string InventoryMainName(int16 main);
|
||||
static std::string InventorySubName(int16 sub);
|
||||
static std::string InventoryAugName(int16 aug);
|
||||
static std::string InventoryMapName(int16 indexMap);
|
||||
static std::string InventoryMainName(int16 indexMain);
|
||||
static std::string InventorySubName(int16 indexSub);
|
||||
static std::string InventoryAugName(int16 indexAug);
|
||||
|
||||
// these are currently hard-coded for existing inventory system..do not use in place of special client version handlers until ready
|
||||
static const uint16 MAP_POSSESSIONS_SIZE = _MainCount;
|
||||
@@ -138,8 +137,8 @@ public:
|
||||
|
||||
// items
|
||||
// common and container sizes will not increase until the new 'location' struct is implemented
|
||||
static const uint16 ITEM_COMMON_SIZE = Underfoot::consts::ITEM_COMMON_SIZE;
|
||||
static const uint16 ITEM_CONTAINER_SIZE = Underfoot::consts::ITEM_CONTAINER_SIZE;
|
||||
static const uint16 ITEM_COMMON_SIZE = RoF::consts::ITEM_COMMON_SIZE;
|
||||
static const uint16 ITEM_CONTAINER_SIZE = Titanium::consts::ITEM_CONTAINER_SIZE;
|
||||
|
||||
// player profile
|
||||
//static const uint32 CLASS_BITMASK = 0; // needs value
|
||||
@@ -150,6 +149,8 @@ public:
|
||||
static const uint32 BANDOLIER_SIZE = Titanium::consts::BANDOLIER_SIZE; // size = number of equipment slots in bandolier instance
|
||||
static const uint32 POTION_BELT_SIZE = Titanium::consts::POTION_BELT_SIZE;
|
||||
|
||||
static const size_t TEXT_LINK_BODY_LENGTH = 56;
|
||||
|
||||
// legacy-related functions
|
||||
//static int ServerToPerlSlot(int slot); // encode
|
||||
//static int PerlToServerSlot(int slot); // decode
|
||||
@@ -162,43 +163,41 @@ class EQLimits {
|
||||
public:
|
||||
// client version validation (checks to avoid crashing zone server when accessing reference arrays)
|
||||
// use this inside of class Client (limits to actual clients)
|
||||
static bool IsValidClientVersion(uint32 version);
|
||||
static uint32 ValidateClientVersion(uint32 version);
|
||||
static EQClientVersion ValidateClientVersion(EQClientVersion version);
|
||||
static bool IsValidPCClientVersion(ClientVersion clientVersion);
|
||||
static ClientVersion ValidatePCClientVersion(ClientVersion clientVersion);
|
||||
|
||||
// basically..any non-client classes - do not when setting a valid client
|
||||
static bool IsValidNPCVersion(uint32 version);
|
||||
static uint32 ValidateNPCVersion(uint32 version);
|
||||
static EQClientVersion ValidateNPCVersion(EQClientVersion version);
|
||||
static bool IsValidNPCClientVersion(ClientVersion clientVersion);
|
||||
static ClientVersion ValidateNPCClientVersion(ClientVersion clientVersion);
|
||||
|
||||
// these are 'universal' - do not when setting a valid client
|
||||
static bool IsValidMobVersion(uint32 version);
|
||||
static uint32 ValidateMobVersion(uint32 version);
|
||||
static EQClientVersion ValidateMobVersion(EQClientVersion version);
|
||||
static bool IsValidMobClientVersion(ClientVersion clientVersion);
|
||||
static ClientVersion ValidateMobClientVersion(ClientVersion clientVersion);
|
||||
|
||||
// inventory
|
||||
static uint16 InventoryMapSize(int16 map, uint32 version);
|
||||
static uint64 PossessionsBitmask(uint32 version);
|
||||
static uint64 EquipmentBitmask(uint32 version);
|
||||
static uint64 GeneralBitmask(uint32 version);
|
||||
static uint64 CursorBitmask(uint32 version);
|
||||
static uint16 InventoryMapSize(int16 indexMap, ClientVersion clientVersion);
|
||||
static uint64 PossessionsBitmask(ClientVersion clientVersion);
|
||||
static uint64 EquipmentBitmask(ClientVersion clientVersion);
|
||||
static uint64 GeneralBitmask(ClientVersion clientVersion);
|
||||
static uint64 CursorBitmask(ClientVersion clientVersion);
|
||||
|
||||
static bool AllowsEmptyBagInBag(uint32 version);
|
||||
static bool AllowsEmptyBagInBag(ClientVersion clientVersion);
|
||||
static bool AllowsClickCastFromBag(ClientVersion clientVersion);
|
||||
|
||||
// items
|
||||
static uint16 ItemCommonSize(uint32 version);
|
||||
static uint16 ItemContainerSize(uint32 version);
|
||||
static uint16 ItemCommonSize(ClientVersion clientVersion);
|
||||
static uint16 ItemContainerSize(ClientVersion clientVersion);
|
||||
|
||||
// player profile
|
||||
static bool CoinHasWeight(uint32 version);
|
||||
static bool CoinHasWeight(ClientVersion clientVersion);
|
||||
|
||||
static uint32 BandoliersCount(uint32 version);
|
||||
static uint32 BandolierSize(uint32 version);
|
||||
static uint32 BandoliersCount(ClientVersion clientVersion);
|
||||
static uint32 BandolierSize(ClientVersion clientVersion);
|
||||
|
||||
static uint32 PotionBeltSize(uint32 version);
|
||||
static uint32 PotionBeltSize(ClientVersion clientVersion);
|
||||
};
|
||||
|
||||
#endif /* EQ_LIMITS_H */
|
||||
#endif /* EQ_DICTIONARY_H */
|
||||
|
||||
/*
|
||||
Working Notes:
|
||||
|
||||
+51
-81
@@ -15,18 +15,22 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "debug.h"
|
||||
#include <stdio.h>
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "crc16.h"
|
||||
#include "global_define.h"
|
||||
#include "eq_packet.h"
|
||||
#include "misc.h"
|
||||
#include "op_codes.h"
|
||||
#include "crc16.h"
|
||||
#include "platform.h"
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef STATIC_OPCODE
|
||||
#include "opcodemgr.h"
|
||||
#endif
|
||||
|
||||
#include "packet_dump.h"
|
||||
#include "packet_functions.h"
|
||||
#include <cstdlib>
|
||||
@@ -36,9 +40,11 @@ EQPacket::EQPacket(EmuOpcode op, const unsigned char *buf, uint32 len)
|
||||
: BasePacket(buf, len),
|
||||
emu_opcode(op)
|
||||
{
|
||||
_eqp
|
||||
}
|
||||
|
||||
void EQPacket::build_raw_header_dump(char *buffer, uint16 seq) const {
|
||||
_eqp
|
||||
BasePacket::build_raw_header_dump(buffer, seq);
|
||||
buffer += strlen(buffer);
|
||||
|
||||
@@ -47,17 +53,20 @@ void EQPacket::build_raw_header_dump(char *buffer, uint16 seq) const {
|
||||
|
||||
void EQPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp
|
||||
char buff[196];
|
||||
build_raw_header_dump(buff, seq);
|
||||
fprintf(to, "%s", buff);
|
||||
}
|
||||
|
||||
void EQPacket::build_header_dump(char *buffer) const {
|
||||
_eqp
|
||||
sprintf(buffer, "[EmuOpCode 0x%04x Size=%u]", emu_opcode, size);
|
||||
}
|
||||
|
||||
void EQPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp
|
||||
if (src_ip) {
|
||||
std::string sIP,dIP;;
|
||||
sIP=long2ip(src_ip);
|
||||
@@ -72,6 +81,7 @@ void EQPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
|
||||
void EQProtocolPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
{
|
||||
_eqp
|
||||
BasePacket::build_raw_header_dump(buffer, seq);
|
||||
buffer += strlen(buffer);
|
||||
|
||||
@@ -80,6 +90,7 @@ void EQProtocolPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
|
||||
void EQProtocolPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp
|
||||
char buff[196];
|
||||
build_raw_header_dump(buff, seq);
|
||||
fprintf(to, "%s", buff);
|
||||
@@ -87,11 +98,13 @@ void EQProtocolPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
|
||||
void EQProtocolPacket::build_header_dump(char *buffer) const
|
||||
{
|
||||
_eqp
|
||||
sprintf(buffer, "[ProtoOpCode 0x%04x Size=%u]",opcode,size);
|
||||
}
|
||||
|
||||
void EQProtocolPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp
|
||||
if (src_ip) {
|
||||
std::string sIP,dIP;;
|
||||
sIP=long2ip(src_ip);
|
||||
@@ -106,6 +119,7 @@ void EQProtocolPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
|
||||
void EQApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
{
|
||||
_eqp
|
||||
BasePacket::build_raw_header_dump(buffer, seq);
|
||||
buffer += strlen(buffer);
|
||||
|
||||
@@ -118,6 +132,7 @@ void EQApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
|
||||
void EQApplicationPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp
|
||||
char buff[196];
|
||||
build_raw_header_dump(buff, seq);
|
||||
fprintf(to, "%s", buff);
|
||||
@@ -125,6 +140,7 @@ void EQApplicationPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
|
||||
void EQApplicationPacket::build_header_dump(char *buffer) const
|
||||
{
|
||||
_eqp
|
||||
#ifdef STATIC_OPCODE
|
||||
sprintf(buffer, "[OpCode 0x%04x Size=%u]\n", emu_opcode,size);
|
||||
#else
|
||||
@@ -134,6 +150,7 @@ void EQApplicationPacket::build_header_dump(char *buffer) const
|
||||
|
||||
void EQApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp
|
||||
if (src_ip) {
|
||||
std::string sIP,dIP;;
|
||||
sIP=long2ip(src_ip);
|
||||
@@ -152,6 +169,7 @@ void EQApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
|
||||
void EQRawApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) const
|
||||
{
|
||||
_eqp
|
||||
BasePacket::build_raw_header_dump(buffer, seq);
|
||||
buffer += strlen(buffer);
|
||||
|
||||
@@ -164,6 +182,7 @@ void EQRawApplicationPacket::build_raw_header_dump(char *buffer, uint16 seq) con
|
||||
|
||||
void EQRawApplicationPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp
|
||||
char buff[196];
|
||||
build_raw_header_dump(buff, seq);
|
||||
fprintf(to, "%s", buff);
|
||||
@@ -171,6 +190,7 @@ void EQRawApplicationPacket::DumpRawHeader(uint16 seq, FILE *to) const
|
||||
|
||||
void EQRawApplicationPacket::build_header_dump(char *buffer) const
|
||||
{
|
||||
_eqp
|
||||
#ifdef STATIC_OPCODE
|
||||
sprintf(buffer, "[OpCode 0x%04x (0x%04x) Size=%u]\n", emu_opcode, opcode,size);
|
||||
#else
|
||||
@@ -180,6 +200,7 @@ void EQRawApplicationPacket::build_header_dump(char *buffer) const
|
||||
|
||||
void EQRawApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
{
|
||||
_eqp
|
||||
if (src_ip) {
|
||||
std::string sIP,dIP;;
|
||||
sIP=long2ip(src_ip);
|
||||
@@ -198,6 +219,7 @@ void EQRawApplicationPacket::DumpRawHeaderNoTime(uint16 seq, FILE *to) const
|
||||
|
||||
uint32 EQProtocolPacket::serialize(unsigned char *dest) const
|
||||
{
|
||||
_eqp
|
||||
if (opcode>0xff) {
|
||||
*(uint16 *)dest=opcode;
|
||||
} else {
|
||||
@@ -211,6 +233,7 @@ uint32 EQProtocolPacket::serialize(unsigned char *dest) const
|
||||
|
||||
uint32 EQApplicationPacket::serialize(uint16 opcode, unsigned char *dest) const
|
||||
{
|
||||
_eqp
|
||||
uint8 OpCodeBytes = app_opcode_size;
|
||||
|
||||
if (app_opcode_size==1)
|
||||
@@ -232,29 +255,10 @@ uint32 EQApplicationPacket::serialize(uint16 opcode, unsigned char *dest) const
|
||||
return size+OpCodeBytes;
|
||||
}
|
||||
|
||||
/*EQProtocolPacket::EQProtocolPacket(uint16 op, const unsigned char *buf, uint32 len)
|
||||
: BasePacket(buf, len),
|
||||
opcode(op)
|
||||
{
|
||||
|
||||
uint32 offset;
|
||||
opcode=ntohs(*(const uint16 *)buf);
|
||||
offset=2;
|
||||
|
||||
if (len-offset) {
|
||||
pBuffer= new unsigned char[len-offset];
|
||||
memcpy(pBuffer,buf+offset,len-offset);
|
||||
size=len-offset;
|
||||
} else {
|
||||
pBuffer=nullptr;
|
||||
size=0;
|
||||
}
|
||||
OpMgr=&RawOpcodeManager;
|
||||
}*/
|
||||
|
||||
bool EQProtocolPacket::combine(const EQProtocolPacket *rhs)
|
||||
{
|
||||
bool result=false;
|
||||
_eqp
|
||||
bool result=false;
|
||||
if (opcode==OP_Combined && size+rhs->size+5<256) {
|
||||
unsigned char *tmpbuffer=new unsigned char [size+rhs->size+3];
|
||||
memcpy(tmpbuffer,pBuffer,size);
|
||||
@@ -280,61 +284,12 @@ bool result=false;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
this is the code to do app-layer combining, instead of protocol layer.
|
||||
this was taken out due to complex interactions with the opcode manager,
|
||||
and will require a bit more thinking (likely moving into EQStream) to
|
||||
get running again... but might be a good thing some day.
|
||||
|
||||
bool EQApplicationPacket::combine(const EQApplicationPacket *rhs)
|
||||
{
|
||||
uint32 newsize=0, offset=0;
|
||||
unsigned char *tmpbuffer=nullptr;
|
||||
|
||||
if (opcode!=OP_AppCombined) {
|
||||
newsize=app_opcode_size+size+(size>254?3:1)+app_opcode_size+rhs->size+(rhs->size>254?3:1);
|
||||
tmpbuffer=new unsigned char [newsize];
|
||||
offset=0;
|
||||
if (size>254) {
|
||||
tmpbuffer[offset++]=0xff;
|
||||
*(uint16 *)(tmpbuffer+offset)=htons(size);
|
||||
offset+=1;
|
||||
} else {
|
||||
tmpbuffer[offset++]=size;
|
||||
}
|
||||
offset+=serialize(tmpbuffer+offset);
|
||||
} else {
|
||||
newsize=size+app_opcode_size+rhs->size+(rhs->size>254?3:1);
|
||||
tmpbuffer=new unsigned char [newsize];
|
||||
memcpy(tmpbuffer,pBuffer,size);
|
||||
offset=size;
|
||||
}
|
||||
|
||||
if (rhs->size>254) {
|
||||
tmpbuffer[offset++]=0xff;
|
||||
*(uint16 *)(tmpbuffer+offset)=htons(rhs->size);
|
||||
offset+=1;
|
||||
} else {
|
||||
tmpbuffer[offset++]=rhs->size;
|
||||
}
|
||||
offset+=rhs->serialize(tmpbuffer+offset);
|
||||
|
||||
size=offset;
|
||||
opcode=OP_AppCombined;
|
||||
|
||||
delete[] pBuffer;
|
||||
pBuffer=tmpbuffer;
|
||||
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
bool EQProtocolPacket::ValidateCRC(const unsigned char *buffer, int length, uint32 Key)
|
||||
{
|
||||
bool valid=false;
|
||||
_eqp
|
||||
bool valid=false;
|
||||
// OP_SessionRequest, OP_SessionResponse, OP_OutOfSession are not CRC'd
|
||||
if (buffer[0]==0x00 && (buffer[1]==OP_SessionRequest || buffer[1]==OP_SessionResponse || buffer[1]==OP_OutOfSession)) {
|
||||
valid=true;
|
||||
@@ -353,8 +308,9 @@ bool valid=false;
|
||||
|
||||
uint32 EQProtocolPacket::Decompress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize)
|
||||
{
|
||||
uint32 newlen=0;
|
||||
uint32 flag_offset=0;
|
||||
_eqp
|
||||
uint32 newlen=0;
|
||||
uint32 flag_offset=0;
|
||||
newbuf[0]=buffer[0];
|
||||
if (buffer[0]==0x00) {
|
||||
flag_offset=2;
|
||||
@@ -378,7 +334,8 @@ uint32 flag_offset=0;
|
||||
}
|
||||
|
||||
uint32 EQProtocolPacket::Compress(const unsigned char *buffer, const uint32 length, unsigned char *newbuf, uint32 newbufsize) {
|
||||
uint32 flag_offset=1,newlength;
|
||||
_eqp
|
||||
uint32 flag_offset=1,newlength;
|
||||
//dump_message_column(buffer,length,"Before: ");
|
||||
newbuf[0]=buffer[0];
|
||||
if (buffer[0]==0) {
|
||||
@@ -401,6 +358,7 @@ uint32 flag_offset=1,newlength;
|
||||
|
||||
void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey)
|
||||
{
|
||||
_eqp
|
||||
if ((size >= 2) && buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
|
||||
int Key=DecodeKey;
|
||||
unsigned char *test=(unsigned char *)malloc(size);
|
||||
@@ -426,6 +384,7 @@ void EQProtocolPacket::ChatDecode(unsigned char *buffer, int size, int DecodeKey
|
||||
|
||||
void EQProtocolPacket::ChatEncode(unsigned char *buffer, int size, int EncodeKey)
|
||||
{
|
||||
_eqp
|
||||
if (buffer[1]!=0x01 && buffer[0]!=0x02 && buffer[0]!=0x1d) {
|
||||
int Key=EncodeKey;
|
||||
char *test=(char*)malloc(size);
|
||||
@@ -449,10 +408,12 @@ void EQProtocolPacket::ChatEncode(unsigned char *buffer, int size, int EncodeKey
|
||||
}
|
||||
|
||||
EQApplicationPacket *EQApplicationPacket::Copy() const {
|
||||
_eqp
|
||||
return(new EQApplicationPacket(*this));
|
||||
}
|
||||
|
||||
EQRawApplicationPacket *EQProtocolPacket::MakeAppPacket() const {
|
||||
_eqp
|
||||
EQRawApplicationPacket *res = new EQRawApplicationPacket(opcode, pBuffer, size);
|
||||
res->copyInfo(this);
|
||||
return(res);
|
||||
@@ -462,10 +423,13 @@ EQRawApplicationPacket::EQRawApplicationPacket(uint16 opcode, const unsigned cha
|
||||
: EQApplicationPacket(OP_Unknown, buf, len),
|
||||
opcode(opcode)
|
||||
{
|
||||
_eqp
|
||||
}
|
||||
|
||||
EQRawApplicationPacket::EQRawApplicationPacket(const unsigned char *buf, const uint32 len)
|
||||
: EQApplicationPacket(OP_Unknown, buf+sizeof(uint16), len-sizeof(uint16))
|
||||
{
|
||||
_eqp
|
||||
if(GetExecutablePlatform() != ExePlatformUCS) {
|
||||
opcode = *((const uint16 *) buf);
|
||||
if(opcode == 0x0000)
|
||||
@@ -499,11 +463,17 @@ EQRawApplicationPacket::EQRawApplicationPacket(const unsigned char *buf, const u
|
||||
}
|
||||
|
||||
void DumpPacket(const EQApplicationPacket* app, bool iShowInfo) {
|
||||
_eqp
|
||||
if (iShowInfo) {
|
||||
std::cout << "Dumping Applayer: 0x" << std::hex << std::setfill('0') << std::setw(4) << app->GetOpcode() << std::dec;
|
||||
std::cout << " size:" << app->size << std::endl;
|
||||
}
|
||||
DumpPacketHex(app->pBuffer, app->size);
|
||||
// DumpPacketAscii(app->pBuffer, app->size);
|
||||
}
|
||||
|
||||
std::string DumpPacketToString(const EQApplicationPacket* app){
|
||||
_eqp
|
||||
std::ostringstream out;
|
||||
out << DumpPacketHexToString(app->pBuffer, app->size);
|
||||
return out.str();
|
||||
}
|
||||
|
||||
+11
-12
@@ -19,9 +19,8 @@
|
||||
#define _EQPACKET_H
|
||||
|
||||
#include "base_packet.h"
|
||||
#include "eq_stream_type.h"
|
||||
#include "op_codes.h"
|
||||
#include "platform.h"
|
||||
#include <iostream>
|
||||
|
||||
#ifdef STATIC_OPCODE
|
||||
typedef unsigned short EmuOpcode;
|
||||
@@ -30,9 +29,6 @@
|
||||
#include "emu_opcodes.h"
|
||||
#endif
|
||||
|
||||
class EQStream;
|
||||
class EQStreamPair;
|
||||
|
||||
class EQPacket : public BasePacket {
|
||||
friend class EQStream;
|
||||
public:
|
||||
@@ -97,16 +93,15 @@ protected:
|
||||
};
|
||||
|
||||
class EQApplicationPacket : public EQPacket {
|
||||
// friend class EQProtocolPacket;
|
||||
friend class EQStream;
|
||||
public:
|
||||
EQApplicationPacket() : EQPacket(OP_Unknown,nullptr,0)
|
||||
EQApplicationPacket() : EQPacket(OP_Unknown, nullptr, 0), opcode_bypass(0)
|
||||
{ app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; }
|
||||
EQApplicationPacket(const EmuOpcode op) : EQPacket(op,nullptr,0)
|
||||
EQApplicationPacket(const EmuOpcode op) : EQPacket(op, nullptr, 0), opcode_bypass(0)
|
||||
{ app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; }
|
||||
EQApplicationPacket(const EmuOpcode op, const uint32 len) : EQPacket(op,nullptr,len)
|
||||
EQApplicationPacket(const EmuOpcode op, const uint32 len) : EQPacket(op, nullptr, len), opcode_bypass(0)
|
||||
{ app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; }
|
||||
EQApplicationPacket(const EmuOpcode op, const unsigned char *buf, const uint32 len) : EQPacket(op,buf,len)
|
||||
EQApplicationPacket(const EmuOpcode op, const unsigned char *buf, const uint32 len) : EQPacket(op, buf, len), opcode_bypass(0)
|
||||
{ app_opcode_size = GetExecutablePlatform() == ExePlatformUCS ? 1 : 2; }
|
||||
bool combine(const EQApplicationPacket *rhs);
|
||||
uint32 serialize (uint16 opcode, unsigned char *dest) const;
|
||||
@@ -119,12 +114,16 @@ public:
|
||||
virtual void DumpRawHeader(uint16 seq=0xffff, FILE *to = stdout) const;
|
||||
virtual void DumpRawHeaderNoTime(uint16 seq=0xffff, FILE *to = stdout) const;
|
||||
|
||||
uint16 GetOpcodeBypass() { return opcode_bypass; }
|
||||
void SetOpcodeBypass(uint16 v) { opcode_bypass = v; }
|
||||
|
||||
protected:
|
||||
|
||||
uint8 app_opcode_size;
|
||||
uint16 opcode_bypass;
|
||||
private:
|
||||
|
||||
EQApplicationPacket(const EQApplicationPacket &p) : EQPacket(p.emu_opcode, p.pBuffer, p.size) { app_opcode_size = p.app_opcode_size; }
|
||||
EQApplicationPacket(const EQApplicationPacket &p) : EQPacket(p.emu_opcode, p.pBuffer, p.size), opcode_bypass(p.opcode_bypass) { app_opcode_size = p.app_opcode_size; }
|
||||
|
||||
};
|
||||
|
||||
@@ -148,6 +147,6 @@ protected:
|
||||
};
|
||||
|
||||
extern void DumpPacket(const EQApplicationPacket* app, bool iShowInfo = false);
|
||||
|
||||
extern std::string DumpPacketToString(const EQApplicationPacket* app);
|
||||
|
||||
#endif
|
||||
|
||||
+234
-87
@@ -145,6 +145,28 @@ struct Color_Struct
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
* Visible equiptment.
|
||||
* Size: 20 Octets
|
||||
*/
|
||||
struct EquipStruct {
|
||||
/*00*/ uint32 material;
|
||||
/*04*/ uint32 unknown1;
|
||||
/*08*/ uint32 elitematerial;
|
||||
/*12*/ uint32 heroforgemodel;
|
||||
/*16*/ uint32 material2; // Same as material?
|
||||
/*20*/
|
||||
};
|
||||
|
||||
struct CharSelectEquip {
|
||||
uint32 material;
|
||||
uint32 unknown1;
|
||||
uint32 elitematerial;
|
||||
uint32 heroforgemodel;
|
||||
uint32 material2;
|
||||
Color_Struct color;
|
||||
};
|
||||
|
||||
/*
|
||||
** Character Selection Struct
|
||||
** Length: 1704 Bytes
|
||||
@@ -152,10 +174,11 @@ struct Color_Struct
|
||||
*/
|
||||
struct CharacterSelect_Struct {
|
||||
/*0000*/ uint32 race[10]; // Characters Race
|
||||
/*0040*/ Color_Struct cs_colors[10][9]; // Characters Equipment Colors
|
||||
/*0040*/ //Color_Struct cs_colors[10][9]; // Characters Equipment Colors
|
||||
/*0400*/ uint8 beardcolor[10]; // Characters beard Color
|
||||
/*0410*/ uint8 hairstyle[10]; // Characters hair style
|
||||
/*0420*/ uint32 equip[10][9]; // 0=helm, 1=chest, 2=arm, 3=bracer, 4=hand, 5=leg, 6=boot, 7=melee1, 8=melee2 (Might not be)
|
||||
/*0420*/ //uint32 equip[10][9]; // 0=helm, 1=chest, 2=arm, 3=bracer, 4=hand, 5=leg, 6=boot, 7=melee1, 8=melee2 (Might not be)
|
||||
/*0000*/ CharSelectEquip equip[10][9];
|
||||
/*0780*/ uint32 secondary[10]; // Characters secondary IDFile number
|
||||
/*0820*/ uint32 drakkin_heritage[10]; // added for SoF
|
||||
/*0860*/ uint32 drakkin_tattoo[10]; // added for SoF
|
||||
@@ -258,26 +281,26 @@ struct Spawn_Struct {
|
||||
/*0193*/ uint8 guildrank; // 0=normal, 1=officer, 2=leader
|
||||
/*0194*/ uint8 unknown0194[3];
|
||||
/*0197*/ union
|
||||
{
|
||||
struct
|
||||
{
|
||||
/*0197*/ uint32 equip_helmet; // Equipment: Helmet Visual
|
||||
/*0201*/ uint32 equip_chest; // Equipment: Chest Visual
|
||||
/*0205*/ uint32 equip_arms; // Equipment: Arms Visual
|
||||
/*0209*/ uint32 equip_bracers; // Equipment: Bracers Visual
|
||||
/*0213*/ uint32 equip_hands; // Equipment: Hands Visual
|
||||
/*0217*/ uint32 equip_legs; // Equipment: Legs Visual
|
||||
/*0221*/ uint32 equip_feet; // Equipment: Feet Visual
|
||||
/*0225*/ uint32 equip_primary; // Equipment: Primary Visual
|
||||
/*0229*/ uint32 equip_secondary; // Equipment: Secondary Visual
|
||||
} equip;
|
||||
/*0197*/ uint32 equipment[_MaterialCount]; // Array elements correspond to struct equipment above
|
||||
};
|
||||
{
|
||||
struct
|
||||
{
|
||||
/*0000*/ EquipStruct equip_helmet; // Equipment: Helmet visual
|
||||
/*0000*/ EquipStruct equip_chest; // Equipment: Chest visual
|
||||
/*0000*/ EquipStruct equip_arms; // Equipment: Arms visual
|
||||
/*0000*/ EquipStruct equip_bracers; // Equipment: Wrist visual
|
||||
/*0000*/ EquipStruct equip_hands; // Equipment: Hands visual
|
||||
/*0000*/ EquipStruct equip_legs; // Equipment: Legs visual
|
||||
/*0000*/ EquipStruct equip_feet; // Equipment: Boots visual
|
||||
/*0000*/ EquipStruct equip_primary; // Equipment: Main visual
|
||||
/*0000*/ EquipStruct equip_secondary; // Equipment: Off visual
|
||||
} equip;
|
||||
/*0000*/ EquipStruct equipment[_MaterialCount];
|
||||
};
|
||||
/*0233*/ float runspeed; // Speed when running
|
||||
/*0036*/ uint8 afk; // 0=no, 1=afk
|
||||
/*0238*/ uint32 guildID; // Current guild
|
||||
/*0242*/ char title[32]; // Title
|
||||
/*0274*/ uint8 unknown0274;
|
||||
/*0274*/ uint8 unknown0274; // non-zero prefixes name with '!'
|
||||
/*0275*/ uint8 set_to_0xFF[8]; // ***Placeholder (all ff)
|
||||
/*0283*/ uint8 helm; // Helm texture
|
||||
/*0284*/ uint32 race; // Spawn race
|
||||
@@ -340,6 +363,7 @@ union
|
||||
uint32 DestructibleUnk7;
|
||||
uint8 DestructibleUnk8;
|
||||
uint32 DestructibleUnk9;
|
||||
bool targetable_with_hotkey;
|
||||
|
||||
};
|
||||
|
||||
@@ -478,7 +502,11 @@ struct CastSpell_Struct
|
||||
uint32 spell_id;
|
||||
uint32 inventoryslot; // slot for clicky item, 0xFFFF = normal cast
|
||||
uint32 target_id;
|
||||
uint8 cs_unknown[4];
|
||||
uint32 cs_unknown1;
|
||||
uint32 cs_unknown2;
|
||||
float y_pos;
|
||||
float x_pos;
|
||||
float z_pos;
|
||||
};
|
||||
|
||||
struct SpellEffect_Struct
|
||||
@@ -512,7 +540,7 @@ struct SpawnAppearance_Struct
|
||||
};
|
||||
|
||||
|
||||
// solar: this is used inside profile
|
||||
// this is used inside profile
|
||||
struct SpellBuff_Struct
|
||||
{
|
||||
/*000*/ uint8 slotid; //badly named... seems to be 2 for a real buff, 0 otherwise
|
||||
@@ -534,7 +562,7 @@ struct SpellBuffFade_Struct {
|
||||
/*007*/ uint8 unknown7;
|
||||
/*008*/ uint32 spellid;
|
||||
/*012*/ uint32 duration;
|
||||
/*016*/ uint32 unknown016;
|
||||
/*016*/ uint32 num_hits;
|
||||
/*020*/ uint32 unknown020; //prolly global player ID
|
||||
/*024*/ uint32 slotid;
|
||||
/*028*/ uint32 bufffade;
|
||||
@@ -597,8 +625,8 @@ struct GMTrainee_Struct
|
||||
{
|
||||
/*000*/ uint32 npcid;
|
||||
/*004*/ uint32 playerid;
|
||||
/*008*/ uint32 skills[73];
|
||||
/*300*/ uint8 unknown300[148];
|
||||
/*008*/ uint32 skills[PACKET_SKILL_ARRAY_SIZE];
|
||||
/*408*/ uint8 unknown408[40];
|
||||
/*448*/
|
||||
};
|
||||
|
||||
@@ -689,7 +717,7 @@ struct CharCreate_Struct
|
||||
/*0076*/ uint32 drakkin_heritage; // added for SoF
|
||||
/*0080*/ uint32 drakkin_tattoo; // added for SoF
|
||||
/*0084*/ uint32 drakkin_details; // added for SoF
|
||||
/*0088*/
|
||||
/*0088*/ uint32 tutorial;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -759,14 +787,62 @@ struct MovePotionToBelt_Struct {
|
||||
static const uint32 MAX_GROUP_LEADERSHIP_AA_ARRAY = 16;
|
||||
static const uint32 MAX_RAID_LEADERSHIP_AA_ARRAY = 16;
|
||||
static const uint32 MAX_LEADERSHIP_AA_ARRAY = (MAX_GROUP_LEADERSHIP_AA_ARRAY+MAX_RAID_LEADERSHIP_AA_ARRAY);
|
||||
struct LeadershipAA_Struct {
|
||||
uint32 ranks[MAX_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
struct GroupLeadershipAA_Struct {
|
||||
uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY];
|
||||
union {
|
||||
struct {
|
||||
uint32 groupAAMarkNPC;
|
||||
uint32 groupAANPCHealth;
|
||||
uint32 groupAADelegateMainAssist;
|
||||
uint32 groupAADelegateMarkNPC;
|
||||
uint32 groupAA4;
|
||||
uint32 groupAA5;
|
||||
uint32 groupAAInspectBuffs;
|
||||
uint32 groupAA7;
|
||||
uint32 groupAASpellAwareness;
|
||||
uint32 groupAAOffenseEnhancement;
|
||||
uint32 groupAAManaEnhancement;
|
||||
uint32 groupAAHealthEnhancement;
|
||||
uint32 groupAAHealthRegeneration;
|
||||
uint32 groupAAFindPathToPC;
|
||||
uint32 groupAAHealthOfTargetsTarget;
|
||||
uint32 groupAA15;
|
||||
};
|
||||
uint32 ranks[MAX_GROUP_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
};
|
||||
|
||||
struct RaidLeadershipAA_Struct {
|
||||
uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY];
|
||||
union {
|
||||
struct {
|
||||
uint32 raidAAMarkNPC;
|
||||
uint32 raidAANPCHealth;
|
||||
uint32 raidAADelegateMainAssist;
|
||||
uint32 raidAADelegateMarkNPC;
|
||||
uint32 raidAA4;
|
||||
uint32 raidAA5;
|
||||
uint32 raidAA6;
|
||||
uint32 raidAASpellAwareness;
|
||||
uint32 raidAAOffenseEnhancement;
|
||||
uint32 raidAAManaEnhancement;
|
||||
uint32 raidAAHealthEnhancement;
|
||||
uint32 raidAAHealthRegeneration;
|
||||
uint32 raidAAFindPathToPC;
|
||||
uint32 raidAAHealthOfTargetsTarget;
|
||||
uint32 raidAA14;
|
||||
uint32 raidAA15;
|
||||
};
|
||||
uint32 ranks[MAX_RAID_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
};
|
||||
|
||||
struct LeadershipAA_Struct {
|
||||
union {
|
||||
struct {
|
||||
GroupLeadershipAA_Struct group;
|
||||
RaidLeadershipAA_Struct raid;
|
||||
};
|
||||
uint32 ranks[MAX_LEADERSHIP_AA_ARRAY];
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -779,17 +855,18 @@ struct BindStruct {
|
||||
/*008*/ float y;
|
||||
/*012*/ float z;
|
||||
/*016*/ float heading;
|
||||
/*020*/
|
||||
/*020*/ uint32 instance_id;
|
||||
/*024*/
|
||||
};
|
||||
|
||||
struct SuspendedMinion_Struct
|
||||
{
|
||||
/*000*/ uint16 SpellID;
|
||||
/*002*/ uint32 HP;
|
||||
/*006*/ uint32 Mana;
|
||||
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
|
||||
/*510*/ uint32 Items[_MaterialCount];
|
||||
/*546*/ char Name[64];
|
||||
/*000*/ uint16 SpellID;
|
||||
/*002*/ uint32 HP;
|
||||
/*006*/ uint32 Mana;
|
||||
/*010*/ SpellBuff_Struct Buffs[BUFF_COUNT];
|
||||
/*510*/ uint32 Items[_MaterialCount];
|
||||
/*546*/ char Name[64];
|
||||
/*610*/
|
||||
};
|
||||
|
||||
@@ -800,10 +877,13 @@ struct SuspendedMinion_Struct
|
||||
** Length: 4308 bytes
|
||||
** OpCode: 0x006a
|
||||
*/
|
||||
static const uint32 MAX_PP_LANGUAGE = 28;
|
||||
static const uint32 MAX_PP_SPELLBOOK = 480; // Increased to 480 to support SoF
|
||||
static const uint32 MAX_PP_MEMSPELL = 9;
|
||||
static const uint32 MAX_PP_SKILL = _SkillPacketArraySize; // 100 - actual skills buffer size
|
||||
static const uint32 MAX_PP_LANGUAGE = 28;
|
||||
static const uint32 MAX_PP_SPELLBOOK = 480; // Set for all functions
|
||||
static const uint32 MAX_PP_MEMSPELL = 9; // Set to latest client so functions can work right
|
||||
static const uint32 MAX_PP_REF_SPELLBOOK = 480; // Set for Player Profile size retain
|
||||
static const uint32 MAX_PP_REF_MEMSPELL = 9; // Set for Player Profile size retain
|
||||
|
||||
static const uint32 MAX_PP_SKILL = PACKET_SKILL_ARRAY_SIZE; // 100 - actual skills buffer size
|
||||
static const uint32 MAX_PP_AA_ARRAY = 240;
|
||||
static const uint32 MAX_GROUP_MEMBERS = 6;
|
||||
static const uint32 MAX_RECAST_TYPES = 20;
|
||||
@@ -880,7 +960,7 @@ struct PlayerProfile_Struct
|
||||
/*0245*/ uint8 guildbanker;
|
||||
/*0246*/ uint8 unknown0246[6]; //
|
||||
/*0252*/ uint32 intoxication;
|
||||
/*0256*/ uint32 spellSlotRefresh[MAX_PP_MEMSPELL]; //in ms
|
||||
/*0256*/ uint32 spellSlotRefresh[MAX_PP_REF_MEMSPELL]; //in ms
|
||||
/*0292*/ uint32 abilitySlotRefresh;
|
||||
/*0296*/ uint8 haircolor; // Player hair color
|
||||
/*0297*/ uint8 beardcolor; // Player beard color
|
||||
@@ -919,9 +999,9 @@ struct PlayerProfile_Struct
|
||||
/*2505*/ uint8 unknown2541[47]; // ?
|
||||
/*2552*/ uint8 languages[MAX_PP_LANGUAGE];
|
||||
/*2580*/ uint8 unknown2616[4];
|
||||
/*2584*/ uint32 spell_book[MAX_PP_SPELLBOOK];
|
||||
/*2584*/ uint32 spell_book[MAX_PP_REF_SPELLBOOK];
|
||||
/*4504*/ uint8 unknown4540[128]; // Was [428] all 0xff
|
||||
/*4632*/ uint32 mem_spells[MAX_PP_MEMSPELL];
|
||||
/*4632*/ uint32 mem_spells[MAX_PP_REF_MEMSPELL];
|
||||
/*4668*/ uint8 unknown4704[32]; //
|
||||
/*4700*/ float y; // Player y position
|
||||
/*4704*/ float x; // Player x position
|
||||
@@ -1188,7 +1268,7 @@ struct Animation_Struct {
|
||||
/*04*/
|
||||
};
|
||||
|
||||
// solar: this is what causes the caster to animate and the target to
|
||||
// this is what causes the caster to animate and the target to
|
||||
// get the particle effects around them when a spell is cast
|
||||
// also causes a buff icon
|
||||
struct Action_Struct
|
||||
@@ -1212,7 +1292,7 @@ struct Action_Struct
|
||||
/* 31 */
|
||||
};
|
||||
|
||||
// solar: this is what prints the You have been struck. and the regular
|
||||
// this is what prints the You have been struck. and the regular
|
||||
// melee messages like You try to pierce, etc. It's basically the melee
|
||||
// and spell damage message
|
||||
struct CombatDamage_Struct
|
||||
@@ -1300,19 +1380,19 @@ struct PlayerPositionUpdateServer_Struct
|
||||
struct PlayerPositionUpdateClient_Struct
|
||||
{
|
||||
/*0000*/ uint16 spawn_id;
|
||||
/*0022*/ uint16 sequence; //increments one each packet
|
||||
/*0002*/ uint16 sequence; //increments one each packet
|
||||
/*0004*/ float y_pos; // y coord
|
||||
/*0008*/ float delta_z; // Change in z
|
||||
/*0016*/ float delta_x; // Change in x
|
||||
/*0012*/ float delta_y; // Change in y
|
||||
/*0012*/ float delta_x; // Change in x
|
||||
/*0016*/ float delta_y; // Change in y
|
||||
/*0020*/ int32 animation:10, // animation
|
||||
delta_heading:10, // change in heading
|
||||
padding0020:12; // ***Placeholder (mostly 1)
|
||||
/*0024*/ float x_pos; // x coord
|
||||
/*0028*/ float z_pos; // z coord
|
||||
/*0034*/ uint16 heading:12, // Directional heading
|
||||
/*0032*/ uint16 heading:12, // Directional heading
|
||||
padding0004:4; // ***Placeholder
|
||||
/*0032*/ uint8 unknown0006[2]; // ***Placeholder
|
||||
/*0034*/ uint8 unknown0006[2]; // ***Placeholder
|
||||
/*0036*/
|
||||
};
|
||||
|
||||
@@ -1429,7 +1509,8 @@ enum ItemPacketType
|
||||
ItemPacketTributeItem = 0x6C,
|
||||
ItemPacketMerchant = 0x64,
|
||||
ItemPacketWorldContainer = 0x6B,
|
||||
ItemPacketCharmUpdate = 0x6E
|
||||
ItemPacketCharmUpdate = 0x6E,
|
||||
ItemPacketInvalid = 0xFF
|
||||
};
|
||||
struct ItemPacket_Struct
|
||||
{
|
||||
@@ -1446,17 +1527,18 @@ struct BulkItemPacket_Struct
|
||||
|
||||
struct Consume_Struct
|
||||
{
|
||||
/*0000*/ uint32 slot;
|
||||
/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click
|
||||
/*0008*/ uint8 c_unknown1[4];
|
||||
/*0012*/ uint8 type; // 0x01=Food 0x02=Water
|
||||
/*0013*/ uint8 unknown13[3];
|
||||
/*0000*/ uint32 slot;
|
||||
/*0004*/ uint32 auto_consumed; // 0xffffffff when auto eating e7030000 when right click
|
||||
/*0008*/ uint8 c_unknown1[4];
|
||||
/*0012*/ uint8 type; // 0x01=Food 0x02=Water
|
||||
/*0013*/ uint8 unknown13[3];
|
||||
};
|
||||
|
||||
struct DeleteItem_Struct {
|
||||
/*0000*/ uint32 from_slot;
|
||||
/*0004*/ uint32 to_slot;
|
||||
/*0008*/ uint32 number_in_stack;
|
||||
/*0000*/ uint32 from_slot;
|
||||
/*0004*/ uint32 to_slot;
|
||||
/*0008*/ uint32 number_in_stack;
|
||||
/*0012*/
|
||||
};
|
||||
|
||||
struct MoveItem_Struct
|
||||
@@ -1464,16 +1546,18 @@ struct MoveItem_Struct
|
||||
/*0000*/ uint32 from_slot;
|
||||
/*0004*/ uint32 to_slot;
|
||||
/*0008*/ uint32 number_in_stack;
|
||||
/*0012*/
|
||||
};
|
||||
|
||||
// both MoveItem_Struct/DeleteItem_Struct server structures will be changing to a structure-based slot format..this will
|
||||
// be used for handling SoF/SoD/etc... time stamps sent using the MoveItem_Struct format. (nothing will be done with this
|
||||
// info at the moment..but, it forwards it on to the server for handling/future use)
|
||||
// info at the moment..but, it is forwarded on to the server for handling/future use)
|
||||
struct ClientTimeStamp_Struct
|
||||
{
|
||||
/*0000*/ uint32 from_slot;
|
||||
/*0004*/ uint32 to_slot;
|
||||
/*0008*/ uint32 number_in_stack;
|
||||
/*0000*/ uint32 from_slot;
|
||||
/*0004*/ uint32 to_slot;
|
||||
/*0008*/ uint32 number_in_stack;
|
||||
/*0012*/
|
||||
};
|
||||
|
||||
//
|
||||
@@ -1727,7 +1811,7 @@ struct RandomReq_Struct {
|
||||
uint32 high;
|
||||
};
|
||||
|
||||
/* solar: 9/23/03 reply to /random command; struct from Zaphod */
|
||||
/* 9/23/03 reply to /random command */
|
||||
struct RandomReply_Struct {
|
||||
/* 00 */ uint32 low;
|
||||
/* 04 */ uint32 high;
|
||||
@@ -2177,6 +2261,12 @@ struct GroupLeaderChange_Struct
|
||||
/*128*/ char Unknown128[20];
|
||||
};
|
||||
|
||||
struct GroupMentor_Struct {
|
||||
/*000*/ int percent;
|
||||
/*004*/ char name[64];
|
||||
/*068*/
|
||||
};
|
||||
|
||||
struct FaceChange_Struct {
|
||||
/*000*/ uint8 haircolor;
|
||||
/*001*/ uint8 beardcolor;
|
||||
@@ -2298,7 +2388,7 @@ struct AugmentItem_Struct {
|
||||
|
||||
// OP_Emote
|
||||
struct Emote_Struct {
|
||||
/*0000*/ uint32 unknown01;
|
||||
/*0000*/ uint32 type; // 0 - custom, 0xffffffff - command (/dance, /flip, etc...)
|
||||
/*0004*/ char message[1024];
|
||||
/*1028*/
|
||||
};
|
||||
@@ -2599,6 +2689,17 @@ struct Translocate_Struct {
|
||||
/*088*/ uint32 Complete;
|
||||
};
|
||||
|
||||
struct PendingTranslocate_Struct
|
||||
{
|
||||
uint32 zone_id;
|
||||
uint16 instance_id;
|
||||
float heading;
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
uint32 spell_id;
|
||||
};
|
||||
|
||||
struct Sacrifice_Struct {
|
||||
/*000*/ uint32 CasterID;
|
||||
/*004*/ uint32 TargetID;
|
||||
@@ -2819,7 +2920,7 @@ uint8 npccastfilters; // 0) No, 1) Ignore NPC Casts (all), 2) Ignore NPC Casts
|
||||
*/
|
||||
struct ItemViewRequest_Struct {
|
||||
/*000*/ uint32 item_id;
|
||||
/*004*/ uint32 augments[5];
|
||||
/*004*/ uint32 augments[6];
|
||||
/*024*/ uint32 link_hash;
|
||||
/*028*/ uint32 unknown028;
|
||||
/*032*/ char unknown032[12]; //probably includes loregroup & evolving info. see Client::MakeItemLink() in zone/inventory.cpp:469
|
||||
@@ -2915,14 +3016,14 @@ struct ClientError_Struct
|
||||
};
|
||||
|
||||
struct Track_Struct {
|
||||
uint16 entityid;
|
||||
uint16 padding002;
|
||||
uint32 entityid;
|
||||
float distance;
|
||||
// Fields for SoD and later
|
||||
uint8 level;
|
||||
uint8 NPC;
|
||||
uint8 GroupMember;
|
||||
uint8 is_npc;
|
||||
char name[64];
|
||||
uint8 is_pet;
|
||||
uint8 is_merc;
|
||||
};
|
||||
|
||||
struct Tracking_Struct {
|
||||
@@ -3397,7 +3498,7 @@ struct Split_Struct
|
||||
*/
|
||||
struct NewCombine_Struct {
|
||||
/*00*/ int16 container_slot;
|
||||
/*02*/ char unknown02[2];
|
||||
/*02*/ int16 guildtribute_slot;
|
||||
/*04*/
|
||||
};
|
||||
|
||||
@@ -3908,6 +4009,11 @@ struct MarkNPC_Struct
|
||||
/*08**/ char Name[64];
|
||||
};
|
||||
|
||||
struct InspectBuffs_Struct {
|
||||
/*000*/ uint32 spell_id[BUFF_COUNT];
|
||||
/*100*/ uint32 tics_remaining[BUFF_COUNT];
|
||||
};
|
||||
|
||||
struct RaidGeneral_Struct {
|
||||
/*00*/ uint32 action; //=10
|
||||
/*04*/ char player_name[64]; //should both be the player's name
|
||||
@@ -3923,6 +4029,19 @@ struct RaidAddMember_Struct {
|
||||
/*139*/ uint8 flags[5]; //no idea if these are needed...
|
||||
};
|
||||
|
||||
struct RaidMOTD_Struct {
|
||||
/*000*/ RaidGeneral_Struct general; // leader_name and action only used
|
||||
/*136*/ char motd[0]; // max size is 1024, but reply is variable
|
||||
};
|
||||
|
||||
struct RaidLeadershipUpdate_Struct {
|
||||
/*000*/ uint32 action;
|
||||
/*004*/ char player_name[64];
|
||||
/*068*/ char leader_name[64];
|
||||
/*132*/ GroupLeadershipAA_Struct group; //unneeded
|
||||
/*196*/ RaidLeadershipAA_Struct raid;
|
||||
/*260*/ char Unknown260[128]; //unverified
|
||||
};
|
||||
|
||||
struct RaidAdd_Struct {
|
||||
/*000*/ uint32 action; //=0
|
||||
@@ -4064,7 +4183,7 @@ struct GroupInvite_Struct {
|
||||
// uint8 unknown128[65];
|
||||
};
|
||||
|
||||
struct BuffFadeMsg_Struct {
|
||||
struct ColoredText_Struct {
|
||||
uint32 color;
|
||||
char msg[1];
|
||||
};
|
||||
@@ -4261,6 +4380,13 @@ struct ItemVerifyReply_Struct {
|
||||
/*012*/
|
||||
};
|
||||
|
||||
struct ItemRecastDelay_Struct {
|
||||
/*000*/ uint32 recast_delay; // in seconds
|
||||
/*004*/ uint32 recast_type;
|
||||
/*008*/ uint32 unknown008;
|
||||
/*012*/
|
||||
};
|
||||
|
||||
/**
|
||||
* Shroud yourself. For yourself shrouding, this has your spawnId, spawnStruct,
|
||||
* bits of your charProfileStruct (no checksum, then charProfile up till
|
||||
@@ -4294,14 +4420,14 @@ typedef struct {
|
||||
struct ControlBoat_Struct {
|
||||
/*000*/ uint32 boatId; // entitylist id of the boat
|
||||
/*004*/ bool TakeControl; // 01 if taking control, 00 if releasing it
|
||||
/*007*/ // no idea what these last three bytes represent
|
||||
/*007*/ char unknown[3]; // no idea what these last three bytes represent
|
||||
};
|
||||
|
||||
struct AugmentInfo_Struct
|
||||
{
|
||||
/*000*/ uint32 itemid; // id of the solvent needed
|
||||
/*004*/ uint8 window; // window to display the information in
|
||||
/*005*/ uint8 unknown005[67]; // total packet length 72, all the rest were always 00
|
||||
/*000*/ uint32 itemid; // id of the solvent needed
|
||||
/*004*/ uint32 window; // window to display the information in
|
||||
/*008*/ char augment_info[64]; // the reply has the text here
|
||||
/*072*/
|
||||
};
|
||||
|
||||
@@ -4589,11 +4715,13 @@ struct BuffIconEntry_Struct
|
||||
uint32 buff_slot;
|
||||
uint32 spell_id;
|
||||
uint32 tics_remaining;
|
||||
uint32 num_hits;
|
||||
};
|
||||
|
||||
struct BuffIcon_Struct
|
||||
{
|
||||
uint32 entity_id;
|
||||
uint8 all_buffs;
|
||||
uint16 count;
|
||||
BuffIconEntry_Struct entries[0];
|
||||
};
|
||||
@@ -5106,17 +5234,19 @@ struct MercenaryMerchantResponse_Struct {
|
||||
};
|
||||
|
||||
struct ServerLootItem_Struct {
|
||||
uint32 item_id;
|
||||
int16 equipSlot;
|
||||
uint8 charges;
|
||||
uint16 lootslot;
|
||||
uint32 aug1;
|
||||
uint32 aug2;
|
||||
uint32 aug3;
|
||||
uint32 aug4;
|
||||
uint32 aug5;
|
||||
uint8 minlevel;
|
||||
uint8 maxlevel;
|
||||
uint32 item_id; // uint32 item_id;
|
||||
int16 equip_slot; // int16 equip_slot;
|
||||
uint16 charges; // uint8 charges;
|
||||
uint16 lootslot; // uint16 lootslot;
|
||||
uint32 aug_1; // uint32 aug_1;
|
||||
uint32 aug_2; // uint32 aug_2;
|
||||
uint32 aug_3; // uint32 aug_3;
|
||||
uint32 aug_4; // uint32 aug_4;
|
||||
uint32 aug_5; // uint32 aug_5;
|
||||
uint32 aug_6; // uint32 aug_5;
|
||||
uint8 attuned;
|
||||
uint8 min_level;
|
||||
uint8 max_level;
|
||||
};
|
||||
|
||||
//Found in client near a ref to the string:
|
||||
@@ -5139,6 +5269,23 @@ struct ClientMarqueeMessage_Struct {
|
||||
|
||||
typedef std::list<ServerLootItem_Struct*> ItemList;
|
||||
|
||||
struct TextLinkBody_Struct {
|
||||
// Current server mask: EQClientRoF2
|
||||
uint8 unknown_1; /* %1X */
|
||||
uint32 item_id; /* %05X */
|
||||
uint32 augment_1; /* %05X */
|
||||
uint32 augment_2; /* %05X */
|
||||
uint32 augment_3; /* %05X */
|
||||
uint32 augment_4; /* %05X */
|
||||
uint32 augment_5; /* %05X */
|
||||
uint32 augment_6; /* %05X */
|
||||
uint8 is_evolving; /* %1X */
|
||||
uint32 evolve_group; /* %05X */
|
||||
uint8 evolve_level; /* %02X */
|
||||
uint32 ornament_icon; /* %05X */
|
||||
int hash; /* %08X */
|
||||
};
|
||||
|
||||
// Restore structure packing to default
|
||||
#pragma pack()
|
||||
|
||||
|
||||
+256
-245
File diff suppressed because it is too large
Load Diff
+29
-10
@@ -1,22 +1,26 @@
|
||||
#ifndef _EQSTREAM_H
|
||||
#define _EQSTREAM_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <deque>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#include "eq_stream_type.h"
|
||||
|
||||
#include "../common/misc.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/timer.h"
|
||||
|
||||
#include "eq_packet.h"
|
||||
#include "eq_stream_intf.h"
|
||||
#include "eq_stream_type.h"
|
||||
#include "mutex.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/misc.h"
|
||||
#include "../common/condition.h"
|
||||
#include "../common/timer.h"
|
||||
|
||||
class EQApplicationPacket;
|
||||
class EQProtocolPacket;
|
||||
|
||||
#define FLAG_COMPRESSED 0x01
|
||||
#define FLAG_ENCODED 0x04
|
||||
@@ -45,6 +49,10 @@
|
||||
#define RETRANSMIT_ACKED_PACKETS true
|
||||
#endif
|
||||
|
||||
#ifndef MAX_SESSION_RETRIES
|
||||
#define MAX_SESSION_RETRIES 30
|
||||
#endif
|
||||
|
||||
#pragma pack(1)
|
||||
struct SessionRequest {
|
||||
uint32 UnknownA;
|
||||
@@ -78,7 +86,6 @@ struct SessionStats {
|
||||
#pragma pack()
|
||||
|
||||
class OpcodeManager;
|
||||
class EQStreamPair;
|
||||
class EQRawApplicationPacket;
|
||||
|
||||
class EQStream : public EQStreamInterface {
|
||||
@@ -101,6 +108,9 @@ class EQStream : public EQStreamInterface {
|
||||
uint32 retransmittimer;
|
||||
uint32 retransmittimeout;
|
||||
|
||||
uint16 sessionAttempts;
|
||||
bool streamactive;
|
||||
|
||||
//uint32 buffer_len;
|
||||
|
||||
uint32 Session, Key;
|
||||
@@ -194,10 +204,16 @@ class EQStream : public EQStreamInterface {
|
||||
|
||||
void _SendDisconnect();
|
||||
|
||||
void init();
|
||||
void init(bool resetSession=true);
|
||||
public:
|
||||
EQStream() { init(); remote_ip = 0; remote_port = 0; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); }
|
||||
EQStream(sockaddr_in addr) { init(); remote_ip=addr.sin_addr.s_addr; remote_port=addr.sin_port; State=UNESTABLISHED; StreamType=UnknownStream; compressed=true; encoded=false; app_opcode_size=2; bytes_sent=0; bytes_recv=0; create_time=Timer::GetTimeSeconds(); }
|
||||
EQStream() { init(); remote_ip = 0; remote_port = 0; State = UNESTABLISHED;
|
||||
StreamType = UnknownStream; compressed = true; encoded = false; app_opcode_size = 2;
|
||||
bytes_sent = 0; bytes_recv = 0; create_time = Timer::GetTimeSeconds(); sessionAttempts = 0;
|
||||
streamactive = false; }
|
||||
EQStream(sockaddr_in addr) { init(); remote_ip = addr.sin_addr.s_addr;
|
||||
remote_port = addr.sin_port; State = UNESTABLISHED; StreamType = UnknownStream;
|
||||
compressed = true; encoded = false; app_opcode_size = 2; bytes_sent = 0; bytes_recv = 0;
|
||||
create_time = Timer::GetTimeSeconds(); }
|
||||
virtual ~EQStream() { RemoveData(); SetState(CLOSED); }
|
||||
void SetMaxLen(uint32 length) { MaxLen=length; }
|
||||
|
||||
@@ -221,6 +237,9 @@ class EQStream : public EQStreamInterface {
|
||||
void SetLastPacketTime(uint32 t) {LastPacket=t;}
|
||||
void Write(int eq_fd);
|
||||
|
||||
// whether or not the stream has been assigned (we passed our stream match)
|
||||
void SetActive(bool val) { streamactive = val; }
|
||||
|
||||
//
|
||||
inline bool IsInUse() { bool flag; MInUse.lock(); flag=(active_users>0); MInUse.unlock(); return flag; }
|
||||
inline void PutInUse() { MInUse.lock(); active_users++; MInUse.unlock(); }
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "eq_stream_factory.h"
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <winsock.h>
|
||||
#include <process.h>
|
||||
@@ -13,24 +15,25 @@
|
||||
#include <netdb.h>
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "op_codes.h"
|
||||
#include "eq_stream.h"
|
||||
#include "logsys.h"
|
||||
|
||||
ThreadReturnType EQStreamFactoryReaderLoop(void *eqfs)
|
||||
{
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
_eqp
|
||||
EQStreamFactory *fs = (EQStreamFactory*)eqfs;
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
||||
Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
fs->ReaderLoop();
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
||||
Log.Out(Logs::Detail, Logs::None, "Ending EQStreamFactoryReaderLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
THREAD_RETURN(nullptr);
|
||||
@@ -38,16 +41,17 @@ EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
|
||||
ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs)
|
||||
{
|
||||
EQStreamFactory *fs=(EQStreamFactory *)eqfs;
|
||||
_eqp
|
||||
EQStreamFactory *fs = (EQStreamFactory*)eqfs;
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
||||
Log.Out(Logs::Detail, Logs::None, "Starting EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
fs->WriterLoop();
|
||||
|
||||
#ifndef WIN32
|
||||
_log(COMMON__THREADS, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
||||
Log.Out(Logs::Detail, Logs::None, "Ending EQStreamFactoryWriterLoop with thread ID %d", pthread_self());
|
||||
#endif
|
||||
|
||||
THREAD_RETURN(nullptr);
|
||||
@@ -56,6 +60,7 @@ ThreadReturnType EQStreamFactoryWriterLoop(void *eqfs)
|
||||
EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout)
|
||||
: Timeoutable(5000), stream_timeout(timeout)
|
||||
{
|
||||
_eqp
|
||||
StreamType=type;
|
||||
Port=port;
|
||||
sock=-1;
|
||||
@@ -63,6 +68,7 @@ EQStreamFactory::EQStreamFactory(EQStreamType type, int port, uint32 timeout)
|
||||
|
||||
void EQStreamFactory::Close()
|
||||
{
|
||||
_eqp
|
||||
Stop();
|
||||
|
||||
#ifdef _WINDOWS
|
||||
@@ -75,7 +81,8 @@ void EQStreamFactory::Close()
|
||||
|
||||
bool EQStreamFactory::Open()
|
||||
{
|
||||
struct sockaddr_in address;
|
||||
_eqp
|
||||
struct sockaddr_in address;
|
||||
#ifndef WIN32
|
||||
pthread_t t1,t2;
|
||||
#endif
|
||||
@@ -104,8 +111,6 @@ struct sockaddr_in address;
|
||||
fcntl(sock, F_SETFL, O_NONBLOCK);
|
||||
#endif
|
||||
//moved these because on windows the output was delayed and causing the console window to look bad
|
||||
//std::cout << "Starting factory Reader" << std::endl;
|
||||
//std::cout << "Starting factory Writer" << std::endl;
|
||||
#ifdef _WINDOWS
|
||||
_beginthread(EQStreamFactoryReaderLoop,0, this);
|
||||
_beginthread(EQStreamFactoryWriterLoop,0, this);
|
||||
@@ -116,44 +121,42 @@ struct sockaddr_in address;
|
||||
return true;
|
||||
}
|
||||
|
||||
EQStream *EQStreamFactory::Pop()
|
||||
std::shared_ptr<EQStream> EQStreamFactory::Pop()
|
||||
{
|
||||
EQStream *s=nullptr;
|
||||
//std::cout << "Pop():Locking MNewStreams" << std::endl;
|
||||
_eqp
|
||||
std::shared_ptr<EQStream> s = nullptr;
|
||||
MNewStreams.lock();
|
||||
if (NewStreams.size()) {
|
||||
s=NewStreams.front();
|
||||
s = NewStreams.front();
|
||||
NewStreams.pop();
|
||||
s->PutInUse();
|
||||
}
|
||||
MNewStreams.unlock();
|
||||
//std::cout << "Pop(): Unlocking MNewStreams" << std::endl;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
void EQStreamFactory::Push(EQStream *s)
|
||||
void EQStreamFactory::Push(std::shared_ptr<EQStream> s)
|
||||
{
|
||||
//std::cout << "Push():Locking MNewStreams" << std::endl;
|
||||
_eqp
|
||||
MNewStreams.lock();
|
||||
NewStreams.push(s);
|
||||
MNewStreams.unlock();
|
||||
//std::cout << "Push(): Unlocking MNewStreams" << std::endl;
|
||||
}
|
||||
|
||||
void EQStreamFactory::ReaderLoop()
|
||||
{
|
||||
fd_set readset;
|
||||
std::map<std::pair<uint32, uint16>,EQStream *>::iterator stream_itr;
|
||||
int num;
|
||||
int length;
|
||||
unsigned char buffer[2048];
|
||||
sockaddr_in from;
|
||||
int socklen=sizeof(sockaddr_in);
|
||||
timeval sleep_time;
|
||||
//time_t now;
|
||||
_eqp
|
||||
fd_set readset;
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
|
||||
int num;
|
||||
int length;
|
||||
unsigned char buffer[2048];
|
||||
sockaddr_in from;
|
||||
int socklen = sizeof(sockaddr_in);
|
||||
timeval sleep_time;
|
||||
ReaderRunning = true;
|
||||
|
||||
ReaderRunning=true;
|
||||
while(sock!=-1) {
|
||||
MReaderRunning.lock();
|
||||
if (!ReaderRunning)
|
||||
@@ -184,10 +187,10 @@ timeval sleep_time;
|
||||
// What do we wanna do?
|
||||
} else {
|
||||
MStreams.lock();
|
||||
stream_itr=Streams.find(std::make_pair(from.sin_addr.s_addr, from.sin_port));
|
||||
stream_itr = Streams.find(std::make_pair(from.sin_addr.s_addr, from.sin_port));
|
||||
if (stream_itr == Streams.end()) {
|
||||
if (buffer[1]==OP_SessionRequest) {
|
||||
EQStream *s = new EQStream(from);
|
||||
std::shared_ptr<EQStream> s = std::make_shared<EQStream>(from);
|
||||
s->SetStreamType(StreamType);
|
||||
Streams[std::make_pair(from.sin_addr.s_addr, from.sin_port)]=s;
|
||||
WriterWork.Signal();
|
||||
@@ -198,13 +201,13 @@ timeval sleep_time;
|
||||
}
|
||||
MStreams.unlock();
|
||||
} else {
|
||||
EQStream *curstream = stream_itr->second;
|
||||
std::shared_ptr<EQStream> curstream = stream_itr->second;
|
||||
//dont bother processing incoming packets for closed connections
|
||||
if(curstream->CheckClosed())
|
||||
curstream = nullptr;
|
||||
else
|
||||
curstream->PutInUse();
|
||||
MStreams.unlock(); //the in use flag prevents the stream from being deleted while we are using it.
|
||||
//the in use flag prevents the stream from being deleted while we are using it.
|
||||
|
||||
if(curstream) {
|
||||
curstream->AddBytesRecv(length);
|
||||
@@ -212,6 +215,7 @@ timeval sleep_time;
|
||||
curstream->SetLastPacketTime(Timer::GetCurrentTime());
|
||||
curstream->ReleaseFromUse();
|
||||
}
|
||||
MStreams.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -220,14 +224,15 @@ timeval sleep_time;
|
||||
|
||||
void EQStreamFactory::CheckTimeout()
|
||||
{
|
||||
_eqp
|
||||
//lock streams the entire time were checking timeouts, it should be fast.
|
||||
MStreams.lock();
|
||||
|
||||
unsigned long now=Timer::GetCurrentTime();
|
||||
std::map<std::pair<uint32, uint16>,EQStream *>::iterator stream_itr;
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
|
||||
|
||||
for(stream_itr=Streams.begin();stream_itr!=Streams.end();) {
|
||||
EQStream *s = stream_itr->second;
|
||||
for(stream_itr = Streams.begin(); stream_itr != Streams.end();) {
|
||||
std::shared_ptr<EQStream> s = stream_itr->second;
|
||||
|
||||
s->CheckTimeout(now, stream_timeout);
|
||||
|
||||
@@ -239,11 +244,9 @@ void EQStreamFactory::CheckTimeout()
|
||||
//give it a little time for everybody to finish with it
|
||||
} else {
|
||||
//everybody is done, we can delete it now
|
||||
//std::cout << "Removing connection" << std::endl;
|
||||
std::map<std::pair<uint32, uint16>,EQStream *>::iterator temp=stream_itr;
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator temp = stream_itr;
|
||||
++stream_itr;
|
||||
//let whoever has the stream outside delete it
|
||||
delete temp->second;
|
||||
temp->second = nullptr;
|
||||
Streams.erase(temp);
|
||||
continue;
|
||||
}
|
||||
@@ -256,21 +259,18 @@ void EQStreamFactory::CheckTimeout()
|
||||
|
||||
void EQStreamFactory::WriterLoop()
|
||||
{
|
||||
std::map<std::pair<uint32, uint16>,EQStream *>::iterator stream_itr;
|
||||
bool havework=true;
|
||||
std::vector<EQStream *> wants_write;
|
||||
std::vector<EQStream *>::iterator cur,end;
|
||||
bool decay=false;
|
||||
uint32 stream_count;
|
||||
|
||||
Timer DecayTimer(20);
|
||||
|
||||
WriterRunning=true;
|
||||
_eqp
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>>::iterator stream_itr;
|
||||
bool havework=true;
|
||||
std::vector<std::shared_ptr<EQStream>> wants_write;
|
||||
std::vector<std::shared_ptr<EQStream>>::iterator cur, end;
|
||||
bool decay = false;
|
||||
uint32 stream_count;
|
||||
Timer DecayTimer(20);
|
||||
WriterRunning = true;
|
||||
DecayTimer.Enable();
|
||||
|
||||
while(sock!=-1) {
|
||||
//if (!havework) {
|
||||
//WriterWork.Wait();
|
||||
//}
|
||||
MWriterRunning.lock();
|
||||
if (!WriterRunning)
|
||||
break;
|
||||
@@ -291,7 +291,7 @@ Timer DecayTimer(20);
|
||||
|
||||
//bullshit checking, to see if this is really happening, GDB seems to think so...
|
||||
if(stream_itr->second == nullptr) {
|
||||
fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i", stream_itr->first.first, stream_itr->first.second);
|
||||
fprintf(stderr, "ERROR: nullptr Stream encountered in EQStreamFactory::WriterLoop for: %i:%i", stream_itr->first.first, stream_itr->first.second);
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -314,12 +314,10 @@ Timer DecayTimer(20);
|
||||
Sleep(10);
|
||||
|
||||
MStreams.lock();
|
||||
stream_count=Streams.size();
|
||||
stream_count = Streams.size();
|
||||
MStreams.unlock();
|
||||
if (!stream_count) {
|
||||
//std::cout << "No streams, waiting on condition" << std::endl;
|
||||
WriterWork.Wait();
|
||||
//std::cout << "Awake from condition, must have a stream now" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,16 @@
|
||||
|
||||
#define _EQSTREAMFACTORY_H
|
||||
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <map>
|
||||
|
||||
#include "../common/eq_stream.h"
|
||||
#include "../common/condition.h"
|
||||
#include "../common/timeoutmgr.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/timer.h"
|
||||
|
||||
class EQStream;
|
||||
class Timer;
|
||||
|
||||
class EQStreamFactory : private Timeoutable {
|
||||
private:
|
||||
@@ -24,10 +27,10 @@ class EQStreamFactory : private Timeoutable {
|
||||
|
||||
EQStreamType StreamType;
|
||||
|
||||
std::queue<EQStream *> NewStreams;
|
||||
std::queue<std::shared_ptr<EQStream>> NewStreams;
|
||||
Mutex MNewStreams;
|
||||
|
||||
std::map<std::pair<uint32, uint16>,EQStream *> Streams;
|
||||
std::map<std::pair<uint32, uint16>, std::shared_ptr<EQStream>> Streams;
|
||||
Mutex MStreams;
|
||||
|
||||
virtual void CheckTimeout();
|
||||
@@ -40,8 +43,8 @@ class EQStreamFactory : private Timeoutable {
|
||||
EQStreamFactory(EQStreamType type, uint32 timeout = 135000) : Timeoutable(5000), stream_timeout(timeout) { ReaderRunning=false; WriterRunning=false; StreamType=type; sock=-1; }
|
||||
EQStreamFactory(EQStreamType type, int port, uint32 timeout = 135000);
|
||||
|
||||
EQStream *Pop();
|
||||
void Push(EQStream *s);
|
||||
std::shared_ptr<EQStream> Pop();
|
||||
void Push(std::shared_ptr<EQStream> s);
|
||||
|
||||
bool Open();
|
||||
bool Open(unsigned long port) { Port=port; return Open(); }
|
||||
|
||||
+35
-35
@@ -1,20 +1,20 @@
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "eq_stream_ident.h"
|
||||
#include "eq_stream_proxy.h"
|
||||
#include "logsys.h"
|
||||
|
||||
|
||||
EQStreamIdentifier::~EQStreamIdentifier() {
|
||||
while(!m_identified.empty()) {
|
||||
m_identified.front()->ReleaseFromUse();
|
||||
m_identified.pop();
|
||||
}
|
||||
std::vector<Record *>::iterator cur, end;
|
||||
std::vector<Record>::iterator cur, end;
|
||||
cur = m_streams.begin();
|
||||
end = m_streams.end();
|
||||
for(; cur != end; ++cur) {
|
||||
Record *r = *cur;
|
||||
r->stream->ReleaseFromUse();
|
||||
delete r;
|
||||
Record &r = *cur;
|
||||
r.stream->ReleaseFromUse();
|
||||
}
|
||||
std::vector<Patch *>::iterator curp, endp;
|
||||
curp = m_patches.begin();
|
||||
@@ -34,54 +34,52 @@ void EQStreamIdentifier::RegisterPatch(const EQStream::Signature &sig, const cha
|
||||
}
|
||||
|
||||
void EQStreamIdentifier::Process() {
|
||||
std::vector<Record *>::iterator cur;
|
||||
std::vector<Record>::iterator cur;
|
||||
std::vector<Patch *>::iterator curp, endp;
|
||||
|
||||
//foreach pending stream.
|
||||
cur = m_streams.begin();
|
||||
while(cur != m_streams.end()) {
|
||||
Record *r = *cur;
|
||||
Record &r = *cur;
|
||||
|
||||
//first see if this stream has expired
|
||||
if(r->expire.Check(false)) {
|
||||
if(r.expire.Check(false)) {
|
||||
//this stream has failed to match any pattern in our timeframe.
|
||||
_log(NET__IDENTIFY, "Unable to identify stream from %s:%d before timeout.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
|
||||
r->stream->ReleaseFromUse();
|
||||
delete r;
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before timeout.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
r.stream->ReleaseFromUse();
|
||||
cur = m_streams.erase(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
//then make sure the stream is still active
|
||||
//if stream hasn't finished initializing then continue;
|
||||
if(r->stream->GetState() == UNESTABLISHED)
|
||||
if(r.stream->GetState() == UNESTABLISHED)
|
||||
{
|
||||
++cur;
|
||||
continue;
|
||||
}
|
||||
if(r->stream->GetState() != ESTABLISHED) {
|
||||
if(r.stream->GetState() != ESTABLISHED) {
|
||||
//the stream closed before it was identified.
|
||||
_log(NET__IDENTIFY, "Unable to identify stream from %s:%d before it closed.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
|
||||
switch(r->stream->GetState())
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d before it closed.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
switch(r.stream->GetState())
|
||||
{
|
||||
case ESTABLISHED:
|
||||
_log(NET__IDENTIFY, "Stream state was Established");
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Established");
|
||||
break;
|
||||
case CLOSING:
|
||||
_log(NET__IDENTIFY, "Stream state was Closing");
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closing");
|
||||
break;
|
||||
case DISCONNECTING:
|
||||
_log(NET__IDENTIFY, "Stream state was Disconnecting");
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Disconnecting");
|
||||
break;
|
||||
case CLOSED:
|
||||
_log(NET__IDENTIFY, "Stream state was Closed");
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Closed");
|
||||
break;
|
||||
default:
|
||||
_log(NET__IDENTIFY, "Stream state was Unestablished or unknown");
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Stream state was Unestablished or unknown");
|
||||
break;
|
||||
}
|
||||
r->stream->ReleaseFromUse();
|
||||
delete r;
|
||||
r.stream->ReleaseFromUse();
|
||||
cur = m_streams.erase(cur);
|
||||
continue;
|
||||
}
|
||||
@@ -98,20 +96,23 @@ void EQStreamIdentifier::Process() {
|
||||
Patch *p = *curp;
|
||||
|
||||
//ask the stream to see if it matches the supplied signature
|
||||
EQStream::MatchState res = r->stream->CheckSignature(&p->signature);
|
||||
EQStream::MatchState res = r.stream->CheckSignature(&p->signature);
|
||||
switch(res) {
|
||||
case EQStream::MatchNotReady:
|
||||
//the stream has not received enough packets to compare with this signature
|
||||
// _log(NET__IDENT_TRACE, "%s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
|
||||
// Log.LogDebugType(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
all_ready = false;
|
||||
break;
|
||||
case EQStream::MatchSuccessful: {
|
||||
//yay, a match.
|
||||
|
||||
_log(NET__IDENTIFY, "Identified stream %s:%d with signature %s", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
|
||||
// before we assign the eqstream to an interface, let the stream recognize it is in use and the session should not be reset any further
|
||||
r.stream->SetActive(true);
|
||||
|
||||
//might want to do something less-specific here... some day..
|
||||
EQStreamInterface *s = new EQStreamProxy(r->stream, p->structs, p->opcodes);
|
||||
EQStreamInterface *s = new EQStreamProxy(r.stream, p->structs, p->opcodes);
|
||||
m_identified.push(s);
|
||||
|
||||
found_one = true;
|
||||
@@ -119,7 +120,7 @@ void EQStreamIdentifier::Process() {
|
||||
}
|
||||
case EQStream::MatchFailed:
|
||||
//do nothing...
|
||||
_log(NET__IDENT_TRACE, "%s:%d: Tried patch %s, and it did not match.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()), p->name.c_str());
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -127,14 +128,13 @@ void EQStreamIdentifier::Process() {
|
||||
//if we checked all patches and did not find a match.
|
||||
if(all_ready && !found_one) {
|
||||
//the stream cannot be identified.
|
||||
_log(NET__IDENTIFY, "Unable to identify stream from %s:%d, no match found.", long2ip(r->stream->GetRemoteIP()).c_str(), ntohs(r->stream->GetRemotePort()));
|
||||
r->stream->ReleaseFromUse();
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Unable to identify stream from %s:%d, no match found.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()));
|
||||
r.stream->ReleaseFromUse();
|
||||
}
|
||||
|
||||
//if we found a match, or were not able to identify it
|
||||
if(found_one || all_ready) {
|
||||
//cannot print ip/port here. r->stream is invalid.
|
||||
delete r;
|
||||
//cannot print ip/port here. r.stream is invalid.
|
||||
cur = m_streams.erase(cur);
|
||||
} else {
|
||||
++cur;
|
||||
@@ -142,8 +142,8 @@ void EQStreamIdentifier::Process() {
|
||||
} //end foreach stream
|
||||
}
|
||||
|
||||
void EQStreamIdentifier::AddStream(EQStream *&eqs) {
|
||||
m_streams.push_back(new Record(eqs));
|
||||
void EQStreamIdentifier::AddStream(std::shared_ptr<EQStream> &eqs) {
|
||||
m_streams.push_back(Record(eqs));
|
||||
eqs = nullptr;
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ EQStreamInterface *EQStreamIdentifier::PopIdentified() {
|
||||
return(res);
|
||||
}
|
||||
|
||||
EQStreamIdentifier::Record::Record(EQStream *s)
|
||||
EQStreamIdentifier::Record::Record(std::shared_ptr<EQStream> s)
|
||||
: stream(s),
|
||||
expire(STREAM_IDENT_WAIT_MS)
|
||||
{
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
#include "eq_stream.h"
|
||||
#include "timer.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <queue>
|
||||
#include <memory>
|
||||
|
||||
#define STREAM_IDENT_WAIT_MS 10000
|
||||
|
||||
class OpcodeManager;
|
||||
class StructStrategy;
|
||||
class EQStreamInterface;
|
||||
|
||||
class EQStreamIdentifier {
|
||||
public:
|
||||
@@ -21,7 +22,7 @@ public:
|
||||
|
||||
//main processing interface
|
||||
void Process();
|
||||
void AddStream(EQStream *& eqs);
|
||||
void AddStream(std::shared_ptr<EQStream> &eqs);
|
||||
EQStreamInterface *PopIdentified();
|
||||
|
||||
protected:
|
||||
@@ -39,11 +40,11 @@ protected:
|
||||
//pending streams..
|
||||
class Record {
|
||||
public:
|
||||
Record(EQStream *s);
|
||||
EQStream *stream; //we own this
|
||||
Record(std::shared_ptr<EQStream> s);
|
||||
std::shared_ptr<EQStream> stream; //we own this
|
||||
Timer expire;
|
||||
};
|
||||
std::vector<Record *> m_streams; //we own these objects, and the streams contained in them.
|
||||
std::vector<Record> m_streams; //we own these objects, and the streams contained in them.
|
||||
std::queue<EQStreamInterface *> m_identified; //we own these objects
|
||||
};
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
virtual const uint32 GetBytesRecieved() const { return 0; }
|
||||
virtual const uint32 GetBytesSentPerSecond() const { return 0; }
|
||||
virtual const uint32 GetBytesRecvPerSecond() const { return 0; }
|
||||
virtual const EQClientVersion ClientVersion() const { return EQClientUnknown; }
|
||||
virtual const ClientVersion GetClientVersion() const { return ClientVersion::Unknown; }
|
||||
};
|
||||
|
||||
#endif /*EQSTREAMINTF_H_*/
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "eq_stream_proxy.h"
|
||||
#include "eq_stream.h"
|
||||
#include "struct_strategy.h"
|
||||
|
||||
|
||||
EQStreamProxy::EQStreamProxy(EQStream *&stream, const StructStrategy *structs, OpcodeManager **opcodes)
|
||||
EQStreamProxy::EQStreamProxy(std::shared_ptr<EQStream> &stream, const StructStrategy *structs, OpcodeManager **opcodes)
|
||||
: m_stream(stream),
|
||||
m_structs(structs),
|
||||
m_opcodes(opcodes)
|
||||
@@ -15,16 +15,15 @@ EQStreamProxy::EQStreamProxy(EQStream *&stream, const StructStrategy *structs, O
|
||||
}
|
||||
|
||||
EQStreamProxy::~EQStreamProxy() {
|
||||
//delete m_stream; //released by the stream factory.
|
||||
}
|
||||
|
||||
std::string EQStreamProxy::Describe() const {
|
||||
return(m_structs->Describe());
|
||||
}
|
||||
|
||||
const EQClientVersion EQStreamProxy::ClientVersion() const
|
||||
const ClientVersion EQStreamProxy::GetClientVersion() const
|
||||
{
|
||||
return m_structs->ClientVersion();
|
||||
return m_structs->GetClientVersion();
|
||||
}
|
||||
|
||||
void EQStreamProxy::QueuePacket(const EQApplicationPacket *p, bool ack_req) {
|
||||
@@ -85,12 +84,6 @@ const uint32 EQStreamProxy::GetBytesRecvPerSecond() const
|
||||
|
||||
void EQStreamProxy::ReleaseFromUse() {
|
||||
m_stream->ReleaseFromUse();
|
||||
|
||||
//this is so ugly, but I cant think of a better way to deal with
|
||||
//it right now...
|
||||
if(!m_stream->IsInUse()) {
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
|
||||
void EQStreamProxy::RemoveData() {
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "eq_stream_intf.h"
|
||||
#include "eq_stream.h"
|
||||
#include <memory>
|
||||
|
||||
class EQStream;
|
||||
class StructStrategy;
|
||||
class OpcodeManager;
|
||||
class EQApplicationPacket;
|
||||
@@ -13,7 +14,7 @@ class EQApplicationPacket;
|
||||
class EQStreamProxy : public EQStreamInterface {
|
||||
public:
|
||||
//takes ownership of the stream.
|
||||
EQStreamProxy(EQStream *&stream, const StructStrategy *structs, OpcodeManager **opcodes);
|
||||
EQStreamProxy(std::shared_ptr<EQStream> &stream, const StructStrategy *structs, OpcodeManager **opcodes);
|
||||
virtual ~EQStreamProxy();
|
||||
|
||||
//EQStreamInterface:
|
||||
@@ -27,7 +28,7 @@ public:
|
||||
virtual void RemoveData();
|
||||
virtual bool CheckState(EQStreamState state);
|
||||
virtual std::string Describe() const;
|
||||
virtual const EQClientVersion ClientVersion() const;
|
||||
virtual const ClientVersion GetClientVersion() const;
|
||||
|
||||
virtual const uint32 GetBytesSent() const;
|
||||
virtual const uint32 GetBytesRecieved() const;
|
||||
@@ -35,7 +36,7 @@ public:
|
||||
virtual const uint32 GetBytesRecvPerSecond() const;
|
||||
|
||||
protected:
|
||||
EQStream *const m_stream; //we own this stream object.
|
||||
std::shared_ptr<EQStream> const m_stream; //we own this stream object.
|
||||
const StructStrategy *const m_structs; //we do not own this object.
|
||||
//this is a pointer to a pointer to make it less likely that a packet will
|
||||
//reference an invalid opcode manager when they are being reloaded.
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "eqdb.h"
|
||||
#include "database.h"
|
||||
#include <mysql.h>
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "eqdb_res.h"
|
||||
#include <mysql.h>
|
||||
|
||||
|
||||
+345
-295
@@ -1,4 +1,4 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -15,62 +15,66 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "../common/debug.h"
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "eqemu_config.h"
|
||||
#include "misc_functions.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
std::string EQEmuConfig::ConfigFile = "eqemu_config.xml";
|
||||
EQEmuConfig *EQEmuConfig::_config = nullptr;
|
||||
|
||||
void EQEmuConfig::do_world(TiXmlElement *ele) {
|
||||
void EQEmuConfig::do_world(TiXmlElement *ele)
|
||||
{
|
||||
_eqp
|
||||
const char *text;
|
||||
TiXmlElement * sub_ele;;
|
||||
|
||||
text= ParseTextBlock(ele,"shortname");
|
||||
if (text)
|
||||
ShortName=text;
|
||||
|
||||
text = ParseTextBlock(ele,"longname");
|
||||
if (text)
|
||||
LongName=text;
|
||||
|
||||
text = ParseTextBlock(ele,"address",true);
|
||||
if (text)
|
||||
WorldAddress=text;
|
||||
|
||||
text = ParseTextBlock(ele,"localaddress",true);
|
||||
if (text)
|
||||
LocalAddress=text;
|
||||
|
||||
text = ParseTextBlock(ele,"maxclients",true);
|
||||
if (text)
|
||||
MaxClients=atoi(text);
|
||||
|
||||
text = ParseTextBlock(ele, "shortname");
|
||||
if (text) {
|
||||
ShortName = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "longname");
|
||||
if (text) {
|
||||
LongName = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "address", true);
|
||||
if (text) {
|
||||
WorldAddress = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "localaddress", true);
|
||||
if (text) {
|
||||
LocalAddress = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "maxclients", true);
|
||||
if (text) {
|
||||
MaxClients = atoi(text);
|
||||
}
|
||||
// Get the <key> element
|
||||
text = ParseTextBlock(ele,"key",true);
|
||||
if (text)
|
||||
SharedKey=text;
|
||||
|
||||
text = ParseTextBlock(ele, "key", true);
|
||||
if (text) {
|
||||
SharedKey = text;
|
||||
}
|
||||
// Get the <loginserver> element
|
||||
sub_ele = ele->FirstChildElement("loginserver");
|
||||
if (sub_ele) {
|
||||
text=ParseTextBlock(sub_ele,"host",true);
|
||||
if (text)
|
||||
LoginHost=text;
|
||||
|
||||
text=ParseTextBlock(sub_ele,"port",true);
|
||||
if (text)
|
||||
LoginPort=atoi(text);
|
||||
|
||||
text=ParseTextBlock(sub_ele,"account",true);
|
||||
if (text)
|
||||
LoginAccount=text;
|
||||
|
||||
text=ParseTextBlock(sub_ele,"password",true);
|
||||
if (text)
|
||||
LoginPassword=text;
|
||||
text = ParseTextBlock(sub_ele, "host", true);
|
||||
if (text) {
|
||||
LoginHost = text;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "port", true);
|
||||
if (text) {
|
||||
LoginPort = atoi(text);
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "account", true);
|
||||
if (text) {
|
||||
LoginAccount = text;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "password", true);
|
||||
if (text) {
|
||||
LoginPassword = text;
|
||||
}
|
||||
} else {
|
||||
char str[32];
|
||||
do {
|
||||
@@ -78,333 +82,380 @@ void EQEmuConfig::do_world(TiXmlElement *ele) {
|
||||
sub_ele = ele->FirstChildElement(str);
|
||||
if (sub_ele) {
|
||||
LoginConfig* loginconfig = new LoginConfig;
|
||||
text=ParseTextBlock(sub_ele,"host",true);
|
||||
if (text)
|
||||
loginconfig->LoginHost=text;
|
||||
|
||||
text=ParseTextBlock(sub_ele,"port",true);
|
||||
if (text)
|
||||
loginconfig->LoginPort=atoi(text);
|
||||
|
||||
text=ParseTextBlock(sub_ele,"account",true);
|
||||
if (text)
|
||||
loginconfig->LoginAccount=text;
|
||||
|
||||
text=ParseTextBlock(sub_ele,"password",true);
|
||||
if (text)
|
||||
loginconfig->LoginPassword=text;
|
||||
text = ParseTextBlock(sub_ele, "host", true);
|
||||
if (text) {
|
||||
loginconfig->LoginHost = text;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "port", true);
|
||||
if (text) {
|
||||
loginconfig->LoginPort = atoi(text);
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "account", true);
|
||||
if (text) {
|
||||
loginconfig->LoginAccount = text;
|
||||
}
|
||||
text = ParseTextBlock(sub_ele, "password", true);
|
||||
if (text) {
|
||||
loginconfig->LoginPassword = text;
|
||||
}
|
||||
loginlist.Insert(loginconfig);
|
||||
}
|
||||
} while(sub_ele);
|
||||
} while (sub_ele);
|
||||
}
|
||||
|
||||
// Check for locked
|
||||
sub_ele = ele->FirstChildElement("locked");
|
||||
if (sub_ele != nullptr)
|
||||
Locked=true;
|
||||
|
||||
if (sub_ele != nullptr) {
|
||||
Locked = true;
|
||||
}
|
||||
// Get the <tcp> element
|
||||
sub_ele = ele->FirstChildElement("tcp");
|
||||
if(sub_ele != nullptr) {
|
||||
|
||||
if (sub_ele != nullptr) {
|
||||
text = sub_ele->Attribute("ip");
|
||||
if (text)
|
||||
WorldIP=text;
|
||||
|
||||
if (text) {
|
||||
WorldIP = text;
|
||||
}
|
||||
text = sub_ele->Attribute("port");
|
||||
if (text)
|
||||
WorldTCPPort=atoi(text);
|
||||
|
||||
if (text) {
|
||||
WorldTCPPort = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("telnet");
|
||||
if (text && !strcasecmp(text,"enabled"))
|
||||
TelnetEnabled=true;
|
||||
|
||||
if (text && !strcasecmp(text, "enabled")) {
|
||||
TelnetEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the <http> element
|
||||
sub_ele = ele->FirstChildElement("http");
|
||||
if(sub_ele != nullptr) {
|
||||
|
||||
if (sub_ele != nullptr) {
|
||||
// text = sub_ele->Attribute("ip");
|
||||
// if (text)
|
||||
// WorldIP=text;
|
||||
|
||||
text = sub_ele->Attribute("mimefile");
|
||||
if (text)
|
||||
WorldHTTPMimeFile=text;
|
||||
|
||||
if (text) {
|
||||
WorldHTTPMimeFile = text;
|
||||
}
|
||||
text = sub_ele->Attribute("port");
|
||||
if (text)
|
||||
WorldHTTPPort=atoi(text);
|
||||
|
||||
if (text) {
|
||||
WorldHTTPPort = atoi(text);
|
||||
}
|
||||
text = sub_ele->Attribute("enabled");
|
||||
if (text && !strcasecmp(text,"true"))
|
||||
WorldHTTPEnabled=true;
|
||||
|
||||
if (text && !strcasecmp(text, "true")) {
|
||||
WorldHTTPEnabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_chatserver(TiXmlElement *ele) {
|
||||
void EQEmuConfig::do_chatserver(TiXmlElement *ele)
|
||||
{
|
||||
_eqp
|
||||
const char *text;
|
||||
|
||||
text=ParseTextBlock(ele,"host",true);
|
||||
if (text)
|
||||
ChatHost=text;
|
||||
|
||||
text=ParseTextBlock(ele,"port",true);
|
||||
if (text)
|
||||
ChatPort=atoi(text);
|
||||
text = ParseTextBlock(ele, "host", true);
|
||||
if (text) {
|
||||
ChatHost = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "port", true);
|
||||
if (text) {
|
||||
ChatPort = atoi(text);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_mailserver(TiXmlElement *ele) {
|
||||
void EQEmuConfig::do_mailserver(TiXmlElement *ele)
|
||||
{
|
||||
_eqp
|
||||
const char *text;
|
||||
|
||||
text=ParseTextBlock(ele,"host",true);
|
||||
if (text)
|
||||
MailHost=text;
|
||||
|
||||
text=ParseTextBlock(ele,"port",true);
|
||||
if (text)
|
||||
MailPort=atoi(text);
|
||||
text = ParseTextBlock(ele, "host", true);
|
||||
if (text) {
|
||||
MailHost = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "port", true);
|
||||
if (text) {
|
||||
MailPort = atoi(text);
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_database(TiXmlElement *ele) {
|
||||
void EQEmuConfig::do_database(TiXmlElement *ele)
|
||||
{
|
||||
_eqp
|
||||
const char *text;
|
||||
|
||||
text=ParseTextBlock(ele,"host",true);
|
||||
if (text)
|
||||
DatabaseHost=text;
|
||||
|
||||
text=ParseTextBlock(ele,"port",true);
|
||||
if (text)
|
||||
DatabasePort=atoi(text);
|
||||
|
||||
text=ParseTextBlock(ele,"username",true);
|
||||
if (text)
|
||||
DatabaseUsername=text;
|
||||
|
||||
text=ParseTextBlock(ele,"password",true);
|
||||
if (text)
|
||||
DatabasePassword=text;
|
||||
|
||||
text=ParseTextBlock(ele,"db",true);
|
||||
if (text)
|
||||
DatabaseDB=text;
|
||||
text = ParseTextBlock(ele, "host", true);
|
||||
if (text) {
|
||||
DatabaseHost = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "port", true);
|
||||
if (text) {
|
||||
DatabasePort = atoi(text);
|
||||
}
|
||||
text = ParseTextBlock(ele, "username", true);
|
||||
if (text) {
|
||||
DatabaseUsername = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "password", true);
|
||||
if (text) {
|
||||
DatabasePassword = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "db", true);
|
||||
if (text) {
|
||||
DatabaseDB = text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EQEmuConfig::do_qsdatabase(TiXmlElement *ele) {
|
||||
void EQEmuConfig::do_qsdatabase(TiXmlElement *ele)
|
||||
{
|
||||
_eqp
|
||||
const char *text;
|
||||
|
||||
text=ParseTextBlock(ele,"host",true);
|
||||
if (text)
|
||||
QSDatabaseHost=text;
|
||||
|
||||
text=ParseTextBlock(ele,"port",true);
|
||||
if (text)
|
||||
QSDatabasePort=atoi(text);
|
||||
|
||||
text=ParseTextBlock(ele,"username",true);
|
||||
if (text)
|
||||
QSDatabaseUsername=text;
|
||||
|
||||
text=ParseTextBlock(ele,"password",true);
|
||||
if (text)
|
||||
QSDatabasePassword=text;
|
||||
|
||||
text=ParseTextBlock(ele,"db",true);
|
||||
if (text)
|
||||
QSDatabaseDB=text;
|
||||
text = ParseTextBlock(ele, "host", true);
|
||||
if (text) {
|
||||
QSDatabaseHost = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "port", true);
|
||||
if (text) {
|
||||
QSDatabasePort = atoi(text);
|
||||
}
|
||||
text = ParseTextBlock(ele, "username", true);
|
||||
if (text) {
|
||||
QSDatabaseUsername = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "password", true);
|
||||
if (text) {
|
||||
QSDatabasePassword = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "db", true);
|
||||
if (text) {
|
||||
QSDatabaseDB = text;
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_zones(TiXmlElement *ele) {
|
||||
void EQEmuConfig::do_zones(TiXmlElement *ele)
|
||||
{
|
||||
_eqp
|
||||
const char *text;
|
||||
TiXmlElement *sub_ele;
|
||||
// TiXmlNode *node,*sub_node;
|
||||
|
||||
text=ParseTextBlock(ele,"defaultstatus",true);
|
||||
if (text)
|
||||
DefaultStatus=atoi(text);
|
||||
|
||||
text = ParseTextBlock(ele, "defaultstatus", true);
|
||||
if (text) {
|
||||
DefaultStatus = atoi(text);
|
||||
}
|
||||
// Get the <ports> element
|
||||
sub_ele = ele->FirstChildElement("ports");
|
||||
if(sub_ele != nullptr) {
|
||||
|
||||
if (sub_ele != nullptr) {
|
||||
text = sub_ele->Attribute("low");
|
||||
if (text)
|
||||
ZonePortLow=atoi(text);;
|
||||
|
||||
if (text) {
|
||||
ZonePortLow = atoi(text);
|
||||
};
|
||||
text = sub_ele->Attribute("high");
|
||||
if (text)
|
||||
ZonePortHigh=atoi(text);
|
||||
if (text) {
|
||||
ZonePortHigh = atoi(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_files(TiXmlElement *ele) {
|
||||
void EQEmuConfig::do_files(TiXmlElement *ele)
|
||||
{
|
||||
_eqp
|
||||
const char *text;
|
||||
|
||||
text=ParseTextBlock(ele,"spells",true);
|
||||
if (text)
|
||||
SpellsFile=text;
|
||||
|
||||
text=ParseTextBlock(ele,"opcodes",true);
|
||||
if (text)
|
||||
OpCodesFile=text;
|
||||
|
||||
text=ParseTextBlock(ele,"logsettings",true);
|
||||
if (text)
|
||||
LogSettingsFile=text;
|
||||
|
||||
text=ParseTextBlock(ele,"eqtime",true);
|
||||
if (text)
|
||||
EQTimeFile=text;
|
||||
text = ParseTextBlock(ele, "spells", true);
|
||||
if (text) {
|
||||
SpellsFile = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "opcodes", true);
|
||||
if (text) {
|
||||
OpCodesFile = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "eqtime", true);
|
||||
if (text) {
|
||||
EQTimeFile = text;
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_directories(TiXmlElement *ele) {
|
||||
void EQEmuConfig::do_directories(TiXmlElement *ele)
|
||||
{
|
||||
_eqp
|
||||
const char *text;
|
||||
|
||||
text=ParseTextBlock(ele,"maps",true);
|
||||
if (text)
|
||||
MapDir=text;
|
||||
|
||||
text=ParseTextBlock(ele,"quests",true);
|
||||
if (text)
|
||||
QuestDir=text;
|
||||
|
||||
text=ParseTextBlock(ele,"plugins",true);
|
||||
if (text)
|
||||
PluginDir=text;
|
||||
|
||||
text = ParseTextBlock(ele, "maps", true);
|
||||
if (text) {
|
||||
MapDir = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "quests", true);
|
||||
if (text) {
|
||||
QuestDir = text;
|
||||
}
|
||||
text = ParseTextBlock(ele, "plugins", true);
|
||||
if (text) {
|
||||
PluginDir = text;
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuConfig::do_launcher(TiXmlElement *ele) {
|
||||
void EQEmuConfig::do_launcher(TiXmlElement *ele)
|
||||
{
|
||||
_eqp
|
||||
const char *text;
|
||||
TiXmlElement *sub_ele;
|
||||
|
||||
text=ParseTextBlock(ele,"logprefix",true);
|
||||
if (text)
|
||||
text = ParseTextBlock(ele, "logprefix", true);
|
||||
if (text) {
|
||||
LogPrefix = text;
|
||||
|
||||
text=ParseTextBlock(ele,"logsuffix",true);
|
||||
if (text)
|
||||
}
|
||||
text = ParseTextBlock(ele, "logsuffix", true);
|
||||
if (text) {
|
||||
LogSuffix = text;
|
||||
|
||||
}
|
||||
// Get the <exe> element
|
||||
text = ParseTextBlock(ele,"exe",true);
|
||||
if (text)
|
||||
text = ParseTextBlock(ele, "exe", true);
|
||||
if (text) {
|
||||
ZoneExe = text;
|
||||
|
||||
}
|
||||
// Get the <timers> element
|
||||
sub_ele = ele->FirstChildElement("timers");
|
||||
if(sub_ele != nullptr) {
|
||||
if (sub_ele != nullptr) {
|
||||
text = sub_ele->Attribute("restart");
|
||||
if (text)
|
||||
if (text) {
|
||||
RestartWait = atoi(text);
|
||||
|
||||
}
|
||||
text = sub_ele->Attribute("reterminate");
|
||||
if (text)
|
||||
if (text) {
|
||||
TerminateWait = atoi(text);
|
||||
|
||||
}
|
||||
text = sub_ele->Attribute("initial");
|
||||
if (text)
|
||||
if (text) {
|
||||
InitialBootWait = atoi(text);
|
||||
|
||||
}
|
||||
text = sub_ele->Attribute("interval");
|
||||
if (text)
|
||||
if (text) {
|
||||
ZoneBootInterval = atoi(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string EQEmuConfig::GetByName(const std::string &var_name) const {
|
||||
if(var_name == "ShortName")
|
||||
return(ShortName);
|
||||
if(var_name == "LongName")
|
||||
return(LongName);
|
||||
if(var_name == "WorldAddress")
|
||||
return(WorldAddress);
|
||||
if(var_name == "LoginHost")
|
||||
return(LoginHost);
|
||||
if(var_name == "LoginAccount")
|
||||
return(LoginAccount);
|
||||
if(var_name == "LoginPassword")
|
||||
return(LoginPassword);
|
||||
if(var_name == "LoginPort")
|
||||
return(itoa(LoginPort));
|
||||
if(var_name == "Locked")
|
||||
return(Locked?"true":"false");
|
||||
if(var_name == "WorldTCPPort")
|
||||
return(itoa(WorldTCPPort));
|
||||
if(var_name == "WorldIP")
|
||||
return(WorldIP);
|
||||
if(var_name == "TelnetEnabled")
|
||||
return(TelnetEnabled?"true":"false");
|
||||
if(var_name == "WorldHTTPPort")
|
||||
return(itoa(WorldHTTPPort));
|
||||
if(var_name == "WorldHTTPMimeFile")
|
||||
return(WorldHTTPMimeFile);
|
||||
if(var_name == "WorldHTTPEnabled")
|
||||
return(WorldHTTPEnabled?"true":"false");
|
||||
if(var_name == "ChatHost")
|
||||
return(ChatHost);
|
||||
if(var_name == "ChatPort")
|
||||
return(itoa(ChatPort));
|
||||
if(var_name == "MailHost")
|
||||
return(MailHost);
|
||||
if(var_name == "MailPort")
|
||||
return(itoa(MailPort));
|
||||
if(var_name == "DatabaseHost")
|
||||
return(DatabaseHost);
|
||||
if(var_name == "DatabaseUsername")
|
||||
return(DatabaseUsername);
|
||||
if(var_name == "DatabasePassword")
|
||||
return(DatabasePassword);
|
||||
if(var_name == "DatabaseDB")
|
||||
return(DatabaseDB);
|
||||
if(var_name == "DatabasePort")
|
||||
return(itoa(DatabasePort));
|
||||
if(var_name == "QSDatabaseHost")
|
||||
return(QSDatabaseHost);
|
||||
if(var_name == "QSDatabaseUsername")
|
||||
return(QSDatabaseUsername);
|
||||
if(var_name == "QSDatabasePassword")
|
||||
return(QSDatabasePassword);
|
||||
if(var_name == "QSDatabaseDB")
|
||||
return(QSDatabaseDB);
|
||||
if(var_name == "QSDatabasePort")
|
||||
return(itoa(QSDatabasePort));
|
||||
if(var_name == "SpellsFile")
|
||||
return(SpellsFile);
|
||||
if(var_name == "OpCodesFile")
|
||||
return(OpCodesFile);
|
||||
if(var_name == "EQTimeFile")
|
||||
return(EQTimeFile);
|
||||
if(var_name == "LogSettingsFile")
|
||||
return(LogSettingsFile);
|
||||
if(var_name == "MapDir")
|
||||
return(MapDir);
|
||||
if(var_name == "QuestDir")
|
||||
return(QuestDir);
|
||||
if(var_name == "PluginDir")
|
||||
return(PluginDir);
|
||||
if(var_name == "LogPrefix")
|
||||
return(LogPrefix);
|
||||
if(var_name == "LogSuffix")
|
||||
return(LogSuffix);
|
||||
if(var_name == "ZoneExe")
|
||||
return(ZoneExe);
|
||||
if(var_name == "ZonePortLow")
|
||||
return(itoa(ZonePortLow));
|
||||
if(var_name == "ZonePortHigh")
|
||||
return(itoa(ZonePortHigh));
|
||||
if(var_name == "DefaultStatus")
|
||||
return(itoa(DefaultStatus));
|
||||
std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
||||
{
|
||||
_eqp
|
||||
if (var_name == "ShortName") {
|
||||
return (ShortName);
|
||||
}
|
||||
if (var_name == "LongName") {
|
||||
return (LongName);
|
||||
}
|
||||
if (var_name == "WorldAddress") {
|
||||
return (WorldAddress);
|
||||
}
|
||||
if (var_name == "LoginHost") {
|
||||
return (LoginHost);
|
||||
}
|
||||
if (var_name == "LoginAccount") {
|
||||
return (LoginAccount);
|
||||
}
|
||||
if (var_name == "LoginPassword") {
|
||||
return (LoginPassword);
|
||||
}
|
||||
if (var_name == "LoginPort") {
|
||||
return (itoa(LoginPort));
|
||||
}
|
||||
if (var_name == "Locked") {
|
||||
return (Locked ? "true" : "false");
|
||||
}
|
||||
if (var_name == "WorldTCPPort") {
|
||||
return (itoa(WorldTCPPort));
|
||||
}
|
||||
if (var_name == "WorldIP") {
|
||||
return (WorldIP);
|
||||
}
|
||||
if (var_name == "TelnetEnabled") {
|
||||
return (TelnetEnabled ? "true" : "false");
|
||||
}
|
||||
if (var_name == "WorldHTTPPort") {
|
||||
return (itoa(WorldHTTPPort));
|
||||
}
|
||||
if (var_name == "WorldHTTPMimeFile") {
|
||||
return (WorldHTTPMimeFile);
|
||||
}
|
||||
if (var_name == "WorldHTTPEnabled") {
|
||||
return (WorldHTTPEnabled ? "true" : "false");
|
||||
}
|
||||
if (var_name == "ChatHost") {
|
||||
return (ChatHost);
|
||||
}
|
||||
if (var_name == "ChatPort") {
|
||||
return (itoa(ChatPort));
|
||||
}
|
||||
if (var_name == "MailHost") {
|
||||
return (MailHost);
|
||||
}
|
||||
if (var_name == "MailPort") {
|
||||
return (itoa(MailPort));
|
||||
}
|
||||
if (var_name == "DatabaseHost") {
|
||||
return (DatabaseHost);
|
||||
}
|
||||
if (var_name == "DatabaseUsername") {
|
||||
return (DatabaseUsername);
|
||||
}
|
||||
if (var_name == "DatabasePassword") {
|
||||
return (DatabasePassword);
|
||||
}
|
||||
if (var_name == "DatabaseDB") {
|
||||
return (DatabaseDB);
|
||||
}
|
||||
if (var_name == "DatabasePort") {
|
||||
return (itoa(DatabasePort));
|
||||
}
|
||||
if (var_name == "QSDatabaseHost") {
|
||||
return (QSDatabaseHost);
|
||||
}
|
||||
if (var_name == "QSDatabaseUsername") {
|
||||
return (QSDatabaseUsername);
|
||||
}
|
||||
if (var_name == "QSDatabasePassword") {
|
||||
return (QSDatabasePassword);
|
||||
}
|
||||
if (var_name == "QSDatabaseDB") {
|
||||
return (QSDatabaseDB);
|
||||
}
|
||||
if (var_name == "QSDatabasePort") {
|
||||
return (itoa(QSDatabasePort));
|
||||
}
|
||||
if (var_name == "SpellsFile") {
|
||||
return (SpellsFile);
|
||||
}
|
||||
if (var_name == "OpCodesFile") {
|
||||
return (OpCodesFile);
|
||||
}
|
||||
if (var_name == "EQTimeFile") {
|
||||
return (EQTimeFile);
|
||||
}
|
||||
if (var_name == "MapDir") {
|
||||
return (MapDir);
|
||||
}
|
||||
if (var_name == "QuestDir") {
|
||||
return (QuestDir);
|
||||
}
|
||||
if (var_name == "PluginDir") {
|
||||
return (PluginDir);
|
||||
}
|
||||
if (var_name == "LogPrefix") {
|
||||
return (LogPrefix);
|
||||
}
|
||||
if (var_name == "LogSuffix") {
|
||||
return (LogSuffix);
|
||||
}
|
||||
if (var_name == "ZoneExe") {
|
||||
return (ZoneExe);
|
||||
}
|
||||
if (var_name == "ZonePortLow") {
|
||||
return (itoa(ZonePortLow));
|
||||
}
|
||||
if (var_name == "ZonePortHigh") {
|
||||
return (itoa(ZonePortHigh));
|
||||
}
|
||||
if (var_name == "DefaultStatus") {
|
||||
return (itoa(DefaultStatus));
|
||||
}
|
||||
// if(var_name == "DynamicCount")
|
||||
// return(itoa(DynamicCount));
|
||||
return("");
|
||||
return ("");
|
||||
}
|
||||
|
||||
void EQEmuConfig::Dump() const
|
||||
{
|
||||
_eqp
|
||||
std::cout << "ShortName = " << ShortName << std::endl;
|
||||
std::cout << "LongName = " << LongName << std::endl;
|
||||
std::cout << "WorldAddress = " << WorldAddress << std::endl;
|
||||
@@ -436,7 +487,6 @@ void EQEmuConfig::Dump() const
|
||||
std::cout << "SpellsFile = " << SpellsFile << std::endl;
|
||||
std::cout << "OpCodesFile = " << OpCodesFile << std::endl;
|
||||
std::cout << "EQTimeFile = " << EQTimeFile << std::endl;
|
||||
std::cout << "LogSettingsFile = " << LogSettingsFile << std::endl;
|
||||
std::cout << "MapDir = " << MapDir << std::endl;
|
||||
std::cout << "QuestDir = " << QuestDir << std::endl;
|
||||
std::cout << "PluginDir = " << PluginDir << std::endl;
|
||||
|
||||
+158
-168
@@ -1,4 +1,4 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -28,200 +28,190 @@ struct LoginConfig {
|
||||
uint16 LoginPort;
|
||||
};
|
||||
|
||||
class EQEmuConfig : public XMLParser {
|
||||
public:
|
||||
virtual std::string GetByName(const std::string &var_name) const;
|
||||
class EQEmuConfig : public XMLParser
|
||||
{
|
||||
public:
|
||||
virtual std::string GetByName(const std::string &var_name) const;
|
||||
|
||||
// From <world/>
|
||||
std::string ShortName;
|
||||
std::string LongName;
|
||||
std::string WorldAddress;
|
||||
std::string LocalAddress;
|
||||
std::string LoginHost;
|
||||
std::string LoginAccount;
|
||||
std::string LoginPassword;
|
||||
uint16 LoginPort;
|
||||
uint32 LoginCount;
|
||||
LinkedList<LoginConfig*> loginlist;
|
||||
bool Locked;
|
||||
uint16 WorldTCPPort;
|
||||
std::string WorldIP;
|
||||
bool TelnetEnabled;
|
||||
int32 MaxClients;
|
||||
bool WorldHTTPEnabled;
|
||||
uint16 WorldHTTPPort;
|
||||
std::string WorldHTTPMimeFile;
|
||||
std::string SharedKey;
|
||||
// From <world/>
|
||||
std::string ShortName;
|
||||
std::string LongName;
|
||||
std::string WorldAddress;
|
||||
std::string LocalAddress;
|
||||
std::string LoginHost;
|
||||
std::string LoginAccount;
|
||||
std::string LoginPassword;
|
||||
uint16 LoginPort;
|
||||
uint32 LoginCount;
|
||||
LinkedList<LoginConfig*> loginlist;
|
||||
bool Locked;
|
||||
uint16 WorldTCPPort;
|
||||
std::string WorldIP;
|
||||
bool TelnetEnabled;
|
||||
int32 MaxClients;
|
||||
bool WorldHTTPEnabled;
|
||||
uint16 WorldHTTPPort;
|
||||
std::string WorldHTTPMimeFile;
|
||||
std::string SharedKey;
|
||||
|
||||
// From <chatserver/>
|
||||
std::string ChatHost;
|
||||
uint16 ChatPort;
|
||||
// From <chatserver/>
|
||||
std::string ChatHost;
|
||||
uint16 ChatPort;
|
||||
|
||||
// From <mailserver/>
|
||||
std::string MailHost;
|
||||
uint16 MailPort;
|
||||
// From <mailserver/>
|
||||
std::string MailHost;
|
||||
uint16 MailPort;
|
||||
|
||||
// From <database/>
|
||||
std::string DatabaseHost;
|
||||
std::string DatabaseUsername;
|
||||
std::string DatabasePassword;
|
||||
std::string DatabaseDB;
|
||||
uint16 DatabasePort;
|
||||
// From <database/>
|
||||
std::string DatabaseHost;
|
||||
std::string DatabaseUsername;
|
||||
std::string DatabasePassword;
|
||||
std::string DatabaseDB;
|
||||
uint16 DatabasePort;
|
||||
|
||||
// From <qsdatabase> // QueryServ
|
||||
std::string QSDatabaseHost;
|
||||
std::string QSDatabaseUsername;
|
||||
std::string QSDatabasePassword;
|
||||
std::string QSDatabaseDB;
|
||||
uint16 QSDatabasePort;
|
||||
// From <qsdatabase> // QueryServ
|
||||
std::string QSDatabaseHost;
|
||||
std::string QSDatabaseUsername;
|
||||
std::string QSDatabasePassword;
|
||||
std::string QSDatabaseDB;
|
||||
uint16 QSDatabasePort;
|
||||
|
||||
// From <files/>
|
||||
std::string SpellsFile;
|
||||
std::string OpCodesFile;
|
||||
std::string EQTimeFile;
|
||||
std::string LogSettingsFile;
|
||||
// From <files/>
|
||||
std::string SpellsFile;
|
||||
std::string OpCodesFile;
|
||||
std::string EQTimeFile;
|
||||
|
||||
// From <directories/>
|
||||
std::string MapDir;
|
||||
std::string QuestDir;
|
||||
std::string PluginDir;
|
||||
// From <directories/>
|
||||
std::string MapDir;
|
||||
std::string QuestDir;
|
||||
std::string PluginDir;
|
||||
|
||||
// From <launcher/>
|
||||
std::string LogPrefix;
|
||||
std::string LogSuffix;
|
||||
std::string ZoneExe;
|
||||
uint32 RestartWait;
|
||||
uint32 TerminateWait;
|
||||
uint32 InitialBootWait;
|
||||
uint32 ZoneBootInterval;
|
||||
// From <launcher/>
|
||||
std::string LogPrefix;
|
||||
std::string LogSuffix;
|
||||
std::string ZoneExe;
|
||||
uint32 RestartWait;
|
||||
uint32 TerminateWait;
|
||||
uint32 InitialBootWait;
|
||||
uint32 ZoneBootInterval;
|
||||
|
||||
// From <zones/>
|
||||
uint16 ZonePortLow;
|
||||
uint16 ZonePortHigh;
|
||||
uint8 DefaultStatus;
|
||||
// From <zones/>
|
||||
uint16 ZonePortLow;
|
||||
uint16 ZonePortHigh;
|
||||
uint8 DefaultStatus;
|
||||
|
||||
// uint16 DynamicCount;
|
||||
|
||||
// map<string,uint16> StaticZones;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
static EQEmuConfig *_config;
|
||||
static EQEmuConfig *_config;
|
||||
|
||||
static std::string ConfigFile;
|
||||
static std::string ConfigFile;
|
||||
|
||||
#define ELEMENT(name) \
|
||||
void do_##name(TiXmlElement *ele);
|
||||
#include "eqemu_config_elements.h"
|
||||
#include "eqemu_config_elements.h"
|
||||
|
||||
|
||||
EQEmuConfig() {
|
||||
// import the needed handler prototypes
|
||||
EQEmuConfig()
|
||||
{
|
||||
// import the needed handler prototypes
|
||||
#define ELEMENT(name) \
|
||||
Handlers[#name]=(ElementHandler)&EQEmuConfig::do_##name;
|
||||
#include "eqemu_config_elements.h"
|
||||
Handlers[#name]=(ElementHandler)&EQEmuConfig::do_##name;
|
||||
#include "eqemu_config_elements.h"
|
||||
// Set sane defaults
|
||||
// Login server
|
||||
LoginHost = "eqemulator.net";
|
||||
LoginPort = 5998;
|
||||
// World
|
||||
Locked = false;
|
||||
WorldTCPPort = 9000;
|
||||
TelnetEnabled = false;
|
||||
WorldHTTPEnabled = false;
|
||||
WorldHTTPPort = 9080;
|
||||
WorldHTTPMimeFile = "mime.types";
|
||||
SharedKey = ""; //blank disables authentication
|
||||
// Mail
|
||||
ChatHost = "eqchat.eqemulator.net";
|
||||
ChatPort = 7778;
|
||||
// Mail
|
||||
MailHost = "eqmail.eqemulator.net";
|
||||
MailPort = 7779;
|
||||
// Mysql
|
||||
DatabaseHost = "localhost";
|
||||
DatabasePort = 3306;
|
||||
DatabaseUsername = "eq";
|
||||
DatabasePassword = "eq";
|
||||
DatabaseDB = "eq";
|
||||
// QueryServ Database
|
||||
QSDatabaseHost = "localhost";
|
||||
QSDatabasePort = 3306;
|
||||
QSDatabaseUsername = "eq";
|
||||
QSDatabasePassword = "eq";
|
||||
QSDatabaseDB = "eq";
|
||||
// Files
|
||||
SpellsFile = "spells_us.txt";
|
||||
OpCodesFile = "opcodes.conf";
|
||||
EQTimeFile = "eqtime.cfg";
|
||||
// Dirs
|
||||
MapDir = "Maps";
|
||||
QuestDir = "quests";
|
||||
PluginDir = "plugins";
|
||||
// Launcher
|
||||
LogPrefix = "logs/zone-";
|
||||
LogSuffix = ".log";
|
||||
RestartWait = 10000; //milliseconds
|
||||
TerminateWait = 10000; //milliseconds
|
||||
InitialBootWait = 20000; //milliseconds
|
||||
ZoneBootInterval = 2000; //milliseconds
|
||||
#ifdef WIN32
|
||||
ZoneExe = "zone.exe";
|
||||
#else
|
||||
ZoneExe = "./zone";
|
||||
#endif
|
||||
// Zones
|
||||
ZonePortLow = 7000;
|
||||
ZonePortHigh = 7999;
|
||||
DefaultStatus = 0;
|
||||
// For where zones need to connect to.
|
||||
WorldIP = "127.0.0.1";
|
||||
// Dynamics to start
|
||||
//DynamicCount=5;
|
||||
MaxClients = -1;
|
||||
LoginCount = 0;
|
||||
}
|
||||
virtual ~EQEmuConfig() {}
|
||||
|
||||
// Set sane defaults
|
||||
public:
|
||||
|
||||
// Login server
|
||||
LoginHost="eqemulator.net";
|
||||
LoginPort=5998;
|
||||
// Produce a const singleton
|
||||
static const EQEmuConfig *get()
|
||||
{
|
||||
if (_config == nullptr) {
|
||||
LoadConfig();
|
||||
}
|
||||
return (_config);
|
||||
}
|
||||
|
||||
// World
|
||||
Locked=false;
|
||||
WorldTCPPort=9000;
|
||||
TelnetEnabled=false;
|
||||
WorldHTTPEnabled=false;
|
||||
WorldHTTPPort=9080;
|
||||
WorldHTTPMimeFile="mime.types";
|
||||
SharedKey = ""; //blank disables authentication
|
||||
// Allow the use to set the conf file to be used.
|
||||
static void SetConfigFile(std::string file)
|
||||
{
|
||||
EQEmuConfig::ConfigFile = file;
|
||||
}
|
||||
|
||||
// Mail
|
||||
ChatHost="eqchat.eqemulator.net";
|
||||
ChatPort=7778;
|
||||
// Load the config
|
||||
static bool LoadConfig()
|
||||
{
|
||||
if (_config != nullptr) {
|
||||
delete _config;
|
||||
}
|
||||
_config = new EQEmuConfig;
|
||||
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(), "server");
|
||||
}
|
||||
|
||||
// Mail
|
||||
MailHost="eqmail.eqemulator.net";
|
||||
MailPort=7779;
|
||||
|
||||
// Mysql
|
||||
DatabaseHost="localhost";
|
||||
DatabasePort=3306;
|
||||
DatabaseUsername="eq";
|
||||
DatabasePassword="eq";
|
||||
DatabaseDB="eq";
|
||||
|
||||
// QueryServ Database
|
||||
QSDatabaseHost="localhost";
|
||||
QSDatabasePort=3306;
|
||||
QSDatabaseUsername="eq";
|
||||
QSDatabasePassword="eq";
|
||||
QSDatabaseDB="eq";
|
||||
|
||||
// Files
|
||||
SpellsFile="spells_us.txt";
|
||||
OpCodesFile="opcodes.conf";
|
||||
EQTimeFile="eqtime.cfg";
|
||||
LogSettingsFile="log.ini";
|
||||
|
||||
// Dirs
|
||||
MapDir="Maps";
|
||||
QuestDir="quests";
|
||||
PluginDir="plugins";
|
||||
|
||||
// Launcher
|
||||
LogPrefix = "logs/zone-";
|
||||
LogSuffix = ".log";
|
||||
RestartWait = 10000; //milliseconds
|
||||
TerminateWait = 10000; //milliseconds
|
||||
InitialBootWait = 20000; //milliseconds
|
||||
ZoneBootInterval = 2000; //milliseconds
|
||||
#ifdef WIN32
|
||||
ZoneExe = "zone.exe";
|
||||
#else
|
||||
ZoneExe = "./zone";
|
||||
#endif
|
||||
|
||||
// Zones
|
||||
ZonePortLow=7000;
|
||||
ZonePortHigh=7999;
|
||||
DefaultStatus=0;
|
||||
|
||||
// For where zones need to connect to.
|
||||
WorldIP="127.0.0.1";
|
||||
|
||||
// Dynamics to start
|
||||
//DynamicCount=5;
|
||||
|
||||
MaxClients=-1;
|
||||
|
||||
LoginCount=0;
|
||||
|
||||
}
|
||||
virtual ~EQEmuConfig() {}
|
||||
|
||||
public:
|
||||
|
||||
// Produce a const singleton
|
||||
static const EQEmuConfig *get() {
|
||||
if (_config == nullptr)
|
||||
LoadConfig();
|
||||
return(_config);
|
||||
}
|
||||
|
||||
// Allow the use to set the conf file to be used.
|
||||
static void SetConfigFile(std::string file) { EQEmuConfig::ConfigFile = file; }
|
||||
|
||||
// Load the config
|
||||
static bool LoadConfig() {
|
||||
if (_config != nullptr)
|
||||
delete _config;
|
||||
_config=new EQEmuConfig;
|
||||
|
||||
return _config->ParseFile(EQEmuConfig::ConfigFile.c_str(),"server");
|
||||
}
|
||||
|
||||
void Dump() const;
|
||||
void Dump() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2006 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#include "eqemu_error.h"
|
||||
#include "linked_list.h"
|
||||
#include "mutex.h"
|
||||
#include "misc_functions.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef _WINDOWS
|
||||
#include <conio.h>
|
||||
#endif
|
||||
|
||||
void UpdateWindowTitle(char* iNewTitle = 0);
|
||||
void CatchSignal(int sig_num);
|
||||
|
||||
const char* EQEMuErrorText[EQEMuError_MaxErrorID] = { "ErrorID# 0, No Error",
|
||||
"MySQL Error #1405 or #2001 means your mysql server rejected the username and password you presented it.",
|
||||
"MySQL Error #2003 means you were unable to connect to the mysql server.",
|
||||
"MySQL Error #2005 means you there are too many connections on the mysql server. The server is overloaded.",
|
||||
"MySQL Error #2007 means you the server is out of memory. The server is overloaded.",
|
||||
};
|
||||
|
||||
LinkedList<char*>* EQEMuErrorList;
|
||||
Mutex* MEQEMuErrorList;
|
||||
AutoDelete< LinkedList<char*> > ADEQEMuErrorList(&EQEMuErrorList);
|
||||
AutoDelete<Mutex> ADMEQEMuErrorList(&MEQEMuErrorList);
|
||||
|
||||
const char* GetErrorText(uint32 iError) {
|
||||
if (iError >= EQEMuError_MaxErrorID)
|
||||
return "ErrorID# out of range";
|
||||
else
|
||||
return EQEMuErrorText[iError];
|
||||
}
|
||||
|
||||
void AddEQEMuError(eEQEMuError iError, bool iExitNow) {
|
||||
if (!iError)
|
||||
return;
|
||||
if (!EQEMuErrorList) {
|
||||
EQEMuErrorList = new LinkedList<char*>;
|
||||
MEQEMuErrorList = new Mutex;
|
||||
}
|
||||
LockMutex lock(MEQEMuErrorList);
|
||||
|
||||
LinkedListIterator<char*> iterator(*EQEMuErrorList);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (iterator.GetData()[0] == 1) {
|
||||
//Umm... this gets a big WTF...
|
||||
// if (*((uint32*) iterator.GetData()[1]) == iError)
|
||||
//not sure whats going on, using a character as a pointer....
|
||||
if (*((eEQEMuError*) &(iterator.GetData()[1])) == iError)
|
||||
return;
|
||||
}
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
char* tmp = new char[6];
|
||||
tmp[0] = 1;
|
||||
tmp[5] = 0;
|
||||
*((uint32*) &tmp[1]) = iError;
|
||||
EQEMuErrorList->Append(tmp);
|
||||
|
||||
if (iExitNow)
|
||||
CatchSignal(2);
|
||||
}
|
||||
|
||||
void AddEQEMuError(char* iError, bool iExitNow) {
|
||||
if (!iError)
|
||||
return;
|
||||
if (!EQEMuErrorList) {
|
||||
EQEMuErrorList = new LinkedList<char*>;
|
||||
MEQEMuErrorList = new Mutex;
|
||||
}
|
||||
LockMutex lock(MEQEMuErrorList);
|
||||
char* tmp = strcpy(new char[strlen(iError) + 1], iError);
|
||||
EQEMuErrorList->Append(tmp);
|
||||
|
||||
if (iExitNow)
|
||||
CatchSignal(2);
|
||||
}
|
||||
|
||||
uint32 CheckEQEMuError() {
|
||||
if (!EQEMuErrorList)
|
||||
return 0;
|
||||
uint32 ret = 0;
|
||||
char* tmp = 0;
|
||||
bool HeaderPrinted = false;
|
||||
LockMutex lock(MEQEMuErrorList);
|
||||
|
||||
while ((tmp = EQEMuErrorList->Pop() )) {
|
||||
if (!HeaderPrinted) {
|
||||
fprintf(stdout, "===============================\nRuntime errors:\n\n");
|
||||
HeaderPrinted = true;
|
||||
}
|
||||
if (tmp[0] == 1) {
|
||||
fprintf(stdout, "%s\n", GetErrorText(*((uint32*) &tmp[1])));
|
||||
fprintf(stdout, "For more information on this error, visit http://www.eqemu.net/eqemuerror.php?id=%u\n\n", *((uint32*) &tmp[1]));
|
||||
}
|
||||
else {
|
||||
fprintf(stdout, "%s\n\n", tmp);
|
||||
}
|
||||
safe_delete(tmp);
|
||||
ret++;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CheckEQEMuErrorAndPause() {
|
||||
#ifdef _WINDOWS
|
||||
if (CheckEQEMuError()) {
|
||||
fprintf(stdout, "Hit any key to exit\n");
|
||||
UpdateWindowTitle("Error");
|
||||
getch();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -0,0 +1,353 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "eqemu_logsys.h"
|
||||
#include "platform.h"
|
||||
#include "string_util.h"
|
||||
#include "database.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
std::ofstream process_log;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <direct.h>
|
||||
#include <conio.h>
|
||||
#include <iostream>
|
||||
#include <dos.h>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
/* Linux ANSI console color defines */
|
||||
#define LC_RESET "\033[0m"
|
||||
#define LC_BLACK "\033[30m" /* Black */
|
||||
#define LC_RED "\033[31m" /* Red */
|
||||
#define LC_GREEN "\033[32m" /* Green */
|
||||
#define LC_YELLOW "\033[33m" /* Yellow */
|
||||
#define LC_BLUE "\033[34m" /* Blue */
|
||||
#define LC_MAGENTA "\033[35m" /* Magenta */
|
||||
#define LC_CYAN "\033[36m" /* Cyan */
|
||||
#define LC_WHITE "\033[37m" /* White */
|
||||
|
||||
namespace Console {
|
||||
enum Color {
|
||||
Black = 0,
|
||||
Blue = 1,
|
||||
Green = 2,
|
||||
Cyan = 3,
|
||||
Red = 4,
|
||||
Magenta = 5,
|
||||
Brown = 6,
|
||||
LightGray = 7,
|
||||
DarkGray = 8,
|
||||
LightBlue = 9,
|
||||
LightGreen = 10,
|
||||
LightCyan = 11,
|
||||
LightRed = 12,
|
||||
LightMagenta = 13,
|
||||
Yellow = 14,
|
||||
White = 15
|
||||
};
|
||||
}
|
||||
|
||||
EQEmuLogSys::EQEmuLogSys()
|
||||
{
|
||||
on_log_gmsay_hook = [](uint16 log_type, const std::string&) {};
|
||||
bool file_logs_enabled = false;
|
||||
int log_platform = 0;
|
||||
}
|
||||
|
||||
EQEmuLogSys::~EQEmuLogSys()
|
||||
{
|
||||
}
|
||||
|
||||
void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
{
|
||||
/* Get Executable platform currently running this code (Zone/World/etc) */
|
||||
log_platform = GetExecutablePlatformInt();
|
||||
|
||||
/* Zero out Array */
|
||||
memset(log_settings, 0, sizeof(LogSettings) * Logs::LogCategory::MaxCategoryID);
|
||||
|
||||
/* Set Defaults */
|
||||
log_settings[Logs::LoginServer].log_to_console = Logs::General;
|
||||
log_settings[Logs::World_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::Zone_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::QS_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::UCS_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::Crash].log_to_console = Logs::General;
|
||||
log_settings[Logs::MySQLError].log_to_console = Logs::General;
|
||||
|
||||
/* Declare process file names for log writing
|
||||
If there is no process_file_name declared, no log file will be written, simply
|
||||
*/
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld)
|
||||
platform_file_name = "world";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformQueryServ)
|
||||
platform_file_name = "query_server";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
||||
platform_file_name = "zone";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformUCS)
|
||||
platform_file_name = "ucs";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLogin)
|
||||
platform_file_name = "login";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLaunch)
|
||||
platform_file_name = "launcher";
|
||||
}
|
||||
|
||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message)
|
||||
{
|
||||
std::string category_string;
|
||||
if (log_category > 0 && Logs::LogCategoryName[log_category])
|
||||
category_string = StringFormat("[%s] ", Logs::LogCategoryName[log_category]);
|
||||
return StringFormat("%s%s", category_string.c_str(), in_message.c_str());
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_gmsay == 0)
|
||||
return;
|
||||
|
||||
/* Enabling Netcode based GMSay output creates a feedback loop that ultimately ends in a crash */
|
||||
if (log_category == Logs::LogCategory::Netcode)
|
||||
return;
|
||||
|
||||
/* Make sure the message inbound is at a debug level we're set at */
|
||||
if (log_settings[log_category].log_to_gmsay < debug_level)
|
||||
return;
|
||||
|
||||
/* Check to see if the process that actually ran this is zone */
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone)
|
||||
on_log_gmsay_hook(log_category, message);
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
if (log_category == Logs::Crash) {
|
||||
char time_stamp[80];
|
||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||
std::ofstream crash_log;
|
||||
EQEmuLogSys::MakeDirectory("logs/crashes");
|
||||
crash_log.open(StringFormat("logs/crashes/crash_%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
crash_log << time_stamp << " " << message << "\n";
|
||||
crash_log.close();
|
||||
}
|
||||
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_file == 0)
|
||||
return;
|
||||
|
||||
/* Make sure the message inbound is at a debug level we're set at */
|
||||
if (log_settings[log_category].log_to_file < debug_level)
|
||||
return;
|
||||
|
||||
char time_stamp[80];
|
||||
EQEmuLogSys::SetCurrentTimeStamp(time_stamp);
|
||||
|
||||
if (process_log)
|
||||
process_log << time_stamp << " " << message << std::endl;
|
||||
}
|
||||
|
||||
uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category) {
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
return Console::Color::Yellow;
|
||||
case Logs::MySQLError:
|
||||
case Logs::Error:
|
||||
return Console::Color::LightRed;
|
||||
case Logs::MySQLQuery:
|
||||
case Logs::Debug:
|
||||
return Console::Color::LightGreen;
|
||||
case Logs::Quests:
|
||||
return Console::Color::LightCyan;
|
||||
case Logs::Commands:
|
||||
case Logs::Mercenaries:
|
||||
return Console::Color::LightMagenta;
|
||||
case Logs::Crash:
|
||||
return Console::Color::LightRed;
|
||||
default:
|
||||
return Console::Color::Yellow;
|
||||
}
|
||||
}
|
||||
|
||||
std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category) {
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
return LC_YELLOW;
|
||||
case Logs::MySQLError:
|
||||
case Logs::Error:
|
||||
return LC_RED;
|
||||
case Logs::MySQLQuery:
|
||||
case Logs::Debug:
|
||||
return LC_GREEN;
|
||||
case Logs::Quests:
|
||||
return LC_CYAN;
|
||||
case Logs::Commands:
|
||||
case Logs::Mercenaries:
|
||||
return LC_MAGENTA;
|
||||
case Logs::Crash:
|
||||
return LC_RED;
|
||||
default:
|
||||
return LC_YELLOW;
|
||||
}
|
||||
}
|
||||
|
||||
uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category) {
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
return 15; /* Yellow */
|
||||
case Logs::MySQLError:
|
||||
case Logs::Error:
|
||||
return 13; /* Red */
|
||||
case Logs::MySQLQuery:
|
||||
case Logs::Debug:
|
||||
return 14; /* Light Green */
|
||||
case Logs::Quests:
|
||||
return 258; /* Light Cyan */
|
||||
case Logs::Commands:
|
||||
case Logs::Mercenaries:
|
||||
return 5; /* Light Purple */
|
||||
case Logs::Crash:
|
||||
return 13; /* Red */
|
||||
default:
|
||||
return 15; /* Yellow */
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuLogSys::ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message)
|
||||
{
|
||||
/* Check if category enabled for process */
|
||||
if (log_settings[log_category].log_to_console == 0)
|
||||
return;
|
||||
|
||||
/* Make sure the message inbound is at a debug level we're set at */
|
||||
if (log_settings[log_category].log_to_console < debug_level)
|
||||
return;
|
||||
|
||||
#ifdef _WINDOWS
|
||||
HANDLE console_handle;
|
||||
console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
CONSOLE_FONT_INFOEX info = { 0 };
|
||||
info.cbSize = sizeof(info);
|
||||
info.dwFontSize.Y = 12; // leave X as zero
|
||||
info.FontWeight = FW_NORMAL;
|
||||
wcscpy(info.FaceName, L"Lucida Console");
|
||||
SetCurrentConsoleFontEx(console_handle, NULL, &info);
|
||||
SetConsoleTextAttribute(console_handle, EQEmuLogSys::GetWindowsConsoleColorFromCategory(log_category));
|
||||
std::cout << message << "\n";
|
||||
SetConsoleTextAttribute(console_handle, Console::Color::White);
|
||||
#else
|
||||
std::cout << EQEmuLogSys::GetLinuxConsoleColorFromCategory(log_category) << message << LC_RESET << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
void EQEmuLogSys::Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...)
|
||||
{
|
||||
_eqp
|
||||
const bool log_to_console = log_settings[log_category].log_to_console > 0;
|
||||
const bool log_to_file = log_settings[log_category].log_to_file > 0;
|
||||
const bool log_to_gmsay = log_settings[log_category].log_to_gmsay > 0;
|
||||
const bool nothing_to_log = !log_to_console && !log_to_file && !log_to_gmsay;
|
||||
|
||||
if (nothing_to_log)
|
||||
return;
|
||||
|
||||
va_list args;
|
||||
va_start(args, message);
|
||||
std::string output_message = vStringFormat(message.c_str(), args);
|
||||
va_end(args);
|
||||
|
||||
std::string output_debug_message = EQEmuLogSys::FormatOutMessageString(log_category, output_message);
|
||||
|
||||
if (log_to_console) EQEmuLogSys::ProcessConsoleMessage(debug_level, log_category, output_debug_message);
|
||||
if (log_to_gmsay) EQEmuLogSys::ProcessGMSay(debug_level, log_category, output_debug_message);
|
||||
if (log_to_file) EQEmuLogSys::ProcessLogWrite(debug_level, log_category, output_debug_message);
|
||||
}
|
||||
|
||||
void EQEmuLogSys::SetCurrentTimeStamp(char* time_stamp)
|
||||
{
|
||||
time_t raw_time;
|
||||
struct tm * time_info;
|
||||
time(&raw_time);
|
||||
time_info = localtime(&raw_time);
|
||||
strftime(time_stamp, 80, "[%m-%d-%Y :: %H:%M:%S]", time_info);
|
||||
}
|
||||
|
||||
void EQEmuLogSys::MakeDirectory(const std::string &directory_name)
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
struct _stat st;
|
||||
if (_stat(directory_name.c_str(), &st) == 0) // exists
|
||||
return;
|
||||
_mkdir(directory_name.c_str());
|
||||
#else
|
||||
struct stat st;
|
||||
if (stat(directory_name.c_str(), &st) == 0) // exists
|
||||
return;
|
||||
mkdir(directory_name.c_str(), 0755);
|
||||
#endif
|
||||
}
|
||||
|
||||
void EQEmuLogSys::CloseFileLogs()
|
||||
{
|
||||
if (process_log.is_open()) {
|
||||
process_log.close();
|
||||
}
|
||||
}
|
||||
|
||||
void EQEmuLogSys::StartFileLogs(const std::string &log_name)
|
||||
{
|
||||
EQEmuLogSys::CloseFileLogs();
|
||||
|
||||
/* When loading settings, we must have been given a reason in category based logging to output to a file in order to even create or open one... */
|
||||
if (file_logs_enabled == false)
|
||||
return;
|
||||
|
||||
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone) {
|
||||
if (!log_name.empty())
|
||||
platform_file_name = log_name;
|
||||
|
||||
if (platform_file_name.empty())
|
||||
return;
|
||||
|
||||
EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.log'", platform_file_name.c_str(), getpid());
|
||||
EQEmuLogSys::MakeDirectory("logs/zone");
|
||||
process_log.open(StringFormat("logs/zone/%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
} else {
|
||||
if (platform_file_name.empty())
|
||||
return;
|
||||
|
||||
EQEmuLogSys::Out(Logs::General, Logs::Status, "Starting File Log 'logs/%s_%i.log'", platform_file_name.c_str(), getpid());
|
||||
process_log.open(StringFormat("logs/%s_%i.log", platform_file_name.c_str(), getpid()), std::ios_base::app | std::ios_base::out);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2015 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY except by those people which sell it, which
|
||||
are required to give you total support for your newly bought product;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_LOGSYS_H
|
||||
#define EQEMU_LOGSYS_H
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <stdio.h>
|
||||
#include <functional>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace Logs {
|
||||
enum DebugLevel {
|
||||
General = 1, /* 1 - Low-Level general debugging, useful info on single line */
|
||||
Moderate, /* 2 - Informational based, used in functions, when particular things load */
|
||||
Detail /* 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication */
|
||||
};
|
||||
|
||||
/*
|
||||
If you add to this, make sure you update LogCategoryName
|
||||
NOTE: Only add to the bottom of the enum because that is the type ID assignment
|
||||
*/
|
||||
|
||||
enum LogCategory {
|
||||
None = 0,
|
||||
AA,
|
||||
AI,
|
||||
Aggro,
|
||||
Attack,
|
||||
Client_Server_Packet,
|
||||
Combat,
|
||||
Commands,
|
||||
Crash,
|
||||
Database,
|
||||
Debug,
|
||||
Doors,
|
||||
Error,
|
||||
Guilds,
|
||||
Inventory,
|
||||
Launcher,
|
||||
LoginServer,
|
||||
Netcode,
|
||||
Normal,
|
||||
Object,
|
||||
Pathing,
|
||||
QS_Server,
|
||||
Quests,
|
||||
Rules,
|
||||
Skills,
|
||||
Spawns,
|
||||
Spells,
|
||||
Status,
|
||||
TCP_Connection,
|
||||
Tasks,
|
||||
Tradeskills,
|
||||
Trading,
|
||||
Tribute,
|
||||
UCS_Server,
|
||||
WebInterface_Server,
|
||||
World_Server,
|
||||
Zone_Server,
|
||||
MySQLError,
|
||||
MySQLQuery,
|
||||
Mercenaries,
|
||||
QuestDebug,
|
||||
Server_Client_Packet,
|
||||
Client_Server_Packet_Unhandled,
|
||||
Server_Client_Packet_With_Dump,
|
||||
Client_Server_Packet_With_Dump,
|
||||
MaxCategoryID /* Don't Remove this*/
|
||||
};
|
||||
|
||||
/* If you add to this, make sure you update LogCategory */
|
||||
static const char* LogCategoryName[LogCategory::MaxCategoryID] = {
|
||||
"",
|
||||
"AA",
|
||||
"AI",
|
||||
"Aggro",
|
||||
"Attack",
|
||||
"Packet :: Client -> Server",
|
||||
"Combat",
|
||||
"Commands",
|
||||
"Crash",
|
||||
"Database",
|
||||
"Debug",
|
||||
"Doors",
|
||||
"Error",
|
||||
"Guilds",
|
||||
"Inventory",
|
||||
"Launcher",
|
||||
"LoginServer",
|
||||
"Netcode",
|
||||
"Normal",
|
||||
"Object",
|
||||
"Pathing",
|
||||
"QS Server",
|
||||
"Quests",
|
||||
"Rules",
|
||||
"Skills",
|
||||
"Spawns",
|
||||
"Spells",
|
||||
"Status",
|
||||
"TCP Connection",
|
||||
"Tasks",
|
||||
"Tradeskills",
|
||||
"Trading",
|
||||
"Tribute",
|
||||
"UCS Server",
|
||||
"WebInterface Server",
|
||||
"World Server",
|
||||
"Zone Server",
|
||||
"MySQLError",
|
||||
"MySQLQuery",
|
||||
"Mercenaries",
|
||||
"Quest Debug",
|
||||
"Packet :: Server -> Client",
|
||||
"Packet :: Client -> Server Unhandled",
|
||||
"Packet :: Server -> Client (Dump)",
|
||||
"Packet :: Client -> Server (Dump)",
|
||||
};
|
||||
}
|
||||
|
||||
class EQEmuLogSys {
|
||||
public:
|
||||
EQEmuLogSys();
|
||||
~EQEmuLogSys();
|
||||
|
||||
void CloseFileLogs(); /* Close File Logs wherever necessary, either at zone shutdown or entire process shutdown for everything else. This should be handled on deconstructor but to be safe we use it anyways. */
|
||||
void LoadLogSettingsDefaults(); /* Initializes log_settings and sets some defaults if DB is not present */
|
||||
void MakeDirectory(const std::string &directory_name); /* Platform independent way of performing a MakeDirectory based on name */
|
||||
/*
|
||||
The one and only Logging function that uses a debug level as a parameter, as well as a log_category
|
||||
log_category - defined in Logs::LogCategory::[]
|
||||
log_category name resolution works by passing the enum int ID to Logs::LogCategoryName[category_id]
|
||||
|
||||
Example: EQEmuLogSys::Out(Logs::General, Logs::Guilds, "This guild has no leader present");
|
||||
- This would pipe the same category and debug level to all output formats, but the internal memory reference of log_settings would
|
||||
be checked against to see if that piped output is set to actually process it for the category and debug level
|
||||
*/
|
||||
void Out(Logs::DebugLevel debug_level, uint16 log_category, std::string message, ...);
|
||||
void SetCurrentTimeStamp(char* time_stamp); /* Used in file logs to prepend a timestamp entry for logs */
|
||||
void StartFileLogs(const std::string &log_name = ""); /* Used to declare the processes file log and to keep it open for later use */
|
||||
|
||||
/*
|
||||
LogSettings Struct
|
||||
|
||||
This struct is the master reference for all settings for each category, and for each output
|
||||
|
||||
log_to_file[category_id] = [1-3] - Sets debug level for category to output to file
|
||||
log_to_console[category_id] = [1-3] - Sets debug level for category to output to console
|
||||
log_to_gmsay[category_id] = [1-3] - Sets debug level for category to output to gmsay
|
||||
*/
|
||||
|
||||
struct LogSettings {
|
||||
uint8 log_to_file;
|
||||
uint8 log_to_console;
|
||||
uint8 log_to_gmsay;
|
||||
uint8 is_category_enabled; /* When any log output in a category > 0, set this to 1 as (Enabled) */
|
||||
};
|
||||
|
||||
/* Internally used memory reference for all log settings per category.
|
||||
These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults.
|
||||
Database loaded via Database::LoadLogSettings(log_settings)
|
||||
*/
|
||||
LogSettings log_settings[Logs::LogCategory::MaxCategoryID];
|
||||
|
||||
bool file_logs_enabled; /* Set when log settings are loaded to determine if keeping a file open is necessary */
|
||||
|
||||
int log_platform; /* Sets Executable platform (Zone/World/UCS) etc. */
|
||||
|
||||
std::string platform_file_name; /* File name used in writing logs */
|
||||
|
||||
uint16 GetGMSayColorFromCategory(uint16 log_category); /* GMSay Client Message colors mapped by category */
|
||||
|
||||
void OnLogHookCallBackZone(std::function<void(uint16 log_type, const std::string&)> f) { on_log_gmsay_hook = f; }
|
||||
|
||||
private:
|
||||
std::function<void(uint16 log_category, const std::string&)> on_log_gmsay_hook; /* Callback pointer to zone process for hooking logs to zone using GMSay */
|
||||
std::string FormatOutMessageString(uint16 log_category, const std::string &in_message); /* Formats log messages like '[Category] This is a log message' */
|
||||
std::string GetLinuxConsoleColorFromCategory(uint16 log_category); /* Linux console color messages mapped by category */
|
||||
|
||||
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category); /* Windows console color messages mapped by category */
|
||||
|
||||
void ProcessConsoleMessage(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessConsoleMessage called via Log.Out */
|
||||
void ProcessGMSay(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessGMSay called via Log.Out */
|
||||
void ProcessLogWrite(uint16 debug_level, uint16 log_category, const std::string &message); /* ProcessLogWrite called via Log.Out */
|
||||
};
|
||||
|
||||
extern EQEmuLogSys Log;
|
||||
|
||||
#endif
|
||||
+5
-6
@@ -17,7 +17,8 @@
|
||||
*/
|
||||
|
||||
#include <fstream>
|
||||
#include "../common/debug.h"
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/eqtime.h"
|
||||
#include "../common/eq_packet_structs.h"
|
||||
#include <memory.h>
|
||||
@@ -140,11 +141,10 @@ bool EQTime::saveFile(const char *filename)
|
||||
of.open(filename);
|
||||
if(!of)
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename);
|
||||
Log.Out(Logs::General, Logs::Error, "EQTime::saveFile failed: Unable to open file '%s'", filename);
|
||||
return false;
|
||||
}
|
||||
//Enable for debugging
|
||||
//std::cout << "SAVE: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << std::endl;
|
||||
of << EQT_VERSION << std::endl;
|
||||
of << (long)eqTime.start_eqtime.day << std::endl;
|
||||
of << (long)eqTime.start_eqtime.hour << std::endl;
|
||||
@@ -164,14 +164,14 @@ bool EQTime::loadFile(const char *filename)
|
||||
in.open(filename);
|
||||
if(!in)
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "Could not load EQTime file %s", filename);
|
||||
Log.Out(Logs::General, Logs::Error, "Could not load EQTime file %s", filename);
|
||||
return false;
|
||||
}
|
||||
in >> version;
|
||||
in.ignore(80, '\n');
|
||||
if(version != EQT_VERSION)
|
||||
{
|
||||
LogFile->write(EQEMuLog::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION);
|
||||
Log.Out(Logs::General, Logs::Error, "'%s' is NOT a valid EQTime file. File version is %i, EQTime version is %i", filename, version, EQT_VERSION);
|
||||
return false;
|
||||
}
|
||||
//in >> eqTime.start_eqtime.day;
|
||||
@@ -194,7 +194,6 @@ bool EQTime::loadFile(const char *filename)
|
||||
in.ignore(80, '\n');
|
||||
in >> eqTime.start_realtime;
|
||||
//Enable for debugging...
|
||||
//std::cout << "LOAD: day=" << (long)eqTime.start_eqtime.day << ";hour=" << (long)eqTime.start_eqtime.hour << ";min=" << (long)eqTime.start_eqtime.minute << ";mon=" << (long)eqTime.start_eqtime.month << ";yr=" << eqTime.start_eqtime.year << ";timet=" << eqTime.start_realtime << std::endl;
|
||||
in.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "debug.h"
|
||||
#include "global_define.h"
|
||||
#include "extprofile.h"
|
||||
|
||||
//Set defaults in the extended profile...
|
||||
@@ -26,6 +26,7 @@ void InitExtendedProfile(ExtendedProfile_Struct *p) {
|
||||
}
|
||||
|
||||
bool SetExtendedProfile(ExtendedProfile_Struct *to, char *old, unsigned int len) {
|
||||
_eqp
|
||||
if(len == 0 || old == nullptr) {
|
||||
//handle old chars without an extended profile...
|
||||
InitExtendedProfile(to);
|
||||
|
||||
+17
-18
@@ -21,7 +21,6 @@
|
||||
#include "eq_packet_structs.h"
|
||||
#include "item.h"
|
||||
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
/*
|
||||
@@ -37,24 +36,24 @@
|
||||
*/
|
||||
struct ExtendedProfile_Struct {
|
||||
// Pet stuff
|
||||
uint16 pet_id;
|
||||
uint16 old_pet_hp;
|
||||
uint16 old_pet_mana;
|
||||
SpellBuff_Struct pet_buffs[BUFF_COUNT];
|
||||
uint32 pet_items[_MaterialCount];
|
||||
char merc_name[64];
|
||||
uint16 pet_id; /* Not Used */
|
||||
uint16 old_pet_hp; /* Not Used */
|
||||
uint16 old_pet_mana; /* Not Used */
|
||||
SpellBuff_Struct pet_buffs[BUFF_COUNT]; /* Not Used */
|
||||
uint32 pet_items[_MaterialCount]; /* Not Used */
|
||||
char merc_name[64]; /* Used */
|
||||
|
||||
uint32 aa_effects;
|
||||
uint32 perAA; //% of exp going to AAs
|
||||
uint32 expended_aa; // Total of expended AA
|
||||
uint32 pet_hp;
|
||||
uint32 pet_mana;
|
||||
uint32 mercTemplateID;
|
||||
uint32 mercSuspendedTime;
|
||||
bool mercIsSuspended;
|
||||
uint32 mercTimerRemaining;
|
||||
uint8 mercGender;
|
||||
int32 mercState;
|
||||
uint32 aa_effects; /* Used */
|
||||
uint32 perAA; /* Used: % of exp going to AAs */
|
||||
uint32 expended_aa; /* Used: Total of expended AA */
|
||||
uint32 pet_hp; /* Not Used */
|
||||
uint32 pet_mana; /* Not Used */
|
||||
uint32 mercTemplateID; /* Not Used */
|
||||
uint32 mercSuspendedTime; /* Not Used */
|
||||
bool mercIsSuspended; /* Not Used */
|
||||
uint32 mercTimerRemaining; /* Not Used */
|
||||
uint8 mercGender; /* Not Used */
|
||||
int32 mercState; /* Not Used */
|
||||
};
|
||||
|
||||
#pragma pack()
|
||||
|
||||
+120
-89
@@ -1,4 +1,4 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemu.org)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -15,126 +15,157 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "debug.h"
|
||||
|
||||
#include "faction.h"
|
||||
#include "races.h"
|
||||
|
||||
const char *FactionValueToString(FACTION_VALUE fv) {
|
||||
switch(fv) {
|
||||
case FACTION_ALLY:
|
||||
return("Ally");
|
||||
case FACTION_WARMLY:
|
||||
return("Warmly");
|
||||
case FACTION_KINDLY:
|
||||
return("Kindly");
|
||||
case FACTION_AMIABLE:
|
||||
return("Amiable");
|
||||
case FACTION_INDIFFERENT:
|
||||
return("Indifferent");
|
||||
case FACTION_APPREHENSIVE:
|
||||
return("Apprehensive");
|
||||
case FACTION_DUBIOUS:
|
||||
return("Dubious");
|
||||
case FACTION_THREATENLY:
|
||||
return("Threatenly");
|
||||
case FACTION_SCOWLS:
|
||||
return("Scowls, ready to attack.");
|
||||
default:
|
||||
break;
|
||||
const char *FactionValueToString(FACTION_VALUE fv)
|
||||
{
|
||||
_eqp
|
||||
switch (fv) {
|
||||
case FACTION_ALLY:
|
||||
return ("Ally");
|
||||
case FACTION_WARMLY:
|
||||
return ("Warmly");
|
||||
case FACTION_KINDLY:
|
||||
return ("Kindly");
|
||||
case FACTION_AMIABLE:
|
||||
return ("Amiable");
|
||||
case FACTION_INDIFFERENT:
|
||||
return ("Indifferent");
|
||||
case FACTION_APPREHENSIVE:
|
||||
return ("Apprehensive");
|
||||
case FACTION_DUBIOUS:
|
||||
return ("Dubious");
|
||||
case FACTION_THREATENLY:
|
||||
return ("Threatenly");
|
||||
case FACTION_SCOWLS:
|
||||
return ("Scowls, ready to attack.");
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return("Unknown Faction Con");
|
||||
return ("Unknown Faction Con");
|
||||
}
|
||||
|
||||
|
||||
//o--------------------------------------------------------------
|
||||
//| Name: CalculateFaction; rembrant, Dec. 16, 2001
|
||||
//| Name: CalculateFaction; Dec. 16, 2001
|
||||
//o--------------------------------------------------------------
|
||||
//| Notes: Returns the faction message value.
|
||||
//| Modify these values to taste.
|
||||
//o--------------------------------------------------------------
|
||||
FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value)
|
||||
{
|
||||
_eqp
|
||||
int32 character_value = tmpCharacter_value;
|
||||
if (fm)
|
||||
if (fm) {
|
||||
character_value += fm->base + fm->class_mod + fm->race_mod + fm->deity_mod;
|
||||
if(character_value >= 1101) return FACTION_ALLY;
|
||||
if(character_value >= 701 && character_value <= 1100) return FACTION_WARMLY;
|
||||
if(character_value >= 401 && character_value <= 700) return FACTION_KINDLY;
|
||||
if(character_value >= 101 && character_value <= 400) return FACTION_AMIABLE;
|
||||
if(character_value >= 0 && character_value <= 100) return FACTION_INDIFFERENT;
|
||||
if(character_value >= -100 && character_value <= -1) return FACTION_APPREHENSIVE;
|
||||
if(character_value >= -700 && character_value <= -101) return FACTION_DUBIOUS;
|
||||
if(character_value >= -999 && character_value <= -701) return FACTION_THREATENLY;
|
||||
if(character_value <= -1000) return FACTION_SCOWLS;
|
||||
}
|
||||
if (character_value >= 1101) {
|
||||
return FACTION_ALLY;
|
||||
}
|
||||
if (character_value >= 701 && character_value <= 1100) {
|
||||
return FACTION_WARMLY;
|
||||
}
|
||||
if (character_value >= 401 && character_value <= 700) {
|
||||
return FACTION_KINDLY;
|
||||
}
|
||||
if (character_value >= 101 && character_value <= 400) {
|
||||
return FACTION_AMIABLE;
|
||||
}
|
||||
if (character_value >= 0 && character_value <= 100) {
|
||||
return FACTION_INDIFFERENT;
|
||||
}
|
||||
if (character_value >= -100 && character_value <= -1) {
|
||||
return FACTION_APPREHENSIVE;
|
||||
}
|
||||
if (character_value >= -700 && character_value <= -101) {
|
||||
return FACTION_DUBIOUS;
|
||||
}
|
||||
if (character_value >= -999 && character_value <= -701) {
|
||||
return FACTION_THREATENLY;
|
||||
}
|
||||
if (character_value <= -1000) {
|
||||
return FACTION_SCOWLS;
|
||||
}
|
||||
return FACTION_INDIFFERENT;
|
||||
}
|
||||
|
||||
// neotokyo: this function should check if some races have more than one race define
|
||||
// this function should check if some races have more than one race define
|
||||
bool IsOfEqualRace(int r1, int r2)
|
||||
{
|
||||
if (r1 == r2)
|
||||
_eqp
|
||||
if (r1 == r2) {
|
||||
return true;
|
||||
}
|
||||
// TODO: add more values
|
||||
switch(r1)
|
||||
{
|
||||
case DARK_ELF:
|
||||
if (r2 == 77)
|
||||
return true;
|
||||
break;
|
||||
case BARBARIAN:
|
||||
if (r2 == 90)
|
||||
return true;
|
||||
switch (r1) {
|
||||
case DARK_ELF:
|
||||
if (r2 == 77) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case BARBARIAN:
|
||||
if (r2 == 90) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// neotokyo: trolls endure ogres, dark elves, ...
|
||||
// trolls endure ogres, dark elves, ...
|
||||
bool IsOfIndiffRace(int r1, int r2)
|
||||
{
|
||||
if (r1 == r2)
|
||||
_eqp
|
||||
if (r1 == r2) {
|
||||
return true;
|
||||
}
|
||||
// TODO: add more values
|
||||
switch(r1)
|
||||
{
|
||||
case DARK_ELF:
|
||||
case OGRE:
|
||||
case TROLL:
|
||||
if (r2 == OGRE || r2 == TROLL || r2 == DARK_ELF)
|
||||
switch (r1) {
|
||||
case DARK_ELF:
|
||||
case OGRE:
|
||||
case TROLL:
|
||||
if (r2 == OGRE || r2 == TROLL || r2 == DARK_ELF) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case HUMAN:
|
||||
case BARBARIAN:
|
||||
case HALF_ELF:
|
||||
case GNOME:
|
||||
case HALFLING:
|
||||
case WOOD_ELF:
|
||||
if (r2 == HUMAN ||
|
||||
r2 == BARBARIAN ||
|
||||
r2 == ERUDITE ||
|
||||
r2 == HALF_ELF ||
|
||||
r2 == GNOME ||
|
||||
r2 == HALFLING ||
|
||||
r2 == DWARF ||
|
||||
r2 == HIGH_ELF ||
|
||||
r2 == WOOD_ELF) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case ERUDITE:
|
||||
if (r2 == HUMAN || r2 == HALF_ELF) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case DWARF:
|
||||
if (r2 == HALFLING || r2 == GNOME) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case HIGH_ELF:
|
||||
if (r2 == WOOD_ELF) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case VAHSHIR:
|
||||
return true;
|
||||
break;
|
||||
case HUMAN:
|
||||
case BARBARIAN:
|
||||
case HALF_ELF:
|
||||
case GNOME:
|
||||
case HALFLING:
|
||||
case WOOD_ELF:
|
||||
if (r2 == HUMAN ||
|
||||
r2 == BARBARIAN ||
|
||||
r2 == ERUDITE ||
|
||||
r2 == HALF_ELF ||
|
||||
r2 == GNOME ||
|
||||
r2 == HALFLING ||
|
||||
r2 == DWARF ||
|
||||
r2 == HIGH_ELF ||
|
||||
r2 == WOOD_ELF)
|
||||
return true;
|
||||
break;
|
||||
case ERUDITE:
|
||||
if (r2 == HUMAN || r2 == HALF_ELF)
|
||||
return true;
|
||||
break;
|
||||
case DWARF:
|
||||
if (r2 == HALFLING || r2 == GNOME)
|
||||
return true;
|
||||
break;
|
||||
case HIGH_ELF:
|
||||
if (r2 == WOOD_ELF)
|
||||
return true;
|
||||
break;
|
||||
case VAHSHIR:
|
||||
return true;
|
||||
case IKSAR:
|
||||
return false;
|
||||
case IKSAR:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+7
-6
@@ -163,7 +163,7 @@ enum { //timer settings, all in milliseconds
|
||||
CombatEventTimer_expire = 12000,
|
||||
Tribute_duration = 600000,
|
||||
ZoneTimerResolution = 3, //sleep time between zone main loop runs (milliseconds)
|
||||
FeignMemoryDuration = 120000, // EverHood - Duration player must feign death to clear zonewide agro.
|
||||
FeignMemoryDuration = 120000, // Duration player must feign death to clear zonewide agro.
|
||||
EnragedTimer = 360000,
|
||||
EnragedDurationTimer = 10000
|
||||
};
|
||||
@@ -208,12 +208,12 @@ enum { //some random constants
|
||||
//chance ratio that a
|
||||
#define THREATENLY_ARRGO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly
|
||||
|
||||
// max factions per npc faction list
|
||||
//max factions per npc faction list
|
||||
#define MAX_NPC_FACTIONS 20
|
||||
|
||||
//value caps
|
||||
#define MAX_FACTION 1500
|
||||
#define MIN_FACTION -1500
|
||||
//individual faction pool
|
||||
#define MAX_PERSONAL_FACTION 1200
|
||||
#define MIN_PERSONAL_FACTION -3000
|
||||
|
||||
//The Level Cap:
|
||||
//#define LEVEL_CAP RuleI(Character, MaxLevel) //hard cap is 127
|
||||
@@ -261,7 +261,8 @@ enum {
|
||||
commandChangeFlags = 200, //ability to set/refresh flags
|
||||
commandBanPlayers = 100, //can set bans on players
|
||||
commandChangeDatarate = 201, //edit client's data rate
|
||||
commandZoneToCoords = 0 //can #zone with coords
|
||||
commandZoneToCoords = 0, //can #zone with coords
|
||||
commandInterrogateInv = 100 //below this == only log on error state and self-only target dump
|
||||
};
|
||||
|
||||
//default states for logging flag on NPCs and clients (having NPCs on by default is prolly a bad idea)
|
||||
|
||||
@@ -30,11 +30,13 @@ source_group("GTX Files" FILES ${GTX_HEADER})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||
|
||||
add_executable(${NAME} ${ROOT_TEXT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
|
||||
if(GLM_TEST_ENABLE)
|
||||
add_executable(${NAME} ${ROOT_TEXT}
|
||||
${ROOT_SOURCE} ${ROOT_INLINE} ${ROOT_HEADER}
|
||||
${CORE_SOURCE} ${CORE_INLINE} ${CORE_HEADER}
|
||||
${GTC_SOURCE} ${GTC_INLINE} ${GTC_HEADER}
|
||||
${GTX_SOURCE} ${GTX_INLINE} ${GTX_HEADER})
|
||||
endif(GLM_TEST_ENABLE)
|
||||
|
||||
#add_library(glm STATIC glm.cpp)
|
||||
#add_library(glm_shared SHARED glm.cpp)
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -26,9 +30,6 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_COMMON_INCLUDED
|
||||
#define GLM_COMMON_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "detail/func_common.hpp"
|
||||
|
||||
#endif//GLM_COMMON_INCLUDED
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/_features.hpp
|
||||
/// @file glm/detail/_features.hpp
|
||||
/// @date 2013-02-20 / 2013-02-20
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_features
|
||||
#define glm_core_features
|
||||
#pragma once
|
||||
|
||||
// #define GLM_CXX98_EXCEPTIONS
|
||||
// #define GLM_CXX98_RTTI
|
||||
@@ -281,7 +284,7 @@
|
||||
# define GLM_CXX11_STATIC_ASSERT
|
||||
# endif
|
||||
|
||||
#elif(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
#elif(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
||||
# if(__has_feature(cxx_exceptions))
|
||||
# define GLM_CXX98_EXCEPTIONS
|
||||
# endif
|
||||
@@ -422,6 +425,4 @@
|
||||
# define GLM_CXX11_VARIADIC_TEMPLATES
|
||||
# endif
|
||||
|
||||
#endif//(GLM_COMPILER & GLM_COMPILER_CLANG)
|
||||
|
||||
#endif//glm_core_features
|
||||
#endif//(GLM_COMPILER & (GLM_COMPILER_APPLE_CLANG | GLM_COMPILER_LLVM))
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/_fixes.hpp
|
||||
/// @file glm/detail/_fixes.hpp
|
||||
/// @date 2011-02-21 / 2011-11-22
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -26,8 +30,12 @@
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_DETAIL_NOISE_INCLUDED
|
||||
#define GLM_DETAIL_NOISE_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "../vec2.hpp"
|
||||
#include "../vec3.hpp"
|
||||
#include "../vec4.hpp"
|
||||
#include "../common.hpp"
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
@@ -75,19 +83,19 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> taylorInvSqrt(detail::tvec2<T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> taylorInvSqrt(tvec2<T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> taylorInvSqrt(detail::tvec3<T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> taylorInvSqrt(tvec3<T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> taylorInvSqrt(detail::tvec4<T, P> const & r)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> taylorInvSqrt(tvec4<T, P> const & r)
|
||||
{
|
||||
return T(1.79284291400159) - T(0.85373472095314) * r;
|
||||
}
|
||||
@@ -100,19 +108,19 @@ namespace detail
|
||||
*/
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> fade(detail::tvec2<T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> fade(tvec2<T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> fade(detail::tvec3<T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> fade(tvec3<T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> fade(detail::tvec4<T, P> const & t)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> fade(tvec4<T, P> const & t)
|
||||
{
|
||||
return (t * t * t) * (t * (t * T(6) - T(15)) + T(10));
|
||||
}
|
||||
@@ -126,5 +134,3 @@ namespace detail
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_DETAIL_NOISE_INCLUDED
|
||||
|
||||
|
||||
+492
-499
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,13 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/_swizzle_func.hpp
|
||||
/// @file glm/detail/_swizzle_func.hpp
|
||||
/// @date 2011-10-16 / 2011-10-16
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_swizzle_func
|
||||
#define glm_core_swizzle_func
|
||||
#pragma once
|
||||
|
||||
#define GLM_SWIZZLE_GEN_VEC2_ENTRY(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_TYPE, CONST, A, B) \
|
||||
SWIZZLED_TYPE<TMPL_TYPE, PRECISION> A ## B() CONST \
|
||||
@@ -720,5 +723,3 @@
|
||||
GLM_SWIZZLE_GEN_VEC_FROM_VEC4_COMP(TMPL_TYPE, PRECISION, CLASS_TYPE, SWIZZLED_VEC2_TYPE, SWIZZLED_VEC3_TYPE, SWIZZLED_VEC4_TYPE, s, t, p, q)
|
||||
|
||||
//GLM_SWIZZLE_GEN_VEC_FROM_VEC4(valType, detail::vec4, detail::vec2, detail::vec3, detail::vec4)
|
||||
|
||||
#endif//glm_core_swizzle_func
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,197 +25,136 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/_vectorize.hpp
|
||||
/// @file glm/detail/_vectorize.hpp
|
||||
/// @date 2011-10-14 / 2011-10-14
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_DETAIL_INCLUDED
|
||||
#define GLM_CORE_DETAIL_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec3.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
|
||||
#define VECTORIZE1_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec1<T, P> func( \
|
||||
detail::tvec1<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec1<T, P>( \
|
||||
func(v.x)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE2_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func( \
|
||||
detail::tvec2<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec2<T, P>( \
|
||||
func(v.x), \
|
||||
func(v.y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE3_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func( \
|
||||
detail::tvec3<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec3<T, P>( \
|
||||
func(v.x), \
|
||||
func(v.y), \
|
||||
func(v.z)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE4_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func( \
|
||||
detail::tvec4<T, P> const & v) \
|
||||
{ \
|
||||
return detail::tvec4<T, P>( \
|
||||
func(v.x), \
|
||||
func(v.y), \
|
||||
func(v.z), \
|
||||
func(v.w)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC(func) \
|
||||
VECTORIZE1_VEC(func) \
|
||||
VECTORIZE2_VEC(func) \
|
||||
VECTORIZE3_VEC(func) \
|
||||
VECTORIZE4_VEC(func)
|
||||
|
||||
#define VECTORIZE1_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec1<T, P> func \
|
||||
( \
|
||||
detail::tvec1<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec1<T, P>( \
|
||||
func(x.x, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE2_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \
|
||||
( \
|
||||
detail::tvec2<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec2<T, P>( \
|
||||
func(x.x, y), \
|
||||
func(x.y, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE3_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func \
|
||||
( \
|
||||
detail::tvec3<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec3<T, P>( \
|
||||
func(x.x, y), \
|
||||
func(x.y, y), \
|
||||
func(x.z, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE4_VEC_SCA(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func \
|
||||
( \
|
||||
detail::tvec4<T, P> const & x, \
|
||||
T const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec4<T, P>( \
|
||||
func(x.x, y), \
|
||||
func(x.y, y), \
|
||||
func(x.z, y), \
|
||||
func(x.w, y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC_SCA(func) \
|
||||
VECTORIZE1_VEC_SCA(func) \
|
||||
VECTORIZE2_VEC_SCA(func) \
|
||||
VECTORIZE3_VEC_SCA(func) \
|
||||
VECTORIZE4_VEC_SCA(func)
|
||||
|
||||
#define VECTORIZE2_VEC_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> func \
|
||||
( \
|
||||
detail::tvec2<T, P> const & x, \
|
||||
detail::tvec2<T, P> const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec2<T, P>( \
|
||||
func(x.x, y.x), \
|
||||
func(x.y, y.y)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE3_VEC_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> func \
|
||||
( \
|
||||
detail::tvec3<T, P> const & x, \
|
||||
detail::tvec3<T, P> const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec3<T, P>( \
|
||||
func(x.x, y.x), \
|
||||
func(x.y, y.y), \
|
||||
func(x.z, y.z)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE4_VEC_VEC(func) \
|
||||
template <typename T, precision P> \
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> func \
|
||||
( \
|
||||
detail::tvec4<T, P> const & x, \
|
||||
detail::tvec4<T, P> const & y \
|
||||
) \
|
||||
{ \
|
||||
return detail::tvec4<T, P>( \
|
||||
func(x.x, y.x), \
|
||||
func(x.y, y.y), \
|
||||
func(x.z, y.z), \
|
||||
func(x.w, y.w)); \
|
||||
}
|
||||
|
||||
#define VECTORIZE_VEC_VEC(func) \
|
||||
VECTORIZE2_VEC_VEC(func) \
|
||||
VECTORIZE3_VEC_VEC(func) \
|
||||
VECTORIZE4_VEC_VEC(func)
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template<bool C>
|
||||
struct If
|
||||
template <typename R, typename T, precision P, template <typename, precision> class vecType>
|
||||
struct functor1{};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec1>
|
||||
{
|
||||
template<typename F, typename T>
|
||||
static GLM_FUNC_QUALIFIER T apply(F functor, const T& val)
|
||||
GLM_FUNC_QUALIFIER static tvec1<R, P> call(R (*Func) (T x), tvec1<T, P> const & v)
|
||||
{
|
||||
return functor(val);
|
||||
return tvec1<R, P>(Func(v.x));
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct If<false>
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec2>
|
||||
{
|
||||
template<typename F, typename T>
|
||||
static GLM_FUNC_QUALIFIER T apply(F, const T& val)
|
||||
GLM_FUNC_QUALIFIER static tvec2<R, P> call(R (*Func) (T x), tvec2<T, P> const & v)
|
||||
{
|
||||
return val;
|
||||
return tvec2<R, P>(Func(v.x), Func(v.y));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec3>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<R, P> call(R (*Func) (T x), tvec3<T, P> const & v)
|
||||
{
|
||||
return tvec3<R, P>(Func(v.x), Func(v.y), Func(v.z));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename R, typename T, precision P>
|
||||
struct functor1<R, T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<R, P> call(R (*Func) (T x), tvec4<T, P> const & v)
|
||||
{
|
||||
return tvec4<R, P>(Func(v.x), Func(v.y), Func(v.z), Func(v.w));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
struct functor2{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec1>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, tvec1<T, P> const & b)
|
||||
{
|
||||
return tvec1<T, P>(Func(a.x, b.x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec2>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, tvec2<T, P> const & b)
|
||||
{
|
||||
return tvec2<T, P>(Func(a.x, b.x), Func(a.y, b.y));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec3>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, tvec3<T, P> const & b)
|
||||
{
|
||||
return tvec3<T, P>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2<T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, tvec4<T, P> const & b)
|
||||
{
|
||||
return tvec4<T, P>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
struct functor2_vec_sca{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec1>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, T b)
|
||||
{
|
||||
return tvec1<T, P>(Func(a.x, b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec2>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, T b)
|
||||
{
|
||||
return tvec2<T, P>(Func(a.x, b), Func(a.y, b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec3>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, T b)
|
||||
{
|
||||
return tvec3<T, P>(Func(a.x, b), Func(a.y, b), Func(a.z, b));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct functor2_vec_sca<T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, T b)
|
||||
{
|
||||
return tvec4<T, P>(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b));
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_CORE_DETAIL_INCLUDED
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -29,7 +33,6 @@
|
||||
/// dummy.cpp exist only a wordaround for CMake file.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define GLM_FORCE_RADIANS
|
||||
#define GLM_MESSAGES
|
||||
#include "../glm.hpp"
|
||||
#include <limits>
|
||||
@@ -42,6 +45,7 @@ struct material
|
||||
glm::vec4 specular; // Scm
|
||||
float shininess; // Srm
|
||||
};
|
||||
|
||||
struct light
|
||||
{
|
||||
glm::vec4 ambient; // Acli
|
||||
@@ -60,6 +64,7 @@ struct light
|
||||
float quadraticAttenuation;// K2
|
||||
};
|
||||
|
||||
|
||||
// Sample 1
|
||||
#include <glm/vec3.hpp>// glm::vec3
|
||||
#include <glm/geometric.hpp>// glm::cross, glm::normalize
|
||||
@@ -184,7 +189,34 @@ glm::vec3 lighting
|
||||
return Color;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
template <typename T, glm::precision P, template<typename, glm::precision> class vecType>
|
||||
T normalizeDotA(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
|
||||
#define GLM_TEMPLATE_GENTYPE typename T, glm::precision P, template<typename, glm::precision> class
|
||||
|
||||
template <GLM_TEMPLATE_GENTYPE vecType>
|
||||
T normalizeDotB(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
return glm::dot(x, y) * glm::inversesqrt(glm::dot(x, x) * glm::dot(y, y));
|
||||
}
|
||||
|
||||
template <typename vecType>
|
||||
typename vecType::value_type normalizeDotC(vecType const & a, vecType const & b)
|
||||
{
|
||||
return glm::dot(a, b) * glm::inversesqrt(glm::dot(a, a) * glm::dot(b, b));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
glm::vec4 v(1);
|
||||
float a = normalizeDotA(v, v);
|
||||
float b = normalizeDotB(v, v);
|
||||
float c = normalizeDotC(v, v);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_common.hpp
|
||||
/// @file glm/detail/func_common.hpp
|
||||
/// @date 2008-03-08 / 2010-01-26
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@@ -33,8 +37,7 @@
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_FUNC_COMMON_INCLUDED
|
||||
#define GLM_FUNC_COMMON_INCLUDED
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#include "precision.hpp"
|
||||
@@ -53,7 +56,10 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/abs.xml">GLSL abs man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType abs(genType const & x);
|
||||
GLM_FUNC_DECL genType abs(genType x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> abs(vecType<T, P> const & x);
|
||||
|
||||
/// Returns 1.0 if x > 0, 0.0 if x == 0, or -1.0 if x < 0.
|
||||
///
|
||||
@@ -61,17 +67,17 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sign.xml">GLSL sign man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType sign(genType const & x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> sign(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer that is less then or equal to x.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/floor.xml">GLSL floor man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType floor(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> floor(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x
|
||||
/// whose absolute value is not larger than the absolute value of x.
|
||||
@@ -80,8 +86,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/trunc.xml">GLSL trunc man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType trunc(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> trunc(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// The fraction 0.5 will round in a direction chosen by the
|
||||
@@ -93,9 +99,9 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/round.xml">GLSL round man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType round(genType const & x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> round(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer to x.
|
||||
/// A fractional part of 0.5 will round toward the nearest even
|
||||
/// integer. (Both 3.5 and 4.5 for x will return 4.0.)
|
||||
@@ -105,8 +111,8 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/roundEven.xml">GLSL roundEven man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
/// @see <a href="http://developer.amd.com/documentation/articles/pages/New-Round-to-Even-Technique.aspx">New round to even technique</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType roundEven(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> roundEven(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a value equal to the nearest integer
|
||||
/// that is greater than or equal to x.
|
||||
@@ -115,8 +121,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/ceil.xml">GLSL ceil man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType ceil(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> ceil(vecType<T, P> const & x);
|
||||
|
||||
/// Return x - floor(x).
|
||||
///
|
||||
@@ -125,7 +131,10 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/fract.xml">GLSL fract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType fract(genType const & x);
|
||||
GLM_FUNC_DECL genType fract(genType x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> fract(vecType<T, P> const & x);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
@@ -135,21 +144,13 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType mod(
|
||||
genType const & x,
|
||||
genType const & y);
|
||||
GLM_FUNC_DECL genType mod(genType x, genType y);
|
||||
|
||||
/// Modulus. Returns x - y * floor(x / y)
|
||||
/// for each component in x using the floating point value y.
|
||||
///
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/mod.xml">GLSL mod man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType mod(
|
||||
genType const & x,
|
||||
typename genType::value_type const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, T y);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mod(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the fractional part of x and sets i to the integer
|
||||
/// part (as a whole number floating point value). Both the
|
||||
@@ -161,25 +162,22 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/modf.xml">GLSL modf man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType modf(
|
||||
genType const & x,
|
||||
genType & i);
|
||||
GLM_FUNC_DECL genType modf(genType x, genType & i);
|
||||
|
||||
/// Returns y if y < x; otherwise, it returns x.
|
||||
///
|
||||
/// @tparam genType Floating-point or integer; scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/min.xml">GLSL min man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a><<<<<<< HEAD
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType min(
|
||||
genType const & x,
|
||||
genType const & y);
|
||||
GLM_FUNC_DECL genType min(genType x, genType y);
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType min(
|
||||
genType const & x,
|
||||
typename genType::value_type const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> min(vecType<T, P> const & x, T y);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> min(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns y if x < y; otherwise, it returns x.
|
||||
///
|
||||
@@ -188,14 +186,13 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/max.xml">GLSL max man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType max(
|
||||
genType const & x,
|
||||
genType const & y);
|
||||
GLM_FUNC_DECL genType max(genType x, genType y);
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType max(
|
||||
genType const & x,
|
||||
typename genType::value_type const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> max(vecType<T, P> const & x, T y);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> max(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns min(max(x, minVal), maxVal) for each component in x
|
||||
/// using the floating-point values minVal and maxVal.
|
||||
@@ -205,16 +202,13 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/clamp.xml">GLSL clamp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType clamp(
|
||||
genType const & x,
|
||||
genType const & minVal,
|
||||
genType const & maxVal);
|
||||
GLM_FUNC_DECL genType clamp(genType x, genType minVal, genType maxVal);
|
||||
|
||||
template <typename genType, precision P>
|
||||
GLM_FUNC_DECL genType clamp(
|
||||
genType const & x,
|
||||
typename genType::value_type const & minVal,
|
||||
typename genType::value_type const & maxVal);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> clamp(vecType<T, P> const & x, T minVal, T maxVal);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> clamp(vecType<T, P> const & x, vecType<T, P> const & minVal, vecType<T, P> const & maxVal);
|
||||
|
||||
/// If genTypeU is a floating scalar or vector:
|
||||
/// Returns x * (1.0 - a) + y * a, i.e., the linear blend of
|
||||
@@ -259,40 +253,34 @@ namespace glm
|
||||
/// glm::vec4 u = glm::mix(g, h, r); // Interpolations can be perform per component with a vector for the last parameter.
|
||||
/// @endcode
|
||||
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mix(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y,
|
||||
vecType<U, P> const & a);
|
||||
GLM_FUNC_DECL vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, vecType<U, P> const & a);
|
||||
|
||||
template <typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> mix(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y,
|
||||
U const & a);
|
||||
GLM_FUNC_DECL vecType<T, P> mix(vecType<T, P> const & x, vecType<T, P> const & y, U a);
|
||||
|
||||
template <typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeT mix(
|
||||
genTypeT const & x,
|
||||
genTypeT const & y,
|
||||
genTypeU const & a);
|
||||
GLM_FUNC_DECL genTypeT mix(genTypeT x, genTypeT y, genTypeU a);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0 for each component of a genType.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType step(
|
||||
genType const & edge,
|
||||
genType const & x);
|
||||
GLM_FUNC_DECL genType step(genType edge, genType x);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <typename, precision> class vecType, typename T, precision P>
|
||||
GLM_FUNC_DECL vecType<T, P> step(
|
||||
T const & edge,
|
||||
vecType<T, P> const & x);
|
||||
GLM_FUNC_DECL vecType<T, P> step(T edge, vecType<T, P> const & x);
|
||||
|
||||
/// Returns 0.0 if x < edge, otherwise it returns 1.0.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/step.xml">GLSL step man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <template <typename, precision> class vecType, typename T, precision P>
|
||||
GLM_FUNC_DECL vecType<T, P> step(vecType<T, P> const & edge, vecType<T, P> const & x);
|
||||
|
||||
/// Returns 0.0 if x <= edge0 and 1.0 if x >= edge1 and
|
||||
/// performs smooth Hermite interpolation between 0 and 1
|
||||
@@ -309,16 +297,13 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/smoothstep.xml">GLSL smoothstep man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType smoothstep(
|
||||
genType const & edge0,
|
||||
genType const & edge1,
|
||||
genType const & x);
|
||||
GLM_FUNC_DECL genType smoothstep(genType edge0, genType edge1, genType x);
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType smoothstep(
|
||||
typename genType::value_type const & edge0,
|
||||
typename genType::value_type const & edge1,
|
||||
genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> smoothstep(T edge0, T edge1, vecType<T, P> const & x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> smoothstep(vecType<T, P> const & edge0, vecType<T, P> const & edge1, vecType<T, P> const & x);
|
||||
|
||||
/// Returns true if x holds a NaN (not a number)
|
||||
/// representation in the underlying implementation's set of
|
||||
@@ -332,8 +317,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isnan.xml">GLSL isnan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::bool_type isnan(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<bool, P> isnan(vecType<T, P> const & x);
|
||||
|
||||
/// Returns true if x holds a positive infinity or negative
|
||||
/// infinity representation in the underlying implementation's
|
||||
@@ -345,8 +330,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/isinf.xml">GLSL isinf man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.3 Common Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::bool_type isinf(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<bool, P> isinf(vecType<T, P> const & x);
|
||||
|
||||
/// Returns a signed integer value representing
|
||||
/// the encoding of a floating-point value. The floating-point
|
||||
@@ -469,4 +454,3 @@ namespace glm
|
||||
|
||||
#include "func_common.inl"
|
||||
|
||||
#endif//GLM_FUNC_COMMON_INCLUDED
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_exponential.hpp
|
||||
/// @file glm/detail/func_exponential.hpp
|
||||
/// @date 2008-08-08 / 2011-06-14
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@@ -33,8 +37,7 @@
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_func_exponential
|
||||
#define glm_core_func_exponential
|
||||
#pragma once
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
@@ -49,84 +52,81 @@ namespace glm
|
||||
|
||||
/// Returns 'base' raised to the power 'exponent'.
|
||||
///
|
||||
/// @param base Floating point value. pow function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @param base Floating point value. pow function is defined for input values of 'base' defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @param exponent Floating point value representing the 'exponent'.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/pow.xml">GLSL pow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType pow(genType const & base, genType const & exponent);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> pow(vecType<T, P> const & base, vecType<T, P> const & exponent);
|
||||
|
||||
/// Returns the natural exponentiation of x, i.e., e^x.
|
||||
///
|
||||
/// @param x exp function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @param v exp function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp.xml">GLSL exp man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType exp(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> exp(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the natural logarithm of x, i.e.,
|
||||
/// Returns the natural logarithm of v, i.e.,
|
||||
/// returns the value y which satisfies the equation x = e^y.
|
||||
/// Results are undefined if x <= 0.
|
||||
/// Results are undefined if v <= 0.
|
||||
///
|
||||
/// @param x log function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision.
|
||||
/// @param v log function is defined for input values of v defined in the range (0, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log.xml">GLSL log man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType log(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> log(vecType<T, P> const & v);
|
||||
|
||||
/// Returns 2 raised to the x power.
|
||||
/// Returns 2 raised to the v power.
|
||||
///
|
||||
/// @param x exp2 function is defined for input values of x defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @param v exp2 function is defined for input values of v defined in the range (inf-, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/exp2.xml">GLSL exp2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType exp2(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> exp2(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the base 2 log of x, i.e., returns the value y,
|
||||
/// which satisfies the equation x = 2 ^ y.
|
||||
///
|
||||
/// @param x log2 function is defined for input values of x defined in the range (0, inf+) in the limit of the type precision.
|
||||
/// @param v log2 function is defined for input values of v defined in the range (0, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/log2.xml">GLSL log2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType log2(genType x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> log2(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the positive square root of x.
|
||||
/// Returns the positive square root of v.
|
||||
///
|
||||
/// @param x sqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
|
||||
/// @param v sqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sqrt.xml">GLSL sqrt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
//template <typename genType>
|
||||
//GLM_FUNC_DECL genType sqrt(genType const & x);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> sqrt(vecType<T, P> const & x);
|
||||
GLM_FUNC_DECL vecType<T, P> sqrt(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the reciprocal of the positive square root of x.
|
||||
/// Returns the reciprocal of the positive square root of v.
|
||||
///
|
||||
/// @param x inversesqrt function is defined for input values of x defined in the range [0, inf+) in the limit of the type precision.
|
||||
/// @param v inversesqrt function is defined for input values of v defined in the range [0, inf+) in the limit of the type precision.
|
||||
/// @tparam genType Floating-point scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inversesqrt.xml">GLSL inversesqrt man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.2 Exponential Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType inversesqrt(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> inversesqrt(vecType<T, P> const & v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_exponential.inl"
|
||||
|
||||
#endif//glm_core_func_exponential
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_exponential.inl
|
||||
/// @file glm/detail/func_exponential.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -29,25 +33,28 @@
|
||||
#include "func_vector_relational.hpp"
|
||||
#include "_vectorize.hpp"
|
||||
#include <limits>
|
||||
#include <cmath>
|
||||
#include <cassert>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <bool isFloat>
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using std::log2;
|
||||
# else
|
||||
template <typename genType>
|
||||
genType log2(genType Value)
|
||||
{
|
||||
return std::log(Value) * static_cast<genType>(1.4426950408889634073599246810019);
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <class, precision> class vecType, bool isFloat = true>
|
||||
struct compute_log2
|
||||
{
|
||||
template <typename T>
|
||||
T operator() (T const & Value) const;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compute_log2<true>
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T operator() (T const & Value) const
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & vec)
|
||||
{
|
||||
return static_cast<T>(::std::log(Value)) * static_cast<T>(1.4426950408889634073599246810019);
|
||||
return detail::functor1<T, T, P, vecType>::call(log2, vec);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -78,170 +85,77 @@ namespace detail
|
||||
}//namespace detail
|
||||
|
||||
// pow
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType pow
|
||||
(
|
||||
genType const & x,
|
||||
genType const & y
|
||||
)
|
||||
using std::pow;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> pow(vecType<T, P> const & base, vecType<T, P> const & exponent)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'pow' only accept floating-point inputs");
|
||||
|
||||
return std::pow(x, y);
|
||||
return detail::functor2<T, P, vecType>::call(pow, base, exponent);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC_VEC(pow)
|
||||
|
||||
// exp
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType exp
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
using std::exp;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> exp(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'exp' only accept floating-point inputs");
|
||||
|
||||
return std::exp(x);
|
||||
return detail::functor1<T, T, P, vecType>::call(exp, x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(exp)
|
||||
|
||||
// log
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType log
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
using std::log;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> log(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'log' only accept floating-point inputs");
|
||||
|
||||
return std::log(x);
|
||||
return detail::functor1<T, T, P, vecType>::call(log, x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(log)
|
||||
|
||||
//exp2, ln2 = 0.69314718055994530941723212145818f
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType exp2(genType const & x)
|
||||
GLM_FUNC_QUALIFIER genType exp2(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(
|
||||
std::numeric_limits<genType>::is_iec559,
|
||||
"'exp2' only accept floating-point inputs");
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'exp2' only accept floating-point inputs");
|
||||
|
||||
return std::exp(static_cast<genType>(0.69314718055994530941723212145818) * x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(exp2)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> exp2(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(exp2, x);
|
||||
}
|
||||
|
||||
// log2, ln2 = 0.69314718055994530941723212145818f
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType log2(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559 || std::numeric_limits<genType>::is_integer,
|
||||
"GLM core 'log2' only accept floating-point inputs. Include <glm/gtx/integer.hpp> for additional integer support.");
|
||||
|
||||
assert(x > genType(0)); // log2 is only defined on the range (0, inf]
|
||||
return detail::compute_log2<std::numeric_limits<genType>::is_iec559>()(x);
|
||||
return log2(tvec1<genType>(x)).x;
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(log2)
|
||||
|
||||
namespace detail
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> log2(vecType<T, P> const & x)
|
||||
{
|
||||
template <template <class, precision> class vecType, typename T, precision P>
|
||||
struct compute_sqrt{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_sqrt<detail::tvec1, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tvec1<T, P> call(detail::tvec1<T, P> const & x)
|
||||
{
|
||||
return detail::tvec1<T, P>(std::sqrt(x.x));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_sqrt<detail::tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tvec2<T, P> call(detail::tvec2<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<T, P>(std::sqrt(x.x), std::sqrt(x.y));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_sqrt<detail::tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tvec3<T, P> call(detail::tvec3<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_sqrt<detail::tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tvec4<T, P> call(detail::tvec4<T, P> const & x)
|
||||
{
|
||||
return detail::tvec4<T, P>(std::sqrt(x.x), std::sqrt(x.y), std::sqrt(x.z), std::sqrt(x.w));
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
return detail::compute_log2<T, P, vecType, std::numeric_limits<T>::is_iec559>::call(x);
|
||||
}
|
||||
|
||||
// sqrt
|
||||
GLM_FUNC_QUALIFIER float sqrt(float x)
|
||||
{
|
||||
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
|
||||
detail::tvec1<float, highp> tmp(detail::compute_sqrt<detail::tvec1, float, highp>::call(x));
|
||||
return tmp.x;
|
||||
# else
|
||||
return detail::compute_sqrt<detail::tvec1, float, highp>::call(x).x;
|
||||
# endif
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER double sqrt(double x)
|
||||
{
|
||||
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
|
||||
detail::tvec1<double, highp> tmp(detail::compute_sqrt<detail::tvec1, double, highp>::call(x));
|
||||
return tmp.x;
|
||||
# else
|
||||
return detail::compute_sqrt<detail::tvec1, double, highp>::call(x).x;
|
||||
# endif
|
||||
}
|
||||
|
||||
using std::sqrt;
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> sqrt(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'sqrt' only accept floating-point inputs");
|
||||
return detail::compute_sqrt<vecType, T, P>::call(x);
|
||||
return detail::functor1<T, T, P, vecType>::call(sqrt, x);
|
||||
}
|
||||
|
||||
// inversesqrt
|
||||
GLM_FUNC_QUALIFIER float inversesqrt(float const & x)
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType inversesqrt(genType x)
|
||||
{
|
||||
return 1.0f / sqrt(x);
|
||||
return static_cast<genType>(1) / sqrt(x);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER double inversesqrt(double const & x)
|
||||
{
|
||||
return 1.0 / sqrt(x);
|
||||
}
|
||||
|
||||
template <template <class, precision> class vecType, typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> inversesqrt
|
||||
(
|
||||
vecType<T, P> const & x
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> inversesqrt(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inversesqrt' only accept floating-point inputs");
|
||||
return detail::compute_inversesqrt<vecType, T, P>::call(x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(inversesqrt)
|
||||
}//namespace glm
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_geometric.hpp
|
||||
/// @file glm/detail/func_geometric.hpp
|
||||
/// @date 2008-08-03 / 2011-06-14
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@@ -33,8 +37,7 @@
|
||||
/// These operate on vectors as vectors, not component-wise.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_func_geometric
|
||||
#define glm_core_func_geometric
|
||||
#pragma once
|
||||
|
||||
#include "type_vec3.hpp"
|
||||
|
||||
@@ -49,9 +52,9 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/length.xml">GLSL length man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::value_type length(
|
||||
genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T length(
|
||||
vecType<T, P> const & x);
|
||||
|
||||
/// Returns the distance betwwen p0 and p1, i.e., length(p0 - p1).
|
||||
///
|
||||
@@ -59,10 +62,10 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/distance.xml">GLSL distance man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL typename genType::value_type distance(
|
||||
genType const & p0,
|
||||
genType const & p1);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL T distance(
|
||||
vecType<T, P> const & p0,
|
||||
vecType<T, P> const & p1);
|
||||
|
||||
/// Returns the dot product of x and y, i.e., result = x * y.
|
||||
///
|
||||
@@ -75,17 +78,6 @@ namespace glm
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y);
|
||||
|
||||
/// Returns the dot product of x and y, i.e., result = x * y.
|
||||
///
|
||||
/// @tparam genType Floating-point vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/dot.xml">GLSL dot man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType dot(
|
||||
genType const & x,
|
||||
genType const & y);
|
||||
|
||||
/// Returns the cross product of x and y.
|
||||
///
|
||||
/// @tparam valType Floating-point scalar types.
|
||||
@@ -93,17 +85,18 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cross.xml">GLSL cross man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL detail::tvec3<T, P> cross(
|
||||
detail::tvec3<T, P> const & x,
|
||||
detail::tvec3<T, P> const & y);
|
||||
GLM_FUNC_DECL tvec3<T, P> cross(
|
||||
tvec3<T, P> const & x,
|
||||
tvec3<T, P> const & y);
|
||||
|
||||
/// Returns a vector in the same direction as x but with length of 1.
|
||||
/// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefined and generate an error.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/normalize.xml">GLSL normalize man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.5 Geometric Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType normalize(
|
||||
genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> normalize(
|
||||
vecType<T, P> const & x);
|
||||
|
||||
/// If dot(Nref, I) < 0.0, return N, otherwise, return -N.
|
||||
///
|
||||
@@ -141,11 +134,9 @@ namespace glm
|
||||
GLM_FUNC_DECL vecType<T, P> refract(
|
||||
vecType<T, P> const & I,
|
||||
vecType<T, P> const & N,
|
||||
T const & eta);
|
||||
T eta);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_geometric.inl"
|
||||
|
||||
#endif//glm_core_func_geometric
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_geometric.inl
|
||||
/// @file glm/detail/func_geometric.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -39,45 +43,40 @@ namespace detail
|
||||
struct compute_dot{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<detail::tvec1, T, P>
|
||||
struct compute_dot<tvec1, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tvec1<T, P> const & x, detail::tvec1<T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static T call(tvec1<T, P> const & a, tvec1<T, P> const & b)
|
||||
{
|
||||
# ifdef __CUDACC__ // Wordaround for a CUDA compiler bug up to CUDA6
|
||||
detail::tvec1<T, P> tmp(x * y);
|
||||
return tmp.x;
|
||||
# else
|
||||
return detail::tvec1<T, P>(x * y).x;
|
||||
# endif
|
||||
return a.x * b.x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<detail::tvec2, T, P>
|
||||
struct compute_dot<tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tvec2<T, P> const & x, detail::tvec2<T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static T call(tvec2<T, P> const & x, tvec2<T, P> const & y)
|
||||
{
|
||||
detail::tvec2<T, P> tmp(x * y);
|
||||
tvec2<T, P> tmp(x * y);
|
||||
return tmp.x + tmp.y;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<detail::tvec3, T, P>
|
||||
struct compute_dot<tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tvec3<T, P> const & x, detail::tvec3<T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static T call(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
||||
{
|
||||
detail::tvec3<T, P> tmp(x * y);
|
||||
tvec3<T, P> tmp(x * y);
|
||||
return tmp.x + tmp.y + tmp.z;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_dot<detail::tvec4, T, P>
|
||||
struct compute_dot<tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tvec4<T, P> const & x, detail::tvec4<T, P> const & y)
|
||||
GLM_FUNC_QUALIFIER static T call(tvec4<T, P> const & x, tvec4<T, P> const & y)
|
||||
{
|
||||
detail::tvec4<T, P> tmp(x * y);
|
||||
tvec4<T, P> tmp(x * y);
|
||||
return (tmp.x + tmp.y) + (tmp.z + tmp.w);
|
||||
}
|
||||
};
|
||||
@@ -85,144 +84,58 @@ namespace detail
|
||||
|
||||
// length
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType length
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType length(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
genType sqr = x * x;
|
||||
return sqrt(sqr);
|
||||
return abs(x);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(detail::tvec2<T, P> const & v)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T length(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
T sqr = v.x * v.x + v.y * v.y;
|
||||
return sqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(detail::tvec3<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
T sqr = v.x * v.x + v.y * v.y + v.z * v.z;
|
||||
return sqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T length(detail::tvec4<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' only accept floating-point inputs");
|
||||
|
||||
T sqr = v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w;
|
||||
return sqrt(sqr);
|
||||
return sqrt(dot(v, v));
|
||||
}
|
||||
|
||||
// distance
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType distance
|
||||
(
|
||||
genType const & p0,
|
||||
genType const & p1
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType distance(genType const & p0, genType const & p1)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T distance
|
||||
(
|
||||
detail::tvec2<T, P> const & p0,
|
||||
detail::tvec2<T, P> const & p1
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T distance(vecType<T, P> const & p0, vecType<T, P> const & p1)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T distance
|
||||
(
|
||||
detail::tvec3<T, P> const & p0,
|
||||
detail::tvec3<T, P> const & p1
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T distance
|
||||
(
|
||||
detail::tvec4<T, P> const & p0,
|
||||
detail::tvec4<T, P> const & p1
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'distance' only accept floating-point inputs");
|
||||
|
||||
return length(p1 - p0);
|
||||
}
|
||||
|
||||
// dot
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T dot
|
||||
(
|
||||
T const & x,
|
||||
T const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T dot(T x, T y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
||||
return detail::compute_dot<detail::tvec1, T, highp>::call(x, y);
|
||||
return x * y;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER T dot
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER T dot(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' only accept floating-point inputs");
|
||||
return detail::compute_dot<vecType, T, P>::call(x, y);
|
||||
}
|
||||
|
||||
/* // SSE3
|
||||
GLM_FUNC_QUALIFIER float dot(const tvec4<float>& x, const tvec4<float>& y)
|
||||
{
|
||||
float Result;
|
||||
__asm
|
||||
{
|
||||
mov esi, x
|
||||
mov edi, y
|
||||
movaps xmm0, [esi]
|
||||
mulps xmm0, [edi]
|
||||
haddps( _xmm0, _xmm0 )
|
||||
haddps( _xmm0, _xmm0 )
|
||||
movss Result, xmm0
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
*/
|
||||
// cross
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> cross
|
||||
(
|
||||
detail::tvec3<T, P> const & x,
|
||||
detail::tvec3<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> cross(tvec3<T, P> const & x, tvec3<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' only accept floating-point inputs");
|
||||
|
||||
return detail::tvec3<T, P>(
|
||||
return tvec3<T, P>(
|
||||
x.y * y.z - y.y * x.z,
|
||||
x.z * y.x - y.z * x.x,
|
||||
x.x * y.y - y.x * x.y);
|
||||
@@ -230,111 +143,53 @@ namespace detail
|
||||
|
||||
// normalize
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType normalize
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType normalize(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
return x < genType(0) ? genType(-1) : genType(1);
|
||||
}
|
||||
|
||||
// According to issue 10 GLSL 1.10 specification, if length(x) == 0 then result is undefine and generate an error
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> normalize
|
||||
(
|
||||
detail::tvec2<T, P> const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
T sqr = x.x * x.x + x.y * x.y;
|
||||
return x * inversesqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> normalize
|
||||
(
|
||||
detail::tvec3<T, P> const & x
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> normalize(vecType<T, P> const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
T sqr = x.x * x.x + x.y * x.y + x.z * x.z;
|
||||
return x * inversesqrt(sqr);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> normalize
|
||||
(
|
||||
detail::tvec4<T, P> const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' only accept floating-point inputs");
|
||||
|
||||
T sqr = x.x * x.x + x.y * x.y + x.z * x.z + x.w * x.w;
|
||||
return x * inversesqrt(sqr);
|
||||
return x * inversesqrt(dot(x, x));
|
||||
}
|
||||
|
||||
// faceforward
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType faceforward
|
||||
(
|
||||
genType const & N,
|
||||
genType const & I,
|
||||
genType const & Nref
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType faceforward(genType const & N, genType const & I, genType const & Nref)
|
||||
{
|
||||
return dot(Nref, I) < 0 ? N : -N;
|
||||
return dot(Nref, I) < static_cast<genType>(0) ? N : -N;
|
||||
}
|
||||
|
||||
// reflect
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType reflect
|
||||
(
|
||||
genType const & I,
|
||||
genType const & N
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType reflect(genType const & I, genType const & N)
|
||||
{
|
||||
return I - N * dot(N, I) * genType(2);
|
||||
return I - N * dot(N, I) * static_cast<genType>(2);
|
||||
}
|
||||
|
||||
// refract
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType refract
|
||||
(
|
||||
genType const & I,
|
||||
genType const & N,
|
||||
genType const & eta
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType refract(genType const & I, genType const & N, genType const & eta)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' only accept floating-point inputs");
|
||||
|
||||
genType dotValue = dot(N, I);
|
||||
genType k = genType(1) - eta * eta * (genType(1) - dotValue * dotValue);
|
||||
if(k < genType(0))
|
||||
return genType(0);
|
||||
else
|
||||
return eta * I - (eta * dotValue + sqrt(k)) * N;
|
||||
genType const dotValue(dot(N, I));
|
||||
genType const k(static_cast<genType>(1) - eta * eta * (static_cast<genType>(1) - dotValue * dotValue));
|
||||
return (eta * I - (eta * dotValue + sqrt(k)) * N) * static_cast<genType>(k >= static_cast<genType>(0));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> refract
|
||||
(
|
||||
vecType<T, P> const & I,
|
||||
vecType<T, P> const & N,
|
||||
T const & eta
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> refract(vecType<T, P> const & I, vecType<T, P> const & N, T eta)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' only accept floating-point inputs");
|
||||
|
||||
T dotValue = dot(N, I);
|
||||
T k = T(1) - eta * eta * (T(1) - dotValue * dotValue);
|
||||
if(k < T(0))
|
||||
return vecType<T, P>(0);
|
||||
else
|
||||
return eta * I - (eta * dotValue + std::sqrt(k)) * N;
|
||||
T const dotValue(dot(N, I));
|
||||
T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue));
|
||||
return (eta * I - (eta * dotValue + std::sqrt(k)) * N) * static_cast<T>(k >= static_cast<T>(0));
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_integer.hpp
|
||||
/// @file glm/detail/func_integer.hpp
|
||||
/// @date 2010-03-17 / 2011-06-18
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@@ -35,10 +39,12 @@
|
||||
/// b, inclusive. The lowest-order bit is bit 0.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_func_integer
|
||||
#define glm_core_func_integer
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#include "precision.hpp"
|
||||
#include "func_common.hpp"
|
||||
#include "func_vector_relational.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
@@ -53,11 +59,11 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/uaddCarry.xml">GLSL uaddCarry man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genUType>
|
||||
GLM_FUNC_DECL genUType uaddCarry(
|
||||
genUType const & x,
|
||||
genUType const & y,
|
||||
genUType & carry);
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<uint, P> uaddCarry(
|
||||
vecType<uint, P> const & x,
|
||||
vecType<uint, P> const & y,
|
||||
vecType<uint, P> & carry);
|
||||
|
||||
/// Subtracts the 32-bit unsigned integer y from x, returning
|
||||
/// the difference if non-negative, or pow(2, 32) plus the difference
|
||||
@@ -67,12 +73,12 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/usubBorrow.xml">GLSL usubBorrow man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genUType>
|
||||
GLM_FUNC_DECL genUType usubBorrow(
|
||||
genUType const & x,
|
||||
genUType const & y,
|
||||
genUType & borrow);
|
||||
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<uint, P> usubBorrow(
|
||||
vecType<uint, P> const & x,
|
||||
vecType<uint, P> const & y,
|
||||
vecType<uint, P> & borrow);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
/// The 32 most-significant bits are returned in msb.
|
||||
@@ -81,12 +87,12 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/umulExtended.xml">GLSL umulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genUType>
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL void umulExtended(
|
||||
genUType const & x,
|
||||
genUType const & y,
|
||||
genUType & msb,
|
||||
genUType & lsb);
|
||||
vecType<uint, P> const & x,
|
||||
vecType<uint, P> const & y,
|
||||
vecType<uint, P> & msb,
|
||||
vecType<uint, P> & lsb);
|
||||
|
||||
/// Multiplies 32-bit integers x and y, producing a 64-bit
|
||||
/// result. The 32 least-significant bits are returned in lsb.
|
||||
@@ -96,12 +102,12 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/imulExtended.xml">GLSL imulExtended man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIType>
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL void imulExtended(
|
||||
genIType const & x,
|
||||
genIType const & y,
|
||||
genIType & msb,
|
||||
genIType & lsb);
|
||||
vecType<int, P> const & x,
|
||||
vecType<int, P> const & y,
|
||||
vecType<int, P> & msb,
|
||||
vecType<int, P> & lsb);
|
||||
|
||||
/// Extracts bits [offset, offset + bits - 1] from value,
|
||||
/// returning them in the least significant bits of the result.
|
||||
@@ -114,15 +120,15 @@ namespace glm
|
||||
/// offset and bits is greater than the number of bits used
|
||||
/// to store the operand.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldExtract.xml">GLSL bitfieldExtract man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldExtract(
|
||||
genIUType const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldExtract(
|
||||
vecType<T, P> const & Value,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
/// Returns the insertion the bits least-significant bits of insert into base.
|
||||
///
|
||||
@@ -134,70 +140,93 @@ namespace glm
|
||||
/// offset and bits is greater than the number of bits used to
|
||||
/// store the operand.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldInsert.xml">GLSL bitfieldInsert man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldInsert(
|
||||
genIUType const & Base,
|
||||
genIUType const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldInsert(
|
||||
vecType<T, P> const & Base,
|
||||
vecType<T, P> const & Insert,
|
||||
int Offset,
|
||||
int Bits);
|
||||
|
||||
/// Returns the reversal of the bits of value.
|
||||
/// The bit numbered n of the result will be taken from bit (bits - 1) - n of value,
|
||||
/// where bits is the total number of bits used to represent value.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitfieldReverse.xml">GLSL bitfieldReverse man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL genIUType bitfieldReverse(genIUType const & Value);
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> bitfieldReverse(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL int bitCount(genType v);
|
||||
|
||||
/// Returns the number of bits set to 1 in the binary representation of value.
|
||||
///
|
||||
/// @todo Clarify the declaration to specify that scalars are suported.
|
||||
template <typename T, template <typename> class genIUType>
|
||||
GLM_FUNC_DECL typename genIUType<T>::signed_type bitCount(genIUType<T> const & Value);
|
||||
/// @tparam T Signed or unsigned integer scalar or vector types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/bitCount.xml">GLSL bitCount man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<int, P> bitCount(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the bit number of the least significant bit set to
|
||||
/// 1 in the binary representation of value.
|
||||
/// If value is zero, -1 will be returned.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL int findLSB(genIUType x);
|
||||
|
||||
/// Returns the bit number of the least significant bit set to
|
||||
/// 1 in the binary representation of value.
|
||||
/// If value is zero, -1 will be returned.
|
||||
///
|
||||
/// @todo Clarify the declaration to specify that scalars are suported.
|
||||
template <typename T, template <typename> class genIUType>
|
||||
GLM_FUNC_DECL typename genIUType<T>::signed_type findLSB(genIUType<T> const & Value);
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findLSB.xml">GLSL findLSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<int, P> findLSB(vecType<T, P> const & v);
|
||||
|
||||
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||
/// For negative integers, the result will be the bit number of the most significant
|
||||
/// bit set to 0. For a value of zero or negative one, -1 will be returned.
|
||||
///
|
||||
/// @tparam genIUType Signed or unsigned integer scalar or vector types.
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_DECL int findMSB(genIUType x);
|
||||
|
||||
/// Returns the bit number of the most significant bit in the binary representation of value.
|
||||
/// For positive integers, the result will be the bit number of the most significant bit set to 1.
|
||||
/// For negative integers, the result will be the bit number of the most significant
|
||||
/// bit set to 0. For a value of zero or negative one, -1 will be returned.
|
||||
///
|
||||
/// @todo Clarify the declaration to specify that scalars are suported.
|
||||
template <typename T, template <typename> class genIUType>
|
||||
GLM_FUNC_DECL typename genIUType<T>::signed_type findMSB(genIUType<T> const & Value);
|
||||
/// @tparam T Signed or unsigned integer scalar types.
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/findMSB.xml">GLSL findMSB man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.8 Integer Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<int, P> findMSB(vecType<T, P> const & v);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_integer.inl"
|
||||
|
||||
#endif//glm_core_func_integer
|
||||
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_integer.inl
|
||||
/// @file glm/detail/func_integer.inl
|
||||
/// @date 2010-03-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -39,73 +43,186 @@
|
||||
#endif//(GLM_ARCH != GLM_ARCH_PURE)
|
||||
#include <limits>
|
||||
|
||||
namespace glm
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T mask(T Bits)
|
||||
{
|
||||
return Bits >= sizeof(T) * 8 ? ~static_cast<T>(0) : (static_cast<T>(1) << Bits) - static_cast<T>(1);
|
||||
}
|
||||
|
||||
template <bool EXEC = false>
|
||||
struct compute_bitfieldReverseStep
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compute_bitfieldReverseStep<true>
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) << Shift | (v & (~Mask)) >> Shift;
|
||||
}
|
||||
};
|
||||
|
||||
template <bool EXEC = false>
|
||||
struct compute_bitfieldBitCountStep
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T, T)
|
||||
{
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compute_bitfieldBitCountStep<true>
|
||||
{
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v, T Mask, T Shift)
|
||||
{
|
||||
return (v & Mask) + ((v >> Shift) & Mask);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename genIUType, size_t Bits>
|
||||
struct compute_findLSB
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static int call(genIUType Value)
|
||||
{
|
||||
if(Value == 0)
|
||||
return -1;
|
||||
|
||||
return glm::bitCount(~Value & (Value - static_cast<genIUType>(1)));
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
template <typename genIUType>
|
||||
struct compute_findLSB<genIUType, 32>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static int call(genIUType Value)
|
||||
{
|
||||
unsigned long Result(0);
|
||||
unsigned char IsNotNull = _BitScanForward(&Result, *reinterpret_cast<unsigned long*>(&Value));
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
};
|
||||
|
||||
# if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_MODEL == GLM_MODEL_32))
|
||||
template <typename genIUType>
|
||||
struct compute_findLSB<genIUType, 64>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static int call(genIUType Value)
|
||||
{
|
||||
unsigned long Result(0);
|
||||
unsigned char IsNotNull = _BitScanForward64(&Result, *reinterpret_cast<unsigned __int64*>(&Value));
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
};
|
||||
# endif
|
||||
# endif//GLM_HAS_BITSCAN_WINDOWS
|
||||
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType, bool EXEC = true>
|
||||
struct compute_findMSB_step_vec
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, T Shift)
|
||||
{
|
||||
return x | (x >> Shift);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
struct compute_findMSB_step_vec<T, P, vecType, false>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & x, T)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType, int>
|
||||
struct compute_findMSB_vec
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & vec)
|
||||
{
|
||||
vecType<T, P> x(vec);
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 1));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 2));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 8>::call(x, static_cast<T>( 4));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 16>::call(x, static_cast<T>( 8));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 32>::call(x, static_cast<T>(16));
|
||||
x = compute_findMSB_step_vec<T, P, vecType, sizeof(T) * 8 >= 64>::call(x, static_cast<T>(32));
|
||||
return vecType<int, P>(sizeof(T) * 8 - 1) - glm::bitCount(~x);
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_HAS_BITSCAN_WINDOWS
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int compute_findMSB_32(genIUType Value)
|
||||
{
|
||||
unsigned long Result(0);
|
||||
unsigned char IsNotNull = _BitScanReverse(&Result, *reinterpret_cast<unsigned long*>(&Value));
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
struct compute_findMSB_vec<T, P, vecType, 32>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<int, T, P, vecType>::call(compute_findMSB_32, x);
|
||||
}
|
||||
};
|
||||
|
||||
# if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_MODEL == GLM_MODEL_32))
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int compute_findMSB_64(genIUType Value)
|
||||
{
|
||||
unsigned long Result(0);
|
||||
unsigned char IsNotNull = _BitScanReverse64(&Result, *reinterpret_cast<unsigned __int64*>(&Value));
|
||||
return IsNotNull ? int(Result) : -1;
|
||||
}
|
||||
|
||||
template <typename T, glm::precision P, template <class, glm::precision> class vecType>
|
||||
struct compute_findMSB_vec<T, P, vecType, 64>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<int, P> call(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::functor1<int, T, P, vecType>::call(compute_findMSB_64, x);
|
||||
}
|
||||
};
|
||||
# endif
|
||||
# endif//GLM_HAS_BITSCAN_WINDOWS
|
||||
}//namespace detail
|
||||
|
||||
// uaddCarry
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uint uaddCarry
|
||||
(
|
||||
uint const & x,
|
||||
uint const & y,
|
||||
uint & Carry
|
||||
)
|
||||
GLM_FUNC_QUALIFIER uint uaddCarry(uint const & x, uint const & y, uint & Carry)
|
||||
{
|
||||
uint64 Value64 = static_cast<uint64>(x) + static_cast<uint64>(y);
|
||||
uint32 Result = static_cast<uint32>(Value64 % (static_cast<uint64>(1) << static_cast<uint64>(32)));
|
||||
Carry = (Value64 % (static_cast<uint64>(1) << static_cast<uint64>(32))) > 1 ? static_cast<uint32>(1) : static_cast<uint32>(0);
|
||||
return Result;
|
||||
uint64 const Value64(static_cast<uint64>(x) + static_cast<uint64>(y));
|
||||
uint64 const Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
|
||||
Carry = Value64 > Max32 ? 1 : 0;
|
||||
return static_cast<uint32>(Value64 % (Max32 + static_cast<uint64>(1)));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec2 uaddCarry
|
||||
(
|
||||
uvec2 const & x,
|
||||
uvec2 const & y,
|
||||
uvec2 & Carry
|
||||
)
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<uint, P> uaddCarry(vecType<uint, P> const & x, vecType<uint, P> const & y, vecType<uint, P> & Carry)
|
||||
{
|
||||
return uvec2(
|
||||
uaddCarry(x[0], y[0], Carry[0]),
|
||||
uaddCarry(x[1], y[1], Carry[1]));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec3 uaddCarry
|
||||
(
|
||||
uvec3 const & x,
|
||||
uvec3 const & y,
|
||||
uvec3 & Carry
|
||||
)
|
||||
{
|
||||
return uvec3(
|
||||
uaddCarry(x[0], y[0], Carry[0]),
|
||||
uaddCarry(x[1], y[1], Carry[1]),
|
||||
uaddCarry(x[2], y[2], Carry[2]));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec4 uaddCarry
|
||||
(
|
||||
uvec4 const & x,
|
||||
uvec4 const & y,
|
||||
uvec4 & Carry
|
||||
)
|
||||
{
|
||||
return uvec4(
|
||||
uaddCarry(x[0], y[0], Carry[0]),
|
||||
uaddCarry(x[1], y[1], Carry[1]),
|
||||
uaddCarry(x[2], y[2], Carry[2]),
|
||||
uaddCarry(x[3], y[3], Carry[3]));
|
||||
vecType<uint64, P> Value64(vecType<uint64, P>(x) + vecType<uint64, P>(y));
|
||||
vecType<uint64, P> Max32((static_cast<uint64>(1) << static_cast<uint64>(32)) - static_cast<uint64>(1));
|
||||
Carry = mix(vecType<uint32, P>(0), vecType<uint32, P>(1), greaterThan(Value64, Max32));
|
||||
return vecType<uint32,P>(Value64 % (Max32 + static_cast<uint64>(1)));
|
||||
}
|
||||
|
||||
// usubBorrow
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uint usubBorrow
|
||||
(
|
||||
uint const & x,
|
||||
uint const & y,
|
||||
uint & Borrow
|
||||
)
|
||||
GLM_FUNC_QUALIFIER uint usubBorrow(uint const & x, uint const & y, uint & Borrow)
|
||||
{
|
||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||
|
||||
@@ -116,57 +233,17 @@ namespace glm
|
||||
return static_cast<uint32>((static_cast<int64>(1) << static_cast<int64>(32)) + (static_cast<int64>(y) - static_cast<int64>(x)));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec2 usubBorrow
|
||||
(
|
||||
uvec2 const & x,
|
||||
uvec2 const & y,
|
||||
uvec2 & Borrow
|
||||
)
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<uint, P> usubBorrow(vecType<uint, P> const & x, vecType<uint, P> const & y, vecType<uint, P> & Borrow)
|
||||
{
|
||||
return uvec2(
|
||||
usubBorrow(x[0], y[0], Borrow[0]),
|
||||
usubBorrow(x[1], y[1], Borrow[1]));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec3 usubBorrow
|
||||
(
|
||||
uvec3 const & x,
|
||||
uvec3 const & y,
|
||||
uvec3 & Borrow
|
||||
)
|
||||
{
|
||||
return uvec3(
|
||||
usubBorrow(x[0], y[0], Borrow[0]),
|
||||
usubBorrow(x[1], y[1], Borrow[1]),
|
||||
usubBorrow(x[2], y[2], Borrow[2]));
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER uvec4 usubBorrow
|
||||
(
|
||||
uvec4 const & x,
|
||||
uvec4 const & y,
|
||||
uvec4 & Borrow
|
||||
)
|
||||
{
|
||||
return uvec4(
|
||||
usubBorrow(x[0], y[0], Borrow[0]),
|
||||
usubBorrow(x[1], y[1], Borrow[1]),
|
||||
usubBorrow(x[2], y[2], Borrow[2]),
|
||||
usubBorrow(x[3], y[3], Borrow[3]));
|
||||
Borrow = mix(vecType<uint, P>(1), vecType<uint, P>(0), greaterThanEqual(x, y));
|
||||
vecType<uint, P> const YgeX(y - x);
|
||||
vecType<uint, P> const XgeY(vecType<uint32, P>((static_cast<int64>(1) << static_cast<int64>(32)) + (vecType<int64, P>(y) - vecType<int64, P>(x))));
|
||||
return mix(XgeY, YgeX, greaterThanEqual(y, x));
|
||||
}
|
||||
|
||||
// umulExtended
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void umulExtended
|
||||
(
|
||||
uint const & x,
|
||||
uint const & y,
|
||||
uint & msb,
|
||||
uint & lsb
|
||||
)
|
||||
GLM_FUNC_QUALIFIER void umulExtended(uint const & x, uint const & y, uint & msb, uint & lsb)
|
||||
{
|
||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||
|
||||
@@ -177,57 +254,18 @@ namespace glm
|
||||
lsb = *PointerLSB;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void umulExtended
|
||||
(
|
||||
uvec2 const & x,
|
||||
uvec2 const & y,
|
||||
uvec2 & msb,
|
||||
uvec2 & lsb
|
||||
)
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER void umulExtended(vecType<uint, P> const & x, vecType<uint, P> const & y, vecType<uint, P> & msb, vecType<uint, P> & lsb)
|
||||
{
|
||||
umulExtended(x[0], y[0], msb[0], lsb[0]);
|
||||
umulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
}
|
||||
GLM_STATIC_ASSERT(sizeof(uint) == sizeof(uint32), "uint and uint32 size mismatch");
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void umulExtended
|
||||
(
|
||||
uvec3 const & x,
|
||||
uvec3 const & y,
|
||||
uvec3 & msb,
|
||||
uvec3 & lsb
|
||||
)
|
||||
{
|
||||
umulExtended(x[0], y[0], msb[0], lsb[0]);
|
||||
umulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
umulExtended(x[2], y[2], msb[2], lsb[2]);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void umulExtended
|
||||
(
|
||||
uvec4 const & x,
|
||||
uvec4 const & y,
|
||||
uvec4 & msb,
|
||||
uvec4 & lsb
|
||||
)
|
||||
{
|
||||
umulExtended(x[0], y[0], msb[0], lsb[0]);
|
||||
umulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
umulExtended(x[2], y[2], msb[2], lsb[2]);
|
||||
umulExtended(x[3], y[3], msb[3], lsb[3]);
|
||||
vecType<uint64, P> Value64(vecType<uint64, P>(x) * vecType<uint64, P>(y));
|
||||
msb = vecType<uint32, P>(Value64 >> static_cast<uint64>(32));
|
||||
lsb = vecType<uint32, P>(Value64);
|
||||
}
|
||||
|
||||
// imulExtended
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void imulExtended
|
||||
(
|
||||
int const & x,
|
||||
int const & y,
|
||||
int & msb,
|
||||
int & lsb
|
||||
)
|
||||
GLM_FUNC_QUALIFIER void imulExtended(int x, int y, int & msb, int & lsb)
|
||||
{
|
||||
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
||||
|
||||
@@ -238,417 +276,118 @@ namespace glm
|
||||
lsb = *PointerLSB;
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void imulExtended
|
||||
(
|
||||
ivec2 const & x,
|
||||
ivec2 const & y,
|
||||
ivec2 & msb,
|
||||
ivec2 & lsb
|
||||
)
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER void imulExtended(vecType<int, P> const & x, vecType<int, P> const & y, vecType<int, P> & msb, vecType<int, P> & lsb)
|
||||
{
|
||||
imulExtended(x[0], y[0], msb[0], lsb[0]),
|
||||
imulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
}
|
||||
GLM_STATIC_ASSERT(sizeof(int) == sizeof(int32), "int and int32 size mismatch");
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void imulExtended
|
||||
(
|
||||
ivec3 const & x,
|
||||
ivec3 const & y,
|
||||
ivec3 & msb,
|
||||
ivec3 & lsb
|
||||
)
|
||||
{
|
||||
imulExtended(x[0], y[0], msb[0], lsb[0]),
|
||||
imulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
imulExtended(x[2], y[2], msb[2], lsb[2]);
|
||||
}
|
||||
|
||||
template <>
|
||||
GLM_FUNC_QUALIFIER void imulExtended
|
||||
(
|
||||
ivec4 const & x,
|
||||
ivec4 const & y,
|
||||
ivec4 & msb,
|
||||
ivec4 & lsb
|
||||
)
|
||||
{
|
||||
imulExtended(x[0], y[0], msb[0], lsb[0]),
|
||||
imulExtended(x[1], y[1], msb[1], lsb[1]);
|
||||
imulExtended(x[2], y[2], msb[2], lsb[2]);
|
||||
imulExtended(x[3], y[3], msb[3], lsb[3]);
|
||||
vecType<int64, P> Value64(vecType<int64, P>(x) * vecType<int64, P>(y));
|
||||
lsb = vecType<int32, P>(Value64 & static_cast<int64>(0xFFFFFFFF));
|
||||
msb = vecType<int32, P>((Value64 >> static_cast<int64>(32)) & static_cast<int64>(0xFFFFFFFF));
|
||||
}
|
||||
|
||||
// bitfieldExtract
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldExtract
|
||||
(
|
||||
genIUType const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldExtract(genIUType Value, int Offset, int Bits)
|
||||
{
|
||||
int GenSize = int(sizeof(genIUType)) << int(3);
|
||||
|
||||
assert(Offset + Bits <= GenSize);
|
||||
|
||||
genIUType ShiftLeft = Bits ? Value << (GenSize - (Bits + Offset)) : genIUType(0);
|
||||
genIUType ShiftBack = ShiftLeft >> genIUType(GenSize - Bits);
|
||||
|
||||
return ShiftBack;
|
||||
return bitfieldExtract(tvec1<genIUType>(Value), Offset, Bits).x;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> bitfieldExtract
|
||||
(
|
||||
detail::tvec2<T, P> const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldExtract(vecType<T, P> const & Value, int Offset, int Bits)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
bitfieldExtract(Value[0], Offset, Bits),
|
||||
bitfieldExtract(Value[1], Offset, Bits));
|
||||
}
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldExtract' only accept integer inputs");
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> bitfieldExtract
|
||||
(
|
||||
detail::tvec3<T, P> const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
bitfieldExtract(Value[0], Offset, Bits),
|
||||
bitfieldExtract(Value[1], Offset, Bits),
|
||||
bitfieldExtract(Value[2], Offset, Bits));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> bitfieldExtract
|
||||
(
|
||||
detail::tvec4<T, P> const & Value,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
bitfieldExtract(Value[0], Offset, Bits),
|
||||
bitfieldExtract(Value[1], Offset, Bits),
|
||||
bitfieldExtract(Value[2], Offset, Bits),
|
||||
bitfieldExtract(Value[3], Offset, Bits));
|
||||
return (Value >> static_cast<T>(Offset)) & static_cast<T>(detail::mask(Bits));
|
||||
}
|
||||
|
||||
// bitfieldInsert
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldInsert
|
||||
(
|
||||
genIUType const & Base,
|
||||
genIUType const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldInsert(genIUType const & Base, genIUType const & Insert, int Offset, int Bits)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'bitfieldInsert' only accept integer values");
|
||||
assert(Offset + Bits <= sizeof(genIUType));
|
||||
return bitfieldInsert(tvec1<genIUType>(Base), tvec1<genIUType>(Insert), Offset, Bits).x;
|
||||
}
|
||||
|
||||
if(Bits == 0)
|
||||
return Base;
|
||||
|
||||
genIUType Mask = 0;
|
||||
for(int Bit = Offset; Bit < Offset + Bits; ++Bit)
|
||||
Mask |= (1 << Bit);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldInsert(vecType<T, P> const & Base, vecType<T, P> const & Insert, int Offset, int Bits)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'bitfieldInsert' only accept integer values");
|
||||
|
||||
T const Mask = static_cast<T>(detail::mask(Bits) << Offset);
|
||||
return (Base & ~Mask) | (Insert & Mask);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> bitfieldInsert
|
||||
(
|
||||
detail::tvec2<T, P> const & Base,
|
||||
detail::tvec2<T, P> const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
bitfieldInsert(Base[0], Insert[0], Offset, Bits),
|
||||
bitfieldInsert(Base[1], Insert[1], Offset, Bits));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> bitfieldInsert
|
||||
(
|
||||
detail::tvec3<T, P> const & Base,
|
||||
detail::tvec3<T, P> const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
bitfieldInsert(Base[0], Insert[0], Offset, Bits),
|
||||
bitfieldInsert(Base[1], Insert[1], Offset, Bits),
|
||||
bitfieldInsert(Base[2], Insert[2], Offset, Bits));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> bitfieldInsert
|
||||
(
|
||||
detail::tvec4<T, P> const & Base,
|
||||
detail::tvec4<T, P> const & Insert,
|
||||
int const & Offset,
|
||||
int const & Bits
|
||||
)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
bitfieldInsert(Base[0], Insert[0], Offset, Bits),
|
||||
bitfieldInsert(Base[1], Insert[1], Offset, Bits),
|
||||
bitfieldInsert(Base[2], Insert[2], Offset, Bits),
|
||||
bitfieldInsert(Base[3], Insert[3], Offset, Bits));
|
||||
}
|
||||
|
||||
// bitfieldReverse
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER genIUType bitfieldReverse(genIUType const & Value)
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType bitfieldReverse(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'bitfieldReverse' only accept integer values");
|
||||
return bitfieldReverse(glm::tvec1<genType, glm::defaultp>(x)).x;
|
||||
}
|
||||
|
||||
genIUType Out = 0;
|
||||
std::size_t BitSize = sizeof(genIUType) * 8;
|
||||
for(std::size_t i = 0; i < BitSize; ++i)
|
||||
if(Value & (genIUType(1) << i))
|
||||
Out |= genIUType(1) << (BitSize - 1 - i);
|
||||
return Out;
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(bitfieldReverse)
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> bitfieldReverse(vecType<T, P> const & v)
|
||||
{
|
||||
vecType<T, P> x(v);
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 2>::call(x, T(0x5555555555555555ull), static_cast<T>( 1));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 4>::call(x, T(0x3333333333333333ull), static_cast<T>( 2));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 8>::call(x, T(0x0F0F0F0F0F0F0F0Full), static_cast<T>( 4));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 16>::call(x, T(0x00FF00FF00FF00FFull), static_cast<T>( 8));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 32>::call(x, T(0x0000FFFF0000FFFFull), static_cast<T>(16));
|
||||
x = detail::compute_bitfieldReverseStep<sizeof(T) * 8 >= 64>::call(x, T(0x00000000FFFFFFFFull), static_cast<T>(32));
|
||||
return x;
|
||||
}
|
||||
|
||||
// bitCount
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int bitCount(genIUType const & Value)
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER int bitCount(genType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'bitCount' only accept integer values");
|
||||
|
||||
int Count = 0;
|
||||
for(std::size_t i = 0; i < sizeof(genIUType) * std::size_t(8); ++i)
|
||||
{
|
||||
if(Value & (1 << i))
|
||||
++Count;
|
||||
}
|
||||
return Count;
|
||||
return bitCount(glm::tvec1<genType, glm::defaultp>(x)).x;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<int, P> bitCount
|
||||
(
|
||||
detail::tvec2<T, P> const & value
|
||||
)
|
||||
template <typename T, glm::precision P, template <typename, glm::precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<int, P> bitCount(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::tvec2<int, P>(
|
||||
bitCount(value[0]),
|
||||
bitCount(value[1]));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<int, P> bitCount
|
||||
(
|
||||
detail::tvec3<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec3<int, P>(
|
||||
bitCount(value[0]),
|
||||
bitCount(value[1]),
|
||||
bitCount(value[2]));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<int, P> bitCount
|
||||
(
|
||||
detail::tvec4<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec4<int, P>(
|
||||
bitCount(value[0]),
|
||||
bitCount(value[1]),
|
||||
bitCount(value[2]),
|
||||
bitCount(value[3]));
|
||||
vecType<typename detail::make_unsigned<T>::type, P> x(*reinterpret_cast<vecType<typename detail::make_unsigned<T>::type, P> const *>(&v));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 2>::call(x, typename detail::make_unsigned<T>::type(0x5555555555555555ull), typename detail::make_unsigned<T>::type( 1));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 4>::call(x, typename detail::make_unsigned<T>::type(0x3333333333333333ull), typename detail::make_unsigned<T>::type( 2));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 8>::call(x, typename detail::make_unsigned<T>::type(0x0F0F0F0F0F0F0F0Full), typename detail::make_unsigned<T>::type( 4));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 16>::call(x, typename detail::make_unsigned<T>::type(0x00FF00FF00FF00FFull), typename detail::make_unsigned<T>::type( 8));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 32>::call(x, typename detail::make_unsigned<T>::type(0x0000FFFF0000FFFFull), typename detail::make_unsigned<T>::type(16));
|
||||
x = detail::compute_bitfieldBitCountStep<sizeof(T) * 8 >= 64>::call(x, typename detail::make_unsigned<T>::type(0x00000000FFFFFFFFull), typename detail::make_unsigned<T>::type(32));
|
||||
return vecType<int, P>(x);
|
||||
}
|
||||
|
||||
// findLSB
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findLSB
|
||||
(
|
||||
genIUType const & Value
|
||||
)
|
||||
GLM_FUNC_QUALIFIER int findLSB(genIUType Value)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findLSB' only accept integer values");
|
||||
if(Value == 0)
|
||||
return -1;
|
||||
|
||||
genIUType Bit;
|
||||
for(Bit = genIUType(0); !(Value & (1 << Bit)); ++Bit){}
|
||||
return Bit;
|
||||
return detail::compute_findLSB<genIUType, sizeof(genIUType) * 8>::call(Value);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<int, P> findLSB
|
||||
(
|
||||
detail::tvec2<T, P> const & value
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<int, P> findLSB(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<int, P>(
|
||||
findLSB(value[0]),
|
||||
findLSB(value[1]));
|
||||
}
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findLSB' only accept integer values");
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<int, P> findLSB
|
||||
(
|
||||
detail::tvec3<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec3<int, P>(
|
||||
findLSB(value[0]),
|
||||
findLSB(value[1]),
|
||||
findLSB(value[2]));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<int, P> findLSB
|
||||
(
|
||||
detail::tvec4<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec4<int, P>(
|
||||
findLSB(value[0]),
|
||||
findLSB(value[1]),
|
||||
findLSB(value[2]),
|
||||
findLSB(value[3]));
|
||||
return detail::functor1<int, T, P, vecType>::call(findLSB, x);
|
||||
}
|
||||
|
||||
// findMSB
|
||||
#if((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_VC))
|
||||
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB
|
||||
(
|
||||
genIUType const & Value
|
||||
)
|
||||
GLM_FUNC_QUALIFIER int findMSB(genIUType x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
if(Value == 0)
|
||||
return -1;
|
||||
|
||||
unsigned long Result(0);
|
||||
_BitScanReverse(&Result, Value);
|
||||
return int(Result);
|
||||
}
|
||||
/*
|
||||
// __builtin_clz seems to be buggy as it crasks for some values, from 0x00200000 to 80000000
|
||||
#elif((GLM_ARCH != GLM_ARCH_PURE) && (GLM_COMPILER & GLM_COMPILER_GCC) && (GLM_COMPILER >= GLM_COMPILER_GCC40))
|
||||
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB
|
||||
(
|
||||
genIUType const & Value
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
if(Value == 0)
|
||||
return -1;
|
||||
|
||||
// clz returns the number or trailing 0-bits; see
|
||||
// http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Other-Builtins.html
|
||||
//
|
||||
// NoteBecause __builtin_clz only works for unsigned ints, this
|
||||
// implementation will not work for 64-bit integers.
|
||||
//
|
||||
return 31 - __builtin_clzl(Value);
|
||||
}
|
||||
*/
|
||||
#else
|
||||
|
||||
/* SSE implementation idea
|
||||
|
||||
__m128i const Zero = _mm_set_epi32( 0, 0, 0, 0);
|
||||
__m128i const One = _mm_set_epi32( 1, 1, 1, 1);
|
||||
__m128i Bit = _mm_set_epi32(-1, -1, -1, -1);
|
||||
__m128i Tmp = _mm_set_epi32(Value, Value, Value, Value);
|
||||
__m128i Mmi = Zero;
|
||||
for(int i = 0; i < 32; ++i)
|
||||
{
|
||||
__m128i Shilt = _mm_and_si128(_mm_cmpgt_epi32(Tmp, One), One);
|
||||
Tmp = _mm_srai_epi32(Tmp, One);
|
||||
Bit = _mm_add_epi32(Bit, _mm_and_si128(Shilt, i));
|
||||
Mmi = _mm_and_si128(Mmi, One);
|
||||
}
|
||||
return Bit;
|
||||
|
||||
*/
|
||||
|
||||
template <typename genIUType>
|
||||
GLM_FUNC_QUALIFIER int findMSB
|
||||
(
|
||||
genIUType const & Value
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genIUType>::is_integer, "'findMSB' only accept integer values");
|
||||
|
||||
if(Value == genIUType(0) || Value == genIUType(-1))
|
||||
return -1;
|
||||
else if(Value > 0)
|
||||
{
|
||||
genIUType Bit = genIUType(-1);
|
||||
for(genIUType tmp = Value; tmp > 0; tmp >>= 1, ++Bit){}
|
||||
return Bit;
|
||||
}
|
||||
else //if(Value < 0)
|
||||
{
|
||||
int const BitCount(sizeof(genIUType) * 8);
|
||||
int MostSignificantBit(-1);
|
||||
for(int BitIndex(0); BitIndex < BitCount; ++BitIndex)
|
||||
MostSignificantBit = (Value & (1 << BitIndex)) ? MostSignificantBit : BitIndex;
|
||||
assert(MostSignificantBit >= 0);
|
||||
return MostSignificantBit;
|
||||
}
|
||||
}
|
||||
#endif//(GLM_COMPILER)
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<int, P> findMSB
|
||||
(
|
||||
detail::tvec2<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec2<int, P>(
|
||||
findMSB(value[0]),
|
||||
findMSB(value[1]));
|
||||
return findMSB(tvec1<genIUType>(x)).x;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<int, P> findMSB
|
||||
(
|
||||
detail::tvec3<T, P> const & value
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<int, P> findMSB(vecType<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<int, P>(
|
||||
findMSB(value[0]),
|
||||
findMSB(value[1]),
|
||||
findMSB(value[2]));
|
||||
}
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_integer, "'findMSB' only accept integer values");
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<int, P> findMSB
|
||||
(
|
||||
detail::tvec4<T, P> const & value
|
||||
)
|
||||
{
|
||||
return detail::tvec4<int, P>(
|
||||
findMSB(value[0]),
|
||||
findMSB(value[1]),
|
||||
findMSB(value[2]),
|
||||
findMSB(value[3]));
|
||||
return detail::compute_findMSB_vec<T, P, vecType, sizeof(T) * 8>::call(x);
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_matrix.hpp
|
||||
/// @file glm/detail/func_matrix.hpp
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@@ -37,8 +41,7 @@
|
||||
/// floating point version is shown.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_func_matrix
|
||||
#define GLM_CORE_func_matrix
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/precision.hpp"
|
||||
@@ -137,8 +140,6 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
///
|
||||
/// @todo Clarify the declaration to specify that matType doesn't have to be provided when used.
|
||||
template <typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB>
|
||||
GLM_FUNC_DECL typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r);
|
||||
|
||||
@@ -148,7 +149,7 @@ namespace detail
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
|
||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))
|
||||
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2012))
|
||||
template <typename T, precision P, template <typename, precision> class matType>
|
||||
GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
|
||||
# endif
|
||||
@@ -175,5 +176,3 @@ namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#include "func_matrix.inl"
|
||||
|
||||
#endif//GLM_CORE_func_matrix
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_matrix.inl
|
||||
/// @file glm/detail/func_matrix.inl
|
||||
/// @date 2008-03-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -32,173 +36,15 @@
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template
|
||||
<
|
||||
template <class, precision> class vecTypeA,
|
||||
template <class, precision> class vecTypeB,
|
||||
typename T, precision P
|
||||
>
|
||||
struct compute_outerProduct{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec2, detail::tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec2, detail::tvec2>::type call(detail::tvec2<T, P> const & c, detail::tvec2<T, P> const & r)
|
||||
{
|
||||
detail::tmat2x2<T, P> m(detail::tmat2x2<T, P>::_null);
|
||||
m[0][0] = c[0] * r[0];
|
||||
m[0][1] = c[1] * r[0];
|
||||
m[1][0] = c[0] * r[1];
|
||||
m[1][1] = c[1] * r[1];
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec3, detail::tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec3, detail::tvec3>::type call(detail::tvec3<T, P> const & c, detail::tvec3<T, P> const & r)
|
||||
{
|
||||
detail::tmat3x3<T, P> m(detail::tmat3x3<T, P>::_null);
|
||||
for(length_t i(0); i < m.length(); ++i)
|
||||
m[i] = c * r[i];
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec4, detail::tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec4, detail::tvec4>::type call(detail::tvec4<T, P> const & c, detail::tvec4<T, P> const & r)
|
||||
{
|
||||
detail::tmat4x4<T, P> m(detail::tmat4x4<T, P>::_null);
|
||||
for(length_t i(0); i < m.length(); ++i)
|
||||
m[i] = c * r[i];
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec3, detail::tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec3, detail::tvec2>::type call(detail::tvec3<T, P> const & c, detail::tvec2<T, P> const & r)
|
||||
{
|
||||
detail::tmat2x3<T, P> m(detail::tmat2x3<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[1][2] = c.z * r.y;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec2, detail::tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec2, detail::tvec3>::type call(detail::tvec2<T, P> const & c, detail::tvec3<T, P> const & r)
|
||||
{
|
||||
detail::tmat3x2<T, P> m(detail::tmat3x2<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[2][0] = c.x * r.z;
|
||||
m[2][1] = c.y * r.z;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec4, detail::tvec2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec4, detail::tvec2>::type call(detail::tvec4<T, P> const & c, detail::tvec2<T, P> const & r)
|
||||
{
|
||||
detail::tmat2x4<T, P> m(detail::tmat2x4<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
m[0][3] = c.w * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[1][2] = c.z * r.y;
|
||||
m[1][3] = c.w * r.y;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec2, detail::tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec2, detail::tvec4>::type call(detail::tvec2<T, P> const & c, detail::tvec4<T, P> const & r)
|
||||
{
|
||||
detail::tmat4x2<T, P> m(detail::tmat4x2<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[2][0] = c.x * r.z;
|
||||
m[2][1] = c.y * r.z;
|
||||
m[3][0] = c.x * r.w;
|
||||
m[3][1] = c.y * r.w;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec4, detail::tvec3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec4, detail::tvec3>::type call(detail::tvec4<T, P> const & c, detail::tvec3<T, P> const & r)
|
||||
{
|
||||
detail::tmat3x4<T, P> m(detail::tmat3x4<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
m[0][3] = c.w * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[1][2] = c.z * r.y;
|
||||
m[1][3] = c.w * r.y;
|
||||
m[2][0] = c.x * r.z;
|
||||
m[2][1] = c.y * r.z;
|
||||
m[2][2] = c.z * r.z;
|
||||
m[2][3] = c.w * r.z;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_outerProduct<detail::tvec3, detail::tvec4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static typename detail::outerProduct_trait<T, P, detail::tvec3, detail::tvec4>::type call(detail::tvec3<T, P> const & c, detail::tvec4<T, P> const & r)
|
||||
{
|
||||
detail::tmat4x3<T, P> m(detail::tmat4x3<T, P>::_null);
|
||||
m[0][0] = c.x * r.x;
|
||||
m[0][1] = c.y * r.x;
|
||||
m[0][2] = c.z * r.x;
|
||||
m[1][0] = c.x * r.y;
|
||||
m[1][1] = c.y * r.y;
|
||||
m[1][2] = c.z * r.y;
|
||||
m[2][0] = c.x * r.z;
|
||||
m[2][1] = c.y * r.z;
|
||||
m[2][2] = c.z * r.z;
|
||||
m[3][0] = c.x * r.w;
|
||||
m[3][1] = c.y * r.w;
|
||||
m[3][2] = c.z * r.w;
|
||||
return m;
|
||||
}
|
||||
};
|
||||
|
||||
template <template <class, precision> class matType, typename T, precision P>
|
||||
struct compute_transpose{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat2x2, T, P>
|
||||
struct compute_transpose<tmat2x2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat2x2<T, P> call(detail::tmat2x2<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat2x2<T, P> call(tmat2x2<T, P> const & m)
|
||||
{
|
||||
detail::tmat2x2<T, P> result(detail::tmat2x2<T, P>::_null);
|
||||
tmat2x2<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[1][0] = m[0][1];
|
||||
@@ -208,11 +54,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat2x3, T, P>
|
||||
struct compute_transpose<tmat2x3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat3x2<T, P> call(detail::tmat2x3<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat3x2<T, P> call(tmat2x3<T, P> const & m)
|
||||
{
|
||||
detail::tmat3x2<T, P> result(detail::tmat3x2<T, P>::_null);
|
||||
tmat3x2<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[1][0] = m[0][1];
|
||||
@@ -224,11 +70,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat2x4, T, P>
|
||||
struct compute_transpose<tmat2x4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat4x2<T, P> call(detail::tmat2x4<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat4x2<T, P> call(tmat2x4<T, P> const & m)
|
||||
{
|
||||
detail::tmat4x2<T, P> result(detail::tmat4x2<T, P>::_null);
|
||||
tmat4x2<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[1][0] = m[0][1];
|
||||
@@ -242,11 +88,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat3x2, T, P>
|
||||
struct compute_transpose<tmat3x2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat2x3<T, P> call(detail::tmat3x2<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat2x3<T, P> call(tmat3x2<T, P> const & m)
|
||||
{
|
||||
detail::tmat2x3<T, P> result(detail::tmat2x3<T, P>::_null);
|
||||
tmat2x3<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@@ -258,11 +104,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat3x3, T, P>
|
||||
struct compute_transpose<tmat3x3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat3x3<T, P> call(detail::tmat3x3<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat3x3<T, P> call(tmat3x3<T, P> const & m)
|
||||
{
|
||||
detail::tmat3x3<T, P> result(detail::tmat3x3<T, P>::_null);
|
||||
tmat3x3<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@@ -279,11 +125,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat3x4, T, P>
|
||||
struct compute_transpose<tmat3x4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat4x3<T, P> call(detail::tmat3x4<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat4x3<T, P> call(tmat3x4<T, P> const & m)
|
||||
{
|
||||
detail::tmat4x3<T, P> result(detail::tmat4x3<T, P>::_null);
|
||||
tmat4x3<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@@ -301,11 +147,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat4x2, T, P>
|
||||
struct compute_transpose<tmat4x2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat2x4<T, P> call(detail::tmat4x2<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat2x4<T, P> call(tmat4x2<T, P> const & m)
|
||||
{
|
||||
detail::tmat2x4<T, P> result(detail::tmat2x4<T, P>::_null);
|
||||
tmat2x4<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@@ -319,11 +165,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat4x3, T, P>
|
||||
struct compute_transpose<tmat4x3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat3x4<T, P> call(detail::tmat4x3<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat3x4<T, P> call(tmat4x3<T, P> const & m)
|
||||
{
|
||||
detail::tmat3x4<T, P> result(detail::tmat3x4<T, P>::_null);
|
||||
tmat3x4<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@@ -341,11 +187,11 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_transpose<detail::tmat4x4, T, P>
|
||||
struct compute_transpose<tmat4x4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static detail::tmat4x4<T, P> call(detail::tmat4x4<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static tmat4x4<T, P> call(tmat4x4<T, P> const & m)
|
||||
{
|
||||
detail::tmat4x4<T, P> result(detail::tmat4x4<T, P>::_null);
|
||||
tmat4x4<T, P> result(uninitialize);
|
||||
result[0][0] = m[0][0];
|
||||
result[0][1] = m[1][0];
|
||||
result[0][2] = m[2][0];
|
||||
@@ -373,18 +219,18 @@ namespace detail
|
||||
struct compute_determinant{};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_determinant<detail::tmat2x2, T, P>
|
||||
struct compute_determinant<tmat2x2, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tmat2x2<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static T call(tmat2x2<T, P> const & m)
|
||||
{
|
||||
return m[0][0] * m[1][1] - m[1][0] * m[0][1];
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_determinant<detail::tmat3x3, T, P>
|
||||
struct compute_determinant<tmat3x3, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tmat3x3<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static T call(tmat3x3<T, P> const & m)
|
||||
{
|
||||
return
|
||||
+ m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2])
|
||||
@@ -394,9 +240,9 @@ namespace detail
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_determinant<detail::tmat4x4, T, P>
|
||||
struct compute_determinant<tmat4x4, T, P>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static T call(detail::tmat4x4<T, P> const & m)
|
||||
GLM_FUNC_QUALIFIER static T call(tmat4x4<T, P> const & m)
|
||||
{
|
||||
T SubFactor00 = m[2][2] * m[3][3] - m[3][2] * m[2][3];
|
||||
T SubFactor01 = m[2][1] * m[3][3] - m[3][1] * m[2][3];
|
||||
@@ -405,7 +251,7 @@ namespace detail
|
||||
T SubFactor04 = m[2][0] * m[3][2] - m[3][0] * m[2][2];
|
||||
T SubFactor05 = m[2][0] * m[3][1] - m[3][0] * m[2][1];
|
||||
|
||||
detail::tvec4<T, P> DetCof(
|
||||
tvec4<T, P> DetCof(
|
||||
+ (m[1][1] * SubFactor00 - m[1][2] * SubFactor01 + m[1][3] * SubFactor02),
|
||||
- (m[1][0] * SubFactor00 - m[1][2] * SubFactor03 + m[1][3] * SubFactor04),
|
||||
+ (m[1][0] * SubFactor01 - m[1][1] * SubFactor03 + m[1][3] * SubFactor05),
|
||||
@@ -423,8 +269,8 @@ namespace detail
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'matrixCompMult' only accept floating-point inputs");
|
||||
|
||||
matType<T, P> result(matType<T, P>::_null);
|
||||
for(length_t i = 0; i < result.length(); ++i)
|
||||
matType<T, P> result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(result); ++i)
|
||||
result[i] = x[i] * y[i];
|
||||
return result;
|
||||
}
|
||||
@@ -433,7 +279,11 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'outerProduct' only accept floating-point inputs");
|
||||
return detail::compute_outerProduct<vecTypeA, vecTypeB, T, P>::call(c, r);
|
||||
|
||||
typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type m(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(m); ++i)
|
||||
m[i] = c * r[i];
|
||||
return m;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class matType>
|
||||
@@ -454,7 +304,7 @@ namespace detail
|
||||
GLM_FUNC_QUALIFIER matType<T, P> inverse(matType<T, P> const & m)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'inverse' only accept floating-point inputs");
|
||||
return detail::compute_inverse<matType, T, P>::call(m);
|
||||
return detail::compute_inverse(m);
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_noise.hpp
|
||||
/// @file glm/detail/func_noise.hpp
|
||||
/// @date 2008-08-01 / 2011-06-18
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@@ -35,8 +39,7 @@
|
||||
/// appearance of randomness, but are not truly random.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_func_noise
|
||||
#define glm_core_func_noise
|
||||
#pragma once
|
||||
|
||||
#include "type_vec1.hpp"
|
||||
#include "type_vec2.hpp"
|
||||
@@ -64,7 +67,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise2.xml">GLSL noise2 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL detail::tvec2<typename genType::value_type, defaultp> noise2(genType const & x);
|
||||
GLM_FUNC_DECL tvec2<typename genType::value_type, defaultp> noise2(genType const & x);
|
||||
|
||||
/// Returns a 3D noise value based on the input value x.
|
||||
///
|
||||
@@ -73,7 +76,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise3.xml">GLSL noise3 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL detail::tvec3<typename genType::value_type, defaultp> noise3(genType const & x);
|
||||
GLM_FUNC_DECL tvec3<typename genType::value_type, defaultp> noise3(genType const & x);
|
||||
|
||||
/// Returns a 4D noise value based on the input value x.
|
||||
///
|
||||
@@ -82,11 +85,9 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/noise4.xml">GLSL noise4 man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.13 Noise Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL detail::tvec4<typename genType::value_type, defaultp> noise4(genType const & x);
|
||||
GLM_FUNC_DECL tvec4<typename genType::value_type, defaultp> noise4(genType const & x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_noise.inl"
|
||||
|
||||
#endif//glm_core_func_noise
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_noise.inl
|
||||
/// @file glm/detail/func_noise.inl
|
||||
/// @date 2008-08-01 / 2011-09-27
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -33,43 +37,43 @@ namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> grad4(T const & j, detail::tvec4<T, P> const & ip)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> grad4(T const & j, tvec4<T, P> const & ip)
|
||||
{
|
||||
detail::tvec3<T, P> pXYZ = floor(fract(detail::tvec3<T, P>(j) * detail::tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
|
||||
T pW = static_cast<T>(1.5) - dot(abs(pXYZ), detail::tvec3<T, P>(1));
|
||||
detail::tvec4<T, P> s = detail::tvec4<T, P>(lessThan(detail::tvec4<T, P>(pXYZ, pW), detail::tvec4<T, P>(0.0)));
|
||||
pXYZ = pXYZ + (detail::tvec3<T, P>(s) * T(2) - T(1)) * s.w;
|
||||
return detail::tvec4<T, P>(pXYZ, pW);
|
||||
tvec3<T, P> pXYZ = floor(fract(tvec3<T, P>(j) * tvec3<T, P>(ip)) * T(7)) * ip[2] - T(1);
|
||||
T pW = static_cast<T>(1.5) - dot(abs(pXYZ), tvec3<T, P>(1));
|
||||
tvec4<T, P> s = tvec4<T, P>(lessThan(tvec4<T, P>(pXYZ, pW), tvec4<T, P>(0.0)));
|
||||
pXYZ = pXYZ + (tvec3<T, P>(s) * T(2) - T(1)) * s.w;
|
||||
return tvec4<T, P>(pXYZ, pW);
|
||||
}
|
||||
}//namespace detail
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T noise1(T const & x)
|
||||
{
|
||||
return noise1(detail::tvec2<T, defaultp>(x, T(0)));
|
||||
return noise1(tvec2<T, defaultp>(x, T(0)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, defaultp> noise2(T const & x)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, defaultp> noise2(T const & x)
|
||||
{
|
||||
return detail::tvec2<T, defaultp>(
|
||||
return tvec2<T, defaultp>(
|
||||
noise1(x + T(0.0)),
|
||||
noise1(x + T(1.0)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, defaultp> noise3(T const & x)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, defaultp> noise3(T const & x)
|
||||
{
|
||||
return detail::tvec3<T, defaultp>(
|
||||
return tvec3<T, defaultp>(
|
||||
noise1(x - T(1.0)),
|
||||
noise1(x + T(0.0)),
|
||||
noise1(x + T(1.0)));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, defaultp> noise4(T const & x)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, defaultp> noise4(T const & x)
|
||||
{
|
||||
return detail::tvec4<T, defaultp>(
|
||||
return tvec4<T, defaultp>(
|
||||
noise1(x - T(1.0)),
|
||||
noise1(x + T(0.0)),
|
||||
noise1(x + T(1.0)),
|
||||
@@ -77,38 +81,38 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T noise1(detail::tvec2<T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER T noise1(tvec2<T, P> const & v)
|
||||
{
|
||||
detail::tvec4<T, P> const C = detail::tvec4<T, P>(
|
||||
tvec4<T, P> const C = tvec4<T, P>(
|
||||
T( 0.211324865405187), // (3.0 - sqrt(3.0)) / 6.0
|
||||
T( 0.366025403784439), // 0.5 * (sqrt(3.0) - 1.0)
|
||||
T(-0.577350269189626), // -1.0 + 2.0 * C.x
|
||||
T( 0.024390243902439)); // 1.0 / 41.0
|
||||
|
||||
// First corner
|
||||
detail::tvec2<T, P> i = floor(v + dot(v, detail::tvec2<T, P>(C[1])));
|
||||
detail::tvec2<T, P> x0 = v - i + dot(i, detail::tvec2<T, P>(C[0]));
|
||||
tvec2<T, P> i = floor(v + dot(v, tvec2<T, P>(C[1])));
|
||||
tvec2<T, P> x0 = v - i + dot(i, tvec2<T, P>(C[0]));
|
||||
|
||||
// Other corners
|
||||
//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
|
||||
//i1.y = 1.0 - i1.x;
|
||||
detail::tvec2<T, P> i1 = (x0.x > x0.y) ? detail::tvec2<T, P>(1, 0) : detail::tvec2<T, P>(0, 1);
|
||||
tvec2<T, P> i1 = (x0.x > x0.y) ? tvec2<T, P>(1, 0) : tvec2<T, P>(0, 1);
|
||||
|
||||
// x0 = x0 - 0.0 + 0.0 * C.xx ;
|
||||
// x1 = x0 - i1 + 1.0 * C.xx ;
|
||||
// x2 = x0 - 1.0 + 2.0 * C.xx ;
|
||||
detail::tvec4<T, P> x12 = detail::tvec4<T, P>(x0.x, x0.y, x0.x, x0.y) + detail::tvec4<T, P>(C.x, C.x, C.z, C.z);
|
||||
x12 = detail::tvec4<T, P>(detail::tvec2<T, P>(x12) - i1, x12.z, x12.w);
|
||||
tvec4<T, P> x12 = tvec4<T, P>(x0.x, x0.y, x0.x, x0.y) + tvec4<T, P>(C.x, C.x, C.z, C.z);
|
||||
x12 = tvec4<T, P>(tvec2<T, P>(x12) - i1, x12.z, x12.w);
|
||||
|
||||
// Permutations
|
||||
i = mod(i, T(289)); // Avoid truncation effects in permutation
|
||||
detail::tvec3<T, P> p = detail::permute(
|
||||
detail::permute(i.y + detail::tvec3<T, P>(T(0), i1.y, T(1))) + i.x + detail::tvec3<T, P>(T(0), i1.x, T(1)));
|
||||
tvec3<T, P> p = detail::permute(
|
||||
detail::permute(i.y + tvec3<T, P>(T(0), i1.y, T(1))) + i.x + tvec3<T, P>(T(0), i1.x, T(1)));
|
||||
|
||||
detail::tvec3<T, P> m = max(T(0.5) - detail::tvec3<T, P>(
|
||||
tvec3<T, P> m = max(T(0.5) - tvec3<T, P>(
|
||||
dot(x0, x0),
|
||||
dot(detail::tvec2<T, P>(x12.x, x12.y), detail::tvec2<T, P>(x12.x, x12.y)),
|
||||
dot(detail::tvec2<T, P>(x12.z, x12.w), detail::tvec2<T, P>(x12.z, x12.w))), T(0));
|
||||
dot(tvec2<T, P>(x12.x, x12.y), tvec2<T, P>(x12.x, x12.y)),
|
||||
dot(tvec2<T, P>(x12.z, x12.w), tvec2<T, P>(x12.z, x12.w))), T(0));
|
||||
|
||||
m = m * m;
|
||||
m = m * m;
|
||||
@@ -116,17 +120,17 @@ namespace detail
|
||||
// Gradients: 41 points uniformly over a line, mapped onto a diamond.
|
||||
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
|
||||
|
||||
detail::tvec3<T, P> x = static_cast<T>(2) * fract(p * C.w) - T(1);
|
||||
detail::tvec3<T, P> h = abs(x) - T(0.5);
|
||||
detail::tvec3<T, P> ox = floor(x + T(0.5));
|
||||
detail::tvec3<T, P> a0 = x - ox;
|
||||
tvec3<T, P> x = static_cast<T>(2) * fract(p * C.w) - T(1);
|
||||
tvec3<T, P> h = abs(x) - T(0.5);
|
||||
tvec3<T, P> ox = floor(x + T(0.5));
|
||||
tvec3<T, P> a0 = x - ox;
|
||||
|
||||
// Normalise gradients implicitly by scaling m
|
||||
// Inlined for speed: m *= taylorInvSqrt( a0*a0 + h*h );
|
||||
m *= static_cast<T>(1.79284291400159) - T(0.85373472095314) * (a0 * a0 + h * h);
|
||||
|
||||
// Compute final noise value at P
|
||||
detail::tvec3<T, P> g;
|
||||
tvec3<T, P> g;
|
||||
g.x = a0.x * x0.x + h.x * x0.y;
|
||||
//g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
||||
g.y = a0.y * x12.x + h.y * x12.y;
|
||||
@@ -135,84 +139,84 @@ namespace detail
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T noise1(detail::tvec3<T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER T noise1(tvec3<T, P> const & v)
|
||||
{
|
||||
detail::tvec2<T, P> const C(1.0 / 6.0, 1.0 / 3.0);
|
||||
detail::tvec4<T, P> const D(0.0, 0.5, 1.0, 2.0);
|
||||
tvec2<T, P> const C(1.0 / 6.0, 1.0 / 3.0);
|
||||
tvec4<T, P> const D(0.0, 0.5, 1.0, 2.0);
|
||||
|
||||
// First corner
|
||||
detail::tvec3<T, P> i(floor(v + dot(v, detail::tvec3<T, P>(C.y))));
|
||||
detail::tvec3<T, P> x0(v - i + dot(i, detail::tvec3<T, P>(C.x)));
|
||||
tvec3<T, P> i(floor(v + dot(v, tvec3<T, P>(C.y))));
|
||||
tvec3<T, P> x0(v - i + dot(i, tvec3<T, P>(C.x)));
|
||||
|
||||
// Other corners
|
||||
detail::tvec3<T, P> g(step(detail::tvec3<T, P>(x0.y, x0.z, x0.x), x0));
|
||||
detail::tvec3<T, P> l(T(1) - g);
|
||||
detail::tvec3<T, P> i1(min(g, detail::tvec3<T, P>(l.z, l.x, l.y)));
|
||||
detail::tvec3<T, P> i2(max(g, detail::tvec3<T, P>(l.z, l.x, l.y)));
|
||||
tvec3<T, P> g(step(tvec3<T, P>(x0.y, x0.z, x0.x), x0));
|
||||
tvec3<T, P> l(T(1) - g);
|
||||
tvec3<T, P> i1(min(g, tvec3<T, P>(l.z, l.x, l.y)));
|
||||
tvec3<T, P> i2(max(g, tvec3<T, P>(l.z, l.x, l.y)));
|
||||
|
||||
// x0 = x0 - 0.0 + 0.0 * C.xxx;
|
||||
// x1 = x0 - i1 + 1.0 * C.xxx;
|
||||
// x2 = x0 - i2 + 2.0 * C.xxx;
|
||||
// x3 = x0 - 1.0 + 3.0 * C.xxx;
|
||||
detail::tvec3<T, P> x1(x0 - i1 + C.x);
|
||||
detail::tvec3<T, P> x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y
|
||||
detail::tvec3<T, P> x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y
|
||||
tvec3<T, P> x1(x0 - i1 + C.x);
|
||||
tvec3<T, P> x2(x0 - i2 + C.y); // 2.0*C.x = 1/3 = C.y
|
||||
tvec3<T, P> x3(x0 - D.y); // -1.0+3.0*C.x = -0.5 = -D.y
|
||||
|
||||
// Permutations
|
||||
i = mod289(i);
|
||||
detail::tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
|
||||
i.z + detail::tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
|
||||
i.y + detail::tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
|
||||
i.x + detail::tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
|
||||
tvec4<T, P> p(detail::permute(detail::permute(detail::permute(
|
||||
i.z + tvec4<T, P>(T(0), i1.z, i2.z, T(1))) +
|
||||
i.y + tvec4<T, P>(T(0), i1.y, i2.y, T(1))) +
|
||||
i.x + tvec4<T, P>(T(0), i1.x, i2.x, T(1))));
|
||||
|
||||
// Gradients: 7x7 points over a square, mapped onto an octahedron.
|
||||
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294)
|
||||
T n_ = static_cast<T>(0.142857142857); // 1.0/7.0
|
||||
detail::tvec3<T, P> ns(n_ * detail::tvec3<T, P>(D.w, D.y, D.z) - detail::tvec3<T, P>(D.x, D.z, D.x));
|
||||
tvec3<T, P> ns(n_ * tvec3<T, P>(D.w, D.y, D.z) - tvec3<T, P>(D.x, D.z, D.x));
|
||||
|
||||
detail::tvec4<T, P> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
|
||||
tvec4<T, P> j(p - T(49) * floor(p * ns.z * ns.z)); // mod(p,7*7)
|
||||
|
||||
detail::tvec4<T, P> x_(floor(j * ns.z));
|
||||
detail::tvec4<T, P> y_(floor(j - T(7) * x_)); // mod(j,N)
|
||||
tvec4<T, P> x_(floor(j * ns.z));
|
||||
tvec4<T, P> y_(floor(j - T(7) * x_)); // mod(j,N)
|
||||
|
||||
detail::tvec4<T, P> x(x_ * ns.x + ns.y);
|
||||
detail::tvec4<T, P> y(y_ * ns.x + ns.y);
|
||||
detail::tvec4<T, P> h(T(1) - abs(x) - abs(y));
|
||||
tvec4<T, P> x(x_ * ns.x + ns.y);
|
||||
tvec4<T, P> y(y_ * ns.x + ns.y);
|
||||
tvec4<T, P> h(T(1) - abs(x) - abs(y));
|
||||
|
||||
detail::tvec4<T, P> b0(x.x, x.y, y.x, y.y);
|
||||
detail::tvec4<T, P> b1(x.z, x.w, y.z, y.w);
|
||||
tvec4<T, P> b0(x.x, x.y, y.x, y.y);
|
||||
tvec4<T, P> b1(x.z, x.w, y.z, y.w);
|
||||
|
||||
// vec4 s0 = vec4(lessThan(b0,0.0))*2.0 - 1.0;
|
||||
// vec4 s1 = vec4(lessThan(b1,0.0))*2.0 - 1.0;
|
||||
detail::tvec4<T, P> s0(floor(b0) * T(2) + T(1));
|
||||
detail::tvec4<T, P> s1(floor(b1) * T(2) + T(1));
|
||||
detail::tvec4<T, P> sh(-step(h, detail::tvec4<T, P>(0.0)));
|
||||
tvec4<T, P> s0(floor(b0) * T(2) + T(1));
|
||||
tvec4<T, P> s1(floor(b1) * T(2) + T(1));
|
||||
tvec4<T, P> sh(-step(h, tvec4<T, P>(0.0)));
|
||||
|
||||
detail::tvec4<T, P> a0 = detail::tvec4<T, P>(b0.x, b0.z, b0.y, b0.w) + detail::tvec4<T, P>(s0.x, s0.z, s0.y, s0.w) * detail::tvec4<T, P>(sh.x, sh.x, sh.y, sh.y);
|
||||
detail::tvec4<T, P> a1 = detail::tvec4<T, P>(b1.x, b1.z, b1.y, b1.w) + detail::tvec4<T, P>(s1.x, s1.z, s1.y, s1.w) * detail::tvec4<T, P>(sh.z, sh.z, sh.w, sh.w);
|
||||
tvec4<T, P> a0 = tvec4<T, P>(b0.x, b0.z, b0.y, b0.w) + tvec4<T, P>(s0.x, s0.z, s0.y, s0.w) * tvec4<T, P>(sh.x, sh.x, sh.y, sh.y);
|
||||
tvec4<T, P> a1 = tvec4<T, P>(b1.x, b1.z, b1.y, b1.w) + tvec4<T, P>(s1.x, s1.z, s1.y, s1.w) * tvec4<T, P>(sh.z, sh.z, sh.w, sh.w);
|
||||
|
||||
detail::tvec3<T, P> p0(a0.x, a0.y, h.x);
|
||||
detail::tvec3<T, P> p1(a0.z, a0.w, h.y);
|
||||
detail::tvec3<T, P> p2(a1.x, a1.y, h.z);
|
||||
detail::tvec3<T, P> p3(a1.z, a1.w, h.w);
|
||||
tvec3<T, P> p0(a0.x, a0.y, h.x);
|
||||
tvec3<T, P> p1(a0.z, a0.w, h.y);
|
||||
tvec3<T, P> p2(a1.x, a1.y, h.z);
|
||||
tvec3<T, P> p3(a1.z, a1.w, h.w);
|
||||
|
||||
// Normalise gradients
|
||||
detail::tvec4<T, P> norm = taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
||||
tvec4<T, P> norm = taylorInvSqrt(tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
||||
p0 *= norm.x;
|
||||
p1 *= norm.y;
|
||||
p2 *= norm.z;
|
||||
p3 *= norm.w;
|
||||
|
||||
// Mix final noise value
|
||||
detail::tvec4<T, P> m = max(T(0.6) - detail::tvec4<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), T(0));
|
||||
tvec4<T, P> m = max(T(0.6) - tvec4<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2), dot(x3, x3)), T(0));
|
||||
m = m * m;
|
||||
return T(42) * dot(m * m, detail::tvec4<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
|
||||
return T(42) * dot(m * m, tvec4<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T noise1(detail::tvec4<T, P> const & v)
|
||||
GLM_FUNC_QUALIFIER T noise1(tvec4<T, P> const & v)
|
||||
{
|
||||
detail::tvec4<T, P> const C(
|
||||
tvec4<T, P> const C(
|
||||
0.138196601125011, // (5 - sqrt(5))/20 G4
|
||||
0.276393202250021, // 2 * G4
|
||||
0.414589803375032, // 3 * G4
|
||||
@@ -222,66 +226,66 @@ namespace detail
|
||||
T const F4 = static_cast<T>(0.309016994374947451);
|
||||
|
||||
// First corner
|
||||
detail::tvec4<T, P> i = floor(v + dot(v, detail::tvec4<T, P>(F4)));
|
||||
detail::tvec4<T, P> x0 = v - i + dot(i, detail::tvec4<T, P>(C.x));
|
||||
tvec4<T, P> i = floor(v + dot(v, tvec4<T, P>(F4)));
|
||||
tvec4<T, P> x0 = v - i + dot(i, tvec4<T, P>(C.x));
|
||||
|
||||
// Other corners
|
||||
|
||||
// Rank sorting originally contributed by Bill Licea-Kane, AMD (formerly ATI)
|
||||
detail::tvec4<T, P> i0;
|
||||
detail::tvec3<T, P> isX = step(detail::tvec3<T, P>(x0.y, x0.z, x0.w), detail::tvec3<T, P>(x0.x));
|
||||
detail::tvec3<T, P> isYZ = step(detail::tvec3<T, P>(x0.z, x0.w, x0.w), detail::tvec3<T, P>(x0.y, x0.y, x0.z));
|
||||
tvec4<T, P> i0;
|
||||
tvec3<T, P> isX = step(tvec3<T, P>(x0.y, x0.z, x0.w), tvec3<T, P>(x0.x));
|
||||
tvec3<T, P> isYZ = step(tvec3<T, P>(x0.z, x0.w, x0.w), tvec3<T, P>(x0.y, x0.y, x0.z));
|
||||
|
||||
// i0.x = dot(isX, vec3(1.0));
|
||||
//i0.x = isX.x + isX.y + isX.z;
|
||||
//i0.yzw = static_cast<T>(1) - isX;
|
||||
i0 = detail::tvec4<T, P>(isX.x + isX.y + isX.z, T(1) - isX);
|
||||
i0 = tvec4<T, P>(isX.x + isX.y + isX.z, T(1) - isX);
|
||||
|
||||
// i0.y += dot(isYZ.xy, vec2(1.0));
|
||||
i0.y += isYZ.x + isYZ.y;
|
||||
|
||||
//i0.zw += 1.0 - detail::tvec2<T, P>(isYZ.x, isYZ.y);
|
||||
//i0.zw += 1.0 - tvec2<T, P>(isYZ.x, isYZ.y);
|
||||
i0.z += static_cast<T>(1) - isYZ.x;
|
||||
i0.w += static_cast<T>(1) - isYZ.y;
|
||||
i0.z += isYZ.z;
|
||||
i0.w += static_cast<T>(1) - isYZ.z;
|
||||
|
||||
// i0 now contains the unique values 0,1,2,3 in each channel
|
||||
detail::tvec4<T, P> i3 = clamp(i0, T(0), T(1));
|
||||
detail::tvec4<T, P> i2 = clamp(i0 - T(1), T(0), T(1));
|
||||
detail::tvec4<T, P> i1 = clamp(i0 - T(2), T(0), T(1));
|
||||
tvec4<T, P> i3 = clamp(i0, T(0), T(1));
|
||||
tvec4<T, P> i2 = clamp(i0 - T(1), T(0), T(1));
|
||||
tvec4<T, P> i1 = clamp(i0 - T(2), T(0), T(1));
|
||||
|
||||
// x0 = x0 - 0.0 + 0.0 * C.xxxx
|
||||
// x1 = x0 - i1 + 0.0 * C.xxxx
|
||||
// x2 = x0 - i2 + 0.0 * C.xxxx
|
||||
// x3 = x0 - i3 + 0.0 * C.xxxx
|
||||
// x4 = x0 - 1.0 + 4.0 * C.xxxx
|
||||
detail::tvec4<T, P> x1 = x0 - i1 + C.x;
|
||||
detail::tvec4<T, P> x2 = x0 - i2 + C.y;
|
||||
detail::tvec4<T, P> x3 = x0 - i3 + C.z;
|
||||
detail::tvec4<T, P> x4 = x0 + C.w;
|
||||
tvec4<T, P> x1 = x0 - i1 + C.x;
|
||||
tvec4<T, P> x2 = x0 - i2 + C.y;
|
||||
tvec4<T, P> x3 = x0 - i3 + C.z;
|
||||
tvec4<T, P> x4 = x0 + C.w;
|
||||
|
||||
// Permutations
|
||||
i = mod(i, T(289));
|
||||
T j0 = detail::permute(detail::permute(detail::permute(detail::permute(i.w) + i.z) + i.y) + i.x);
|
||||
detail::tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
|
||||
i.w + detail::tvec4<T, P>(i1.w, i2.w, i3.w, T(1))) +
|
||||
i.z + detail::tvec4<T, P>(i1.z, i2.z, i3.z, T(1))) +
|
||||
i.y + detail::tvec4<T, P>(i1.y, i2.y, i3.y, T(1))) +
|
||||
i.x + detail::tvec4<T, P>(i1.x, i2.x, i3.x, T(1)));
|
||||
tvec4<T, P> j1 = detail::permute(detail::permute(detail::permute(detail::permute(
|
||||
i.w + tvec4<T, P>(i1.w, i2.w, i3.w, T(1))) +
|
||||
i.z + tvec4<T, P>(i1.z, i2.z, i3.z, T(1))) +
|
||||
i.y + tvec4<T, P>(i1.y, i2.y, i3.y, T(1))) +
|
||||
i.x + tvec4<T, P>(i1.x, i2.x, i3.x, T(1)));
|
||||
|
||||
// Gradients: 7x7x6 points over a cube, mapped onto a 4-cross polytope
|
||||
// 7*7*6 = 294, which is close to the ring size 17*17 = 289.
|
||||
detail::tvec4<T, P> ip = detail::tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
|
||||
tvec4<T, P> ip = tvec4<T, P>(T(1) / T(294), T(1) / T(49), T(1) / T(7), T(0));
|
||||
|
||||
detail::tvec4<T, P> p0 = detail::grad4(j0, ip);
|
||||
detail::tvec4<T, P> p1 = detail::grad4(j1.x, ip);
|
||||
detail::tvec4<T, P> p2 = detail::grad4(j1.y, ip);
|
||||
detail::tvec4<T, P> p3 = detail::grad4(j1.z, ip);
|
||||
detail::tvec4<T, P> p4 = detail::grad4(j1.w, ip);
|
||||
tvec4<T, P> p0 = detail::grad4(j0, ip);
|
||||
tvec4<T, P> p1 = detail::grad4(j1.x, ip);
|
||||
tvec4<T, P> p2 = detail::grad4(j1.y, ip);
|
||||
tvec4<T, P> p3 = detail::grad4(j1.z, ip);
|
||||
tvec4<T, P> p4 = detail::grad4(j1.w, ip);
|
||||
|
||||
// Normalise gradients
|
||||
detail::tvec4<T, P> norm = detail::taylorInvSqrt(detail::tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
||||
tvec4<T, P> norm = detail::taylorInvSqrt(tvec4<T, P>(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
|
||||
p0 *= norm.x;
|
||||
p1 *= norm.y;
|
||||
p2 *= norm.z;
|
||||
@@ -289,96 +293,96 @@ namespace detail
|
||||
p4 *= taylorInvSqrt(dot(p4, p4));
|
||||
|
||||
// Mix contributions from the five corners
|
||||
detail::tvec3<T, P> m0 = max(T(0.6) - detail::tvec3<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0));
|
||||
detail::tvec2<T, P> m1 = max(T(0.6) - detail::tvec2<T, P>(dot(x3, x3), dot(x4, x4) ), T(0));
|
||||
tvec3<T, P> m0 = max(T(0.6) - tvec3<T, P>(dot(x0, x0), dot(x1, x1), dot(x2, x2)), T(0));
|
||||
tvec2<T, P> m1 = max(T(0.6) - tvec2<T, P>(dot(x3, x3), dot(x4, x4) ), T(0));
|
||||
m0 = m0 * m0;
|
||||
m1 = m1 * m1;
|
||||
|
||||
return T(49) * (
|
||||
dot(m0 * m0, detail::tvec3<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
|
||||
dot(m1 * m1, detail::tvec2<T, P>(dot(p3, x3), dot(p4, x4))));
|
||||
dot(m0 * m0, tvec3<T, P>(dot(p0, x0), dot(p1, x1), dot(p2, x2))) +
|
||||
dot(m1 * m1, tvec2<T, P>(dot(p3, x3), dot(p4, x4))));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> noise2(detail::tvec2<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec2<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
noise1(x + detail::tvec2<T, P>(0.0)),
|
||||
noise1(detail::tvec2<T, P>(0.0) - x));
|
||||
return tvec2<T, P>(
|
||||
noise1(x + tvec2<T, P>(0.0)),
|
||||
noise1(tvec2<T, P>(0.0) - x));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> noise2(detail::tvec3<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec3<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
noise1(x + detail::tvec3<T, P>(0.0)),
|
||||
noise1(detail::tvec3<T, P>(0.0) - x));
|
||||
return tvec2<T, P>(
|
||||
noise1(x + tvec3<T, P>(0.0)),
|
||||
noise1(tvec3<T, P>(0.0) - x));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec2<T, P> noise2(detail::tvec4<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec2<T, P> noise2(tvec4<T, P> const & x)
|
||||
{
|
||||
return detail::tvec2<T, P>(
|
||||
noise1(x + detail::tvec4<T, P>(0)),
|
||||
noise1(detail::tvec4<T, P>(0) - x));
|
||||
return tvec2<T, P>(
|
||||
noise1(x + tvec4<T, P>(0)),
|
||||
noise1(tvec4<T, P>(0) - x));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> noise3(detail::tvec2<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec2<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
noise1(x - detail::tvec2<T, P>(1.0)),
|
||||
noise1(x + detail::tvec2<T, P>(0.0)),
|
||||
noise1(x + detail::tvec2<T, P>(1.0)));
|
||||
return tvec3<T, P>(
|
||||
noise1(x - tvec2<T, P>(1.0)),
|
||||
noise1(x + tvec2<T, P>(0.0)),
|
||||
noise1(x + tvec2<T, P>(1.0)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> noise3(detail::tvec3<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec3<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
noise1(x - detail::tvec3<T, P>(1.0)),
|
||||
noise1(x + detail::tvec3<T, P>(0.0)),
|
||||
noise1(x + detail::tvec3<T, P>(1.0)));
|
||||
return tvec3<T, P>(
|
||||
noise1(x - tvec3<T, P>(1.0)),
|
||||
noise1(x + tvec3<T, P>(0.0)),
|
||||
noise1(x + tvec3<T, P>(1.0)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec3<T, P> noise3(detail::tvec4<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> noise3(tvec4<T, P> const & x)
|
||||
{
|
||||
return detail::tvec3<T, P>(
|
||||
noise1(x - detail::tvec4<T, P>(1)),
|
||||
noise1(x + detail::tvec4<T, P>(0)),
|
||||
noise1(x + detail::tvec4<T, P>(1)));
|
||||
return tvec3<T, P>(
|
||||
noise1(x - tvec4<T, P>(1)),
|
||||
noise1(x + tvec4<T, P>(0)),
|
||||
noise1(x + tvec4<T, P>(1)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> noise4(detail::tvec2<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec2<T, P> const & x)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
noise1(x - detail::tvec2<T, P>(1)),
|
||||
noise1(x + detail::tvec2<T, P>(0)),
|
||||
noise1(x + detail::tvec2<T, P>(1)),
|
||||
noise1(x + detail::tvec2<T, P>(2)));
|
||||
return tvec4<T, P>(
|
||||
noise1(x - tvec2<T, P>(1)),
|
||||
noise1(x + tvec2<T, P>(0)),
|
||||
noise1(x + tvec2<T, P>(1)),
|
||||
noise1(x + tvec2<T, P>(2)));
|
||||
}
|
||||
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> noise4(detail::tvec3<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec3<T, P> const & x)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
noise1(x - detail::tvec3<T, P>(1)),
|
||||
noise1(x + detail::tvec3<T, P>(0)),
|
||||
noise1(x + detail::tvec3<T, P>(1)),
|
||||
noise1(x + detail::tvec3<T, P>(2)));
|
||||
return tvec4<T, P>(
|
||||
noise1(x - tvec3<T, P>(1)),
|
||||
noise1(x + tvec3<T, P>(0)),
|
||||
noise1(x + tvec3<T, P>(1)),
|
||||
noise1(x + tvec3<T, P>(2)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER detail::tvec4<T, P> noise4(detail::tvec4<T, P> const & x)
|
||||
GLM_FUNC_QUALIFIER tvec4<T, P> noise4(tvec4<T, P> const & x)
|
||||
{
|
||||
return detail::tvec4<T, P>(
|
||||
noise1(x - detail::tvec4<T, P>(1)),
|
||||
noise1(x + detail::tvec4<T, P>(0)),
|
||||
noise1(x + detail::tvec4<T, P>(1)),
|
||||
noise1(x + detail::tvec4<T, P>(2)));
|
||||
return tvec4<T, P>(
|
||||
noise1(x - tvec4<T, P>(1)),
|
||||
noise1(x + tvec4<T, P>(0)),
|
||||
noise1(x + tvec4<T, P>(1)),
|
||||
noise1(x + tvec4<T, P>(2)));
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,11 +25,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_packing.hpp
|
||||
/// @file glm/detail/func_packing.hpp
|
||||
/// @date 2010-03-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.4 Floating-Point Pack and Unpack Functions</a>
|
||||
/// @see gtc_packing
|
||||
///
|
||||
/// @defgroup core_func_packing Floating-Point Pack and Unpack Functions
|
||||
/// @ingroup core
|
||||
@@ -33,8 +38,7 @@
|
||||
/// These functions do not operate component-wise, rather as described in each case.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_func_packing
|
||||
#define GLM_CORE_func_packing
|
||||
#pragma once
|
||||
|
||||
#include "type_vec2.hpp"
|
||||
#include "type_vec4.hpp"
|
||||
@@ -191,5 +195,3 @@ namespace glm
|
||||
}//namespace glm
|
||||
|
||||
#include "func_packing.inl"
|
||||
|
||||
#endif//GLM_CORE_func_packing
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_packing.inl
|
||||
/// @file glm/detail/func_packing.inl
|
||||
/// @date 2010-03-17 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -35,7 +39,9 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER uint packUnorm2x16(vec2 const & v)
|
||||
{
|
||||
u16vec2 Topack(round(clamp(v, 0.0f, 1.0f) * 65535.0f));
|
||||
return reinterpret_cast<uint&>(Topack);
|
||||
// return reinterpret_cast<uint&>(Topack);
|
||||
uint* ptr(reinterpret_cast<uint*>(&Topack));
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackUnorm2x16(uint const & p)
|
||||
@@ -47,7 +53,9 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER uint packSnorm2x16(vec2 const & v)
|
||||
{
|
||||
i16vec2 Topack(round(clamp(v ,-1.0f, 1.0f) * 32767.0f));
|
||||
return reinterpret_cast<uint32&>(Topack);
|
||||
// return reinterpret_cast<uint32&>(Topack);
|
||||
uint* ptr(reinterpret_cast<uint*>(&Topack));
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER vec2 unpackSnorm2x16(uint const & p)
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_trigonometric.hpp
|
||||
/// @file glm/detail/func_trigonometric.hpp
|
||||
/// @date 2008-08-01 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@@ -37,8 +41,10 @@
|
||||
/// These all operate component-wise. The description is per component.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_func_trigonometric
|
||||
#define GLM_CORE_func_trigonometric
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
#include "precision.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
@@ -51,8 +57,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/radians.xml">GLSL radians man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType radians(genType const & degrees);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> radians(vecType<T, P> const & degrees);
|
||||
|
||||
/// Converts radians to degrees and returns the result.
|
||||
///
|
||||
@@ -60,8 +66,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/degrees.xml">GLSL degrees man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType degrees(genType const & radians);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> degrees(vecType<T, P> const & radians);
|
||||
|
||||
/// The standard trigonometric sine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
@@ -70,8 +76,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sin.xml">GLSL sin man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType sin(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> sin(vecType<T, P> const & angle);
|
||||
|
||||
/// The standard trigonometric cosine function.
|
||||
/// The values returned by this function will range from [-1, 1].
|
||||
@@ -80,8 +86,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cos.xml">GLSL cos man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType cos(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> cos(vecType<T, P> const & angle);
|
||||
|
||||
/// The standard trigonometric tangent function.
|
||||
///
|
||||
@@ -89,8 +95,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tan.xml">GLSL tan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType tan(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> tan(vecType<T, P> const & angle);
|
||||
|
||||
/// Arc sine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
@@ -100,8 +106,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asin.xml">GLSL asin man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType asin(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> asin(vecType<T, P> const & x);
|
||||
|
||||
/// Arc cosine. Returns an angle whose sine is x.
|
||||
/// The range of values returned by this function is [0, PI].
|
||||
@@ -111,8 +117,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acos.xml">GLSL acos man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType acos(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> acos(vecType<T, P> const & x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y/x.
|
||||
/// The signs of x and y are used to determine what
|
||||
@@ -124,8 +130,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType atan(genType const & y, genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> atan(vecType<T, P> const & y, vecType<T, P> const & x);
|
||||
|
||||
/// Arc tangent. Returns an angle whose tangent is y_over_x.
|
||||
/// The range of values returned by this function is [-PI/2, PI/2].
|
||||
@@ -134,8 +140,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atan.xml">GLSL atan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType atan(genType const & y_over_x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> atan(vecType<T, P> const & y_over_x);
|
||||
|
||||
/// Returns the hyperbolic sine function, (exp(x) - exp(-x)) / 2
|
||||
///
|
||||
@@ -143,8 +149,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/sinh.xml">GLSL sinh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType sinh(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> sinh(vecType<T, P> const & angle);
|
||||
|
||||
/// Returns the hyperbolic cosine function, (exp(x) + exp(-x)) / 2
|
||||
///
|
||||
@@ -152,8 +158,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/cosh.xml">GLSL cosh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType cosh(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> cosh(vecType<T, P> const & angle);
|
||||
|
||||
/// Returns the hyperbolic tangent function, sinh(angle) / cosh(angle)
|
||||
///
|
||||
@@ -161,8 +167,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/tanh.xml">GLSL tanh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType tanh(genType const & angle);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> tanh(vecType<T, P> const & angle);
|
||||
|
||||
/// Arc hyperbolic sine; returns the inverse of sinh.
|
||||
///
|
||||
@@ -170,8 +176,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/asinh.xml">GLSL asinh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType asinh(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> asinh(vecType<T, P> const & x);
|
||||
|
||||
/// Arc hyperbolic cosine; returns the non-negative inverse
|
||||
/// of cosh. Results are undefined if x < 1.
|
||||
@@ -180,8 +186,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/acosh.xml">GLSL acosh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType acosh(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> acosh(vecType<T, P> const & x);
|
||||
|
||||
/// Arc hyperbolic tangent; returns the inverse of tanh.
|
||||
/// Results are undefined if abs(x) >= 1.
|
||||
@@ -190,14 +196,10 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/atanh.xml">GLSL atanh man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.1 Angle and Trigonometry Functions</a>
|
||||
template <typename genType>
|
||||
GLM_FUNC_DECL genType atanh(genType const & x);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> atanh(vecType<T, P> const & x);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "func_trigonometric.inl"
|
||||
|
||||
#endif//GLM_CORE_func_trigonometric
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_trigonometric.inl
|
||||
/// @file glm/detail/func_trigonometric.inl
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -34,213 +38,187 @@ namespace glm
|
||||
{
|
||||
// radians
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType radians
|
||||
(
|
||||
genType const & degrees
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType radians(genType degrees)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'radians' only accept floating-point input");
|
||||
|
||||
return degrees * genType(0.01745329251994329576923690768489);
|
||||
return degrees * static_cast<genType>(0.01745329251994329576923690768489);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(radians)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> radians(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(radians, v);
|
||||
}
|
||||
|
||||
// degrees
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType degrees
|
||||
(
|
||||
genType const & radians
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType degrees(genType radians)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'degrees' only accept floating-point input");
|
||||
|
||||
return radians * genType(57.295779513082320876798154814105);
|
||||
return radians * static_cast<genType>(57.295779513082320876798154814105);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(degrees)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> degrees(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(degrees, v);
|
||||
}
|
||||
|
||||
// sin
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sin
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using ::std::sin;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> sin(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sin' only accept floating-point input");
|
||||
|
||||
return genType(::std::sin(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(sin, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(sin)
|
||||
|
||||
// cos
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType cos(genType const & angle)
|
||||
using std::cos;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> cos(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cos' only accept floating-point input");
|
||||
|
||||
return genType(::std::cos(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(cos, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(cos)
|
||||
|
||||
// tan
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType tan
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using std::tan;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> tan(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'tan' only accept floating-point input");
|
||||
|
||||
return genType(::std::tan(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(tan, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(tan)
|
||||
|
||||
// asin
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asin
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
using std::asin;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> asin(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asin' only accept floating-point input");
|
||||
|
||||
return genType(::std::asin(x));
|
||||
return detail::functor1<T, T, P, vecType>::call(asin, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(asin)
|
||||
|
||||
// acos
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acos
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
using std::acos;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> acos(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acos' only accept floating-point input");
|
||||
|
||||
return genType(::std::acos(x));
|
||||
return detail::functor1<T, T, P, vecType>::call(acos, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(acos)
|
||||
|
||||
// atan
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atan
|
||||
(
|
||||
genType const & y,
|
||||
genType const & x
|
||||
)
|
||||
GLM_FUNC_QUALIFIER genType atan(genType const & y, genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
||||
|
||||
return genType(::std::atan2(y, x));
|
||||
return ::std::atan2(y, x);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC_VEC(atan)
|
||||
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atan
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> atan(vecType<T, P> const & a, vecType<T, P> const & b)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atan' only accept floating-point input");
|
||||
|
||||
return genType(::std::atan(x));
|
||||
return detail::functor2<T, P, vecType>::call(atan2, a, b);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(atan)
|
||||
using std::atan;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> atan(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(atan, v);
|
||||
}
|
||||
|
||||
// sinh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType sinh
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using std::sinh;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> sinh(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'sinh' only accept floating-point input");
|
||||
|
||||
return genType(std::sinh(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(sinh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(sinh)
|
||||
|
||||
// cosh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType cosh
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using std::cosh;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> cosh(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'cosh' only accept floating-point input");
|
||||
|
||||
return genType(std::cosh(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(cosh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(cosh)
|
||||
|
||||
// tanh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType tanh
|
||||
(
|
||||
genType const & angle
|
||||
)
|
||||
using std::tanh;
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> tanh(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'tanh' only accept floating-point input");
|
||||
|
||||
return genType(std::tanh(angle));
|
||||
return detail::functor1<T, T, P, vecType>::call(tanh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(tanh)
|
||||
|
||||
// asinh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asinh
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
|
||||
|
||||
return (x < genType(0) ? genType(-1) : (x > genType(0) ? genType(1) : genType(0))) * log(abs(x) + sqrt(genType(1) + x * x));
|
||||
}
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using std::asinh;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType asinh(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'asinh' only accept floating-point input");
|
||||
|
||||
VECTORIZE_VEC(asinh)
|
||||
return (x < static_cast<genType>(0) ? static_cast<genType>(-1) : (x > static_cast<genType>(0) ? static_cast<genType>(1) : static_cast<genType>(0))) * log(abs(x) + sqrt(static_cast<genType>(1) + x * x));
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> asinh(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(asinh, v);
|
||||
}
|
||||
|
||||
// acosh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acosh
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using std::acosh;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType acosh(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
|
||||
|
||||
if(x < static_cast<genType>(1))
|
||||
return static_cast<genType>(0);
|
||||
return log(x + sqrt(x * x - static_cast<genType>(1)));
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> acosh(vecType<T, P> const & v)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'acosh' only accept floating-point input");
|
||||
|
||||
if(x < genType(1))
|
||||
return genType(0);
|
||||
return log(x + sqrt(x * x - genType(1)));
|
||||
return detail::functor1<T, T, P, vecType>::call(acosh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(acosh)
|
||||
|
||||
// atanh
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atanh
|
||||
(
|
||||
genType const & x
|
||||
)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
|
||||
# if GLM_HAS_CXX11_STL
|
||||
using std::atanh;
|
||||
# else
|
||||
template <typename genType>
|
||||
GLM_FUNC_QUALIFIER genType atanh(genType const & x)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'atanh' only accept floating-point input");
|
||||
|
||||
if(abs(x) >= genType(1))
|
||||
return 0;
|
||||
return genType(0.5) * log((genType(1) + x) / (genType(1) - x));
|
||||
if(abs(x) >= static_cast<genType>(1))
|
||||
return 0;
|
||||
return static_cast<genType>(0.5) * log((static_cast<genType>(1) + x) / (static_cast<genType>(1) - x));
|
||||
}
|
||||
# endif
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> atanh(vecType<T, P> const & v)
|
||||
{
|
||||
return detail::functor1<T, T, P, vecType>::call(atanh, v);
|
||||
}
|
||||
|
||||
VECTORIZE_VEC(atanh)
|
||||
|
||||
}//namespace glm
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_vector_relational.hpp
|
||||
/// @file glm/detail/func_vector_relational.hpp
|
||||
/// @date 2008-08-03 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
@@ -38,14 +42,11 @@
|
||||
/// call must match.
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef GLM_CORE_func_vector_relational
|
||||
#define GLM_CORE_func_vector_relational
|
||||
#pragma once
|
||||
|
||||
#include "precision.hpp"
|
||||
#include "setup.hpp"
|
||||
|
||||
#if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER <= GLM_COMPILER_VC10)) // Workaround a Visual C++ bug
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup core_func_vector_relational
|
||||
@@ -57,9 +58,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
// TODO: Mismatched
|
||||
//template <typename T, precision P, template <typename, precision> class vecType>
|
||||
//GLM_FUNC_DECL typename vecType<T, P>::bool_type lessThan(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x <= y.
|
||||
///
|
||||
@@ -68,7 +68,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL typename vecType<T, P>::bool_type lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
GLM_FUNC_DECL vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x > y.
|
||||
///
|
||||
@@ -77,7 +77,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL typename vecType<T, P>::bool_type greaterThan(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
GLM_FUNC_DECL vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x >= y.
|
||||
///
|
||||
@@ -86,7 +86,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL typename vecType<T, P>::bool_type greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
GLM_FUNC_DECL vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x == y.
|
||||
///
|
||||
@@ -94,9 +94,8 @@ namespace glm
|
||||
///
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
//TODO: conflicts with definision
|
||||
//template <typename T, precision P, template <typename, precision> class vecType>
|
||||
//GLM_FUNC_DECL typename vecType<T, P>::bool_type equal(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<bool, P> equal(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns the component-wise comparison of result x != y.
|
||||
///
|
||||
@@ -105,7 +104,7 @@ namespace glm
|
||||
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
|
||||
/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL typename vecType<T, P>::bool_type notEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
GLM_FUNC_DECL vecType<bool, P> notEqual(vecType<T, P> const & x, vecType<T, P> const & y);
|
||||
|
||||
/// Returns true if any component of x is true.
|
||||
///
|
||||
@@ -138,8 +137,4 @@ namespace glm
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#endif
|
||||
|
||||
#include "func_vector_relational.inl"
|
||||
|
||||
#endif//GLM_CORE_func_vector_relational
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -21,7 +25,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/func_vector_relational.inl
|
||||
/// @file glm/detail/func_vector_relational.inl
|
||||
/// @date 2008-08-03 / 2011-09-09
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -31,100 +35,68 @@
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type lessThan
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] < y[i];
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type lessThanEqual
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] <= y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type greaterThan
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] > y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type greaterThanEqual
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
|
||||
"Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors");
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] >= y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type equal
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> equal(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] == y[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER typename vecType<T, P>::bool_type notEqual
|
||||
(
|
||||
vecType<T, P> const & x,
|
||||
vecType<T, P> const & y
|
||||
)
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> notEqual(vecType<T, P> const & x, vecType<T, P> const & y)
|
||||
{
|
||||
assert(x.length() == y.length());
|
||||
assert(detail::component_count(x) == detail::component_count(y));
|
||||
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < x.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(x); ++i)
|
||||
Result[i] = x[i] != y[i];
|
||||
return Result;
|
||||
}
|
||||
@@ -133,7 +105,7 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER bool any(vecType<bool, P> const & v)
|
||||
{
|
||||
bool Result = false;
|
||||
for(int i = 0; i < v.length(); ++i)
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
|
||||
Result = Result || v[i];
|
||||
return Result;
|
||||
}
|
||||
@@ -142,7 +114,7 @@ namespace glm
|
||||
GLM_FUNC_QUALIFIER bool all(vecType<bool, P> const & v)
|
||||
{
|
||||
bool Result = true;
|
||||
for(int i = 0; i < v.length(); ++i)
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
|
||||
Result = Result && v[i];
|
||||
return Result;
|
||||
}
|
||||
@@ -150,8 +122,8 @@ namespace glm
|
||||
template <precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<bool, P> not_(vecType<bool, P> const & v)
|
||||
{
|
||||
typename vecType<bool, P>::bool_type Result(vecType<bool, P>::_null);
|
||||
for(int i = 0; i < v.length(); ++i)
|
||||
vecType<bool, P> Result(uninitialize);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(v); ++i)
|
||||
Result[i] = !v[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// Restrictions:
|
||||
/// By making use of the Software for military purposes, you choose to make
|
||||
/// a Bunny unhappy.
|
||||
///
|
||||
/// 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
|
||||
@@ -30,11 +34,9 @@
|
||||
#include <glm/gtc/quaternion.hpp>
|
||||
#include <glm/gtx/dual_quaternion.hpp>
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
namespace glm
|
||||
{
|
||||
// tvec1 type explicit instantiation
|
||||
/*
|
||||
template struct tvec1<uint8, lowp>;
|
||||
template struct tvec1<uint16, lowp>;
|
||||
template struct tvec1<uint32, lowp>;
|
||||
@@ -43,7 +45,6 @@ template struct tvec1<int8, lowp>;
|
||||
template struct tvec1<int16, lowp>;
|
||||
template struct tvec1<int32, lowp>;
|
||||
template struct tvec1<int64, lowp>;
|
||||
template struct tvec1<float16, lowp>;
|
||||
template struct tvec1<float32, lowp>;
|
||||
template struct tvec1<float64, lowp>;
|
||||
|
||||
@@ -55,7 +56,6 @@ template struct tvec1<int8, mediump>;
|
||||
template struct tvec1<int16, mediump>;
|
||||
template struct tvec1<int32, mediump>;
|
||||
template struct tvec1<int64, mediump>;
|
||||
template struct tvec1<float16, mediump>;
|
||||
template struct tvec1<float32, mediump>;
|
||||
template struct tvec1<float64, mediump>;
|
||||
|
||||
@@ -67,10 +67,9 @@ template struct tvec1<int8, highp>;
|
||||
template struct tvec1<int16, highp>;
|
||||
template struct tvec1<int32, highp>;
|
||||
template struct tvec1<int64, highp>;
|
||||
template struct tvec1<float16, highp>;
|
||||
template struct tvec1<float32, highp>;
|
||||
template struct tvec1<float64, highp>;
|
||||
*/
|
||||
|
||||
// tvec2 type explicit instantiation
|
||||
template struct tvec2<uint8, lowp>;
|
||||
template struct tvec2<uint16, lowp>;
|
||||
@@ -283,6 +282,5 @@ template struct tdualquat<float64, mediump>;
|
||||
template struct tdualquat<float32, highp>;
|
||||
template struct tdualquat<float64, highp>;
|
||||
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_common.hpp
|
||||
/// @file glm/detail/intrinsic_common.hpp
|
||||
/// @date 2009-05-11 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_detail_intrinsic_common
|
||||
#define glm_detail_intrinsic_common
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@@ -86,4 +85,3 @@ namespace detail
|
||||
#include "intrinsic_common.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_detail_intrinsic_common
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_common.inl
|
||||
/// @file glm/detail/intrinsic_common.inl
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_exponential.hpp
|
||||
/// @file glm/detail/intrinsic_exponential.hpp
|
||||
/// @date 2009-05-11 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_detail_intrinsic_exponential
|
||||
#define glm_detail_intrinsic_exponential
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@@ -76,4 +75,3 @@ GLM_FUNC_QUALIFIER __m128 sse_normalize_fast_ps( float * RESTRICT vOut, float *
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_detail_intrinsic_exponential
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_exponential.inl
|
||||
/// @file glm/detail/intrinsic_exponential.inl
|
||||
/// @date 2011-06-15 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -21,13 +21,12 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_geometric.hpp
|
||||
/// @file glm/detail/intrinsic_geometric.hpp
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef glm_core_intrinsic_geometric
|
||||
#define glm_core_intrinsic_geometric
|
||||
#pragma once
|
||||
|
||||
#include "setup.hpp"
|
||||
|
||||
@@ -73,4 +72,3 @@ namespace detail
|
||||
#include "intrinsic_geometric.inl"
|
||||
|
||||
#endif//GLM_ARCH
|
||||
#endif//glm_core_intrinsic_geometric
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref core
|
||||
/// @file glm/core/intrinsic_geometric.inl
|
||||
/// @file glm/detail/intrinsic_geometric.inl
|
||||
/// @date 2009-05-08 / 2011-06-15
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -32,32 +32,33 @@ namespace detail{
|
||||
//length
|
||||
GLM_FUNC_QUALIFIER __m128 sse_len_ps(__m128 x)
|
||||
{
|
||||
__m128 dot0 = sse_dot_ps(x, x);
|
||||
__m128 dot0 = sse_dot_ps(x, x);
|
||||
__m128 sqt0 = _mm_sqrt_ps(dot0);
|
||||
return sqt0;
|
||||
return sqt0;
|
||||
}
|
||||
|
||||
//distance
|
||||
GLM_FUNC_QUALIFIER __m128 sse_dst_ps(__m128 p0, __m128 p1)
|
||||
{
|
||||
__m128 sub0 = _mm_sub_ps(p0, p1);
|
||||
__m128 len0 = sse_len_ps(sub0);
|
||||
return len0;
|
||||
__m128 len0 = sse_len_ps(sub0);
|
||||
return len0;
|
||||
}
|
||||
|
||||
//dot
|
||||
GLM_FUNC_QUALIFIER __m128 sse_dot_ps(__m128 v1, __m128 v2)
|
||||
{
|
||||
# if((GLM_ARCH & GLM_ARCH_AVX) == GLM_ARCH_AVX)
|
||||
return _mm_dp_ps(v1, v2, 0xff);
|
||||
# else
|
||||
__m128 mul0 = _mm_mul_ps(v1, v2);
|
||||
__m128 swp0 = _mm_shuffle_ps(mul0, mul0, _MM_SHUFFLE(2, 3, 0, 1));
|
||||
__m128 add0 = _mm_add_ps(mul0, swp0);
|
||||
__m128 swp1 = _mm_shuffle_ps(add0, add0, _MM_SHUFFLE(0, 1, 2, 3));
|
||||
__m128 add1 = _mm_add_ps(add0, swp1);
|
||||
return add1;
|
||||
# endif
|
||||
|
||||
# if(GLM_ARCH & GLM_ARCH_AVX)
|
||||
return _mm_dp_ps(v1, v2, 0xff);
|
||||
# else
|
||||
__m128 mul0 = _mm_mul_ps(v1, v2);
|
||||
__m128 swp0 = _mm_shuffle_ps(mul0, mul0, _MM_SHUFFLE(2, 3, 0, 1));
|
||||
__m128 add0 = _mm_add_ps(mul0, swp0);
|
||||
__m128 swp1 = _mm_shuffle_ps(add0, add0, _MM_SHUFFLE(0, 1, 2, 3));
|
||||
__m128 add1 = _mm_add_ps(add0, swp1);
|
||||
return add1;
|
||||
# endif
|
||||
}
|
||||
|
||||
// SSE1
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user