mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-16 15:49:43 +00:00
Compare commits
2697 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 77a1900374 | |||
| 6fc3080fc3 | |||
| 1f2714ca79 | |||
| 024db8d058 | |||
| 896551850a | |||
| f2448ebfd4 | |||
| 9d07426a29 | |||
| 4e2bb34be3 | |||
| 0f535026cf | |||
| 9fd6b1009e | |||
| 822afdcecd | |||
| 58f5dbd365 | |||
| a092ee463f | |||
| e2df07ec05 | |||
| e2dda7bce6 | |||
| 5e1e902600 | |||
| c8dd64bdbc | |||
| 7d03773383 | |||
| 2f668b8669 | |||
| 876813cd9d | |||
| 61a7b45dd9 | |||
| 8c7e594b08 | |||
| b7beb3d87d | |||
| e6d16d17dc | |||
| f3b0de85bf | |||
| b2fac2e99f | |||
| f7603ba3ac | |||
| ddfe8f608f | |||
| 8b8ef85ccb | |||
| 524934bbf6 | |||
| 132125de77 | |||
| 9d11d11d68 | |||
| 98c62ba8e0 | |||
| 4e09974975 | |||
| bb49381cd3 | |||
| 20538e9b40 | |||
| 2de4331931 | |||
| 5fed533ce8 | |||
| f4e7d3203a | |||
| ff8b3f980f | |||
| 051c5da378 | |||
| 0e41c3dc58 | |||
| 8931913884 | |||
| a235c72b0d | |||
| 3924b84744 | |||
| 691c93ee99 | |||
| 0bcdd910f9 | |||
| 0d010c97e6 | |||
| 585b47b6c5 | |||
| 9c1ad5d610 | |||
| b3a2f09ae9 | |||
| d6933998e4 | |||
| 7e604b72db | |||
| d16dea5859 | |||
| 571bbc06d7 | |||
| a6756ccf21 | |||
| 1a2fac805c | |||
| 6fb36934a8 | |||
| 663b1c6c00 | |||
| 452ae7470b | |||
| c8a2c7ae94 | |||
| 070edf2f73 | |||
| 2612d48550 | |||
| bc450bbc9a | |||
| fa735869e1 | |||
| 8721b05453 | |||
| 952f246433 | |||
| a8758cbf5e | |||
| 2b287a9e72 | |||
| 0d80c70b5f | |||
| 78fa9c7393 | |||
| 42a9353ae2 | |||
| a4807caf6a | |||
| ec7d2fbb39 | |||
| 098300cc7d | |||
| 0f28e74e3e | |||
| 70efa805cb | |||
| 93082104dd | |||
| 188352ea3e | |||
| cc7a9d1ce6 | |||
| 979a8fea86 | |||
| 128249e63e | |||
| a1342c9d52 | |||
| d13763a9c4 | |||
| d22e8c636d | |||
| 935ab76f0f | |||
| 016c498216 | |||
| 102f9be296 | |||
| e78997fdfd | |||
| 6971aee967 | |||
| a292621b14 | |||
| 26226f1d43 | |||
| d161a8a330 | |||
| 27954279d6 | |||
| e35a131153 | |||
| b87b5f1187 | |||
| 8403f2bd33 | |||
| 887ad00dff | |||
| 5988069372 | |||
| f1b53b113f | |||
| 2a746ffa2d | |||
| 90aff7a026 | |||
| 28ca056d56 | |||
| 2067b2e7b4 | |||
| be288e4d1b | |||
| 7c5a58bbad | |||
| 019e794234 | |||
| 4bf1741783 | |||
| de34ab97a2 | |||
| e81c316134 | |||
| 18de531671 | |||
| 793a0099d4 | |||
| c86e6e008d | |||
| 473b3072ea | |||
| 1cfabfbb09 | |||
| 015db8a461 | |||
| e8c871a603 | |||
| e373bd02ba | |||
| 835cd6ea28 | |||
| 79ce0def50 | |||
| 4cda74cb31 | |||
| efd3d42107 | |||
| 10a2787fd5 | |||
| b542f784f9 | |||
| 54501dc6df | |||
| 183f6f6d07 | |||
| b23ffe4045 | |||
| 71fb252a8a | |||
| 08a3e346cd | |||
| 72b70fa042 | |||
| af70b49bf7 | |||
| 5ac1a89f92 | |||
| e272b03fee | |||
| 980e8f525b | |||
| 1d88dfd460 | |||
| 4b464093e7 | |||
| 911a8aa08d | |||
| f55153ce3c | |||
| eeeebf9f6d | |||
| 5353d05865 | |||
| 608e9a7203 | |||
| 2a94a64711 | |||
| 10c6d4c738 | |||
| 6820aada04 | |||
| 246c126d25 | |||
| 1ffc700797 | |||
| a4de62577d | |||
| d6bfff85cb | |||
| 37c3cd2e5b | |||
| 7e5da7d8b2 | |||
| 0f03d94fbe | |||
| 6319e8910f | |||
| 8c707f6211 | |||
| fad5dcffda | |||
| 878c868f02 | |||
| a857706145 | |||
| 8ffe9da482 | |||
| 19d0517c71 | |||
| fa78c057ee | |||
| e5e15808f1 | |||
| c11fb56bf7 | |||
| f2db7e7245 | |||
| 955f06b9ac | |||
| 9b0b2e8d2e | |||
| 5df6a12ed3 | |||
| 671c085206 | |||
| 9abf05dcef | |||
| 128317d3ec | |||
| be01586049 | |||
| 15220f3578 | |||
| 97e9141c65 | |||
| a24de0ba3b | |||
| 7142512754 | |||
| db03c5d5e8 | |||
| 0f41b99c5e | |||
| 8f873d4ece | |||
| bb90e51ac5 | |||
| e744bbee59 | |||
| a7793e97a5 | |||
| e66db9c6d4 | |||
| 3532b91eef | |||
| 3561a3068e | |||
| b06b3e2ca2 | |||
| 2956b119b2 | |||
| bd909b0952 | |||
| 592aee1e27 | |||
| 28fe368b7f | |||
| ca52ec33b2 | |||
| 6884453b66 | |||
| 531073bea0 | |||
| f94da63a8d | |||
| f6330faead | |||
| ec274769b9 | |||
| 560e92aa4a | |||
| cc2b51320f | |||
| 4634243110 | |||
| bf98086de8 | |||
| 23bfc03054 | |||
| ce94c90a7b | |||
| d8727d7fcd | |||
| 56998926e7 | |||
| 2a60262c99 | |||
| 560a4a9c4a | |||
| 04f39ef749 | |||
| 07c3abfe92 | |||
| 2dc8e0c3d9 | |||
| f4e1f18a15 | |||
| ec2675c2c5 | |||
| 42d8e8410b | |||
| be65f908c8 | |||
| 0de260182b | |||
| ba7cc8e190 | |||
| 809b03c81a | |||
| 6a6e145010 | |||
| f1877b3fe9 | |||
| b6ca90e021 | |||
| c872ac4eb4 | |||
| e9e1c4de53 | |||
| 26a5e120e8 | |||
| 6cfdfcc4ba | |||
| 111e5ef0fd | |||
| 578883266f | |||
| 05fbf0ada5 | |||
| 2148e1fa89 | |||
| 1c57091230 | |||
| 54cb542e1d | |||
| bfc8b30325 | |||
| 4bc7265b03 | |||
| 4f9bb11846 | |||
| af87b2916a | |||
| 686da2f4e1 | |||
| a3d142ed57 | |||
| 1a93bcb5bb | |||
| 414481cdd8 | |||
| 0f2a0df165 | |||
| 2946f3c1f9 | |||
| 961b71f434 | |||
| 8277a0651e | |||
| b860d1194d | |||
| bfeddf1db1 | |||
| 214ed794a1 | |||
| 7460ecd42a | |||
| ea9cb3ee5b | |||
| 480b1575fe | |||
| 6ed22fb3d4 | |||
| fde99748c0 | |||
| 4191adb92c | |||
| 44c70c24d3 | |||
| c963c59b67 | |||
| 2eb1c8a215 | |||
| 4b4d171ca5 | |||
| a2ae8a707c | |||
| 87f54ebf92 | |||
| 9a381f4d5d | |||
| 10ce514f59 | |||
| 728aba9d7c | |||
| a090886073 | |||
| 732e71228b | |||
| aa39eb5a9a | |||
| 8733f49e88 | |||
| b8f8f3869d | |||
| 08b990886d | |||
| 4927236912 | |||
| f6ddaf6a23 | |||
| 4845ff063b | |||
| 6a4ba84320 | |||
| 4d2c4c5d8a | |||
| 31f218fdf9 | |||
| c7f3192f6b | |||
| f2b344084a | |||
| c7683a63ce | |||
| 24eda23b80 | |||
| e472fed85a | |||
| 22a4679837 | |||
| 40ec9bb123 | |||
| a87ff2dc88 | |||
| cac9cfe249 | |||
| eba1f68439 | |||
| 3e702afc08 | |||
| 754d26407e | |||
| 5cb9de35d1 | |||
| c1b012171d | |||
| b739674307 | |||
| 89cfe202b8 | |||
| 1bffec2c27 | |||
| f750a773a4 | |||
| ec57ef78a2 | |||
| 8cebe2f607 | |||
| 272d63b062 | |||
| d177e5da67 | |||
| aaed2a41a0 | |||
| 7a7847ed61 | |||
| cc61dd4890 | |||
| 06a708b7b3 | |||
| d76fc8d7d1 | |||
| ce9cbb9c47 | |||
| 8d57bfc921 | |||
| 1806293e46 | |||
| 62b2b4613f | |||
| 784d41b650 | |||
| 1d109214bc | |||
| 3bf8d2ccbb | |||
| 66d44766a7 | |||
| b5dafb8f94 | |||
| 24f857ed5e | |||
| 9f8c5d8fd2 | |||
| b9729fb72e | |||
| 1b0091e0d2 | |||
| 8658560229 | |||
| 7b7593d092 | |||
| f7abff5f96 | |||
| d8b56c123e | |||
| 5fa6b7eb06 | |||
| 6124ee0974 | |||
| 833032adc0 | |||
| 357aba7475 | |||
| eeade69786 | |||
| 8a05c1e31d | |||
| 4a14a586e2 | |||
| ee15e3de13 | |||
| 59e885c2bf | |||
| 422bea5a0b | |||
| b3056bc799 | |||
| a7fe1495cd | |||
| ff8223150a | |||
| b1075ca7a4 | |||
| 1c867927a3 | |||
| 53ddd87dc2 | |||
| a20b9c2240 | |||
| 7d888a5715 | |||
| 350f0f2cdb | |||
| 5e278b7ec3 | |||
| 5481dcd191 | |||
| 723e789b2f | |||
| 947fc8a8ec | |||
| 7304bbe500 | |||
| f816b74536 | |||
| 8bcfa23d29 | |||
| bc25cd89bf | |||
| 220b4c27c1 | |||
| b58cfc36da | |||
| de76933337 | |||
| 63842939ed | |||
| b6d1f81635 | |||
| 58785904a6 | |||
| 49335b4daa | |||
| 0412040bcc | |||
| 267314b4d0 | |||
| d86829d0e0 | |||
| 7d4d13df35 | |||
| c8ea743e47 | |||
| d42b7649a4 | |||
| a21762980d | |||
| 62d7732273 | |||
| 081bae03d9 | |||
| 04134d1481 | |||
| c8ea909811 | |||
| ea720689a3 | |||
| b950fee119 | |||
| 80af1ebca8 | |||
| 01b6109751 | |||
| 7c40462d24 | |||
| e80d448478 | |||
| 689006ee73 | |||
| 9d786d3e53 | |||
| b850806205 | |||
| 9bcf0cd1e2 | |||
| 422a8654e3 | |||
| 94e09ba605 | |||
| 7e03f1cc3c | |||
| 59913ae719 | |||
| 6390bcc636 | |||
| f6fdb150e7 | |||
| 8ea1639603 | |||
| 35217570a9 | |||
| 682b9ee8e4 | |||
| 95d1c43565 | |||
| 7298b0b31b | |||
| c1c086d9a0 | |||
| 1a2ad83b00 | |||
| 328158395b | |||
| 1ef02f8cca | |||
| c406487b14 | |||
| 6c4b37c9fe | |||
| b5583659e0 | |||
| 6d41c23cf2 | |||
| 76f4c5b6f9 | |||
| 187ea08e1d | |||
| 9e957ff80b | |||
| 9bbf8ea9d0 | |||
| f561993112 | |||
| 1cc5379706 | |||
| 203726ed34 | |||
| b97473e874 | |||
| 477aa9f69c | |||
| 66e688cba3 | |||
| 7cace07e01 | |||
| bf467bd99c | |||
| e0dd7efc82 | |||
| f5ea31b9da | |||
| 47137cefb7 | |||
| 2cc2154ad2 | |||
| 0163870006 | |||
| 5565abb871 | |||
| 8bf11c2e41 | |||
| 2b91f55b32 | |||
| 6a5c0fabdd | |||
| d5eb4183b8 | |||
| 4253f3d330 | |||
| afc9951648 | |||
| 4fb76f67ae | |||
| e611fee4e5 | |||
| ece9b9b2b6 | |||
| 5f604ec63a | |||
| 758ae7e8f6 | |||
| cb67ee9bf5 | |||
| ec66b1ca3b | |||
| be984d9bcc | |||
| 8419473453 | |||
| f3de172560 | |||
| d4752ba0da | |||
| d4463b4b95 | |||
| 6bf4e4af3c | |||
| 23ecc82ad3 | |||
| b85da4fef2 | |||
| 60882b29c8 | |||
| 9314ea877f | |||
| 0834a88a12 | |||
| b537cc6618 | |||
| 66bf4f863d | |||
| ab657338ec | |||
| d52bf846f3 | |||
| d5042d4ab2 | |||
| ab41ccb23c | |||
| 5c3625b88f | |||
| f97d1274bc | |||
| 1667628659 | |||
| 67741ceace | |||
| 7520ef8f33 | |||
| d37639ac3e | |||
| 03e947cbfe | |||
| 5551b423fc | |||
| 0321dc9fc5 | |||
| c78e87d4da | |||
| d678a12445 | |||
| 9fea263c77 | |||
| 6fb7381efa | |||
| 76db75d81a | |||
| cafd3528a4 | |||
| 7ba69ad146 | |||
| 9134e19d7e | |||
| 3397e202c8 | |||
| 2b44da199c | |||
| 37af5bc475 | |||
| 9666e753fb | |||
| 6006aa1a04 | |||
| ae4a1f3675 | |||
| 102cf2615f | |||
| abe60acbbb | |||
| c655e13e92 | |||
| d1591e864d | |||
| 9fabe008a0 | |||
| c3a73d4047 | |||
| 8bd4a63c47 | |||
| 01559c99b1 | |||
| db3b1228bf | |||
| b0a365ee67 | |||
| a3d40a29fc | |||
| e8fac6c6cb | |||
| c294de06b9 | |||
| 4fe06ceecc | |||
| adc5c1230f | |||
| 0cc45ecd8e | |||
| eb1d025d08 | |||
| ed8c9c91d6 | |||
| af5b74f0ed | |||
| f6bda82806 | |||
| f8d1267d71 | |||
| e33faa5ed5 | |||
| 3a964862f7 | |||
| ce1c72cf6e | |||
| 6249dd46ad | |||
| 5f3bb18eb7 | |||
| ff30404170 | |||
| 50f1a93664 | |||
| fbf06041ca | |||
| 2314431a59 | |||
| c76f01b6ff | |||
| d28067445a | |||
| 23838df7fa | |||
| 269627b0ba | |||
| c2c865e4b9 | |||
| 03ad234d47 | |||
| c02b1d555d | |||
| 47de27ab69 | |||
| 5dad0588df | |||
| 1b16f210c2 | |||
| b1e6b54f94 | |||
| d5d8d29c9f | |||
| 35ce780bb6 | |||
| 7ee0b8ac86 | |||
| 9c2700b14c | |||
| 313fcfbd83 | |||
| afcb9f0d60 | |||
| eeeeecb030 | |||
| e380abec97 | |||
| 02c2de2a67 | |||
| 1195076373 | |||
| 4d8c903d62 | |||
| 5676cc32b4 | |||
| 2f0616e9f2 | |||
| a3b3c3cf31 | |||
| 3d197e0861 | |||
| 8e6a911700 | |||
| 3097ee2429 | |||
| 72ef17dace | |||
| c930f8f8c0 | |||
| 4797310f91 | |||
| 2525e1d507 | |||
| 180997534c | |||
| 1419244551 | |||
| e9401f09a7 | |||
| 7164ff86f9 | |||
| db31fe8e15 | |||
| 2131f68ae2 | |||
| 1bf06d7da4 | |||
| 236abb6a6c | |||
| 2e87864d0b | |||
| 42813c5426 | |||
| b84e36d717 | |||
| 02472528ad | |||
| c5fa3848f6 | |||
| 802edd7f0d | |||
| aa08027ab3 | |||
| e78d41bbb2 | |||
| ffd044c5e8 | |||
| b0ddaae4af | |||
| 08e0769967 | |||
| 8894b930ae | |||
| edb56c2c46 | |||
| 2c89b0f539 | |||
| 287684e953 | |||
| 9de2c05c56 | |||
| 0fe36a6900 | |||
| 04f051e423 | |||
| 2e0e932e9d | |||
| cd54bf48d1 | |||
| a744b15907 | |||
| b45ab0fab4 | |||
| 4b59946ffe | |||
| 5d3f87bcd8 | |||
| 45ca3b6336 | |||
| d73d12ae8a | |||
| 73662f2fcb | |||
| 991d5c6234 | |||
| e39bf0dc34 | |||
| 8328bff7bf | |||
| 01d83166c7 | |||
| 948e470b3a | |||
| 2bc18c456f | |||
| 5b0a5c70a9 | |||
| 9a2ee23c98 | |||
| e2000ab858 | |||
| 864cb3fa11 | |||
| 3ace3769c9 | |||
| 3dd2dab7e9 | |||
| 828e7ed3e7 | |||
| 92270500e9 | |||
| d05f504c01 | |||
| a181446829 | |||
| ae356b641d | |||
| 6a69687ea1 | |||
| 3fb5aa8e23 | |||
| 9d8a39a3f6 | |||
| 74f0c8b55a | |||
| a02ee8ffda | |||
| d975abc96c | |||
| 70c07d13be | |||
| abb034c2cd | |||
| 175b2cd12a | |||
| 7e84d8b295 | |||
| 1677748d4d | |||
| ffdefbdee2 | |||
| 8b85cf53e5 | |||
| a38d2f15b7 | |||
| f914a7eca6 | |||
| 51c2ef8685 | |||
| b01c951224 | |||
| 65bdb2ce67 | |||
| b45aeb5c36 | |||
| 9d9ee2fe56 | |||
| a2a15784ac | |||
| ad4243ab7d | |||
| 4a1f46a99a | |||
| 1c686229af | |||
| 7a184a0ea3 | |||
| ae49d487cc | |||
| c1f4acd4a0 | |||
| 2080cf991f | |||
| 8b3c50147e | |||
| 01f0af5189 | |||
| 67a1507b83 | |||
| 1c3958c8fc | |||
| 0c7af4a5ad | |||
| 1637df1788 | |||
| 7e0c06e018 | |||
| 9ee5d61b73 | |||
| 52c859cbe8 | |||
| d057d8b366 | |||
| 19f5036c46 | |||
| 26d24f64fc | |||
| bdd5d4ebb1 | |||
| 38f344b351 | |||
| 302055fc15 | |||
| d7eaf35357 | |||
| bdff0fa2d2 | |||
| 7e702e2d50 | |||
| 732acc8ead | |||
| 235d84583f | |||
| 61e97e733d | |||
| d1c5128c42 | |||
| e16ae164af | |||
| 038501e174 | |||
| bfe8f13a8a | |||
| ecf20af742 | |||
| f7593f1b99 | |||
| 4582eb85a2 | |||
| 042f079b8d | |||
| 8f398f2f50 | |||
| bed459d5d3 | |||
| e42b560049 | |||
| b67af2df3e | |||
| a837d74ae6 | |||
| 062ed26b4d | |||
| a7e4057d2d | |||
| af819c3822 | |||
| 47e28d9152 | |||
| 129898cd77 | |||
| 64bf2a4f29 | |||
| b0d4e391da | |||
| b101846d3b | |||
| 0b6864b589 | |||
| 3f39db10d7 | |||
| 14e80ca159 | |||
| 59da8350c1 | |||
| 2b4e85db0b | |||
| dc20e0ae81 | |||
| dd03e018b5 | |||
| bb3ab916b3 | |||
| 3ff46bd8ba | |||
| a587c38864 | |||
| 73d0f36175 | |||
| 5d5a7c48ee | |||
| b0f307365a | |||
| 03e860d06d | |||
| 3b6b3af629 | |||
| ed8e2bac04 | |||
| ddb58492f3 | |||
| baca040df0 | |||
| 4f15ada6cd | |||
| eb826dfb66 | |||
| 747a0f6a55 | |||
| a8e53be6b9 | |||
| c78af95d1d | |||
| 4696ef802a | |||
| 4f9b0d5f29 | |||
| a86e9689df | |||
| 647fe2e866 | |||
| d327ab1d3e | |||
| 9470fdbdb2 | |||
| 570c5794eb | |||
| ec8f481311 | |||
| 91d21d1a1a | |||
| 076f7ada6b | |||
| e4cad82b00 | |||
| 1d527c58cb | |||
| 017b72d98a | |||
| 124b352862 | |||
| 0be9459ece | |||
| e44b9934b1 | |||
| bc3a8cbdc8 | |||
| df5e328f37 | |||
| de298f9250 | |||
| 517619ac35 | |||
| 09deb41e36 | |||
| e0cf20441f | |||
| 9a6975504b | |||
| 66fa62b3ea | |||
| 29564f9fcf | |||
| 91353c841f | |||
| e06d017b91 | |||
| 211280ab0e | |||
| 0226e0799d | |||
| 49c399fa83 | |||
| fc5e2d4861 | |||
| fcf5ace08f | |||
| 132ce0a598 | |||
| 4190e5581d | |||
| 1adb0e868c | |||
| 42ec43e4b2 | |||
| 74d4aff64b | |||
| de45efa479 | |||
| ed2f5d02c8 | |||
| 11a70c5e91 | |||
| 773dedfd03 | |||
| 546c34f2e5 | |||
| 50e41dc1d1 | |||
| a2c42e06ed | |||
| 4761d92399 | |||
| 2f54ad9310 | |||
| b629745c16 | |||
| 9b676d2cd9 | |||
| 79620db9be | |||
| 24986e9144 | |||
| bb1e1f2b5f | |||
| 3a162799fd | |||
| 1736566e22 | |||
| 3868b151a9 | |||
| 12b5dcb1b8 | |||
| f57d263d83 | |||
| 6abf8f89a2 | |||
| f359d1a394 | |||
| 1a5de9ff9b | |||
| 0432a02054 | |||
| 30a5f299f8 | |||
| 79292d193e | |||
| a2a5593fcc | |||
| 8677020a8b | |||
| 177fa1d163 | |||
| 64ac1a6414 | |||
| ff61e34d6c | |||
| 04f4d8237b | |||
| 139f0c95ca | |||
| 727dea5824 | |||
| 4a4829fa0e | |||
| 21ed40bc53 | |||
| 502718caa6 | |||
| e2ce1f997a | |||
| 2ff85cdc56 | |||
| 5821529859 | |||
| 6c52a8629d | |||
| c43653b565 | |||
| 286f8726d5 | |||
| 6f74bbaeec | |||
| 249a35cfe8 | |||
| af9f55c977 | |||
| 102653eb63 | |||
| 31b480d079 | |||
| a16418266e | |||
| 7e65f44168 | |||
| 7f1877a617 | |||
| 44691cde0f | |||
| ed2e3c77af | |||
| 09204dcf44 | |||
| 84f78ea44a | |||
| f60b122a68 | |||
| 28a2ed0a2c | |||
| 4f6b8232c9 | |||
| 2dfbb2963d | |||
| b18af859ef | |||
| 201990b5d9 | |||
| cb3c325e5f | |||
| 238e47cd42 | |||
| a227065ab7 | |||
| c7980036e9 | |||
| 384b284846 | |||
| 475d7fc0ae | |||
| 23c20173b1 | |||
| e36506b1d1 | |||
| 86a76d735e | |||
| 3ecbbf3baf | |||
| aef046b4d7 | |||
| 4a14350711 | |||
| 60d2232c60 | |||
| 1e70ba752e | |||
| 10fd03e222 | |||
| 54e02a620a | |||
| 5178ad768d | |||
| 07a6e612ec | |||
| af1d719856 | |||
| dd7321a014 | |||
| a13d515d5e | |||
| c50223526c | |||
| 1b6ff121f4 | |||
| 290bb2fda6 | |||
| aa29ee6eda | |||
| 559babcdc9 | |||
| 18d79cc30f | |||
| ad97673399 | |||
| 11d21bb2a1 | |||
| 0762aa9ec9 | |||
| a446294e7c | |||
| f1bd4f1055 | |||
| 317beebd7d | |||
| e2a305144c | |||
| e53c4db866 | |||
| 284d9ed7fb | |||
| 31e87de71e | |||
| 4dde700458 | |||
| d71788c402 | |||
| 5c5840417e | |||
| 85f06d6e7b | |||
| 18a93cca3d | |||
| 030c37160d | |||
| 389f61218d | |||
| 4130198f48 | |||
| 3720503e7c | |||
| 29b81f63fd | |||
| 7da16dbf4b | |||
| ac66e3e28f | |||
| f432314fa9 | |||
| 951cde5b72 | |||
| 26c8bdde43 | |||
| b8b14ac6c8 | |||
| 2379c59ab8 | |||
| f0c0c03c5f | |||
| 7c694f2553 | |||
| 4b1c520264 | |||
| 7a553d8439 | |||
| 34253195a2 | |||
| 448467a9a1 | |||
| 99c17f8ac7 | |||
| e3a75901c9 | |||
| 5862c0a174 | |||
| 3e97dda275 | |||
| 29f6ada06a | |||
| c1da382e9a | |||
| bbc4c5fc34 | |||
| 28a6e10a63 | |||
| 6b439d6f82 | |||
| dcd97a431b | |||
| 5695330940 | |||
| e52443ebc1 | |||
| 59d4ab3752 | |||
| 1d11bbb34d | |||
| eabc482184 | |||
| 0550c4a87a | |||
| 52b42ff508 | |||
| edbe969d23 | |||
| df08e10cfa | |||
| abc9376308 | |||
| 39c9b8a665 | |||
| ff2662ebe7 | |||
| b9a6c16461 | |||
| 71277a2283 | |||
| dfc3695ad7 | |||
| f8b7b107d8 | |||
| 99c6944497 | |||
| 0eef2daf06 | |||
| 3e49626aec | |||
| 80aa8c868b | |||
| d355aa11a5 | |||
| 7fceed0446 | |||
| a09342c1fc | |||
| 1022bf7d93 | |||
| 2fd162b8dd | |||
| 62011eed95 | |||
| 658f9cb03f | |||
| 3ce9fb6bbd | |||
| b76a0b8158 | |||
| 718307ffa4 | |||
| 2469cedd15 | |||
| b72e1fb67d | |||
| 10bc66eb42 | |||
| 9ca761b065 | |||
| 64f6839816 | |||
| 01f3b6b6fe | |||
| 61558dcb3d | |||
| 11d9f50115 | |||
| bd974bb443 | |||
| 8ff1f8c526 | |||
| f12b3a0c18 | |||
| 19cb5e054a | |||
| 85ef06a0b5 | |||
| 95463428c8 | |||
| c496d92c3e | |||
| 71f9078bdd | |||
| c964809d37 | |||
| 6a3f58e050 | |||
| 3486e7e9d5 | |||
| 157addf5e9 | |||
| ade7446522 | |||
| a528102994 | |||
| ab51051fcf | |||
| 20e60e5411 | |||
| a069876725 | |||
| 2fa79c9b4d | |||
| 8f71864bef | |||
| b21ee889fe | |||
| a9b4e7963b | |||
| a9aa4dc61b | |||
| 90e2a41027 | |||
| b4f549f4ee | |||
| 53851d5e77 | |||
| 3e62457107 | |||
| 1a046ff4c6 | |||
| be98b1bf7e | |||
| a1ec4aff77 | |||
| 6013b327f7 | |||
| 4b006aa6cf | |||
| 8c1d74162f | |||
| 1a1dde7c8d | |||
| 4c8e6bbbb3 | |||
| 9c94a0ed6f | |||
| ebe3b89b98 | |||
| f523be81d4 | |||
| dc9b51f110 | |||
| 9a1b3fc181 | |||
| b5a30ed0fc | |||
| 6ea60aba31 | |||
| b867b113cc | |||
| db04a7cb35 | |||
| 9c3188741f | |||
| f479013b14 | |||
| a63bb6f650 | |||
| 8c0dfab281 | |||
| 3c9456dd45 | |||
| b45eee3157 | |||
| 5286a014ec | |||
| ff0383dace | |||
| 418e032fac | |||
| 6cef71b1b2 | |||
| 6a645a3eb8 | |||
| 1b4a0897b6 | |||
| 83f72f696a | |||
| 3f91650d6e | |||
| fbe617baba | |||
| 15a783ef82 | |||
| a014ef6340 | |||
| 480ced43c9 | |||
| edcccb6ab2 | |||
| 86d6cebb53 | |||
| e5df099c9b | |||
| e4215f1751 | |||
| 513dc78ebc | |||
| a06b2fdc44 | |||
| b29556e6b5 | |||
| 7b39e32c93 | |||
| 9b395f4d81 | |||
| 42d086b212 | |||
| 5fb14350a0 | |||
| 60ddaf95f0 | |||
| b872cf7f7b | |||
| fb8e5f61b1 | |||
| 6df35235d5 | |||
| 6c5df28d7c | |||
| ae032390e2 | |||
| 8051d5c296 | |||
| ee97db70c5 | |||
| 265e243832 | |||
| 229fbefc03 | |||
| b64c9b8b1f | |||
| cd8d2643d3 | |||
| c92e85a357 | |||
| 75bb548da4 | |||
| 46074e0dd8 | |||
| 27e61cbd84 | |||
| 7ff19d7dfd | |||
| 9d75047211 | |||
| 6e72d514b7 | |||
| a45b6278d1 | |||
| fc43b1ba09 | |||
| b38358f8b7 | |||
| ab7b8b50e3 | |||
| 78fed52627 | |||
| 0407bc8cfe | |||
| d29b922636 | |||
| 9e239ec36e | |||
| bec5e4fb4c | |||
| 61f6f07edd | |||
| cea090af09 | |||
| c12319535b | |||
| 3154e7148d | |||
| 3448729ff3 | |||
| 9a2b39f0ba | |||
| 86ddee5d79 | |||
| f39f9fab3d | |||
| 2a65590755 | |||
| f1b7957028 | |||
| f43275fab4 | |||
| 56f3bc9e69 | |||
| 7b0c767238 | |||
| 7549cb5271 | |||
| 3192b4becd | |||
| 4806ac05a7 | |||
| 003b4e7f15 | |||
| 5119cce2a8 | |||
| aa7334a3ec | |||
| e2df1d71d5 | |||
| e5ccce418f | |||
| c887ff331a | |||
| 0be5b38286 | |||
| e9115f28c9 | |||
| 6b5fa4cd0e | |||
| 1a96770d81 | |||
| 4754dad0d6 | |||
| 3042e945d3 | |||
| fc96e80688 | |||
| 7721a2efe4 | |||
| d90840f7f8 | |||
| 7e9e233b37 | |||
| 958df2b229 | |||
| 3c133f1f53 | |||
| 8c6fa13faa | |||
| c81de3e1e9 | |||
| 8e53533786 | |||
| bacc5396e6 | |||
| 9cb58e0bb3 | |||
| fc5784a310 | |||
| 085cc7ca0e | |||
| 2e42c82793 | |||
| 8607bbf06d | |||
| b73099e083 | |||
| 6358c91a5e | |||
| 9b8cb17831 | |||
| 85fae22fa8 | |||
| d2869fbb5f | |||
| 6533db736c | |||
| 89bd0b50b6 | |||
| 65a00ea754 | |||
| 9ec944003b | |||
| ea0f21fbcc | |||
| 0171aae109 | |||
| fa8f46c0b7 | |||
| d0cdb45b6c | |||
| 8a0f4f32ea | |||
| 0d926eee37 | |||
| 6d78b70075 | |||
| 4184611d3a | |||
| ac1af7848e | |||
| b2b0f6f3ce | |||
| 7dd5578477 | |||
| 2d19785e43 | |||
| d549523f96 | |||
| fd80208af9 | |||
| 5fed47964e | |||
| 71c2a573e1 | |||
| c1173657c7 | |||
| 2bcb41293f | |||
| 7992e105f9 | |||
| 2fbb96bfa5 | |||
| 1018d3b786 | |||
| 09aadafda1 | |||
| ea57dee837 | |||
| eb173099e9 | |||
| 9ac03e7181 | |||
| c2e977a0b8 | |||
| 74541c1dcc | |||
| 0c4ecbe9ec | |||
| 19e2b40a78 | |||
| 43f7974f6d | |||
| 7f0caaa89a | |||
| 6933aaa210 | |||
| 137e67ae70 | |||
| ad2eef0a30 | |||
| 3f3cbea5c4 | |||
| e8c6b8feca | |||
| 81ac4ac152 | |||
| b438b1248c | |||
| 62c96b52a0 | |||
| 210540ce1a | |||
| 4719bb0c6e | |||
| 5f652e632b | |||
| 6b7f3da7c6 | |||
| a51cfd58b8 | |||
| f7dcd2e834 | |||
| 351d7aaa9f | |||
| d1c1a7cba7 | |||
| 55423efb06 | |||
| 628b1adbd2 | |||
| d0a0d6fcb5 | |||
| 0cd53574ec | |||
| 00cf2eae38 | |||
| feec9cc7cf | |||
| 01f06784e7 | |||
| e06c121d78 | |||
| 98b3840a3e | |||
| 8ef11fc41f | |||
| 188d1e2e19 | |||
| 7d9fe86622 | |||
| c757606502 | |||
| acef413f00 | |||
| df4c22e358 | |||
| 426aa514ff | |||
| 8ef3f896f5 | |||
| f9989998a7 | |||
| 2aaff36eef | |||
| 72f673f36d | |||
| 4cd4a2be79 | |||
| 6566941077 | |||
| d90948abb7 | |||
| 1498d42ef6 | |||
| a2f691b24a | |||
| 5e040110fc | |||
| 726f86e020 | |||
| ec4f1d12f4 | |||
| aa1c202577 | |||
| 870127fd30 | |||
| 27dee01623 | |||
| bff8dfea1c | |||
| 54bc10515f | |||
| a893485be1 | |||
| 519c4161d5 | |||
| 1ab7238c15 | |||
| 0b89bbaa3c | |||
| 1b2b0d5b79 | |||
| cdb81c660c | |||
| 9fb4b2ef55 | |||
| 70e2e79c45 | |||
| cb5107f97f | |||
| d3ce687daf | |||
| 1c22cea02d | |||
| 21d9e2c934 | |||
| 90ca24f7b6 | |||
| a5612ab10a | |||
| 54b7fb0203 | |||
| 166c1badc9 | |||
| 143dd26ef5 | |||
| 391c34c12b | |||
| f48fdba12c | |||
| 7daaf1f100 | |||
| effbba74f5 | |||
| 653000bdd6 | |||
| 4554daa130 | |||
| 3bd76dad5b | |||
| b18e4d1a8d | |||
| ff52fc8267 | |||
| 2bc9764fcf | |||
| 7dc5c5d1b1 | |||
| fea5965679 | |||
| 6cd410afbb | |||
| 3fd39ec630 | |||
| 89587c1d51 | |||
| 2151550631 | |||
| 14996be3ef | |||
| 5501f25084 | |||
| 0ddf93956e | |||
| 6f06930ee3 | |||
| 788286e9d3 | |||
| 4c0c553a8f | |||
| 220e5be863 | |||
| 32bb69ef1c | |||
| 0269361b28 | |||
| 2aa94201dc | |||
| d99dddc704 | |||
| 2bf3d14dfc | |||
| fbb794d450 | |||
| 5174d3adfe | |||
| 3a4bedaad6 | |||
| 950dcd47eb | |||
| 0ff942f560 | |||
| d19438f858 | |||
| 31f8f6a7b5 | |||
| 033995ec6e | |||
| 56e7e4cf25 | |||
| c626555f68 | |||
| 921cc4e94a | |||
| f3b217db9d | |||
| a72c06d845 | |||
| 729066e407 | |||
| aa4f2d2db2 | |||
| 268968a8b4 | |||
| 6cdb9580e2 | |||
| 5e6923e936 | |||
| fe223eccf4 | |||
| ab954a934a | |||
| 4ad80ae872 | |||
| edd8c87502 | |||
| 2b96754673 | |||
| 5f6de3e47c | |||
| 74671bd2c9 | |||
| 8d392cf5c7 | |||
| 0e08878a68 | |||
| f2bc27718a | |||
| 3ad11e0ad4 | |||
| b90e9d49ca | |||
| 0618a6d0df | |||
| 81474c2623 | |||
| 18bc5ae77e | |||
| adf929fef5 | |||
| 61ca460457 | |||
| 69a09c6f77 | |||
| d17476b058 | |||
| 203a84dd0b | |||
| 42eb63a7de | |||
| df21566f9f | |||
| c85f049f52 | |||
| b12c6bac57 | |||
| effca9f6ec | |||
| 95c040b723 | |||
| b2efecd9b4 | |||
| 0699c54c45 | |||
| 24943a4759 | |||
| 9b8aa4c101 | |||
| ad6b37a423 | |||
| a1e27b1606 | |||
| b22ebeda61 | |||
| 6eb094c726 | |||
| 2ab5eee78b | |||
| d26052c7df | |||
| 3b3a2b890f | |||
| 5a35c8cc4e | |||
| ece616ff22 | |||
| 4e1fbe54b2 | |||
| 5a69201451 | |||
| 63784c5b5a | |||
| 8f6b3154e5 | |||
| ab0a6f2e73 | |||
| 57dbe50597 | |||
| 2cc10f829f | |||
| d102d0c26d | |||
| 7a012a3465 | |||
| 639b6e780f | |||
| cf5370eb22 | |||
| 7b68c6cefe | |||
| e32aa54a41 | |||
| cdb896b790 | |||
| 13f07582b0 | |||
| d7e6f468e9 | |||
| 6ff8340619 | |||
| 0ec5775ded | |||
| 974c19a51c | |||
| 6f9c6effaf | |||
| 27dbc4ba09 | |||
| a1143a53f0 | |||
| 11dc0e1777 | |||
| 762b5f7a75 | |||
| 5d192d7150 | |||
| facd3d1af1 | |||
| 176c155193 | |||
| 566df8dc65 | |||
| 6ceeedfd3c | |||
| 591217da4a | |||
| 403845c9ca | |||
| 1265478a98 | |||
| c731091941 | |||
| c8f07a2dd9 | |||
| 1b312083fc | |||
| 29347840c2 | |||
| cc65bd1702 | |||
| 0f08e83553 | |||
| 51c56287f0 | |||
| 972448d5ae | |||
| 878cebaa70 | |||
| 0fa9c23225 | |||
| 6edd6a850a | |||
| 7a787a672d | |||
| 31dfae8aa2 | |||
| 19dc0a8561 | |||
| bb22f72ad9 | |||
| 3c3507c822 | |||
| 4eeac3ea75 | |||
| 174030a15f | |||
| 2e58ce2fd9 | |||
| d5bcf62e5c | |||
| 3e470708a6 | |||
| 5572a92c58 | |||
| ecc0cd37f4 | |||
| cada1e24b5 | |||
| 3b9931fcba | |||
| 3a4c1ce351 | |||
| febae668fe | |||
| 7f4b636559 | |||
| 860242b811 | |||
| 02f5818912 | |||
| 277d9d237b | |||
| e00785a855 | |||
| 8724ba8e01 | |||
| 4601cd1366 | |||
| 2397ff86e6 | |||
| 90cc36f7e2 | |||
| f5d9cb58eb | |||
| b02dde1982 | |||
| a714444a8e | |||
| 6409e6efaf | |||
| e82f724e9a | |||
| 9876fb54bd | |||
| 4dbf5b37cc | |||
| 41f38775a1 | |||
| 6f15593ce2 | |||
| 91d44ef577 | |||
| 5a65140cb4 | |||
| 13969f5940 | |||
| 4af271c494 | |||
| 5d02a2c295 | |||
| 7ef681eaed | |||
| a9c52454c8 | |||
| 5e4961d902 | |||
| da3621c180 | |||
| 9c3813e213 | |||
| a3293be124 | |||
| 68138d6a31 | |||
| 081ff24282 | |||
| 5a78c32a23 | |||
| 4bd95d756e | |||
| 7f941818a8 | |||
| 5109df6f55 | |||
| 93c61b9e8f | |||
| 13fc3271f4 | |||
| 92fe22382a | |||
| dfe6c34bf1 | |||
| 22d36985cd | |||
| 4aa7cf8e9f | |||
| 8153a56aa4 | |||
| 42eae13270 | |||
| ead34df653 | |||
| 6c825df8f7 | |||
| 00c819c0d5 | |||
| b2c7543204 | |||
| 2ac7077571 | |||
| 31381af8a0 | |||
| fc411d3675 | |||
| f00d0d8ea8 | |||
| 83d62b1aa2 | |||
| 587106a869 | |||
| 5d937e4a23 | |||
| 64533d53dc | |||
| f35b59aded | |||
| 3bfda758db | |||
| 0f830b79e1 | |||
| edd301d364 | |||
| 10e4c9bfab | |||
| ad7f157ac4 | |||
| 2d0698633d | |||
| 8d09a1ae87 | |||
| bfe31c32c0 | |||
| 71b0622cec | |||
| d35f965c47 | |||
| f053bbb4f4 | |||
| 65ed56e970 | |||
| 018f6f6f85 | |||
| 1379dc298e | |||
| 5a527daac9 | |||
| 1d0e0b22e4 | |||
| 2857b71214 | |||
| 35ff9d850c | |||
| 043ac73b19 | |||
| ada6f0be8b | |||
| 3d6d4b1bfd | |||
| 725060b353 | |||
| c6f56edcff | |||
| 66989faab6 | |||
| 16a64d7000 | |||
| 7ff930af04 | |||
| 95541fa52d | |||
| d97ff67129 | |||
| e7937998d6 | |||
| 508738f836 | |||
| c68cfdeeca | |||
| 3a8665f796 | |||
| eb96f89960 | |||
| 9d2406729e | |||
| 6ec727d15c | |||
| 6bca4c041a | |||
| 4573a9f872 | |||
| e4cb9dbb77 | |||
| 51eeea477b | |||
| f42d17c6b3 | |||
| bba102e624 | |||
| ae359d0d02 | |||
| 9e53b86dca | |||
| a494f96cfe | |||
| c4133f2535 | |||
| 31c36d3dd4 | |||
| aafb136cd0 | |||
| 04dc6441aa | |||
| 60bb2374d6 | |||
| 8acc24f000 | |||
| 0659f34aa6 | |||
| aba225c88d | |||
| e01338fcf5 | |||
| a0f9a7597c | |||
| bf1fd0379c | |||
| 0c5d61bd56 | |||
| e416fe8066 | |||
| 45425bedca | |||
| 8efcba81d7 | |||
| 742513d708 | |||
| cef2e24ec4 | |||
| f89984642e | |||
| d4b3469e2f | |||
| 7340aa5b8e | |||
| 67d2ada020 | |||
| b909a1f775 | |||
| 3855c7f92f | |||
| c4f1d4dfed | |||
| 5ce3537ef0 | |||
| 7da3b3b92d | |||
| 05dbeaeba4 | |||
| 339785dad7 | |||
| 7fceb7ea86 | |||
| 44f3702919 | |||
| e94a921c2b | |||
| 9832a691fe | |||
| 6d75cce924 | |||
| 1eab014524 | |||
| 0c325e10da | |||
| 9cde836d08 | |||
| 6e142d523e | |||
| 75bc6cd7e7 | |||
| b721a08ef2 | |||
| 602fda327f | |||
| 62b8355af0 | |||
| 16a3bc35c0 | |||
| 9791068844 | |||
| 2423eaac2c | |||
| 5972d84c82 | |||
| 83637d164e | |||
| f86318407c | |||
| 1536c3ae5a | |||
| 9b1e6e6d3e | |||
| fbb11ea366 | |||
| 88ef277dc3 | |||
| ccd6a0614f | |||
| bfc1d43a27 | |||
| 71dba5f511 | |||
| 22c4924040 | |||
| 04087c9ac9 | |||
| b19553574e | |||
| fbc2eacade | |||
| 087d78d465 | |||
| 1990c139d5 | |||
| f179dc7acc | |||
| f41be0b25a | |||
| 6bd06dbc33 | |||
| fe8313159a | |||
| d2ae7dd186 | |||
| d6b8375504 | |||
| b3b6eafe1d | |||
| acb1fb2e30 | |||
| e12bb5504a | |||
| e5036891f6 | |||
| ad579912f4 | |||
| cb084f59c2 | |||
| f1f70501db | |||
| 195e515de1 | |||
| dad3d12406 | |||
| 42cd07a2e2 | |||
| 61e0dd439f | |||
| f91f8d9559 | |||
| cf43c7a0e6 | |||
| 3763ec7652 | |||
| cc99c3e262 | |||
| 2c762a67ab | |||
| 6cbf73a666 | |||
| 038e711af2 | |||
| c2fea7b3c6 | |||
| d631b1fa8c | |||
| de47d0935f | |||
| 010d1a9be3 | |||
| c3f9f5efaf | |||
| 1cb9ea5c46 | |||
| 39305c1a7c | |||
| f04780e66d | |||
| 70be35f319 | |||
| e76912303c | |||
| 2d9611f948 | |||
| bf8965a615 | |||
| e003532701 | |||
| 89d1c60c3f | |||
| f820aa3f60 | |||
| 83df863b6c | |||
| fea811a4b7 | |||
| d755b7908e | |||
| eab8b9a116 | |||
| e98a7ff239 | |||
| 0b82467cf1 | |||
| a0ef37e7bc | |||
| 8064254eaf | |||
| 8982342c54 | |||
| c26177d14f | |||
| ba89c8d580 | |||
| 4bf173e9c1 | |||
| e6feb22411 | |||
| e5121e70d0 | |||
| 9bd079d425 | |||
| 9bc68d209f | |||
| e6e3e69da4 | |||
| 750a265531 | |||
| 95fafc7c25 | |||
| 0f3bb838d8 | |||
| 11ba413c4a | |||
| 6e1e4f1dc2 | |||
| 34f14e657d | |||
| a571f31c95 | |||
| b7747b50ce | |||
| 0e367ba541 | |||
| 83d3f85636 | |||
| 4206d8f955 | |||
| aea57f2026 | |||
| 232e41f2ff | |||
| d781d7ec00 | |||
| 3e51317236 | |||
| 9c7d3f7f67 | |||
| 7473cef063 | |||
| bcc9dcd210 | |||
| f2e45daf54 | |||
| b43a52128f | |||
| 0e4828e732 | |||
| 771bd349cb | |||
| 6c60ff92ff | |||
| f1f1783aa8 | |||
| 028ef2b5b5 | |||
| 6902a8b294 | |||
| feb907d225 | |||
| bb5b89eb26 | |||
| a0c157eea8 | |||
| 4a6a7028a9 | |||
| eb3671b647 | |||
| 97b2635e7d | |||
| 39743082b4 | |||
| 2e3465cb49 | |||
| 7ee6d0fa62 | |||
| 0ae7df4a95 | |||
| 3e142a6297 | |||
| aee2b0c50a | |||
| 9973e97b84 | |||
| e748280622 | |||
| a4a09e73d5 | |||
| a747e2bb97 | |||
| 4c9b6b44d5 | |||
| 71906d09b7 | |||
| fb98c932b2 | |||
| 2a78d3efa9 | |||
| d0f9cc27a3 | |||
| 4325f13f74 | |||
| 3aa99a660e | |||
| 01fd7eb861 | |||
| b5a96ff9c1 | |||
| 6f184a0471 | |||
| 0067f68117 | |||
| 232fffffac | |||
| 0c3927ce4a | |||
| ae4995c671 | |||
| 862faa16c0 | |||
| 6519d3bc97 | |||
| ccbb6263ea | |||
| 053d1bade3 | |||
| 694741f441 | |||
| 6fd4347c6c | |||
| e25dd2c2c3 | |||
| ef24a3caa8 | |||
| 9efcfc65af | |||
| f55bde6ee4 | |||
| 50ac80cb4c | |||
| d51e9e3d03 | |||
| 0abd611c0a | |||
| 0ddbc1304b | |||
| 1f66d60272 | |||
| 6805abe0f3 | |||
| 20b8c48440 | |||
| c2a6d182d7 | |||
| 7746c4722b | |||
| aa55bc1559 | |||
| 5b261af659 | |||
| 51eef8c5b7 | |||
| f22eab5544 | |||
| fbe47d912a | |||
| 33ae18b8b3 | |||
| d865c55007 | |||
| 0d8dcacee2 | |||
| ae2cfeefe3 | |||
| d06f52a7f0 | |||
| 2de3dc2735 | |||
| bf5e0c10ce | |||
| b973ad1df9 | |||
| eff3252095 | |||
| 4a4b9d145d | |||
| 9f4e45d333 | |||
| 431447ef87 | |||
| 73c0f21363 | |||
| f7991303e8 | |||
| fe6f9e9a65 | |||
| 7678a937e4 | |||
| 7a690eb5fb | |||
| 9cfe28aee8 | |||
| c17c743ed4 | |||
| 4102982ef4 | |||
| 5ff839732e | |||
| e2359c11ae | |||
| 8fea0f0a8f | |||
| d449145799 | |||
| 9e847075fa | |||
| fac25561bc | |||
| 1ef2ad611f | |||
| 9f7074a706 | |||
| 204d08140a | |||
| 77d26759e3 | |||
| 58c46bed40 | |||
| ac6857ee28 | |||
| 6b83a05ada | |||
| ac758b6875 | |||
| 9c99c7d11a | |||
| 3a93a250b7 | |||
| f03b8859ed | |||
| 5c946cdbd8 | |||
| 1b617b28fc | |||
| 33cf096b03 | |||
| 9031e0369e | |||
| 94c75f33bb | |||
| 2a151d9354 | |||
| 092e72d60d | |||
| 297223cc21 | |||
| 4b2e34e0aa | |||
| 8aee833024 | |||
| d1fb165ad2 | |||
| 1afad51ee2 | |||
| 0525b08612 | |||
| 8867c00d68 | |||
| c1a2be0d05 | |||
| 5df36d4ead | |||
| be840ccd00 | |||
| f758bd769b | |||
| b1baa4ed8b | |||
| f8d97a5f61 | |||
| ad837c2069 | |||
| 9198522307 | |||
| 552d84884f | |||
| 7c38b7bc01 | |||
| c5c5c9b17c | |||
| eed181245d | |||
| 27dc506a03 | |||
| cc8fc19d4a | |||
| 2bd8df54e1 | |||
| bedc63d75d | |||
| d48261aa23 | |||
| 2fb453a4a5 | |||
| eb28e8b322 | |||
| c513c4da96 | |||
| b0d6d59be5 | |||
| 92d1b6060c | |||
| d11cc22536 | |||
| b2ae5b197e | |||
| 498ccae27a | |||
| ccf3c71903 | |||
| 020c1e9b6c | |||
| e9c93f9c0c | |||
| 6493e12bfb | |||
| 1d5c516780 | |||
| ff3bc3cc94 | |||
| 0381073e56 | |||
| 0b8876e946 | |||
| ccb80ab09d | |||
| 80776172a5 | |||
| 31e098e64e | |||
| 7aae12d55d | |||
| 4d62bbf857 | |||
| 7d3a576a7b | |||
| 17ca2c49a5 | |||
| 7278f72157 | |||
| f0f85a7ef3 | |||
| 77b3a76919 | |||
| 0ec4ee5963 | |||
| 6932461e63 | |||
| 422ebcf8e0 | |||
| 4b71f9126e | |||
| b4c3f9aaf0 | |||
| 50df3ec103 | |||
| 54a84a6e6e | |||
| 2ff6cc3135 | |||
| f8f6132006 | |||
| 8eda8113d9 | |||
| 04921a9015 | |||
| e2dab60ad1 | |||
| 093ae2b4b4 | |||
| 10adda0d73 | |||
| 4f5255c36e | |||
| 97728357e4 | |||
| 7be92db76f | |||
| 7241f42e9d | |||
| 42f98c7eec | |||
| 88ebe22d8b | |||
| a5ffbbee2d | |||
| 08f2a395a3 | |||
| 5e1364daeb | |||
| f42e8ac3d2 | |||
| 0601293edb | |||
| 1938a73c90 | |||
| f1d4a85f59 | |||
| ae3638121c | |||
| 74df79331d | |||
| 3f45338cc9 | |||
| 83a889d678 | |||
| ab3ed5c431 | |||
| 944bba1031 | |||
| 30a328705e | |||
| 03095f85bc | |||
| 5c43906b24 | |||
| 0be987391b | |||
| 777dd99585 | |||
| 6d5fdc2b68 | |||
| c02c35e256 | |||
| 20d1f357dd | |||
| a00571a1d7 | |||
| cf5dd15213 | |||
| 8dc84b3deb | |||
| ff973f7992 | |||
| aa592190dc | |||
| af3605705f | |||
| 35cb4fbf8c | |||
| b344d30792 | |||
| 9776f2350b | |||
| a2dec6c32a | |||
| b64c375f2f | |||
| 7bbcf5875c | |||
| e1c19367f0 | |||
| 4cc0952736 | |||
| f4ffba1a6e | |||
| 25f514ab6d | |||
| 6955f80c6e | |||
| b312055c80 | |||
| 1c109afdaa | |||
| 73c0cc5203 | |||
| 94f6208bde | |||
| 55e1eab1a2 | |||
| e3287ad303 | |||
| 7526afdae0 | |||
| 5f05703206 | |||
| 6d1ee15b9a | |||
| 1527ef3db0 | |||
| 8580e73b65 | |||
| f838448552 | |||
| abf2ae3f80 | |||
| 307c27892d | |||
| 961ba55e85 | |||
| e8f4b7cf19 | |||
| 5987455d35 | |||
| cc7f7220c0 | |||
| c16c7312cf | |||
| b18851e0b9 | |||
| b29877e14c | |||
| 3a89108a55 | |||
| 752b3f0dd6 | |||
| 885fd2b15c | |||
| 2005495bfb | |||
| 97ae59fe1a | |||
| 797355cb7e | |||
| f2af1ed332 | |||
| f08d102ac2 | |||
| a2de96abc0 | |||
| 5885b31bb4 | |||
| 3b6901f7fd | |||
| 849ffd59ec | |||
| db4721a31d | |||
| 27cd24c316 | |||
| 41ca1be4ff | |||
| dce0bbad6c | |||
| 3617d24318 | |||
| 4e6d6578e4 | |||
| 5856325e5a | |||
| b4b134e527 | |||
| c8d084a85e | |||
| 3e0dcfd47f | |||
| 99338d278d | |||
| 1ae9e7b448 | |||
| 14f0cb2704 | |||
| eebb2f196d | |||
| 63653bd6af | |||
| 6eec07257a | |||
| 1bdd01867a | |||
| 1fd8c45c55 | |||
| 0470fe9f89 | |||
| 54549adc66 | |||
| f84607af52 | |||
| ecb954fd9d | |||
| 8742b63fa1 | |||
| ac0ea378ff | |||
| d580d4e46c | |||
| a2971d0449 | |||
| 478e001d0e | |||
| efcd72a2ef | |||
| 5665d51bb3 | |||
| 518034d28d | |||
| 7874c86cb2 | |||
| 6d23dac1f6 | |||
| 993a106679 | |||
| 8e5e2e52fd | |||
| 346d10172b | |||
| 085ae9cab2 | |||
| 6497f08ad4 | |||
| 85248d7850 | |||
| 3276c46c72 | |||
| 76e1dd515f | |||
| 568dff40b6 | |||
| d439221c62 | |||
| 03ba24dd65 | |||
| 75045328ec | |||
| 6e532184bb | |||
| 1054ec7749 | |||
| 001fa99741 | |||
| 3482605b1a | |||
| 6a66bb2314 | |||
| 212ecff33b | |||
| ae7bdefc33 | |||
| 66166bd7f7 | |||
| 4cc23f6608 | |||
| 7150dd66cd | |||
| 5666efe66b | |||
| e006f89aa3 | |||
| ffb2c4de77 | |||
| 19c55cbb75 | |||
| 720b906a74 | |||
| e05f961eed | |||
| 6151c1044a | |||
| aad7995648 | |||
| 700862295f | |||
| b9c13283a4 | |||
| f08983a948 | |||
| 7a5ce1cb34 | |||
| 7f14b69022 | |||
| 6e2abeba5e | |||
| eae329f332 | |||
| ef3961448f | |||
| 9139f4ba84 | |||
| 6dc99f7738 | |||
| b4c4daf775 | |||
| ad6cc5a12d | |||
| a9e789fa02 | |||
| 590bbd7e21 | |||
| 29e0ded977 | |||
| 6912223444 | |||
| 6510b12203 | |||
| dd6a6fa7ec | |||
| 94dc25b45f | |||
| f1c151f157 | |||
| f31d8bb9a1 | |||
| 660f130d2b | |||
| a2619da37e | |||
| 24a34936db | |||
| 8edff76765 | |||
| 2cf65953db | |||
| 62e8c573e8 | |||
| 88c10e02ff | |||
| 1a92141896 | |||
| 53d1c3f117 | |||
| 9a96f5b64e | |||
| 52ec917125 | |||
| ae792cedde | |||
| bb276ef5a9 | |||
| 7d0468aaa4 | |||
| 44f48ce915 | |||
| 80131e1e4a | |||
| a11eddd04b | |||
| 8fe9bc6439 | |||
| 9f60324821 | |||
| fd25a53d1b | |||
| 322bd934be | |||
| 720b183017 | |||
| 7243369333 | |||
| f83828d944 | |||
| c7502c6eb3 | |||
| 8e7d88c85b | |||
| 6027e777c8 | |||
| 8313879b3c | |||
| e5cd6b6193 | |||
| e75c48ec7a | |||
| 189ca73707 | |||
| 7984a9a500 | |||
| 54e78e114c | |||
| 6fb79d5f33 | |||
| b49547b2b5 | |||
| c0a0d1bb22 | |||
| f40ff3c134 | |||
| 7c28bafba9 | |||
| 6e17ee9fe2 | |||
| 5d443a2482 | |||
| 4ce10986b5 | |||
| 0a944dc950 | |||
| 5290d5f667 | |||
| 962dd27a8c | |||
| 2f4959dcd8 | |||
| ef93fcfe48 | |||
| c245d93e7d | |||
| 2e0d576e6b | |||
| 44dae05c3d | |||
| 1af764c4d0 | |||
| f8345b3fe6 | |||
| f0e616ea2b | |||
| e9c25f8274 | |||
| aaf09ceb26 | |||
| 28df4a0e25 | |||
| 7837be0575 | |||
| 2fd3553d78 | |||
| e4a3d284b2 | |||
| 15630855dd | |||
| 941da5dc94 | |||
| a6d1544447 | |||
| 69065b53c8 | |||
| f09b0def11 | |||
| b1c4b0f07d | |||
| 31d6f87d80 | |||
| 64b08311b9 | |||
| 389a4bf44d | |||
| eaa6bf3f42 | |||
| 5bcf3d2bc0 | |||
| 4559279686 | |||
| e0471187d0 | |||
| 9fadf6cf84 | |||
| f4f705e723 | |||
| 1847b99461 | |||
| 5adad6c1b4 | |||
| fb0c3c8061 | |||
| d4beff7954 | |||
| a1e94b67d5 | |||
| 8521367373 | |||
| 022b8cea37 | |||
| 8e404a26f6 | |||
| be5a832db3 | |||
| ef923fae44 | |||
| b119b6c474 | |||
| 340a9ab6be | |||
| 8efc7866dd | |||
| 37f56fa324 | |||
| 208a9b8547 | |||
| ae796740aa | |||
| d2643dc483 | |||
| efecea001a | |||
| 1955371a71 | |||
| d41a003bcc | |||
| 6e07bad728 | |||
| 971d844266 | |||
| 633786f55e | |||
| 1b00f36520 | |||
| 24c9e6ff66 | |||
| e6d31cb89c | |||
| d275109e79 | |||
| 732c362dea | |||
| ef3b9161f8 | |||
| 559317f9d0 | |||
| 02ed8410a2 | |||
| 3279a7c9a2 | |||
| 7f7c6297f7 | |||
| f9b5f704b1 | |||
| 75474e5bf1 | |||
| c3a40dba68 | |||
| 976ed5e396 | |||
| 83b00ad861 | |||
| dd27968460 | |||
| e9a57c56b7 | |||
| 3a838447a8 | |||
| 4136f395bf | |||
| 9d1f7e7348 | |||
| 34db065631 | |||
| 314a4245a9 | |||
| febac23b25 | |||
| 9e10458209 | |||
| 352cf002b2 | |||
| 7dddb6cf7a | |||
| 237732d0a1 | |||
| 6dd2e2f06d | |||
| 61cae70fe5 | |||
| 06cc62f40d | |||
| 0074496ea4 | |||
| 131f4c50fd | |||
| 253a02e712 | |||
| f062187e47 | |||
| 45233a7e16 | |||
| fd19404b6f | |||
| 747eab12d9 | |||
| 7ec997afce | |||
| f25bec9132 | |||
| a243285af4 | |||
| ff23795f5b | |||
| 1a450b0b39 | |||
| 4873c0b1ea | |||
| 1feae2083d | |||
| 5fac6142e8 | |||
| 085563653f | |||
| 38da06301d | |||
| ae72661742 | |||
| 05a3a83b6c | |||
| 46d0e2f892 | |||
| 70f9921423 | |||
| 02e020c05e | |||
| 1fc77885c2 | |||
| 2c6e2a68b7 | |||
| 52de6766c7 | |||
| c0b82db752 | |||
| 83b2abb6d6 | |||
| 29b4ab04c3 | |||
| fae367ab31 | |||
| 1261a44cec | |||
| 49e7939a10 | |||
| 53bd40ebaf | |||
| cd4e73193d | |||
| b9fed3391b | |||
| aacb89ed53 | |||
| 52bfa90d5e | |||
| aa261049f4 | |||
| c77e9231ef | |||
| 49584082a0 | |||
| c6c86abeee | |||
| fbcc84bdcf | |||
| 97479f9613 | |||
| 55e6b4f928 | |||
| 32f480a4ae | |||
| 9853d4e0d4 | |||
| 598addff94 | |||
| 86c3bfd66d | |||
| e17a8989cf | |||
| 13dda25334 | |||
| 0f339f3a6b | |||
| 5edecb9495 | |||
| bfc670b4d9 | |||
| 4b6a846d9c | |||
| 5110ffeef4 | |||
| ead1aa8dfc | |||
| d4d4a46436 | |||
| 788f543bc3 | |||
| 3be9515d84 | |||
| 4972b3722e | |||
| dcca3cf80b | |||
| 90871eeb9e | |||
| 634c395a6f | |||
| 69a4df909c | |||
| 3f7da833d1 | |||
| db4668c057 | |||
| b11f7c7817 | |||
| 2da54df9df | |||
| 116789022c | |||
| b78b576b21 | |||
| 76c7f3b14e | |||
| 35972e68e1 | |||
| 7ca6b2b8b0 | |||
| f5c33e5073 | |||
| 9a4465f9c0 | |||
| e58739c559 | |||
| 8ed132a5b9 | |||
| a6ba0d3fbe | |||
| a3c0e81230 | |||
| 63e97754fb | |||
| a4111363c0 | |||
| deabdb666f | |||
| 57aebadb15 | |||
| 8b7c1e94e1 | |||
| 2c9cd8f68c | |||
| 8e58dd8dec | |||
| c06dd27c33 | |||
| becd9c224e | |||
| 5b7e224f46 | |||
| f8c95a1dbe | |||
| 790b03c707 | |||
| 1e99155d61 | |||
| cc465f0f35 | |||
| 5583fd89b3 | |||
| 2cdc210193 | |||
| 523a6a1cff | |||
| f1e9fdf76d | |||
| 6735135773 | |||
| 67161506ad | |||
| 2543158c8e | |||
| 61761cfab1 | |||
| 87e5984ae2 | |||
| 9294d33611 | |||
| e31da8532e | |||
| c4b682f996 | |||
| 4c5f6fe360 | |||
| 0fe19ed2ac | |||
| 2af42f48b9 | |||
| 29d2f6ed6c | |||
| 6edb21231e | |||
| 88b8a01da6 | |||
| 101ccce895 | |||
| 27df6c86fc | |||
| c5d6230c66 | |||
| 4f496b8681 | |||
| 86fa7720f9 | |||
| a9b3d8c998 | |||
| cdfb3d5113 | |||
| 3a48ab4c54 | |||
| 5a9478cdba | |||
| 39bb863024 | |||
| 2f2688b829 | |||
| 579d51b1b2 | |||
| f6c4e3eb1c | |||
| 9a49fda8e6 | |||
| d922ca68e7 | |||
| 52c87a0330 | |||
| 1ee725ef35 | |||
| ad24d6cb04 | |||
| e0c4e144b9 | |||
| 363dd7bdf0 | |||
| a94fe04a9a | |||
| 5b6be88587 | |||
| 79d29b7633 | |||
| afb6e5441d | |||
| c0702318d2 | |||
| d382463f8a | |||
| a72d993e65 | |||
| 3ee8697bbf | |||
| ca1b3a80ae | |||
| d317a93e0f | |||
| 39f8b82640 | |||
| 32bfe0dddd | |||
| 4c14afba4e | |||
| 288c52b688 | |||
| 2cb37408a3 | |||
| 60ba9c3280 | |||
| 7e89cd8643 | |||
| 6c4840fa50 | |||
| 29e71638ce | |||
| 608cdbe3f6 | |||
| 09dd8053a9 | |||
| ae336f146d | |||
| 6a6cbdd9b4 | |||
| efc2702491 | |||
| 2351271889 | |||
| 29d8c5bb50 | |||
| a11f46fed4 | |||
| 5d06584545 | |||
| a0716c39de | |||
| 461ca703ff | |||
| 36333076d5 | |||
| 2ebc5011f3 | |||
| 92ac503b74 | |||
| 1fef394fde | |||
| d76ecbba7c | |||
| 6c1e2989b1 | |||
| 4b38004a49 | |||
| 546fcfa3ec | |||
| 32c3fbd18e | |||
| 635b854c29 | |||
| bcc3b1cbb5 | |||
| 57852f6498 | |||
| 14dfb539b0 | |||
| fe08f457bc | |||
| e24c0ec9df | |||
| 37a18c858f | |||
| 6735bffd39 | |||
| e6a59be8c0 | |||
| c4d073a4de | |||
| 5b8c604f47 | |||
| c2ee8d70e4 | |||
| 41201f488c | |||
| c531739602 | |||
| a5a811f767 | |||
| 15d188d7f8 | |||
| 8dcbf2675b | |||
| 96b36ec01e | |||
| 1f4c1e8821 | |||
| f3c8f40c51 | |||
| b01382c20b | |||
| e4ee040a04 | |||
| c575939ef4 | |||
| c5cca49117 | |||
| 7e0f47ff15 | |||
| 4972ba9a78 | |||
| 4ec9356ba2 | |||
| de597eb7d2 | |||
| 7d18544b04 | |||
| 3b60676e64 | |||
| d7bc1d776c | |||
| 1e8cfa10bf | |||
| b249954538 | |||
| dda14faac5 | |||
| 6788a614d1 | |||
| 97ec7de9e6 | |||
| ffed7d6834 | |||
| c330e4203e | |||
| 0533d9ff6e | |||
| f5b68e2d9d | |||
| 58c153b9ac | |||
| 60052ffb45 | |||
| 1558948b9b | |||
| c9645885d0 | |||
| 3672ae1118 | |||
| c48ba54a09 | |||
| 3f87f29a81 | |||
| a9bb5be49d | |||
| d91326fb4a | |||
| a14a78de34 | |||
| 533e7a97ef | |||
| b4c80052fe | |||
| 79bbc37daa | |||
| 3a98db672b | |||
| 28c1dc3e39 | |||
| c4836bbd70 | |||
| 0e3399177e | |||
| 39727d6a81 | |||
| fb345e983e | |||
| 64e153fc34 | |||
| e297eada07 | |||
| 51cbbd0438 | |||
| 51257991c0 | |||
| d66adc937d | |||
| 90b2b2144b | |||
| ed0a42f940 | |||
| b7f71b026d | |||
| 5c7decc27d | |||
| 68e1cdbdea | |||
| 4f4fa940d8 | |||
| 46af99b8c0 | |||
| f55303b0a8 | |||
| 222d6ca952 | |||
| 160a0a5ee1 | |||
| 9a0c994fa8 | |||
| 91d1805fb1 | |||
| af4f4069ee | |||
| d9199657c1 | |||
| 8bf52f8c0f | |||
| 1e1eac5f17 | |||
| 19e3842615 | |||
| 8ab0190c29 | |||
| 07d0fd6719 | |||
| 9044110096 | |||
| d8709b18c6 | |||
| 8ee37e7b47 | |||
| 24853eb42c | |||
| c136432978 | |||
| 245bc59c68 | |||
| 97865f03f6 | |||
| 7cfaa8a418 | |||
| 3bbea05a93 | |||
| 3d0cd51f27 | |||
| 9b237345d1 | |||
| 5f25a0788a | |||
| 7460764d91 | |||
| 36ce6a7e4f | |||
| 7e61a04785 | |||
| 28d34b0f56 | |||
| 5caca8d64e | |||
| 123acd5a73 | |||
| 110b410af4 | |||
| 862370f232 | |||
| 7182b2508d | |||
| 0807891501 | |||
| 60204bd309 | |||
| db16262698 | |||
| 96c1e88d56 | |||
| 9bd54b592d | |||
| 8c6c4e5262 | |||
| 18dd7ebae2 | |||
| 4d94803d32 | |||
| 0e19f74c16 | |||
| bb5dca016d | |||
| cf89cb12cd | |||
| f18b913493 | |||
| 61d744c38a | |||
| 453c85e61d | |||
| 853c11d301 | |||
| b9779176d5 | |||
| c7b5cc3787 | |||
| 158a4d897b | |||
| 1fd06cf773 | |||
| 74a0d26d0e | |||
| 17a613546c | |||
| 3f2d2d8f37 | |||
| 88b94c3c67 | |||
| 80a9fa962d | |||
| a4e5ed68fd | |||
| 376c5adb7c | |||
| 64f98e058d | |||
| 9d05289147 | |||
| ef89eb019a | |||
| e75954a7ab | |||
| 52685ad50c | |||
| da24f97483 | |||
| f04d49ca17 | |||
| f6e23d726f | |||
| 5e28fb8f97 | |||
| 89fd12692f | |||
| 74a149127d | |||
| dccd3adb9b | |||
| 523ba1ff50 | |||
| 693d074d76 | |||
| c5770907ac | |||
| e5a2abb872 | |||
| 83981e40b5 | |||
| ec94450aef | |||
| 76363231be | |||
| 765ecfed84 | |||
| 736718ef53 | |||
| 15265ac40a | |||
| 37192a99a6 | |||
| 5f51b42c99 | |||
| 88862fcdb6 | |||
| 2d5a938621 | |||
| ce4bff7fa5 | |||
| 39b3e71239 | |||
| fa1f026367 | |||
| 9595ee80e3 | |||
| 015fb81810 | |||
| d867a845fd | |||
| d7d3ff4849 | |||
| a4a3d829be | |||
| b615e854e1 | |||
| f1b6b1711b | |||
| 29b844a408 | |||
| c8ca2a8604 | |||
| f3ca6a9180 | |||
| c58549d512 | |||
| 6cb53e7d34 | |||
| af9dc1f817 | |||
| b6c74c1c20 | |||
| 52aeaebde0 | |||
| 20f36f8c88 | |||
| 967762e5ef | |||
| 55f3347514 | |||
| 23612e41f2 | |||
| a94da5937c | |||
| 7196860373 | |||
| 833ce98409 | |||
| 1fcf823d66 | |||
| 043b8bc5ad | |||
| 1b386f46b4 | |||
| a9972399c5 | |||
| 77e882c3bd | |||
| 2b13b2d239 | |||
| 27e008d3f7 | |||
| 9aeb0e1d30 | |||
| def5fc3ff7 | |||
| db6a545203 | |||
| cf205d059f | |||
| c185adf780 | |||
| 5b2cd5fae0 | |||
| 551d0622c5 | |||
| 92b8ec9ff8 | |||
| d1d33372ff | |||
| d6e4999f1f | |||
| 2e7f669153 | |||
| 9ced62e239 | |||
| 382b924b41 | |||
| b153236503 | |||
| 549dafc241 | |||
| e7886b6a34 | |||
| 25dfbc3134 | |||
| bff8c0af61 | |||
| 1c4c5ae370 | |||
| c0247e66e8 | |||
| 4d7c2e9d90 | |||
| f80094deb7 | |||
| c0603e4768 | |||
| 523b37a3e9 | |||
| 2690ba03b2 | |||
| 9e3ca26ae6 | |||
| 52134822b8 | |||
| 3c3ba97d11 | |||
| 99f0cda875 | |||
| 7188778c81 | |||
| 625b0ffec0 | |||
| 532aa593a6 | |||
| 3887747e4a | |||
| c8452c5195 | |||
| 6d8a0c52f5 | |||
| 8057dd2214 | |||
| 96bf7074e3 | |||
| 8f7373427e | |||
| 0e79314353 | |||
| 5221f35182 | |||
| a65302dafe | |||
| 397bd915a3 | |||
| e027fa76b1 | |||
| 920a93071b | |||
| 5b72167c8c | |||
| 7559b9fed1 | |||
| f995fd08a1 | |||
| 0ba5123cef | |||
| 5a3ef18c94 | |||
| 8dc2405ad6 | |||
| 72559a785e | |||
| 88cdb99ff7 | |||
| 5b0915e677 | |||
| 55bac62c5a | |||
| 38f5ef6bd4 | |||
| bd1d21911d | |||
| ea8311301e | |||
| c669c94ba3 | |||
| 625332a686 | |||
| 6bc9b64421 | |||
| 74619675d5 | |||
| 416e2b67b1 | |||
| 02bf3ed5c0 | |||
| 93a4dbda4b | |||
| 4a818ecbb6 | |||
| 416953f6dc | |||
| 9ec6e0a501 | |||
| 22951f5523 | |||
| ec40598d4c | |||
| 2bb5145a20 | |||
| ecf7e8e9a7 | |||
| 1f31bee5e4 | |||
| 5b0743d66b | |||
| 6fd3fc10e3 | |||
| 547a2d1f9f | |||
| 7938c1b884 | |||
| 253ec52c01 | |||
| 701e58e157 | |||
| bad25dec0e | |||
| 051134ac9f | |||
| a3a2f0617c | |||
| 293d5bffa8 | |||
| c8d83ce557 | |||
| 860a39af2a | |||
| 78b651c2c9 | |||
| 7c2448ecea | |||
| 1de8e294d8 | |||
| cef5ac8c8b | |||
| 6e49b85703 | |||
| 14a025a6bf | |||
| e7ee76dc56 | |||
| 47713d05e3 | |||
| 40121d60cd | |||
| 43e495045c | |||
| 581302e147 | |||
| 00168d4660 | |||
| 39382a16f3 | |||
| b8f6d41418 | |||
| 0434287ef8 | |||
| e56c3cddd8 | |||
| d036559e0e | |||
| aa183e35d8 | |||
| 56dd31f33b | |||
| 5149373467 | |||
| c00258237e | |||
| b7f0b278fb | |||
| fdb447ac55 | |||
| 2c88f958ed | |||
| a317cbdc09 | |||
| 5a458590b8 | |||
| e9b49ebf8e | |||
| c925f452e7 | |||
| 2fc6077a68 | |||
| ec7586dac3 | |||
| 00d6b3609f | |||
| a580b4c21e | |||
| ccd731a2ce | |||
| d701668f50 | |||
| 5733ad3e32 | |||
| 29cec910fc | |||
| 9be1dadb04 | |||
| d542f5624a | |||
| 6b9a744b2d | |||
| 12d6d679b0 | |||
| 97c533eb9c | |||
| 0554031514 | |||
| 908adfc191 | |||
| 08e16d966a | |||
| daa599c135 | |||
| 1c86acd8ba | |||
| 7b8bf96c2b | |||
| d801ca16a3 | |||
| a295166754 | |||
| acbd1801c7 | |||
| 908d2471ec | |||
| b07357373f | |||
| e35a0b1c44 | |||
| 669368cf21 | |||
| 372340b731 | |||
| 3ef3f05288 | |||
| fca55e3741 | |||
| 0ea87b6473 | |||
| aceb89fb7d | |||
| e8537f5512 | |||
| 06158be674 | |||
| 0b3cceb21d | |||
| c5b0ecac4f | |||
| a3cb5499bf | |||
| ca0f5ffe60 | |||
| 2214a9df5c | |||
| 34c89d6896 | |||
| f012e15c95 | |||
| b2e973056a | |||
| 4beb4ae2bc | |||
| bf587e9aac | |||
| 3ee0dee12a | |||
| d4b723a7c9 | |||
| d51887fbed | |||
| 8a3d7cce1c | |||
| a744e8e375 | |||
| 40a04816a4 | |||
| 6d81770985 | |||
| 4e41cf9e2b | |||
| 485102814f | |||
| 17cfda1a98 | |||
| 7fea17457d | |||
| 2a3969695b | |||
| 57adc97733 | |||
| 75d002690a | |||
| 4bba1273aa | |||
| bf6dace925 | |||
| 32f69dab0e | |||
| 578bde9aae | |||
| e1c1036648 | |||
| 5650257c0c | |||
| 7a8fb5d2fd | |||
| d9096f9ea4 | |||
| 989fd10d06 | |||
| ad068622fb | |||
| 0f7e48ead2 | |||
| 249438be88 | |||
| d51daeab1a | |||
| 3f91aff573 | |||
| 83ffb9c7fa | |||
| 258ffc1382 | |||
| 8d91459f37 | |||
| 9dd7c284f0 | |||
| 31184f974e | |||
| 4612dcdb48 | |||
| 0f24c74b14 | |||
| d753aeea58 | |||
| 3a7abc2a35 | |||
| c4e9896851 | |||
| 155f20329b | |||
| 87adce3ca0 | |||
| 13f0b6c0cf | |||
| 0086bb9d06 | |||
| 2760ed80fd | |||
| 4fb8338fa6 | |||
| dd90693a4c | |||
| 46dddda22f | |||
| e2f3634db3 | |||
| 86d19cb577 | |||
| cd6cb84889 | |||
| 60184e1495 | |||
| cc428ef6cf | |||
| 69159b6e52 | |||
| b65bda506c | |||
| 61103119fb | |||
| f1a3b32dc4 | |||
| 450c669eb2 | |||
| fb4b5fa841 | |||
| 6da3e44fc7 | |||
| a0b4161a32 | |||
| 2f35fea097 | |||
| 57c472e093 | |||
| 01e88bb61d | |||
| 95a3e4fe1f | |||
| 747d0fcca9 | |||
| 5a07c9bd71 | |||
| 4852474343 | |||
| afca207cf0 | |||
| 5914888ad6 | |||
| d99b89ab29 | |||
| 363a92bd43 | |||
| fb64b4e499 | |||
| 051e094921 | |||
| ec434b208e | |||
| c2193ce1a8 | |||
| 0bcc9b7573 | |||
| 249a170ace | |||
| 200d3fdbe8 | |||
| 183c33931d | |||
| a348f74c65 | |||
| ea48b0d05c | |||
| e656a91736 | |||
| a415b8ecce | |||
| 5fcd71cf28 | |||
| 2b5b1f4e06 | |||
| 80f787e60a | |||
| 5847317526 | |||
| ccc496ba2c | |||
| 5663926aaf | |||
| 770eb4c8c3 | |||
| 552689b7fe | |||
| 397cc50f61 | |||
| 8946e92468 | |||
| 989289fadd | |||
| 4f6fa3b468 | |||
| a9a7957eaa | |||
| 2f56162f35 | |||
| eb50427670 | |||
| a9a852a4d6 | |||
| 37cbae0370 | |||
| 84d1041edf | |||
| 7a2a973b48 | |||
| 7930faace9 | |||
| e9ef930155 | |||
| 1f12dee3a0 | |||
| 0a2f28c2f2 | |||
| e260aa3870 | |||
| e31f37d578 | |||
| 20e9a8061d | |||
| dae7b4ae21 | |||
| 7690093b4c | |||
| b5e1240a8a | |||
| b8327e0457 | |||
| 6db750373a | |||
| 04748217d1 | |||
| 3df0ff7854 | |||
| 53116247c3 | |||
| 22f627c8e1 | |||
| 76341a9173 | |||
| 2ab4669251 | |||
| 27b48faad2 | |||
| 015cb74dd9 | |||
| 7accdb9003 | |||
| 2aae43a848 | |||
| c53cf38ffd | |||
| 16f8a7b2d2 | |||
| a2869639b2 | |||
| fd80b53f39 | |||
| e7441c39e3 | |||
| acaff32984 | |||
| aac4fbc220 | |||
| 5d6c0a8220 | |||
| 65058d0d57 | |||
| 7a97e54559 | |||
| 95fdf39bca | |||
| 315006a28e | |||
| 872f49ae8a | |||
| 603618a75b | |||
| b78bbf80bf | |||
| 72880f2dad | |||
| 2cf5b77d0b | |||
| 37e199cd2b | |||
| 21b1607fb5 | |||
| f1d552c5b6 | |||
| 6909bba290 | |||
| 476dfd9f12 | |||
| 9c1aa0b75f | |||
| 92d1dd153f | |||
| 0a422b06a5 | |||
| d641175e3c | |||
| 8348068f5f | |||
| f2a858c6a5 | |||
| f7485d586e | |||
| fe1ccdf834 | |||
| 2eb00c0bd3 | |||
| f6690500bf | |||
| 49d0f082f8 | |||
| 9947627df9 | |||
| 034b0b5aef | |||
| 1fd2edf29a | |||
| 88e3ef36a4 | |||
| 385da141e6 | |||
| 98b60a605f | |||
| 9c3b9fd40d | |||
| 884fd51b68 | |||
| af3348fe94 | |||
| 43ca0548da | |||
| a99ac0d057 | |||
| edf841fb6f | |||
| 0dbe38fba7 | |||
| 35c13ef965 | |||
| 12c91671bf | |||
| 3dc8dcf312 | |||
| 75a54521e8 | |||
| 773737930a | |||
| 4449917a7c | |||
| 67f385ded8 | |||
| cee5cd6cc7 | |||
| 36f18e7f40 | |||
| 198f841c7e | |||
| f3758d133a | |||
| d72abf6c3e | |||
| 408a27a64e | |||
| db516f667e | |||
| f7fee73752 | |||
| cd01b3890a | |||
| 475ef74ab7 | |||
| 93d9afca4b | |||
| 493df26058 | |||
| 0ba58f25a4 | |||
| 807da4e722 | |||
| be726e5ec4 | |||
| e0d671ab5f | |||
| 72bd3bd170 | |||
| eb445b5189 | |||
| a38e2d046a | |||
| 6cad1071c8 | |||
| e2c1370d60 | |||
| 089a2a7847 | |||
| b7fd924806 | |||
| c62f670bca | |||
| d1a88cbbca | |||
| f5a50c0007 | |||
| 894bb262ad | |||
| ebc18e3957 | |||
| da80dabe6b | |||
| 431363908e | |||
| 7e882e8fa3 | |||
| 9d1bf52ce3 | |||
| 345003d49f | |||
| f7eccfc6fe | |||
| e049bd9b2b | |||
| f7cfd47261 | |||
| 7693c58e28 | |||
| 78b02129c1 | |||
| 0e08a8f61c | |||
| 5b145f4d7c | |||
| dae15e81d8 | |||
| e63f6efaef | |||
| 11545f1c4d | |||
| 1cfc877088 | |||
| 21b905e963 | |||
| 19533f8992 | |||
| 09fcc36c9c | |||
| 25b5a727e8 | |||
| cbcf002a91 | |||
| a69e422cdd | |||
| 0346fec1ca | |||
| f15c85d508 | |||
| 39f1c6dda3 | |||
| 9dcf10eb6c | |||
| eaeca76e5a | |||
| a43bc5f82e | |||
| 937aafd6d2 |
@@ -0,0 +1,233 @@
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = openttd
|
||||
OUTPUT_DIRECTORY = docs/source/
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
BRIEF_MEMBER_DESC = YES
|
||||
REPEAT_BRIEF = YES
|
||||
ABBREVIATE_BRIEF = "The $name class" \
|
||||
"The $name widget" \
|
||||
"The $name file" \
|
||||
is \
|
||||
provides \
|
||||
specifies \
|
||||
contains \
|
||||
represents \
|
||||
a \
|
||||
an \
|
||||
the
|
||||
ALWAYS_DETAILED_SEC = NO
|
||||
INLINE_INHERITED_MEMB = NO
|
||||
FULL_PATH_NAMES = YES
|
||||
STRIP_FROM_PATH = ./
|
||||
STRIP_FROM_INC_PATH =
|
||||
SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
DISTRIBUTE_GROUP_DOC = NO
|
||||
TAB_SIZE = 2
|
||||
ALIASES =
|
||||
OPTIMIZE_OUTPUT_FOR_C = YES
|
||||
OPTIMIZE_OUTPUT_JAVA = NO
|
||||
SUBGROUPING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Build related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
EXTRACT_ALL = NO
|
||||
EXTRACT_PRIVATE = YES
|
||||
EXTRACT_STATIC = YES
|
||||
EXTRACT_LOCAL_CLASSES = YES
|
||||
EXTRACT_LOCAL_METHODS = YES
|
||||
HIDE_UNDOC_MEMBERS = NO
|
||||
HIDE_UNDOC_CLASSES = NO
|
||||
HIDE_FRIEND_COMPOUNDS = NO
|
||||
HIDE_IN_BODY_DOCS = NO
|
||||
INTERNAL_DOCS = NO
|
||||
CASE_SENSE_NAMES = YES
|
||||
HIDE_SCOPE_NAMES = NO
|
||||
SHOW_INCLUDE_FILES = YES
|
||||
INLINE_INFO = YES
|
||||
SORT_MEMBER_DOCS = YES
|
||||
SORT_BRIEF_DOCS = NO
|
||||
SORT_BY_SCOPE_NAME = NO
|
||||
GENERATE_TODOLIST = YES
|
||||
GENERATE_TESTLIST = YES
|
||||
GENERATE_BUGLIST = YES
|
||||
GENERATE_DEPRECATEDLIST= YES
|
||||
ENABLED_SECTIONS =
|
||||
MAX_INITIALIZER_LINES = 30
|
||||
SHOW_USED_FILES = YES
|
||||
SHOW_DIRECTORIES = YES
|
||||
FILE_VERSION_FILTER =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to warning and progress messages
|
||||
#---------------------------------------------------------------------------
|
||||
QUIET = NO
|
||||
WARNINGS = YES
|
||||
WARN_IF_UNDOCUMENTED = YES
|
||||
WARN_IF_DOC_ERROR = YES
|
||||
WARN_NO_PARAMDOC = NO
|
||||
WARN_FORMAT = "$file:$line: $text"
|
||||
WARN_LOGFILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ./
|
||||
FILE_PATTERNS = *.c \
|
||||
*.cc \
|
||||
*.cxx \
|
||||
*.cpp \
|
||||
*.c++ \
|
||||
*.h \
|
||||
table/*.h
|
||||
RECURSIVE = YES
|
||||
EXCLUDE =
|
||||
EXCLUDE_SYMLINKS = NO
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS = *
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_PATTERNS =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to source browsing
|
||||
#---------------------------------------------------------------------------
|
||||
SOURCE_BROWSER = YES
|
||||
INLINE_SOURCES = NO
|
||||
STRIP_CODE_COMMENTS = YES
|
||||
REFERENCED_BY_RELATION = YES
|
||||
REFERENCES_RELATION = YES
|
||||
VERBATIM_HEADERS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the alphabetical class index
|
||||
#---------------------------------------------------------------------------
|
||||
ALPHABETICAL_INDEX = NO
|
||||
COLS_IN_ALPHA_INDEX = 5
|
||||
IGNORE_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_HTML = YES
|
||||
HTML_OUTPUT = html
|
||||
HTML_FILE_EXTENSION = .html
|
||||
HTML_HEADER =
|
||||
HTML_FOOTER =
|
||||
HTML_STYLESHEET =
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
GENERATE_HTMLHELP = YES
|
||||
CHM_FILE =
|
||||
HHC_LOCATION =
|
||||
GENERATE_CHI = NO
|
||||
BINARY_TOC = NO
|
||||
TOC_EXPAND = YES
|
||||
DISABLE_INDEX = NO
|
||||
ENUM_VALUES_PER_LINE = 4
|
||||
GENERATE_TREEVIEW = YES
|
||||
TREEVIEW_WIDTH = 250
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the LaTeX output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_LATEX = NO
|
||||
LATEX_OUTPUT = latex
|
||||
LATEX_CMD_NAME = latex
|
||||
MAKEINDEX_CMD_NAME = makeindex
|
||||
COMPACT_LATEX = NO
|
||||
PAPER_TYPE = a4wide
|
||||
EXTRA_PACKAGES =
|
||||
LATEX_HEADER =
|
||||
PDF_HYPERLINKS = NO
|
||||
USE_PDFLATEX = NO
|
||||
LATEX_BATCHMODE = NO
|
||||
LATEX_HIDE_INDICES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the RTF output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_RTF = NO
|
||||
RTF_OUTPUT = rtf
|
||||
COMPACT_RTF = NO
|
||||
RTF_HYPERLINKS = NO
|
||||
RTF_STYLESHEET_FILE =
|
||||
RTF_EXTENSIONS_FILE =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the man page output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_MAN = YES
|
||||
MAN_OUTPUT = man
|
||||
MAN_EXTENSION = .3
|
||||
MAN_LINKS = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the XML output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_XML = NO
|
||||
XML_OUTPUT = xml
|
||||
XML_SCHEMA =
|
||||
XML_DTD =
|
||||
XML_PROGRAMLISTING = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options for the AutoGen Definitions output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_AUTOGEN_DEF = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the Perl module output
|
||||
#---------------------------------------------------------------------------
|
||||
GENERATE_PERLMOD = NO
|
||||
PERLMOD_LATEX = NO
|
||||
PERLMOD_PRETTY = YES
|
||||
PERLMOD_MAKEVAR_PREFIX =
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES =
|
||||
GENERATE_TAGFILE = openttd.tag
|
||||
ALLEXTERNALS = NO
|
||||
EXTERNAL_GROUPS = YES
|
||||
PERL_PATH = /usr/bin/perl
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the dot tool
|
||||
#---------------------------------------------------------------------------
|
||||
CLASS_DIAGRAMS = YES
|
||||
HIDE_UNDOC_RELATIONS = YES
|
||||
HAVE_DOT = NO
|
||||
CLASS_GRAPH = YES
|
||||
COLLABORATION_GRAPH = YES
|
||||
GROUP_GRAPHS = YES
|
||||
UML_LOOK = NO
|
||||
TEMPLATE_RELATIONS = NO
|
||||
INCLUDE_GRAPH = YES
|
||||
INCLUDED_BY_GRAPH = YES
|
||||
CALL_GRAPH = NO
|
||||
GRAPHICAL_HIERARCHY = YES
|
||||
DIRECTORY_GRAPH = YES
|
||||
DOT_IMAGE_FORMAT = png
|
||||
DOT_PATH =
|
||||
DOTFILE_DIRS =
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
MAX_DOT_GRAPH_DEPTH = 1000
|
||||
DOT_TRANSPARENT = NO
|
||||
DOT_MULTI_TARGETS = NO
|
||||
GENERATE_LEGEND = YES
|
||||
DOT_CLEANUP = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::additions related to the search engine
|
||||
#---------------------------------------------------------------------------
|
||||
SEARCHENGINE = NO
|
||||
-163
@@ -1,163 +0,0 @@
|
||||
CFILES = ai.c aircraft_cmd.c aircraft_gui.c airport_gui.c
|
||||
bridge_gui.c clear_cmd.c command.c disaster_cmd.c
|
||||
dock_gui.c dummy_land.c economy.c engine.c engine_gui.c
|
||||
fileio.c gfx.c graph_gui.c industry_cmd.c industry_gui.c
|
||||
intro_gui.c landscape.c main_gui.c minilzo.c misc.c
|
||||
misc_cmd.c misc_gui.c music_gui.c namegen.c network.c
|
||||
news_gui.c oldloader.c order_cmd.c order_gui.c pathfind.c
|
||||
player_gui.c players.c rail_cmd.c rail_gui.c road_cmd.c
|
||||
road_gui.c roadveh_cmd.c roadveh_gui.c saveload.c sdl.c
|
||||
settings.c settings_gui.c ship_cmd.c ship_gui.c smallmap_gui.c
|
||||
sound.c spritecache.c station_cmd.c station_gui.c
|
||||
strings.c subsidy_gui.c texteff.c town_cmd.c town_gui.c
|
||||
train_cmd.c train_gui.c tree_cmd.c ttd.c
|
||||
tunnelbridge_cmd.c unmovable_cmd.c vehicle.c
|
||||
viewport.c water_cmd.c widget.c window.c screenshot.c
|
||||
airport.c grfspecial.c terraform_gui.c ;
|
||||
|
||||
|
||||
LANGFILES = english.txt swedish.txt french.txt german.txt italian.txt slovak.txt hungarian.txt norwegian.txt danish.txt czech.txt galician.txt polish.txt romanian.txt;
|
||||
|
||||
####################
|
||||
# On UNIX we use gcc
|
||||
####################
|
||||
if $(UNIX) {
|
||||
SDL_CONFIG_CFLAGS = `XX_SDL_CONFIG_PLACEHOLDER_XX --cflags` ;
|
||||
SDL_CONFIG_LIBS = `XX_SDL_CONFIG_PLACEHOLDER_XX --libs` ;
|
||||
|
||||
LINKFLAGS += $(SDL_CONFIG_LIBS) ;
|
||||
CC = gcc ;
|
||||
CCFLAGS += -Wall -Wno-multichar -DUNIX -DWITH_SDL ;
|
||||
|
||||
OPTIMFLAGS = -O2 -fomit-frame-pointer ;
|
||||
DEBUGFLAGS = -g ;
|
||||
|
||||
# also include extmidi
|
||||
CFILES += extmidi.c unix.c ;
|
||||
|
||||
# compile in PNG support?
|
||||
if $(WITH_PNG) {
|
||||
CCFLAGS += -DWITH_PNG -I$(WITH_PNG) ;
|
||||
LINKFLAGS += -lpng ;
|
||||
}
|
||||
|
||||
# compile in zlib support?
|
||||
if $(WITH_ZLIB) {
|
||||
CCFLAGS += -DWITH_ZLIB ;
|
||||
LINKFLAGS += -lz ;
|
||||
}
|
||||
# compile for BeOS 5.1 and higher
|
||||
if $(WITH_BONE_NETWORKING) {
|
||||
CCFLAGS += -DENABLE_NETWORK ;
|
||||
LINKFLAGS += -lsocket -lbind ;
|
||||
}
|
||||
# link in BeOS MIDI and Be API libraries
|
||||
if $(BEOS_MIDI) {
|
||||
CCFLAGS += -DBEOS_MIDI ;
|
||||
LINKFLAGS += -lbe -lmidi ;
|
||||
CFILES += bemidi.cpp ;
|
||||
}
|
||||
}
|
||||
|
||||
####################
|
||||
# MSVC on Win32
|
||||
####################
|
||||
|
||||
actions ActWin32Res {
|
||||
$(VISUALC)\\..\\common\\msdev98\\bin\\rc /r /i $(STDHDRS) /fo $(<) $(>)
|
||||
}
|
||||
|
||||
rule Win32Res { ActWin32Res $(<) : $(>) ; DEPENDS $(<) : $(>) ; }
|
||||
|
||||
if $(TOOLSET) = VISUALC {
|
||||
OPTIMFLAGS = /Oa /Os /Ow /Oy /Oi /Og /Ox /Gr /Gf /Gy /Zp4 /J /WX /W3 -DNDEBUG ;
|
||||
|
||||
CCFLAGS += -DWIN32 -DWIN32_EXCEPTION_TRACKER ;
|
||||
CFILES += win32.c ;
|
||||
LINKFLAGS += /opt:nowin98 /LIBPATH:$(VISUALC)\\lib ;
|
||||
|
||||
LINKLIBS = ws2_32.lib winmm.lib user32.lib gdi32.lib ;
|
||||
|
||||
# compile resources too
|
||||
EOBJ = ttd.res ;
|
||||
Win32Res ttd.res : ttd.rc ;
|
||||
|
||||
# png screenshots?
|
||||
if $(WITH_PNG) {
|
||||
CCFLAGS += -DWITH_PNG -I$(WITH_PNG) ;
|
||||
LINKLIBS += libpng.lib ;
|
||||
}
|
||||
|
||||
# zlib savegames?
|
||||
if $(WITH_ZLIB) {
|
||||
CCFLAGS += -DWITH_ZLIB ;
|
||||
LINKLIBS += zlibstat.lib ;
|
||||
}
|
||||
|
||||
# build release by default
|
||||
RELEASE = 1 ;
|
||||
}
|
||||
|
||||
|
||||
####################
|
||||
# Common
|
||||
####################
|
||||
rule MyObjects {
|
||||
local _i _t _s ;
|
||||
|
||||
_t = $(OUTDIR)/$(>:S=$(SUFOBJ)) ;
|
||||
OPTIM on $(_t) = $(3) ;
|
||||
|
||||
MkDir $(OUTDIR) ;
|
||||
Depends $(_t) : $(OUTDIR) ;
|
||||
|
||||
for _i in $(>) {
|
||||
_s = $(OUTDIR)/$(_i:S=$(SUFOBJ)) ;
|
||||
Object $(_s) : $(_i) ;
|
||||
|
||||
# special handling for sdl.c and unix.c
|
||||
if $(_i) = sdl.c || $(_i) = unix.c { CCFLAGS on $(_s) += $(SDL_CONFIG_CFLAGS) ; }
|
||||
}
|
||||
MainFromObjects $(OUTDIR)/$(<) : $(_t) $(EOBJ) ;
|
||||
}
|
||||
|
||||
rule MyMain {
|
||||
if $(RELEASE) {
|
||||
OUTDIR = release ;
|
||||
MyObjects ttd : $(>) : $(OPTIMFLAGS) ;
|
||||
} else {
|
||||
OUTDIR = debug ;
|
||||
MyObjects ttd : $(>) : -D_DEBUG $(DEBUGFLAGS) ;
|
||||
}
|
||||
}
|
||||
|
||||
actions CompileLang {
|
||||
strgen$(SLASH)strgen $(>)
|
||||
}
|
||||
|
||||
rule LangFile {
|
||||
if $(>) = lang/english.txt {
|
||||
CompileLang $(<) table/strings.h : ;
|
||||
DEPENDS table/string.h : $(>) ;
|
||||
} else {
|
||||
CompileLang $(<) : $(>) ;
|
||||
}
|
||||
|
||||
Clean clean : $(<) ;
|
||||
DEPENDS $(<) : $(>) ;
|
||||
DEPENDS all : $(<) ;
|
||||
DEPENDS $(<) : strgen/strgen ;
|
||||
}
|
||||
|
||||
rule LangFiles {
|
||||
local _i ;
|
||||
for _i in $(<) { LangFile $(_i:S=.lng) : $(_i) ; }
|
||||
Clean clean : table/strings.h ;
|
||||
}
|
||||
|
||||
LangFiles lang/$(LANGFILES) ;
|
||||
|
||||
Main strgen/strgen : strgen/strgen.c ;
|
||||
|
||||
MyMain ttd : $(CFILES) ;
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* $Id$ */
|
||||
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// ttd.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
@@ -0,0 +1,263 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../openttd.h"
|
||||
#include "../variables.h"
|
||||
#include "../command.h"
|
||||
#include "../network.h"
|
||||
#include "ai.h"
|
||||
#include "default/default.h"
|
||||
|
||||
/**
|
||||
* Dequeues commands put in the queue via AI_PutCommandInQueue.
|
||||
*/
|
||||
static void AI_DequeueCommands(byte player)
|
||||
{
|
||||
AICommand *com, *entry_com;
|
||||
|
||||
entry_com = _ai_player[player].queue;
|
||||
|
||||
/* It happens that DoCommandP issues a new DoCommandAI which adds a new command
|
||||
* to this very same queue (don't argue about this, if it currently doesn't
|
||||
* happen I can tell you it will happen with AIScript -- TrueLight). If we
|
||||
* do not make the queue NULL, that commands will be dequeued immediatly.
|
||||
* Therefor we safe the entry-point to entry_com, and make the queue NULL, so
|
||||
* the new queue can be safely built up. */
|
||||
_ai_player[player].queue = NULL;
|
||||
_ai_player[player].queue_tail = NULL;
|
||||
|
||||
/* Dequeue all commands */
|
||||
while ((com = entry_com) != NULL) {
|
||||
_current_player = player;
|
||||
|
||||
/* Copy the DP back in place */
|
||||
_cmd_text = com->text;
|
||||
DoCommandP(com->tile, com->p1, com->p2, NULL, com->procc);
|
||||
|
||||
/* Free item */
|
||||
entry_com = com->next;
|
||||
if (com->text != NULL)
|
||||
free(com->text);
|
||||
free(com);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Needed for SP; we need to delay DoCommand with 1 tick, because else events
|
||||
* will make infinite loops (AIScript).
|
||||
*/
|
||||
static void AI_PutCommandInQueue(byte player, uint tile, uint32 p1, uint32 p2, uint procc)
|
||||
{
|
||||
AICommand *com;
|
||||
|
||||
if (_ai_player[player].queue_tail == NULL) {
|
||||
/* There is no item in the queue yet, create the queue */
|
||||
_ai_player[player].queue = malloc(sizeof(AICommand));
|
||||
_ai_player[player].queue_tail = _ai_player[player].queue;
|
||||
} else {
|
||||
/* Add an item at the end */
|
||||
_ai_player[player].queue_tail->next = malloc(sizeof(AICommand));
|
||||
_ai_player[player].queue_tail = _ai_player[player].queue_tail->next;
|
||||
}
|
||||
|
||||
/* This is our new item */
|
||||
com = _ai_player[player].queue_tail;
|
||||
|
||||
/* Assign the info */
|
||||
com->tile = tile;
|
||||
com->p1 = p1;
|
||||
com->p2 = p2;
|
||||
com->procc = procc;
|
||||
com->next = NULL;
|
||||
com->text = NULL;
|
||||
|
||||
/* Copy the cmd_text, if needed */
|
||||
if (_cmd_text != NULL) {
|
||||
com->text = strdup(_cmd_text);
|
||||
_cmd_text = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a raw DoCommand for the AI.
|
||||
*/
|
||||
int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
|
||||
{
|
||||
PlayerID old_lp;
|
||||
int32 res = 0;
|
||||
char *tmp_cmdtext = NULL;
|
||||
|
||||
/* If you enable DC_EXEC with DC_QUERY_COST you are a really strange
|
||||
* person.. should we check for those funny jokes?
|
||||
*/
|
||||
|
||||
/* The test already free _cmd_text in most cases, so let's backup the string, else we have a problem ;) */
|
||||
if (_cmd_text != NULL)
|
||||
tmp_cmdtext = strdup(_cmd_text);
|
||||
|
||||
/* First, do a test-run to see if we can do this */
|
||||
res = DoCommandByTile(tile, p1, p2, flags & ~DC_EXEC, procc);
|
||||
/* The command failed, or you didn't want to execute, or you are quering, return */
|
||||
if ((CmdFailed(res)) || !(flags & DC_EXEC) || (flags & DC_QUERY_COST)) {
|
||||
if (tmp_cmdtext != NULL)
|
||||
free(tmp_cmdtext);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Recover _cmd_text */
|
||||
if (tmp_cmdtext != NULL)
|
||||
_cmd_text = tmp_cmdtext;
|
||||
|
||||
/* If we did a DC_EXEC, and the command did not return an error, execute it
|
||||
over the network */
|
||||
if (flags & DC_AUTO) procc |= CMD_AUTO;
|
||||
if (flags & DC_NO_WATER) procc |= CMD_NO_WATER;
|
||||
|
||||
/* NetworkSend_Command needs _local_player to be set correctly, so
|
||||
adjust it, and put it back right after the function */
|
||||
old_lp = _local_player;
|
||||
_local_player = _current_player;
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
/* Send the command */
|
||||
if (_networking)
|
||||
/* Network is easy, send it to his handler */
|
||||
NetworkSend_Command(tile, p1, p2, procc, NULL);
|
||||
else
|
||||
#endif
|
||||
/* If we execute BuildCommands directly in SP, we have a big problem with events
|
||||
* so we need to delay is for 1 tick */
|
||||
AI_PutCommandInQueue(_current_player, tile, p1, p2, procc);
|
||||
|
||||
/* Set _local_player back */
|
||||
_local_player = old_lp;
|
||||
|
||||
/* Free the temp _cmd_text var */
|
||||
if (tmp_cmdtext != NULL)
|
||||
free(tmp_cmdtext);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run 1 tick of the AI. Don't overdo it, keep it realistic.
|
||||
*/
|
||||
static void AI_RunTick(PlayerID player)
|
||||
{
|
||||
extern void AiNewDoGameLoop(Player *p);
|
||||
|
||||
Player *p = GetPlayer(player);
|
||||
_current_player = player;
|
||||
|
||||
if (_patches.ainew_active) {
|
||||
AiNewDoGameLoop(p);
|
||||
} else {
|
||||
/* Enable all kind of cheats the old AI needs in order to operate correctly... */
|
||||
_is_old_ai_player = true;
|
||||
AiDoGameLoop(p);
|
||||
_is_old_ai_player = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The gameloop for AIs.
|
||||
* Handles one tick for all the AIs.
|
||||
*/
|
||||
void AI_RunGameLoop(void)
|
||||
{
|
||||
/* Don't do anything if ai is disabled */
|
||||
if (!_ai.enabled) return;
|
||||
|
||||
/* Don't do anything if we are a network-client
|
||||
* (too bad when a client joins, he thinks the AIs are real, so it wants to control
|
||||
* them.. this avoids that, while loading a network game in singleplayer, does make
|
||||
* the AIs to continue ;))
|
||||
*/
|
||||
if (_networking && !_network_server && !_ai.network_client)
|
||||
return;
|
||||
|
||||
/* New tick */
|
||||
_ai.tick++;
|
||||
|
||||
/* Make sure the AI follows the difficulty rule.. */
|
||||
assert(_opt.diff.competitor_speed <= 4);
|
||||
if ((_ai.tick & ((1 << (4 - _opt.diff.competitor_speed)) - 1)) != 0)
|
||||
return;
|
||||
|
||||
/* Check for AI-client (so joining a network with an AI) */
|
||||
if (_ai.network_client && _ai_player[_ai.network_playas].active) {
|
||||
/* Run the script */
|
||||
AI_DequeueCommands(_ai.network_playas);
|
||||
AI_RunTick(_ai.network_playas);
|
||||
} else if (!_networking || _network_server) {
|
||||
/* Check if we want to run AIs (server or SP only) */
|
||||
Player *p;
|
||||
|
||||
FOR_ALL_PLAYERS(p) {
|
||||
if (p->is_active && p->is_ai) {
|
||||
/* This should always be true, else something went wrong... */
|
||||
assert(_ai_player[p->index].active);
|
||||
|
||||
/* Run the script */
|
||||
AI_DequeueCommands(p->index);
|
||||
AI_RunTick(p->index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_current_player = OWNER_NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
* A new AI sees the day of light. You can do here what ever you think is needed.
|
||||
*/
|
||||
void AI_StartNewAI(PlayerID player)
|
||||
{
|
||||
assert(player < MAX_PLAYERS);
|
||||
|
||||
/* Called if a new AI is booted */
|
||||
_ai_player[player].active = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This AI player died. Give it some chance to make a final puf.
|
||||
*/
|
||||
void AI_PlayerDied(PlayerID player)
|
||||
{
|
||||
if (_ai.network_client && _ai.network_playas == player)
|
||||
_ai.network_playas = OWNER_SPECTATOR;
|
||||
|
||||
/* Called if this AI died */
|
||||
_ai_player[player].active = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize some AI-related stuff.
|
||||
*/
|
||||
void AI_Initialize(void)
|
||||
{
|
||||
bool ai_network_client = _ai.network_client;
|
||||
|
||||
/* First, make sure all AIs are DEAD! */
|
||||
AI_Uninitialize();
|
||||
|
||||
memset(&_ai, 0, sizeof(_ai));
|
||||
memset(&_ai_player, 0, sizeof(_ai_player));
|
||||
|
||||
_ai.network_client = ai_network_client;
|
||||
_ai.network_playas = OWNER_SPECTATOR;
|
||||
_ai.enabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Deinitializer for AI-related stuff.
|
||||
*/
|
||||
void AI_Uninitialize(void)
|
||||
{
|
||||
Player* p;
|
||||
|
||||
FOR_ALL_PLAYERS(p) {
|
||||
if (p->is_active && p->is_ai) AI_PlayerDied(p->index);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
#ifndef AI_H
|
||||
#define AI_H
|
||||
|
||||
#include "../functions.h"
|
||||
#include "../network.h"
|
||||
#include "../player.h"
|
||||
|
||||
/* How DoCommands look like for an AI */
|
||||
typedef struct AICommand {
|
||||
uint32 tile;
|
||||
uint32 p1;
|
||||
uint32 p2;
|
||||
uint32 procc;
|
||||
|
||||
char *text;
|
||||
uint uid;
|
||||
|
||||
struct AICommand *next;
|
||||
} AICommand;
|
||||
|
||||
/* The struct for an AIScript Player */
|
||||
typedef struct AIPlayer {
|
||||
bool active; //! Is this AI active?
|
||||
AICommand *queue; //! The commands that he has in his queue
|
||||
AICommand *queue_tail; //! The tail of this queue
|
||||
} AIPlayer;
|
||||
|
||||
/* The struct to keep some data about the AI in general */
|
||||
typedef struct AIStruct {
|
||||
/* General */
|
||||
bool enabled; //! Is AI enabled?
|
||||
uint tick; //! The current tick (something like _frame_counter, only for AIs)
|
||||
|
||||
/* For network-clients (a OpenTTD client who acts as an AI connected to a server) */
|
||||
bool network_client; //! Are we a network_client?
|
||||
uint8 network_playas; //! The current network player we are connected as
|
||||
} AIStruct;
|
||||
|
||||
VARDEF AIStruct _ai;
|
||||
VARDEF AIPlayer _ai_player[MAX_PLAYERS];
|
||||
|
||||
// ai.c
|
||||
void AI_StartNewAI(PlayerID player);
|
||||
void AI_PlayerDied(PlayerID player);
|
||||
void AI_RunGameLoop(void);
|
||||
void AI_Initialize(void);
|
||||
void AI_Uninitialize(void);
|
||||
int32 AI_DoCommand(uint tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
|
||||
|
||||
/** Is it allowed to start a new AI.
|
||||
* This function checks some boundries to see if we should launch a new AI.
|
||||
* @return True if we can start a new AI.
|
||||
*/
|
||||
static inline bool AI_AllowNewAI(void)
|
||||
{
|
||||
/* If disabled, no AI */
|
||||
if (!_ai.enabled)
|
||||
return false;
|
||||
|
||||
/* If in network, but no server, no AI */
|
||||
if (_networking && !_network_server)
|
||||
return false;
|
||||
|
||||
/* If in network, and server, possible AI */
|
||||
if (_networking && _network_server) {
|
||||
/* Do we want AIs in multiplayer? */
|
||||
if (!_patches.ai_in_multiplayer)
|
||||
return false;
|
||||
|
||||
/* Only the NewAI is allowed... sadly enough the old AI just doesn't support this
|
||||
* system, because all commands are delayed by at least 1 tick, which causes
|
||||
* a big problem, because it uses variables that are only set AFTER the command
|
||||
* is really executed... */
|
||||
if (!_patches.ainew_active)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define AI_CHANCE16(a,b) ((uint16) AI_Random() <= (uint16)((65536 * a) / b))
|
||||
#define AI_CHANCE16R(a,b,r) ((uint16)(r = AI_Random()) <= (uint16)((65536 * a) / b))
|
||||
|
||||
/**
|
||||
* The random-function that should be used by ALL AIs.
|
||||
*/
|
||||
static inline uint AI_RandomRange(uint max)
|
||||
{
|
||||
/* We pick RandomRange if we are in SP (so when saved, we do the same over and over)
|
||||
* but we pick InteractiveRandomRange if we are a network_server or network-client.
|
||||
*/
|
||||
if (_networking)
|
||||
return InteractiveRandomRange(max);
|
||||
else
|
||||
return RandomRange(max);
|
||||
}
|
||||
|
||||
/**
|
||||
* The random-function that should be used by ALL AIs.
|
||||
*/
|
||||
static inline uint32 AI_Random(void)
|
||||
{
|
||||
/* We pick RandomRange if we are in SP (so when saved, we do the same over and over)
|
||||
* but we pick InteractiveRandomRange if we are a network_server or network-client.
|
||||
*/
|
||||
if (_networking)
|
||||
return InteractiveRandom();
|
||||
else
|
||||
return Random();
|
||||
}
|
||||
|
||||
#endif /* AI_H */
|
||||
+480
-462
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,8 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef DEFAULT_H
|
||||
#define DEFAULT_H
|
||||
|
||||
void AiDoGameLoop(Player*);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,273 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../openttd.h"
|
||||
#include "../../debug.h"
|
||||
#include "../../functions.h"
|
||||
#include "../../map.h"
|
||||
#include "../../tile.h"
|
||||
#include "../../command.h"
|
||||
#include "trolly.h"
|
||||
#include "../../engine.h"
|
||||
#include "../../station.h"
|
||||
#include "../../variables.h"
|
||||
#include "../ai.h"
|
||||
|
||||
// Build HQ
|
||||
// Params:
|
||||
// tile : tile where HQ is going to be build
|
||||
bool AiNew_Build_CompanyHQ(Player *p, TileIndex tile)
|
||||
{
|
||||
if (CmdFailed(AI_DoCommand(tile, 0, 0, DC_AUTO | DC_NO_WATER, CMD_BUILD_COMPANY_HQ)))
|
||||
return false;
|
||||
AI_DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_BUILD_COMPANY_HQ);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Build station
|
||||
// Params:
|
||||
// type : AI_TRAIN/AI_BUS/AI_TRUCK : indicates the type of station
|
||||
// tile : tile where station is going to be build
|
||||
// length : in case of AI_TRAIN: length of station
|
||||
// numtracks : in case of AI_TRAIN: tracks of station
|
||||
// direction : the direction of the station
|
||||
// flag : flag passed to DoCommand (normally 0 to get the cost or DC_EXEC to build it)
|
||||
int AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte numtracks, byte direction, byte flag)
|
||||
{
|
||||
if (type == AI_TRAIN)
|
||||
return AI_DoCommand(tile, direction + (numtracks << 8) + (length << 16), 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_RAILROAD_STATION);
|
||||
|
||||
if (type == AI_BUS)
|
||||
return AI_DoCommand(tile, direction, RS_BUS, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP);
|
||||
|
||||
return AI_DoCommand(tile, direction, RS_TRUCK, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_STOP);
|
||||
}
|
||||
|
||||
|
||||
// Builds a brdige. The second best out of the ones available for this player
|
||||
// Params:
|
||||
// tile_a : starting point
|
||||
// tile_b : end point
|
||||
// flag : flag passed to DoCommand
|
||||
int AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag)
|
||||
{
|
||||
int bridge_type, bridge_len, type, type2;
|
||||
|
||||
// Find a good bridgetype (the best money can buy)
|
||||
bridge_len = GetBridgeLength(tile_a, tile_b);
|
||||
type = type2 = 0;
|
||||
for (bridge_type = MAX_BRIDGES-1; bridge_type >= 0; bridge_type--) {
|
||||
if (CheckBridge_Stuff(bridge_type, bridge_len)) {
|
||||
type2 = type;
|
||||
type = bridge_type;
|
||||
// We found two bridges, exit
|
||||
if (type2 != 0) break;
|
||||
}
|
||||
}
|
||||
// There is only one bridge that can be build..
|
||||
if (type2 == 0 && type != 0) type2 = type;
|
||||
|
||||
// Now, simply, build the bridge!
|
||||
if (p->ainew.tbt == AI_TRAIN)
|
||||
return AI_DoCommand(tile_a, tile_b, (0<<8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE);
|
||||
|
||||
return AI_DoCommand(tile_a, tile_b, (0x80 << 8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE);
|
||||
}
|
||||
|
||||
|
||||
// Build the route part by part
|
||||
// Basicly what this function do, is build that amount of parts of the route
|
||||
// that go in the same direction. It sets 'part' to the last part of the route builded.
|
||||
// The return value is the cost for the builded parts
|
||||
//
|
||||
// Params:
|
||||
// PathFinderInfo : Pointer to the PathFinderInfo used for AiPathFinder
|
||||
// part : Which part we need to build
|
||||
//
|
||||
// TODO: skip already builded road-pieces (e.g.: cityroad)
|
||||
int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte flag)
|
||||
{
|
||||
int part = PathFinderInfo->position;
|
||||
byte *route_extra = PathFinderInfo->route_extra;
|
||||
TileIndex *route = PathFinderInfo->route;
|
||||
int dir;
|
||||
int old_dir = -1;
|
||||
int cost = 0;
|
||||
int res;
|
||||
// We need to calculate the direction with the parent of the parent.. so we skip
|
||||
// the first pieces and the last piece
|
||||
if (part < 1) part = 1;
|
||||
// When we are done, stop it
|
||||
if (part >= PathFinderInfo->route_length - 1) { PathFinderInfo->position = -2; return 0; }
|
||||
|
||||
|
||||
if (PathFinderInfo->rail_or_road) {
|
||||
// Tunnel code
|
||||
if ((AI_PATHFINDER_FLAG_TUNNEL & route_extra[part]) != 0) {
|
||||
cost += AI_DoCommand(route[part], 0, 0, flag, CMD_BUILD_TUNNEL);
|
||||
PathFinderInfo->position++;
|
||||
// TODO: problems!
|
||||
if (CmdFailed(cost)) {
|
||||
DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: tunnel could not be build!");
|
||||
return 0;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
// Bridge code
|
||||
if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
|
||||
cost += AiNew_Build_Bridge(p, route[part], route[part-1], flag);
|
||||
PathFinderInfo->position++;
|
||||
// TODO: problems!
|
||||
if (CmdFailed(cost)) {
|
||||
DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: bridge could not be build!");
|
||||
return 0;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
// Build normal rail
|
||||
// Keep it doing till we go an other way
|
||||
if (route_extra[part-1] == 0 && route_extra[part] == 0) {
|
||||
while (route_extra[part] == 0) {
|
||||
// Get the current direction
|
||||
dir = AiNew_GetRailDirection(route[part-1], route[part], route[part+1]);
|
||||
// Is it the same as the last one?
|
||||
if (old_dir != -1 && old_dir != dir) break;
|
||||
old_dir = dir;
|
||||
// Build the tile
|
||||
res = AI_DoCommand(route[part], 0, dir, flag, CMD_BUILD_SINGLE_RAIL);
|
||||
if (CmdFailed(res)) {
|
||||
// Problem.. let's just abort it all!
|
||||
p->ainew.state = AI_STATE_NOTHING;
|
||||
return 0;
|
||||
}
|
||||
cost += res;
|
||||
// Go to the next tile
|
||||
part++;
|
||||
// Check if it is still in range..
|
||||
if (part >= PathFinderInfo->route_length - 1) break;
|
||||
}
|
||||
part--;
|
||||
}
|
||||
// We want to return the last position, so we go back one
|
||||
PathFinderInfo->position = part;
|
||||
} else {
|
||||
// Tunnel code
|
||||
if ((AI_PATHFINDER_FLAG_TUNNEL & route_extra[part]) != 0) {
|
||||
cost += AI_DoCommand(route[part], 0x200, 0, flag, CMD_BUILD_TUNNEL);
|
||||
PathFinderInfo->position++;
|
||||
// TODO: problems!
|
||||
if (CmdFailed(cost)) {
|
||||
DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: tunnel could not be build!");
|
||||
return 0;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
// Bridge code
|
||||
if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
|
||||
cost += AiNew_Build_Bridge(p, route[part], route[part+1], flag);
|
||||
PathFinderInfo->position++;
|
||||
// TODO: problems!
|
||||
if (CmdFailed(cost)) {
|
||||
DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: bridge could not be build!");
|
||||
return 0;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
// Build normal road
|
||||
// Keep it doing till we go an other way
|
||||
// EnsureNoVehicle makes sure we don't build on a tile where a vehicle is. This way
|
||||
// it will wait till the vehicle is gone..
|
||||
if (route_extra[part-1] == 0 && route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicle(route[part]))) {
|
||||
while (route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicle(route[part]))) {
|
||||
// Get the current direction
|
||||
dir = AiNew_GetRoadDirection(route[part-1], route[part], route[part+1]);
|
||||
// Is it the same as the last one?
|
||||
if (old_dir != -1 && old_dir != dir) break;
|
||||
old_dir = dir;
|
||||
// There is already some road, and it is a bridge.. don't build!!!
|
||||
if (!IsTileType(route[part], MP_TUNNELBRIDGE)) {
|
||||
// Build the tile
|
||||
res = AI_DoCommand(route[part], dir, 0, flag | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
// Currently, we ignore CMD_ERRORs!
|
||||
if (CmdFailed(res) && flag == DC_EXEC && !IsTileType(route[part], MP_STREET) && !EnsureNoVehicle(route[part])) {
|
||||
// Problem.. let's just abort it all!
|
||||
DEBUG(ai,0)("Darn, the route could not be builded.. aborting!");
|
||||
p->ainew.state = AI_STATE_NOTHING;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!CmdFailed(res)) cost += res;
|
||||
}
|
||||
// Go to the next tile
|
||||
part++;
|
||||
// Check if it is still in range..
|
||||
if (part >= PathFinderInfo->route_length - 1) break;
|
||||
}
|
||||
part--;
|
||||
// We want to return the last position, so we go back one
|
||||
}
|
||||
if (!EnsureNoVehicle(route[part]) && flag == DC_EXEC) part--;
|
||||
PathFinderInfo->position = part;
|
||||
}
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
||||
|
||||
// This functions tries to find the best vehicle for this type of cargo
|
||||
// It returns vehicle_id or -1 if not found
|
||||
int AiNew_PickVehicle(Player *p)
|
||||
{
|
||||
if (p->ainew.tbt == AI_TRAIN) {
|
||||
// Not supported yet
|
||||
return -1;
|
||||
} else {
|
||||
int start, count, i, ret = CMD_ERROR;
|
||||
start = _cargoc.ai_roadveh_start[p->ainew.cargo];
|
||||
count = _cargoc.ai_roadveh_count[p->ainew.cargo];
|
||||
|
||||
// Let's check it backwards.. we simply want to best engine available..
|
||||
for (i = start + count - 1; i >= start; i--) {
|
||||
// Is it availiable?
|
||||
// Also, check if the reliability of the vehicle is above the AI_VEHICLE_MIN_RELIABILTY
|
||||
if (!HASBIT(GetEngine(i)->player_avail, _current_player) || GetEngine(i)->reliability * 100 < AI_VEHICLE_MIN_RELIABILTY << 16) continue;
|
||||
// Can we build it?
|
||||
ret = AI_DoCommand(0, i, 0, DC_QUERY_COST, CMD_BUILD_ROAD_VEH);
|
||||
if (!CmdFailed(ret)) break;
|
||||
}
|
||||
// We did not find a vehicle :(
|
||||
if (CmdFailed(ret)) return -1;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Builds the best vehicle possible
|
||||
int AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag)
|
||||
{
|
||||
int i = AiNew_PickVehicle(p);
|
||||
if (i == -1) return CMD_ERROR;
|
||||
|
||||
if (p->ainew.tbt == AI_TRAIN) return CMD_ERROR;
|
||||
|
||||
return AI_DoCommand(tile, i, 0, flag, CMD_BUILD_ROAD_VEH);
|
||||
}
|
||||
|
||||
int AiNew_Build_Depot(Player *p, TileIndex tile, byte direction, byte flag)
|
||||
{
|
||||
static const byte _roadbits_by_dir[4] = {2,1,8,4};
|
||||
int ret, ret2;
|
||||
if (p->ainew.tbt == AI_TRAIN)
|
||||
return AI_DoCommand(tile, 0, direction, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_TRAIN_DEPOT);
|
||||
|
||||
ret = AI_DoCommand(tile, direction, 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_DEPOT);
|
||||
if (CmdFailed(ret)) return ret;
|
||||
// Try to build the road from the depot
|
||||
ret2 = AI_DoCommand(tile + TileOffsByDir(direction), _roadbits_by_dir[direction], 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
// If it fails, ignore it..
|
||||
if (CmdFailed(ret2)) return ret;
|
||||
return ret + ret2;
|
||||
}
|
||||
@@ -0,0 +1,509 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include "../../openttd.h"
|
||||
#include "../../debug.h"
|
||||
#include "../../functions.h"
|
||||
#include "../../map.h"
|
||||
#include "../../tile.h"
|
||||
#include "../../command.h"
|
||||
#include "trolly.h"
|
||||
#include "../../depot.h"
|
||||
#include "../../variables.h"
|
||||
#include "../ai.h"
|
||||
|
||||
#define TEST_STATION_NO_DIR 0xFF
|
||||
|
||||
// Tests if a station can be build on the given spot
|
||||
// TODO: make it train compatible
|
||||
static bool TestCanBuildStationHere(TileIndex tile, byte dir)
|
||||
{
|
||||
Player *p = GetPlayer(_current_player);
|
||||
|
||||
if (dir == TEST_STATION_NO_DIR) {
|
||||
int32 ret;
|
||||
// TODO: currently we only allow spots that can be access from al 4 directions...
|
||||
// should be fixed!!!
|
||||
for (dir = 0; dir < 4; dir++) {
|
||||
ret = AiNew_Build_Station(p, p->ainew.tbt, tile, 1, 1, dir, DC_QUERY_COST);
|
||||
if (!CmdFailed(ret)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// return true if command succeeded, so the inverse of CmdFailed()
|
||||
return !CmdFailed(AiNew_Build_Station(p, p->ainew.tbt, tile, 1, 1, dir, DC_QUERY_COST));
|
||||
}
|
||||
|
||||
|
||||
static bool IsRoad(TileIndex tile)
|
||||
{
|
||||
return
|
||||
// MP_STREET, but not a road depot?
|
||||
(IsTileType(tile, MP_STREET) && !IsTileDepotType(tile, TRANSPORT_ROAD)) ||
|
||||
(IsTileType(tile, MP_TUNNELBRIDGE) && (
|
||||
// road tunnel?
|
||||
((_m[tile].m5 & 0x80) == 0 && (_m[tile].m5 & 0x4) == 0x4) ||
|
||||
// road bridge?
|
||||
((_m[tile].m5 & 0x80) != 0 && (_m[tile].m5 & 0x2) == 0x2)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
// Checks if a tile 'a' is between the tiles 'b' and 'c'
|
||||
#define TILES_BETWEEN(a, b, c) (TileX(a) >= TileX(b) && TileX(a) <= TileX(c) && TileY(a) >= TileY(b) && TileY(a) <= TileY(c))
|
||||
|
||||
|
||||
// Check if the current tile is in our end-area
|
||||
static int32 AyStar_AiPathFinder_EndNodeCheck(AyStar *aystar, OpenListNode *current)
|
||||
{
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
// It is not allowed to have a station on the end of a bridge or tunnel ;)
|
||||
if (current->path.node.user_data[0] != 0) return AYSTAR_DONE;
|
||||
if (TILES_BETWEEN(current->path.node.tile, PathFinderInfo->end_tile_tl, PathFinderInfo->end_tile_br))
|
||||
if (IsTileType(current->path.node.tile, MP_CLEAR) || IsTileType(current->path.node.tile, MP_TREES))
|
||||
if (current->path.parent == NULL || TestCanBuildStationHere(current->path.node.tile, AiNew_GetDirection(current->path.parent->node.tile, current->path.node.tile)))
|
||||
return AYSTAR_FOUND_END_NODE;
|
||||
|
||||
return AYSTAR_DONE;
|
||||
}
|
||||
|
||||
|
||||
// Calculates the hash
|
||||
// Currently it is a 10 bit hash, so the hash array has a max depth of 6 bits (so 64)
|
||||
static uint AiPathFinder_Hash(uint key1, uint key2)
|
||||
{
|
||||
return (TileX(key1) & 0x1F) + ((TileY(key1) & 0x1F) << 5);
|
||||
}
|
||||
|
||||
|
||||
// Clear the memory of all the things
|
||||
static void AyStar_AiPathFinder_Free(AyStar *aystar)
|
||||
{
|
||||
AyStarMain_Free(aystar);
|
||||
free(aystar);
|
||||
}
|
||||
|
||||
|
||||
static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
static int32 AyStar_AiPathFinder_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
static void AyStar_AiPathFinder_FoundEndNode(AyStar *aystar, OpenListNode *current);
|
||||
static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *current);
|
||||
|
||||
|
||||
// This creates the AiPathFinder
|
||||
AyStar *new_AyStar_AiPathFinder(int max_tiles_around, Ai_PathFinderInfo *PathFinderInfo)
|
||||
{
|
||||
PathNode start_node;
|
||||
uint x;
|
||||
uint y;
|
||||
// Create AyStar
|
||||
AyStar *result = malloc(sizeof(AyStar));
|
||||
init_AyStar(result, AiPathFinder_Hash, 1 << 10);
|
||||
// Set the function pointers
|
||||
result->CalculateG = AyStar_AiPathFinder_CalculateG;
|
||||
result->CalculateH = AyStar_AiPathFinder_CalculateH;
|
||||
result->EndNodeCheck = AyStar_AiPathFinder_EndNodeCheck;
|
||||
result->FoundEndNode = AyStar_AiPathFinder_FoundEndNode;
|
||||
result->GetNeighbours = AyStar_AiPathFinder_GetNeighbours;
|
||||
|
||||
result->free = AyStar_AiPathFinder_Free;
|
||||
|
||||
// Set some information
|
||||
result->loops_per_tick = AI_PATHFINDER_LOOPS_PER_TICK;
|
||||
result->max_path_cost = 0;
|
||||
result->max_search_nodes = AI_PATHFINDER_MAX_SEARCH_NODES;
|
||||
|
||||
// Set the user_data to the PathFinderInfo
|
||||
result->user_target = PathFinderInfo;
|
||||
|
||||
// Set the start node
|
||||
start_node.parent = NULL;
|
||||
start_node.node.direction = 0;
|
||||
start_node.node.user_data[0] = 0;
|
||||
|
||||
// Now we add all the starting tiles
|
||||
for (x = TileX(PathFinderInfo->start_tile_tl); x <= TileX(PathFinderInfo->start_tile_br); x++) {
|
||||
for (y = TileY(PathFinderInfo->start_tile_tl); y <= TileY(PathFinderInfo->start_tile_br); y++) {
|
||||
start_node.node.tile = TileXY(x, y);
|
||||
result->addstart(result, &start_node.node, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// To reuse AyStar we sometimes have to clean all the memory
|
||||
void clean_AyStar_AiPathFinder(AyStar *aystar, Ai_PathFinderInfo *PathFinderInfo)
|
||||
{
|
||||
PathNode start_node;
|
||||
uint x;
|
||||
uint y;
|
||||
|
||||
aystar->clear(aystar);
|
||||
|
||||
// Set the user_data to the PathFinderInfo
|
||||
aystar->user_target = PathFinderInfo;
|
||||
|
||||
// Set the start node
|
||||
start_node.parent = NULL;
|
||||
start_node.node.direction = 0;
|
||||
start_node.node.user_data[0] = 0;
|
||||
start_node.node.tile = PathFinderInfo->start_tile_tl;
|
||||
|
||||
// Now we add all the starting tiles
|
||||
for (x = TileX(PathFinderInfo->start_tile_tl); x <= TileX(PathFinderInfo->start_tile_br); x++) {
|
||||
for (y = TileY(PathFinderInfo->start_tile_tl); y <= TileY(PathFinderInfo->start_tile_br); y++) {
|
||||
if (!(IsTileType(TileXY(x, y), MP_CLEAR) || IsTileType(TileXY(x, y), MP_TREES))) continue;
|
||||
if (!TestCanBuildStationHere(TileXY(x, y), TEST_STATION_NO_DIR)) continue;
|
||||
start_node.node.tile = TileXY(x, y);
|
||||
aystar->addstart(aystar, &start_node.node, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// The h-value, simple calculation
|
||||
static int32 AyStar_AiPathFinder_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
|
||||
{
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
int r, r2;
|
||||
if (PathFinderInfo->end_direction != AI_PATHFINDER_NO_DIRECTION) {
|
||||
// The station is pointing to a direction, add a tile towards that direction, so the H-value is more accurate
|
||||
r = DistanceManhattan(current->tile, PathFinderInfo->end_tile_tl + TileOffsByDir(PathFinderInfo->end_direction));
|
||||
r2 = DistanceManhattan(current->tile, PathFinderInfo->end_tile_br + TileOffsByDir(PathFinderInfo->end_direction));
|
||||
} else {
|
||||
// No direction, so just get the fastest route to the station
|
||||
r = DistanceManhattan(current->tile, PathFinderInfo->end_tile_tl);
|
||||
r2 = DistanceManhattan(current->tile, PathFinderInfo->end_tile_br);
|
||||
}
|
||||
// See if the bottomright is faster than the topleft..
|
||||
if (r2 < r) r = r2;
|
||||
return r * AI_PATHFINDER_H_MULTIPLER;
|
||||
}
|
||||
|
||||
|
||||
// We found the end.. let's get the route back and put it in an array
|
||||
static void AyStar_AiPathFinder_FoundEndNode(AyStar *aystar, OpenListNode *current)
|
||||
{
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
uint i = 0;
|
||||
PathNode *parent = ¤t->path;
|
||||
|
||||
do {
|
||||
PathFinderInfo->route_extra[i] = parent->node.user_data[0];
|
||||
PathFinderInfo->route[i++] = parent->node.tile;
|
||||
if (i > lengthof(PathFinderInfo->route)) {
|
||||
// We ran out of space for the PathFinder
|
||||
DEBUG(ai, 0)("[AiPathFinder] Ran out of space in the route[] array!!!");
|
||||
PathFinderInfo->route_length = -1; // -1 indicates out of space
|
||||
return;
|
||||
}
|
||||
parent = parent->parent;
|
||||
} while (parent != NULL);
|
||||
PathFinderInfo->route_length = i;
|
||||
DEBUG(ai, 1)("[Ai-PathFinding] Found route of %d nodes long in %d nodes of searching", i, Hash_Size(&aystar->ClosedListHash));
|
||||
}
|
||||
|
||||
|
||||
// What tiles are around us.
|
||||
static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *current)
|
||||
{
|
||||
uint i;
|
||||
int ret;
|
||||
int dir;
|
||||
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
|
||||
aystar->num_neighbours = 0;
|
||||
|
||||
// Go through all surrounding tiles and check if they are within the limits
|
||||
for (i = 0; i < 4; i++) {
|
||||
TileIndex ctile = current->path.node.tile; // Current tile
|
||||
TileIndex atile = ctile + TileOffsByDir(i); // Adjacent tile
|
||||
|
||||
if (TileX(atile) > 1 && TileX(atile) < MapMaxX() - 1 &&
|
||||
TileY(atile) > 1 && TileY(atile) < MapMaxY() - 1) {
|
||||
// We also directly test if the current tile can connect to this tile..
|
||||
// We do this simply by just building the tile!
|
||||
|
||||
// If the next step is a bridge, we have to enter it the right way
|
||||
if (!PathFinderInfo->rail_or_road && IsRoad(atile)) {
|
||||
if (IsTileType(atile, MP_TUNNELBRIDGE)) {
|
||||
// An existing bridge... let's test the direction ;)
|
||||
if ((_m[atile].m5 & 1U) != (i & 1)) continue;
|
||||
// This problem only is valid for tunnels:
|
||||
// When the last tile was not yet a tunnel, check if we enter from the right side..
|
||||
if ((_m[atile].m5 & 0x80) == 0) {
|
||||
if (i != (_m[atile].m5 & 3U)) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// But also if we are on a bridge, we can only move a certain direction
|
||||
if (!PathFinderInfo->rail_or_road && IsRoad(ctile)) {
|
||||
if (IsTileType(ctile, MP_TUNNELBRIDGE)) {
|
||||
// An existing bridge/tunnel... let's test the direction ;)
|
||||
if ((_m[ctile].m5 & 1U) != (i & 1)) continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((AI_PATHFINDER_FLAG_BRIDGE & current->path.node.user_data[0]) != 0 ||
|
||||
(AI_PATHFINDER_FLAG_TUNNEL & current->path.node.user_data[0]) != 0) {
|
||||
// We are a bridge/tunnel, how cool!!
|
||||
// This means we can only point forward.. get the direction from the user_data
|
||||
if (i != (current->path.node.user_data[0] >> 8)) continue;
|
||||
}
|
||||
dir = 0;
|
||||
|
||||
// First, check if we have a parent
|
||||
if (current->path.parent == NULL && current->path.node.user_data[0] == 0) {
|
||||
// If not, this means we are at the starting station
|
||||
if (PathFinderInfo->start_direction != AI_PATHFINDER_NO_DIRECTION) {
|
||||
// We do need a direction?
|
||||
if (AiNew_GetDirection(ctile, atile) != PathFinderInfo->start_direction) {
|
||||
// We are not pointing the right way, invalid tile
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} else if (current->path.node.user_data[0] == 0) {
|
||||
if (PathFinderInfo->rail_or_road) {
|
||||
// Rail check
|
||||
dir = AiNew_GetRailDirection(current->path.parent->node.tile, ctile, atile);
|
||||
ret = AI_DoCommand(ctile, 0, dir, DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL);
|
||||
if (CmdFailed(ret)) continue;
|
||||
#ifdef AI_PATHFINDER_NO_90DEGREES_TURN
|
||||
if (current->path.parent->parent != NULL) {
|
||||
// Check if we don't make a 90degree curve
|
||||
int dir1 = AiNew_GetRailDirection(current->path.parent->parent->node.tile, current->path.parent->node.tile, ctile);
|
||||
if (_illegal_curves[dir1] == dir || _illegal_curves[dir] == dir1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
// Road check
|
||||
dir = AiNew_GetRoadDirection(current->path.parent->node.tile, ctile, atile);
|
||||
if (IsRoad(ctile)) {
|
||||
if (IsTileType(ctile, MP_TUNNELBRIDGE)) {
|
||||
// We have a bridge, how nicely! We should mark it...
|
||||
dir = 0;
|
||||
} else {
|
||||
// It already has road.. check if we miss any bits!
|
||||
if ((_m[ctile].m5 & dir) != dir) {
|
||||
// We do miss some pieces :(
|
||||
dir &= ~_m[ctile].m5;
|
||||
} else {
|
||||
dir = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Only destruct things if it is MP_CLEAR of MP_TREES
|
||||
if (dir != 0) {
|
||||
ret = AI_DoCommand(ctile, dir, 0, DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
if (CmdFailed(ret)) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The tile can be connected
|
||||
aystar->neighbours[aystar->num_neighbours].tile = atile;
|
||||
aystar->neighbours[aystar->num_neighbours].user_data[0] = 0;
|
||||
aystar->neighbours[aystar->num_neighbours++].direction = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Next step, check for bridges and tunnels
|
||||
if (current->path.parent != NULL && current->path.node.user_data[0] == 0) {
|
||||
TileInfo ti;
|
||||
// First we get the dir from this tile and his parent
|
||||
int dir = AiNew_GetDirection(current->path.parent->node.tile, current->path.node.tile);
|
||||
// It means we can only walk with the track, so the bridge has to be in the same direction
|
||||
TileIndex tile = current->path.node.tile;
|
||||
TileIndex new_tile = tile;
|
||||
|
||||
FindLandscapeHeightByTile(&ti, tile);
|
||||
|
||||
// Bridges can only be build on land that is not flat
|
||||
// And if there is a road or rail blocking
|
||||
if (ti.tileh != 0 ||
|
||||
(PathFinderInfo->rail_or_road && IsTileType(tile + TileOffsByDir(dir), MP_STREET)) ||
|
||||
(!PathFinderInfo->rail_or_road && IsTileType(tile + TileOffsByDir(dir), MP_RAILWAY))) {
|
||||
for (;;) {
|
||||
new_tile += TileOffsByDir(dir);
|
||||
|
||||
// Precheck, is the length allowed?
|
||||
if (!CheckBridge_Stuff(0, GetBridgeLength(tile, new_tile))) break;
|
||||
|
||||
// Check if we hit the station-tile.. we don't like that!
|
||||
if (TILES_BETWEEN(new_tile, PathFinderInfo->end_tile_tl, PathFinderInfo->end_tile_br)) break;
|
||||
|
||||
// Try building the bridge..
|
||||
ret = AI_DoCommand(tile, new_tile, (0 << 8) + (MAX_BRIDGES / 2), DC_AUTO, CMD_BUILD_BRIDGE);
|
||||
if (CmdFailed(ret)) continue;
|
||||
// We can build a bridge here.. add him to the neighbours
|
||||
aystar->neighbours[aystar->num_neighbours].tile = new_tile;
|
||||
aystar->neighbours[aystar->num_neighbours].user_data[0] = AI_PATHFINDER_FLAG_BRIDGE + (dir << 8);
|
||||
aystar->neighbours[aystar->num_neighbours++].direction = 0;
|
||||
// We can only have 12 neighbours, and we need 1 left for tunnels
|
||||
if (aystar->num_neighbours == 11) break;
|
||||
}
|
||||
}
|
||||
|
||||
// Next, check for tunnels!
|
||||
// Tunnels can only be build with tileh of 3, 6, 9 or 12, depending on the direction
|
||||
// For now, we check both sides for this tile.. terraforming gives fuzzy result
|
||||
if ((dir == 0 && ti.tileh == 12) ||
|
||||
(dir == 1 && ti.tileh == 6) ||
|
||||
(dir == 2 && ti.tileh == 3) ||
|
||||
(dir == 3 && ti.tileh == 9)) {
|
||||
// Now simply check if a tunnel can be build
|
||||
ret = AI_DoCommand(tile, (PathFinderInfo->rail_or_road?0:0x200), 0, DC_AUTO, CMD_BUILD_TUNNEL);
|
||||
FindLandscapeHeightByTile(&ti, _build_tunnel_endtile);
|
||||
if (!CmdFailed(ret) && (ti.tileh == 3 || ti.tileh == 6 || ti.tileh == 9 || ti.tileh == 12)) {
|
||||
aystar->neighbours[aystar->num_neighbours].tile = _build_tunnel_endtile;
|
||||
aystar->neighbours[aystar->num_neighbours].user_data[0] = AI_PATHFINDER_FLAG_TUNNEL + (dir << 8);
|
||||
aystar->neighbours[aystar->num_neighbours++].direction = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern uint GetRailFoundation(uint tileh, uint bits);
|
||||
extern uint GetRoadFoundation(uint tileh, uint bits);
|
||||
extern uint GetBridgeFoundation(uint tileh, byte direction);
|
||||
enum {
|
||||
BRIDGE_NO_FOUNDATION = 1 << 0 | 1 << 3 | 1 << 6 | 1 << 9 | 1 << 12,
|
||||
};
|
||||
|
||||
// The most important function: it calculates the g-value
|
||||
static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
|
||||
{
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
int r, res = 0;
|
||||
TileInfo ti, parent_ti;
|
||||
|
||||
// Gather some information about the tile..
|
||||
FindLandscapeHeightByTile(&ti, current->tile);
|
||||
FindLandscapeHeightByTile(&parent_ti, parent->path.node.tile);
|
||||
|
||||
// Check if we hit the end-tile
|
||||
if (TILES_BETWEEN(current->tile, PathFinderInfo->end_tile_tl, PathFinderInfo->end_tile_br)) {
|
||||
// We are at the end-tile, check if we had a direction or something...
|
||||
if (PathFinderInfo->end_direction != AI_PATHFINDER_NO_DIRECTION && AiNew_GetDirection(current->tile, parent->path.node.tile) != PathFinderInfo->end_direction) {
|
||||
// We are not pointing the right way, invalid tile
|
||||
return AYSTAR_INVALID_NODE;
|
||||
}
|
||||
// If it was valid, drop out.. we don't build on the endtile
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Give everything a small penalty
|
||||
res += AI_PATHFINDER_PENALTY;
|
||||
|
||||
if (!PathFinderInfo->rail_or_road) {
|
||||
// Road has the lovely advantage it can use other road... check if
|
||||
// the current tile is road, and if so, give a good bonus
|
||||
if (IsRoad(current->tile)) {
|
||||
res -= AI_PATHFINDER_ROAD_ALREADY_EXISTS_BONUS;
|
||||
}
|
||||
}
|
||||
|
||||
// We should give a penalty when the tile is going up or down.. this is one way to do so!
|
||||
// Too bad we have to count it from the parent.. but that is not so bad.
|
||||
// We also dislike long routes on slopes, since they do not look too realistic
|
||||
// when there is a flat land all around, they are more expensive to build, and
|
||||
// especially they essentially block the ability to connect or cross the road
|
||||
// from one side.
|
||||
if (parent_ti.tileh != 0 && parent->path.parent != NULL) {
|
||||
// Skip if the tile was from a bridge or tunnel
|
||||
if (parent->path.node.user_data[0] == 0 && current->user_data[0] == 0) {
|
||||
if (PathFinderInfo->rail_or_road) {
|
||||
r = GetRailFoundation(parent_ti.tileh, 1 << AiNew_GetRailDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile));
|
||||
// Maybe is BRIDGE_NO_FOUNDATION a bit strange here, but it contains just the right information..
|
||||
if (r >= 15 || (r == 0 && (BRIDGE_NO_FOUNDATION & (1 << ti.tileh)))) {
|
||||
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
|
||||
} else {
|
||||
res += AI_PATHFINDER_FOUNDATION_PENALTY;
|
||||
}
|
||||
} else {
|
||||
if (!(IsRoad(parent->path.node.tile) && IsTileType(parent->path.node.tile, MP_TUNNELBRIDGE))) {
|
||||
r = GetRoadFoundation(parent_ti.tileh, AiNew_GetRoadDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile));
|
||||
if (r >= 15 || r == 0)
|
||||
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
|
||||
else
|
||||
res += AI_PATHFINDER_FOUNDATION_PENALTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Are we part of a tunnel?
|
||||
if ((AI_PATHFINDER_FLAG_TUNNEL & current->user_data[0]) != 0) {
|
||||
// Tunnels are very expensive when build on long routes..
|
||||
// Ironicly, we are using BridgeCode here ;)
|
||||
r = AI_PATHFINDER_TUNNEL_PENALTY * GetBridgeLength(current->tile, parent->path.node.tile);
|
||||
res += r + (r >> 8);
|
||||
}
|
||||
|
||||
// Are we part of a bridge?
|
||||
if ((AI_PATHFINDER_FLAG_BRIDGE & current->user_data[0]) != 0) {
|
||||
// That means for every length a penalty
|
||||
res += AI_PATHFINDER_BRIDGE_PENALTY * GetBridgeLength(current->tile, parent->path.node.tile);
|
||||
// Check if we are going up or down, first for the starting point
|
||||
// In user_data[0] is at the 8th bit the direction
|
||||
if (!(BRIDGE_NO_FOUNDATION & (1 << parent_ti.tileh))) {
|
||||
if (GetBridgeFoundation(parent_ti.tileh, (current->user_data[0] >> 8) & 1) < 15)
|
||||
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
}
|
||||
// Second for the end point
|
||||
if (!(BRIDGE_NO_FOUNDATION & (1 << ti.tileh))) {
|
||||
if (GetBridgeFoundation(ti.tileh, (current->user_data[0] >> 8) & 1) < 15)
|
||||
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
}
|
||||
if (parent_ti.tileh == 0) res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
if (ti.tileh == 0) res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
}
|
||||
|
||||
// To prevent the AI from taking the fastest way in tiles, but not the fastest way
|
||||
// in speed, we have to give a good penalty to direction changing
|
||||
// This way, we get almost the fastest way in tiles, and a very good speed on the track
|
||||
if (!PathFinderInfo->rail_or_road) {
|
||||
if (parent->path.parent != NULL &&
|
||||
AiNew_GetDirection(current->tile, parent->path.node.tile) != AiNew_GetDirection(parent->path.node.tile, parent->path.parent->node.tile)) {
|
||||
// When road exists, we don't like turning, but its free, so don't be to piggy about it
|
||||
if (IsRoad(parent->path.node.tile))
|
||||
res += AI_PATHFINDER_DIRECTION_CHANGE_ON_EXISTING_ROAD_PENALTY;
|
||||
else
|
||||
res += AI_PATHFINDER_DIRECTION_CHANGE_PENALTY;
|
||||
}
|
||||
} else {
|
||||
// For rail we have 1 exeption: diagonal rail..
|
||||
// So we fetch 2 raildirection. That of the current one, and of the one before that
|
||||
if (parent->path.parent != NULL && parent->path.parent->parent != NULL) {
|
||||
int dir1 = AiNew_GetRailDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile);
|
||||
int dir2 = AiNew_GetRailDirection(parent->path.parent->parent->node.tile, parent->path.parent->node.tile, parent->path.node.tile);
|
||||
// First, see if we are on diagonal path, that is better than straight path
|
||||
if (dir1 > 1) { res -= AI_PATHFINDER_DIAGONAL_BONUS; }
|
||||
|
||||
// First see if they are different
|
||||
if (dir1 != dir2) {
|
||||
// dir 2 and 3 are 1 diagonal track, and 4 and 5.
|
||||
if (!(((dir1 == 2 || dir1 == 3) && (dir2 == 2 || dir2 == 3)) || ((dir1 == 4 || dir1 == 5) && (dir2 == 4 || dir2 == 5)))) {
|
||||
// It is not, so we changed of direction
|
||||
res += AI_PATHFINDER_DIRECTION_CHANGE_PENALTY;
|
||||
}
|
||||
if (parent->path.parent->parent->parent != NULL) {
|
||||
int dir3 = AiNew_GetRailDirection(parent->path.parent->parent->parent->node.tile, parent->path.parent->parent->node.tile, parent->path.parent->node.tile);
|
||||
// Check if we changed 3 tiles of direction in 3 tiles.. bad!!!
|
||||
if ((dir1 == 0 || dir1 == 1) && dir2 > 1 && (dir3 == 0 || dir3 == 1)) {
|
||||
res += AI_PATHFINDER_CURVE_PENALTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return (res < 0) ? 0 : res;
|
||||
}
|
||||
@@ -1,9 +1,14 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "ai.h"
|
||||
#include "vehicle.h"
|
||||
/* $Id$ */
|
||||
|
||||
int AiNew_GetRailDirection(uint tile_a, uint tile_b, uint tile_c) {
|
||||
#include "../../stdafx.h"
|
||||
#include "../../openttd.h"
|
||||
#include "../../debug.h"
|
||||
#include "../../map.h"
|
||||
#include "trolly.h"
|
||||
#include "../../vehicle.h"
|
||||
|
||||
int AiNew_GetRailDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c)
|
||||
{
|
||||
// 0 = vert
|
||||
// 1 = horz
|
||||
// 2 = dig up-left
|
||||
@@ -14,13 +19,13 @@ int AiNew_GetRailDirection(uint tile_a, uint tile_b, uint tile_c) {
|
||||
int x1, x2, x3;
|
||||
int y1, y2, y3;
|
||||
|
||||
x1 = GET_TILE_X(tile_a);
|
||||
x2 = GET_TILE_X(tile_b);
|
||||
x3 = GET_TILE_X(tile_c);
|
||||
x1 = TileX(tile_a);
|
||||
x2 = TileX(tile_b);
|
||||
x3 = TileX(tile_c);
|
||||
|
||||
y1 = GET_TILE_Y(tile_a);
|
||||
y2 = GET_TILE_Y(tile_b);
|
||||
y3 = GET_TILE_Y(tile_c);
|
||||
y1 = TileY(tile_a);
|
||||
y2 = TileY(tile_b);
|
||||
y3 = TileY(tile_c);
|
||||
|
||||
if (y1 == y2 && y2 == y3) return 0;
|
||||
if (x1 == x2 && x2 == x3) return 1;
|
||||
@@ -44,18 +49,19 @@ int AiNew_GetRailDirection(uint tile_a, uint tile_b, uint tile_c) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int AiNew_GetRoadDirection(uint tile_a, uint tile_b, uint tile_c) {
|
||||
int AiNew_GetRoadDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c)
|
||||
{
|
||||
int x1, x2, x3;
|
||||
int y1, y2, y3;
|
||||
int r;
|
||||
|
||||
x1 = GET_TILE_X(tile_a);
|
||||
x2 = GET_TILE_X(tile_b);
|
||||
x3 = GET_TILE_X(tile_c);
|
||||
x1 = TileX(tile_a);
|
||||
x2 = TileX(tile_b);
|
||||
x3 = TileX(tile_c);
|
||||
|
||||
y1 = GET_TILE_Y(tile_a);
|
||||
y2 = GET_TILE_Y(tile_b);
|
||||
y3 = GET_TILE_Y(tile_c);
|
||||
y1 = TileY(tile_a);
|
||||
y2 = TileY(tile_b);
|
||||
y3 = TileY(tile_c);
|
||||
|
||||
r = 0;
|
||||
|
||||
@@ -73,10 +79,11 @@ int AiNew_GetRoadDirection(uint tile_a, uint tile_b, uint tile_c) {
|
||||
}
|
||||
|
||||
// Get's the direction between 2 tiles seen from tile_a
|
||||
int AiNew_GetDirection(uint tile_a, uint tile_b) {
|
||||
if (GET_TILE_Y(tile_a) < GET_TILE_Y(tile_b)) return 1;
|
||||
if (GET_TILE_Y(tile_a) > GET_TILE_Y(tile_b)) return 3;
|
||||
if (GET_TILE_X(tile_a) < GET_TILE_X(tile_b)) return 2;
|
||||
int AiNew_GetDirection(TileIndex tile_a, TileIndex tile_b)
|
||||
{
|
||||
if (TileY(tile_a) < TileY(tile_b)) return 1;
|
||||
if (TileY(tile_a) > TileY(tile_b)) return 3;
|
||||
if (TileX(tile_a) < TileX(tile_b)) return 2;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1364
File diff suppressed because it is too large
Load Diff
+45
-55
@@ -1,7 +1,10 @@
|
||||
#ifndef AI_H
|
||||
#define AI_H
|
||||
/* $Id$ */
|
||||
|
||||
#include "aystar.h"
|
||||
#ifndef AI_TROLLY_H
|
||||
#define AI_TROLLY_H
|
||||
|
||||
#include "../../aystar.h"
|
||||
#include "../../player.h"
|
||||
|
||||
/*
|
||||
* These defines can be altered to change the behavoir of the AI
|
||||
@@ -37,6 +40,8 @@
|
||||
#define AI_PATHFINDER_PENALTY 150
|
||||
// The penalty given to a tile that is going up
|
||||
#define AI_PATHFINDER_TILE_GOES_UP_PENALTY 450
|
||||
// The penalty given to a tile which would have to use fundation
|
||||
#define AI_PATHFINDER_FOUNDATION_PENALTY 100
|
||||
// Changing direction is a penalty, to prevent curved ways (with that: slow ways)
|
||||
#define AI_PATHFINDER_DIRECTION_CHANGE_PENALTY 200
|
||||
// Same penalty, only for when road already exists
|
||||
@@ -71,7 +76,7 @@
|
||||
#define AI_LOCATE_ROUTE_MAX_COUNTER 200
|
||||
|
||||
// How many days must there be between building the first station and the second station
|
||||
// within one city. This number is in days and should be more then 4 months.
|
||||
// within one city. This number is in days and should be more than 4 months.
|
||||
#define AI_CHECKCITY_DATE_BETWEEN 180
|
||||
|
||||
// How many cargo is needed for one station in a city?
|
||||
@@ -130,7 +135,7 @@
|
||||
// reuse the station instead of building a new one!
|
||||
#define AI_STATION_REUSE_MULTIPLER 2
|
||||
|
||||
// No more then this amount of vehicles per station..
|
||||
// No more than this amount of vehicles per station..
|
||||
#define AI_CHECK_MAX_VEHICLE_PER_STATION 10
|
||||
|
||||
// How many thick between building 2 vehicles
|
||||
@@ -149,7 +154,7 @@
|
||||
// while old vehicles stay longer, because we do get less in return.
|
||||
#define AI_MINIMUM_ROUTE_PROFIT 1000
|
||||
|
||||
// A vehicle is considered lost when he his cargo is more then 180 days old
|
||||
// A vehicle is considered lost when he his cargo is more than 180 days old
|
||||
#define AI_VEHICLE_LOST_DAYS 180
|
||||
|
||||
// How many times may the AI try to find a route before it gives up
|
||||
@@ -161,40 +166,33 @@
|
||||
|
||||
// This stops 90degrees curves
|
||||
static const byte _illegal_curves[6] = {
|
||||
255, 255, // Horz and vert, don't have the effect
|
||||
5, // upleft and upright are not valid
|
||||
4, // downright and downleft are not valid
|
||||
2, // downleft and upleft are not valid
|
||||
3, // upright and downright are not valid
|
||||
};
|
||||
|
||||
static const TileIndexDiff _tiles_around[4] = {
|
||||
TILE_XY(-1,0),
|
||||
TILE_XY(0,1),
|
||||
TILE_XY(1,0),
|
||||
TILE_XY(0,-1),
|
||||
255, 255, // Horz and vert, don't have the effect
|
||||
5, // upleft and upright are not valid
|
||||
4, // downright and downleft are not valid
|
||||
2, // downleft and upleft are not valid
|
||||
3, // upright and downright are not valid
|
||||
};
|
||||
|
||||
enum {
|
||||
AI_STATE_STARTUP = 0,
|
||||
AI_STATE_FIRST_TIME,
|
||||
AI_STATE_NOTHING,
|
||||
AI_STATE_WAKE_UP,
|
||||
AI_STATE_LOCATE_ROUTE,
|
||||
AI_STATE_FIND_STATION,
|
||||
AI_STATE_FIND_PATH,
|
||||
AI_STATE_FIND_DEPOT,
|
||||
AI_STATE_VERIFY_ROUTE,
|
||||
AI_STATE_BUILD_STATION,
|
||||
AI_STATE_BUILD_PATH,
|
||||
AI_STATE_BUILD_DEPOT,
|
||||
AI_STATE_BUILD_VEHICLE,
|
||||
AI_STATE_GIVE_ORDERS,
|
||||
AI_STATE_START_VEHICLE,
|
||||
AI_STATE_REPAY_MONEY,
|
||||
AI_STATE_STARTUP = 0,
|
||||
AI_STATE_FIRST_TIME,
|
||||
AI_STATE_NOTHING,
|
||||
AI_STATE_WAKE_UP,
|
||||
AI_STATE_LOCATE_ROUTE,
|
||||
AI_STATE_FIND_STATION,
|
||||
AI_STATE_FIND_PATH,
|
||||
AI_STATE_FIND_DEPOT,
|
||||
AI_STATE_VERIFY_ROUTE,
|
||||
AI_STATE_BUILD_STATION,
|
||||
AI_STATE_BUILD_PATH,
|
||||
AI_STATE_BUILD_DEPOT,
|
||||
AI_STATE_BUILD_VEHICLE,
|
||||
AI_STATE_GIVE_ORDERS,
|
||||
AI_STATE_START_VEHICLE,
|
||||
AI_STATE_REPAY_MONEY,
|
||||
AI_STATE_CHECK_ALL_VEHICLES,
|
||||
AI_STATE_ACTION_DONE,
|
||||
AI_STATE_STOP, // Temporary function to stop the AI
|
||||
AI_STATE_ACTION_DONE,
|
||||
AI_STATE_STOP, // Temporary function to stop the AI
|
||||
};
|
||||
|
||||
// Used for tbt (train/bus/truck)
|
||||
@@ -214,7 +212,7 @@ enum {
|
||||
|
||||
// Used for from_type/to_type
|
||||
enum {
|
||||
AI_NO_TYPE = 0,
|
||||
AI_NO_TYPE = 0,
|
||||
AI_CITY,
|
||||
AI_INDUSTRY,
|
||||
};
|
||||
@@ -227,7 +225,7 @@ enum {
|
||||
|
||||
#define AI_NO_CARGO 0xFF // Means that there is no cargo defined yet (used for industry)
|
||||
#define AI_NEED_CARGO 0xFE // Used when the AI needs to find out a cargo for the route
|
||||
#define AI_STATION_RANGE TILE_XY(TILE_X_MAX, TILE_Y_MAX)
|
||||
#define AI_STATION_RANGE TileXY(MapMaxX(), MapMaxY())
|
||||
|
||||
#define AI_PATHFINDER_NO_DIRECTION (byte)-1
|
||||
|
||||
@@ -235,13 +233,6 @@ enum {
|
||||
#define AI_PATHFINDER_FLAG_BRIDGE 1
|
||||
#define AI_PATHFINDER_FLAG_TUNNEL 2
|
||||
|
||||
// A macro for mp_street, where 0x20 is depot
|
||||
// mp_tunnelbridge, where 0xf0 is a bridge, and 0x4/0x2 means: roadtunnel/bridge
|
||||
#define AI_PATHFINDER_IS_ROAD(tile) ((IS_TILETYPE(tile, MP_STREET) && !(_map5[tile] & 0x20)) || \
|
||||
(IS_TILETYPE(tile, MP_TUNNELBRIDGE) && \
|
||||
(((_map5[tile] & 0x80) == 0 && (_map5[tile] & 0x4) == 0x4) || \
|
||||
((_map5[tile] & 0x80) != 0 && (_map5[tile] & 0x2) == 0x2))))
|
||||
|
||||
typedef void AiNew_StateFunction(Player *p);
|
||||
|
||||
// ai_new.c
|
||||
@@ -252,20 +243,19 @@ AyStar *new_AyStar_AiPathFinder(int max_tiles_around, Ai_PathFinderInfo *PathFin
|
||||
void clean_AyStar_AiPathFinder(AyStar *aystar, Ai_PathFinderInfo *PathFinderInfo);
|
||||
|
||||
// ai_shared.c
|
||||
int AiNew_GetRailDirection(uint tile_a, uint tile_b, uint tile_c);
|
||||
int AiNew_GetRoadDirection(uint tile_a, uint tile_b, uint tile_c);
|
||||
int AiNew_GetDirection(uint tile_a, uint tile_b);
|
||||
int AiNew_GetRailDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c);
|
||||
int AiNew_GetRoadDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c);
|
||||
int AiNew_GetDirection(TileIndex tile_a, TileIndex tile_b);
|
||||
bool AiNew_SetSpecialVehicleFlag(Player *p, Vehicle *v, uint flag);
|
||||
uint AiNew_GetSpecialVehicleFlag(Player *p, Vehicle *v);
|
||||
|
||||
// ai_build.c
|
||||
bool AiNew_Build_CompanyHQ(Player *p, uint tile);
|
||||
int AiNew_Build_Station(Player *p, byte type, uint tile, byte length, byte numtracks, byte direction, byte flag);
|
||||
int AiNew_Build_Bridge(Player *p, uint tile_a, uint tile_b, byte flag);
|
||||
bool AiNew_Build_CompanyHQ(Player *p, TileIndex tile);
|
||||
int AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte numtracks, byte direction, byte flag);
|
||||
int AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag);
|
||||
int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte flag);
|
||||
int AiNew_PickVehicle(Player *p);
|
||||
int AiNew_Build_Vehicle(Player *p, uint tile, byte flag);
|
||||
int AiNew_Build_Depot(Player *p, uint tile, byte direction, byte flag);
|
||||
int AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag);
|
||||
int AiNew_Build_Depot(Player *p, TileIndex tile, byte direction, byte flag);
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* AI_TROLLY_H */
|
||||
-257
@@ -1,257 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "command.h"
|
||||
#include "ai.h"
|
||||
#include "engine.h"
|
||||
|
||||
// Build HQ
|
||||
// Params:
|
||||
// tile : tile where HQ is going to be build
|
||||
bool AiNew_Build_CompanyHQ(Player *p, uint tile) {
|
||||
if (DoCommandByTile(tile, 0, 0, DC_AUTO | DC_NO_WATER, CMD_BUILD_COMPANY_HQ) == CMD_ERROR)
|
||||
return false;
|
||||
DoCommandByTile(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_BUILD_COMPANY_HQ);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Build station
|
||||
// Params:
|
||||
// type : AI_TRAIN/AI_BUS/AI_TRUCK : indicates the type of station
|
||||
// tile : tile where station is going to be build
|
||||
// length : in case of AI_TRAIN: length of station
|
||||
// numtracks : in case of AI_TRAIN: tracks of station
|
||||
// direction : the direction of the station
|
||||
// flag : flag passed to DoCommand (normally 0 to get the cost or DC_EXEC to build it)
|
||||
int AiNew_Build_Station(Player *p, byte type, uint tile, byte length, byte numtracks, byte direction, byte flag) {
|
||||
if (type == AI_TRAIN)
|
||||
return DoCommandByTile(tile, direction + (numtracks << 8) + (length << 16), 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_RAILROAD_STATION);
|
||||
else if (type == AI_BUS)
|
||||
return DoCommandByTile(tile, direction, 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_BUS_STATION);
|
||||
else
|
||||
return DoCommandByTile(tile, direction, 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_TRUCK_STATION);
|
||||
}
|
||||
|
||||
// Builds a brdige. The second best out of the ones available for this player
|
||||
// Params:
|
||||
// tile_a : starting point
|
||||
// tile_b : end point
|
||||
// flag : flag passed to DoCommand
|
||||
int AiNew_Build_Bridge(Player *p, uint tile_a, uint tile_b, byte flag) {
|
||||
int bridge_type, bridge_len, type, type2;
|
||||
|
||||
// Find a good bridgetype (the best money can buy)
|
||||
bridge_len = GetBridgeLength(tile_a, tile_b);
|
||||
type = type2 = 0;
|
||||
for (bridge_type = MAX_BRIDGES-1; bridge_type >= 0; bridge_type--) {
|
||||
if (CheckBridge_Stuff(bridge_type, bridge_len)) {
|
||||
type2 = type;
|
||||
type = bridge_type;
|
||||
// We found two bridges, exit
|
||||
if (type2 != 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
// There is only one bridge that can be build..
|
||||
if (type2 == 0 && type != 0) type2 = type;
|
||||
|
||||
// Now, simply, build the bridge!
|
||||
if (p->ainew.tbt == AI_TRAIN)
|
||||
return DoCommandByTile(tile_a, tile_b, (0<<8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE);
|
||||
else
|
||||
return DoCommandByTile(tile_a, tile_b, (0x80 << 8) + type2, flag | DC_AUTO, CMD_BUILD_BRIDGE);
|
||||
}
|
||||
|
||||
|
||||
// Build the route part by part
|
||||
// Basicly what this function do, is build that amount of parts of the route
|
||||
// that go in the same direction. It sets 'part' to the last part of the route builded.
|
||||
// The return value is the cost for the builded parts
|
||||
//
|
||||
// Params:
|
||||
// PathFinderInfo : Pointer to the PathFinderInfo used for AiPathFinder
|
||||
// part : Which part we need to build
|
||||
//
|
||||
// TODO: skip already builded road-pieces (e.g.: cityroad)
|
||||
int AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte flag) {
|
||||
int part = PathFinderInfo->position;
|
||||
byte *route_extra = PathFinderInfo->route_extra;
|
||||
TileIndex *route = PathFinderInfo->route;
|
||||
int dir;
|
||||
int old_dir = -1;
|
||||
int cost = 0;
|
||||
int res;
|
||||
// We need to calculate the direction with the parent of the parent.. so we skip
|
||||
// the first pieces and the last piece
|
||||
if (part < 1) part = 1;
|
||||
// When we are done, stop it
|
||||
if (part >= PathFinderInfo->route_length - 1) { PathFinderInfo->position = -2; return 0; }
|
||||
|
||||
|
||||
if (PathFinderInfo->rail_or_road) {
|
||||
// Tunnel code
|
||||
if ((AI_PATHFINDER_FLAG_TUNNEL & route_extra[part]) != 0) {
|
||||
cost += DoCommandByTile(route[part], 0, 0, flag, CMD_BUILD_TUNNEL);
|
||||
PathFinderInfo->position++;
|
||||
// TODO: problems!
|
||||
if (cost == CMD_ERROR) {
|
||||
DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: tunnel could not be build!");
|
||||
return 0;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
// Bridge code
|
||||
if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
|
||||
cost += AiNew_Build_Bridge(p, route[part], route[part-1], flag);
|
||||
PathFinderInfo->position++;
|
||||
// TODO: problems!
|
||||
if (cost == CMD_ERROR) {
|
||||
DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: bridge could not be build!");
|
||||
return 0;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
// Build normal rail
|
||||
// Keep it doing till we go an other way
|
||||
if (route_extra[part-1] == 0 && route_extra[part] == 0) {
|
||||
while (route_extra[part] == 0) {
|
||||
// Get the current direction
|
||||
dir = AiNew_GetRailDirection(route[part-1], route[part], route[part+1]);
|
||||
// Is it the same as the last one?
|
||||
if (old_dir != -1 && old_dir != dir) break;
|
||||
old_dir = dir;
|
||||
// Build the tile
|
||||
res = DoCommandByTile(route[part], 0, dir, flag, CMD_BUILD_SINGLE_RAIL);
|
||||
if (res == CMD_ERROR) {
|
||||
// Problem.. let's just abort it all!
|
||||
p->ainew.state = AI_STATE_NOTHING;
|
||||
return 0;
|
||||
}
|
||||
cost += res;
|
||||
// Go to the next tile
|
||||
part++;
|
||||
// Check if it is still in range..
|
||||
if (part >= PathFinderInfo->route_length - 1) break;
|
||||
}
|
||||
part--;
|
||||
}
|
||||
// We want to return the last position, so we go back one
|
||||
PathFinderInfo->position = part;
|
||||
} else {
|
||||
// Tunnel code
|
||||
if ((AI_PATHFINDER_FLAG_TUNNEL & route_extra[part]) != 0) {
|
||||
cost += DoCommandByTile(route[part], 0x200, 0, flag, CMD_BUILD_TUNNEL);
|
||||
PathFinderInfo->position++;
|
||||
// TODO: problems!
|
||||
if (cost == CMD_ERROR) {
|
||||
DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: tunnel could not be build!");
|
||||
return 0;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
// Bridge code
|
||||
if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
|
||||
cost += AiNew_Build_Bridge(p, route[part], route[part+1], flag);
|
||||
PathFinderInfo->position++;
|
||||
// TODO: problems!
|
||||
if (cost == CMD_ERROR) {
|
||||
DEBUG(ai,0)("[AiNew - BuildPath] We have a serious problem: bridge could not be build!");
|
||||
return 0;
|
||||
}
|
||||
return cost;
|
||||
}
|
||||
|
||||
// Build normal road
|
||||
// Keep it doing till we go an other way
|
||||
// EnsureNoVehicle makes sure we don't build on a tile where a vehicle is. This way
|
||||
// it will wait till the vehicle is gone..
|
||||
if (route_extra[part-1] == 0 && route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicle(route[part]))) {
|
||||
while (route_extra[part] == 0 && (flag != DC_EXEC || EnsureNoVehicle(route[part]))) {
|
||||
// Get the current direction
|
||||
dir = AiNew_GetRoadDirection(route[part-1], route[part], route[part+1]);
|
||||
// Is it the same as the last one?
|
||||
if (old_dir != -1 && old_dir != dir) break;
|
||||
old_dir = dir;
|
||||
// There is already some road, and it is a bridge.. don't build!!!
|
||||
if (!IS_TILETYPE(route[part], MP_TUNNELBRIDGE)) {
|
||||
// Build the tile
|
||||
res = DoCommandByTile(route[part], dir, 0, flag | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
// Currently, we ignore CMD_ERRORs!
|
||||
if (res == CMD_ERROR && flag == DC_EXEC && !IS_TILETYPE(route[part], MP_STREET) && !EnsureNoVehicle(route[part])) {
|
||||
// Problem.. let's just abort it all!
|
||||
DEBUG(ai,0)("Darn, the route could not be builded.. aborting!");
|
||||
p->ainew.state = AI_STATE_NOTHING;
|
||||
return 0;
|
||||
} else {
|
||||
if (res != CMD_ERROR)
|
||||
cost += res;
|
||||
}
|
||||
}
|
||||
// Go to the next tile
|
||||
part++;
|
||||
// Check if it is still in range..
|
||||
if (part >= PathFinderInfo->route_length - 1) break;
|
||||
}
|
||||
part--;
|
||||
// We want to return the last position, so we go back one
|
||||
}
|
||||
if (!EnsureNoVehicle(route[part]) && flag == DC_EXEC) part--;
|
||||
PathFinderInfo->position = part;
|
||||
}
|
||||
|
||||
return cost;
|
||||
}
|
||||
|
||||
// This functions tries to find the best vehicle for this type of cargo
|
||||
// It returns vehicle_id or -1 if not found
|
||||
int AiNew_PickVehicle(Player *p) {
|
||||
if (p->ainew.tbt == AI_TRAIN) {
|
||||
// Not supported yet
|
||||
return -1;
|
||||
} else {
|
||||
int start, count, i, r = CMD_ERROR;
|
||||
start = _cargoc.ai_roadveh_start[p->ainew.cargo];
|
||||
count = _cargoc.ai_roadveh_count[p->ainew.cargo];
|
||||
|
||||
// Let's check it backwards.. we simply want to best engine available..
|
||||
for (i=start+count-1;i>=start;i--) {
|
||||
// Is it availiable?
|
||||
// Also, check if the reliability of the vehicle is above the AI_VEHICLE_MIN_RELIABILTY
|
||||
if (!HASBIT(_engines[i].player_avail, _current_player) || _engines[i].reliability * 100 < AI_VEHICLE_MIN_RELIABILTY << 16) continue;
|
||||
// Can we build it?
|
||||
r = DoCommandByTile(0, i, 0, DC_QUERY_COST, CMD_BUILD_ROAD_VEH);
|
||||
if (r != CMD_ERROR) break;
|
||||
}
|
||||
// We did not find a vehicle :(
|
||||
if (r == CMD_ERROR) { return -1; }
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// Builds the best vehicle possible
|
||||
int AiNew_Build_Vehicle(Player *p, uint tile, byte flag) {
|
||||
int i = AiNew_PickVehicle(p);
|
||||
if (i == -1) return CMD_ERROR;
|
||||
|
||||
if (p->ainew.tbt == AI_TRAIN) {
|
||||
return CMD_ERROR;
|
||||
} else {
|
||||
return DoCommandByTile(tile, i, 0, flag, CMD_BUILD_ROAD_VEH);
|
||||
}
|
||||
}
|
||||
|
||||
int AiNew_Build_Depot(Player *p, uint tile, byte direction, byte flag) {
|
||||
static const byte _roadbits_by_dir[4] = {2,1,8,4};
|
||||
int r, r2;
|
||||
if (p->ainew.tbt == AI_TRAIN) {
|
||||
return DoCommandByTile(tile, 0, direction, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_TRAIN_DEPOT);
|
||||
} else {
|
||||
r = DoCommandByTile(tile, direction, 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD_DEPOT);
|
||||
if (r == CMD_ERROR) return r;
|
||||
// Try to build the road from the depot
|
||||
r2 = DoCommandByTile(tile + _tileoffs_by_dir[direction], _roadbits_by_dir[direction], 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
// If it fails, ignore it..
|
||||
if (r2 == CMD_ERROR) return r;
|
||||
return r + r2;
|
||||
}
|
||||
}
|
||||
-457
@@ -1,457 +0,0 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "command.h"
|
||||
#include "ai.h"
|
||||
|
||||
#define TEST_STATION_NO_DIR 0xFF
|
||||
|
||||
// Tests if a station can be build on the given spot
|
||||
// TODO: make it train compatible
|
||||
bool TestCanBuildStationHere(uint tile, byte dir) {
|
||||
Player *p = DEREF_PLAYER(_current_player);
|
||||
if (dir == TEST_STATION_NO_DIR) {
|
||||
// TODO: currently we only allow spots that can be access from al 4 directions...
|
||||
// should be fixed!!!
|
||||
for (dir=0;dir<4;dir++) {
|
||||
int res = AiNew_Build_Station(p, p->ainew.tbt, tile, 1, 1, dir, DC_QUERY_COST);
|
||||
if (res != CMD_ERROR)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
int res = AiNew_Build_Station(p, p->ainew.tbt, tile, 1, 1, dir, DC_QUERY_COST);
|
||||
if (res == CMD_ERROR)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Checks if a tile 'a' is between the tiles 'b' and 'c'
|
||||
#define TILES_BETWEEN(a,b,c) (GET_TILE_X(a) >= GET_TILE_X(b) && GET_TILE_X(a) <= GET_TILE_X(c) && GET_TILE_Y(a) >= GET_TILE_Y(b) && GET_TILE_Y(a) <= GET_TILE_Y(c))
|
||||
|
||||
// Check if the current tile is in our end-area
|
||||
int32 AyStar_AiPathFinder_EndNodeCheck(AyStar *aystar, OpenListNode *current) {
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
// It is not allowed to have a station on the end of a bridge or tunnel ;)
|
||||
if (current->path.node.user_data[0] != 0) return AYSTAR_DONE;
|
||||
if (TILES_BETWEEN(current->path.node.tile, PathFinderInfo->end_tile_tl, PathFinderInfo->end_tile_br))
|
||||
if (IS_TILETYPE(current->path.node.tile, MP_CLEAR) || IS_TILETYPE(current->path.node.tile, MP_TREES))
|
||||
if (current->path.parent == NULL || TestCanBuildStationHere(current->path.node.tile,AiNew_GetDirection(current->path.parent->node.tile, current->path.node.tile)))
|
||||
return AYSTAR_FOUND_END_NODE;
|
||||
|
||||
return AYSTAR_DONE;
|
||||
}
|
||||
|
||||
// Calculates the hash
|
||||
// Currently it is a 10 bit hash, so the hash array has a max depth of 6 bits (so 64)
|
||||
uint AiPathFinder_Hash(uint key1, uint key2) {
|
||||
return (GET_TILE_X(key1) & 0x1F) + ((GET_TILE_Y(key1) & 0x1F) << 5);
|
||||
}
|
||||
|
||||
// Clear the memory of all the things
|
||||
void AyStar_AiPathFinder_Free(AyStar *aystar) {
|
||||
AyStarMain_Free(aystar);
|
||||
free(aystar);
|
||||
}
|
||||
|
||||
static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
static int32 AyStar_AiPathFinder_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
static void AyStar_AiPathFinder_FoundEndNode(AyStar *aystar, OpenListNode *current);
|
||||
static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *current);
|
||||
|
||||
// This creates the AiPathFinder
|
||||
AyStar *new_AyStar_AiPathFinder(int max_tiles_around, Ai_PathFinderInfo *PathFinderInfo) {
|
||||
PathNode start_node;
|
||||
uint x,y;
|
||||
// Create AyStar
|
||||
AyStar *result = malloc(sizeof(AyStar));
|
||||
init_AyStar(result, AiPathFinder_Hash, 1 << 10);
|
||||
// Set the function pointers
|
||||
result->CalculateG = AyStar_AiPathFinder_CalculateG;
|
||||
result->CalculateH = AyStar_AiPathFinder_CalculateH;
|
||||
result->EndNodeCheck = AyStar_AiPathFinder_EndNodeCheck;
|
||||
result->FoundEndNode = AyStar_AiPathFinder_FoundEndNode;
|
||||
result->GetNeighbours = AyStar_AiPathFinder_GetNeighbours;
|
||||
|
||||
result->free = AyStar_AiPathFinder_Free;
|
||||
|
||||
// Set some information
|
||||
result->loops_per_tick = AI_PATHFINDER_LOOPS_PER_TICK;
|
||||
result->max_path_cost = 0;
|
||||
result->max_search_nodes = AI_PATHFINDER_MAX_SEARCH_NODES;
|
||||
|
||||
// Set the user_data to the PathFinderInfo
|
||||
result->user_target = PathFinderInfo;
|
||||
|
||||
// Set the start node
|
||||
start_node.parent = NULL;
|
||||
start_node.node.direction = 0;
|
||||
start_node.node.user_data[0] = 0;
|
||||
|
||||
// Now we add all the starting tiles
|
||||
for (x=GET_TILE_X(PathFinderInfo->start_tile_tl);x<=GET_TILE_X(PathFinderInfo->start_tile_br);x++) {
|
||||
for (y=GET_TILE_Y(PathFinderInfo->start_tile_tl);y<=GET_TILE_Y(PathFinderInfo->start_tile_br);y++) {
|
||||
start_node.node.tile = TILE_XY(x,y);
|
||||
result->addstart(result, &start_node.node);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
// To reuse AyStar we sometimes have to clean all the memory
|
||||
void clean_AyStar_AiPathFinder(AyStar *aystar, Ai_PathFinderInfo *PathFinderInfo) {
|
||||
PathNode start_node;
|
||||
uint x,y;
|
||||
|
||||
aystar->clear(aystar);
|
||||
|
||||
// Set the user_data to the PathFinderInfo
|
||||
aystar->user_target = PathFinderInfo;
|
||||
|
||||
// Set the start node
|
||||
start_node.parent = NULL;
|
||||
start_node.node.direction = 0;
|
||||
start_node.node.user_data[0] = 0;
|
||||
start_node.node.tile = PathFinderInfo->start_tile_tl;
|
||||
|
||||
// Now we add all the starting tiles
|
||||
for (x=GET_TILE_X(PathFinderInfo->start_tile_tl);x<=GET_TILE_X(PathFinderInfo->start_tile_br);x++) {
|
||||
for (y=GET_TILE_Y(PathFinderInfo->start_tile_tl);y<=GET_TILE_Y(PathFinderInfo->start_tile_br);y++) {
|
||||
if (!(IS_TILETYPE(TILE_XY(x,y), MP_CLEAR) || IS_TILETYPE(TILE_XY(x,y), MP_TREES))) continue;
|
||||
if (!TestCanBuildStationHere(TILE_XY(x,y),TEST_STATION_NO_DIR)) continue;
|
||||
start_node.node.tile = TILE_XY(x,y);
|
||||
aystar->addstart(aystar, &start_node.node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The h-value, simple calculation
|
||||
static int32 AyStar_AiPathFinder_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent) {
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
int r, r2;
|
||||
if (PathFinderInfo->end_direction != AI_PATHFINDER_NO_DIRECTION) {
|
||||
// The station is pointing to a direction, add a tile towards that direction, so the H-value is more accurate
|
||||
r = GetTileDist(current->tile, PathFinderInfo->end_tile_tl + _tiles_around[PathFinderInfo->end_direction]);
|
||||
r2 = GetTileDist(current->tile, PathFinderInfo->end_tile_br + _tiles_around[PathFinderInfo->end_direction]);
|
||||
} else {
|
||||
// No direction, so just get the fastest route to the station
|
||||
r = GetTileDist(current->tile, PathFinderInfo->end_tile_tl);
|
||||
r2 = GetTileDist(current->tile, PathFinderInfo->end_tile_br);
|
||||
}
|
||||
// See if the bottomright is faster then the topleft..
|
||||
if (r2 < r) r = r2;
|
||||
return r * AI_PATHFINDER_H_MULTIPLER;
|
||||
}
|
||||
|
||||
// We found the end.. let's get the route back and put it in an array
|
||||
static void AyStar_AiPathFinder_FoundEndNode(AyStar *aystar, OpenListNode *current) {
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
int i = 0;
|
||||
PathNode *parent = ¤t->path;
|
||||
|
||||
do {
|
||||
PathFinderInfo->route_extra[i] = parent->node.user_data[0];
|
||||
PathFinderInfo->route[i++] = parent->node.tile;
|
||||
if (i > lengthof(PathFinderInfo->route)) {
|
||||
// We ran out of space for the PathFinder
|
||||
DEBUG(ai,0)("[AiPathFinder] Ran out of spacein the route[] array!!!");
|
||||
PathFinderInfo->route_length = -1; // -1 indicates out of space
|
||||
return;
|
||||
}
|
||||
parent = parent->parent;
|
||||
} while (parent != NULL);
|
||||
PathFinderInfo->route_length = i;
|
||||
DEBUG(ai,1)("[Ai-PathFinding] Found route of %d nodes long in %d nodes of searching",i,Hash_Size(&aystar->ClosedListHash));
|
||||
}
|
||||
|
||||
// What tiles are around us.
|
||||
static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *current) {
|
||||
int i, r, dir;
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
|
||||
aystar->num_neighbours = 0;
|
||||
|
||||
// Go through all surrounding tiles and check if they are within the limits
|
||||
for (i=0;i<4;i++) {
|
||||
if (GET_TILE_X(_tiles_around[i] + current->path.node.tile) > 1 && GET_TILE_X(_tiles_around[i] + current->path.node.tile) < TILE_X_MAX - 1 &&
|
||||
GET_TILE_Y(_tiles_around[i] + current->path.node.tile) > 1 && GET_TILE_Y(_tiles_around[i] + current->path.node.tile) < TILE_Y_MAX - 1) {
|
||||
// We also directly test if the current tile can connect to this tile..
|
||||
// We do this simply by just building the tile!
|
||||
|
||||
// If the next step is a bridge, we have to enter it the right way
|
||||
if (!PathFinderInfo->rail_or_road && AI_PATHFINDER_IS_ROAD(current->path.node.tile + _tiles_around[i])) {
|
||||
if (IS_TILETYPE(current->path.node.tile + _tiles_around[i], MP_TUNNELBRIDGE)) {
|
||||
// An existing bridge... let's test the direction ;)
|
||||
if ((_map5[current->path.node.tile + _tiles_around[i]] & 1) != (i & 1)) continue;
|
||||
// This problem only is valid for tunnels:
|
||||
// When the last tile was not yet a tunnel, check if we enter from the right side..
|
||||
if (!IS_TILETYPE(current->path.node.tile, MP_TUNNELBRIDGE) && (_map5[current->path.node.tile + _tiles_around[i]] & 0x80) == 0) {
|
||||
if (i != (_map5[current->path.node.tile + _tiles_around[i]] & 3)) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// But also if we are on a bridge, we can only move a certain direction
|
||||
if (!PathFinderInfo->rail_or_road && AI_PATHFINDER_IS_ROAD(current->path.node.tile)) {
|
||||
if (IS_TILETYPE(current->path.node.tile, MP_TUNNELBRIDGE)) {
|
||||
// An existing bridge/tunnel... let's test the direction ;)
|
||||
if ((_map5[current->path.node.tile] & 1) != (i & 1)) continue;
|
||||
}
|
||||
}
|
||||
|
||||
if ((AI_PATHFINDER_FLAG_BRIDGE & current->path.node.user_data[0]) != 0 ||
|
||||
(AI_PATHFINDER_FLAG_TUNNEL & current->path.node.user_data[0]) != 0) {
|
||||
// We are a bridge/tunnel, how cool!!
|
||||
// This means we can only point forward.. get the direction from the user_data
|
||||
if (i != (current->path.node.user_data[0] >> 8)) continue;
|
||||
}
|
||||
dir = 0;
|
||||
|
||||
// First, check if we have a parent
|
||||
if (current->path.parent == NULL && current->path.node.user_data[0] == 0) {
|
||||
// If not, this means we are at the starting station
|
||||
if (PathFinderInfo->start_direction != AI_PATHFINDER_NO_DIRECTION) {
|
||||
// We do need a direction?
|
||||
if (AiNew_GetDirection(current->path.node.tile, current->path.node.tile + _tiles_around[i]) != PathFinderInfo->start_direction)
|
||||
// We are not pointing the right way, invalid tile
|
||||
continue;
|
||||
}
|
||||
} else if (current->path.node.user_data[0] == 0) {
|
||||
if (PathFinderInfo->rail_or_road) {
|
||||
// Rail check
|
||||
dir = AiNew_GetRailDirection(current->path.parent->node.tile, current->path.node.tile, current->path.node.tile + _tiles_around[i]);
|
||||
r = DoCommandByTile(current->path.node.tile, 0, dir, DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL);
|
||||
if (r == CMD_ERROR) continue;
|
||||
#ifdef AI_PATHFINDER_NO_90DEGREES_TURN
|
||||
if (current->path.parent->parent != NULL) {
|
||||
// Check if we don't make a 90degree curve
|
||||
int dir1 = AiNew_GetRailDirection(current->path.parent->parent->node.tile, current->path.parent->node.tile, current->path.node.tile);
|
||||
if (_illegal_curves[dir1] == dir || _illegal_curves[dir] == dir1) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
// Road check
|
||||
dir = AiNew_GetRoadDirection(current->path.parent->node.tile, current->path.node.tile, current->path.node.tile + _tiles_around[i]);
|
||||
if (AI_PATHFINDER_IS_ROAD(current->path.node.tile)) {
|
||||
if (IS_TILETYPE(current->path.node.tile, MP_TUNNELBRIDGE)) {
|
||||
// We have a bridge, how nicely! We should mark it...
|
||||
dir = 0;
|
||||
} else {
|
||||
// It already has road.. check if we miss any bits!
|
||||
if ((_map5[current->path.node.tile] & dir) != dir) {
|
||||
// We do miss some pieces :(
|
||||
dir &= ~_map5[current->path.node.tile];
|
||||
} else {
|
||||
dir = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Only destruct things if it is MP_CLEAR of MP_TREES
|
||||
if (dir != 0) {
|
||||
r = DoCommandByTile(current->path.node.tile, dir, 0, DC_AUTO | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
if (r == CMD_ERROR) continue;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// The tile can be connected
|
||||
aystar->neighbours[aystar->num_neighbours].tile = _tiles_around[i] + current->path.node.tile;
|
||||
aystar->neighbours[aystar->num_neighbours].user_data[0] = 0;
|
||||
aystar->neighbours[aystar->num_neighbours++].direction = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Next step, check for bridges and tunnels
|
||||
if (current->path.parent != NULL && current->path.node.user_data[0] == 0) {
|
||||
|
||||
TileInfo ti;
|
||||
// First we get the dir from this tile and his parent
|
||||
int dir = AiNew_GetDirection(current->path.parent->node.tile, current->path.node.tile);
|
||||
// It means we can only walk with the track, so the bridge has to be in the same direction
|
||||
TileIndex tile = current->path.node.tile;
|
||||
TileIndex new_tile = tile;
|
||||
|
||||
FindLandscapeHeightByTile(&ti, tile);
|
||||
|
||||
// Bridges can only be build on land that is not flat
|
||||
// And if there is a road or rail blocking
|
||||
if (ti.tileh != 0 ||
|
||||
(PathFinderInfo->rail_or_road && IS_TILETYPE(tile + _tiles_around[dir], MP_STREET)) ||
|
||||
(!PathFinderInfo->rail_or_road && IS_TILETYPE(tile + _tiles_around[dir], MP_RAILWAY))) {
|
||||
|
||||
for (;;) {
|
||||
new_tile += _tiles_around[dir];
|
||||
|
||||
// Precheck, is the length allowed?
|
||||
if (!CheckBridge_Stuff(0,GetBridgeLength(tile, new_tile))) break;
|
||||
|
||||
// Check if we hit the station-tile.. we don't like that!
|
||||
if (TILES_BETWEEN(new_tile,PathFinderInfo->end_tile_tl,PathFinderInfo->end_tile_br)) break;
|
||||
|
||||
// Try building the bridge..
|
||||
r = DoCommandByTile(tile, new_tile, (0<<8) + (MAX_BRIDGES / 2), DC_AUTO, CMD_BUILD_BRIDGE);
|
||||
if (r == CMD_ERROR) continue;
|
||||
// We can build a bridge here.. add him to the neighbours
|
||||
aystar->neighbours[aystar->num_neighbours].tile = new_tile;
|
||||
aystar->neighbours[aystar->num_neighbours].user_data[0] = AI_PATHFINDER_FLAG_BRIDGE + (dir << 8);
|
||||
aystar->neighbours[aystar->num_neighbours++].direction = 0;
|
||||
// We can only have 12 neighbours, and we need 1 left for tunnels
|
||||
if (aystar->num_neighbours == 11) break;
|
||||
}
|
||||
}
|
||||
|
||||
// Next, check for tunnels!
|
||||
// Tunnels can only be build with tileh of 3, 6, 9 or 12, depending on the direction
|
||||
// For now, we check both sides for this tile.. terraforming gives fuzzy result
|
||||
if ((dir == 0 && ti.tileh == 12) ||
|
||||
(dir == 1 && ti.tileh == 6) ||
|
||||
(dir == 2 && ti.tileh == 3) ||
|
||||
(dir == 3 && ti.tileh == 9)) {
|
||||
// Now simply check if a tunnel can be build
|
||||
r = DoCommandByTile(tile, (PathFinderInfo->rail_or_road?0:0x200), 0, DC_AUTO, CMD_BUILD_TUNNEL);
|
||||
FindLandscapeHeightByTile(&ti, _build_tunnel_endtile);
|
||||
if (r != CMD_ERROR && (ti.tileh == 3 || ti.tileh == 6 || ti.tileh == 9 || ti.tileh == 12)) {
|
||||
aystar->neighbours[aystar->num_neighbours].tile = _build_tunnel_endtile;
|
||||
aystar->neighbours[aystar->num_neighbours].user_data[0] = AI_PATHFINDER_FLAG_TUNNEL + (dir << 8);
|
||||
aystar->neighbours[aystar->num_neighbours++].direction = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern uint GetRailFoundation(uint tileh, uint bits);
|
||||
extern uint GetRoadFoundation(uint tileh, uint bits);
|
||||
extern uint GetBridgeFoundation(uint tileh, byte direction);
|
||||
enum {
|
||||
BRIDGE_NO_FOUNDATION = 1 << 0 | 1 << 3 | 1 << 6 | 1 << 9 | 1 << 12,
|
||||
};
|
||||
|
||||
// The most important function: it calculates the g-value
|
||||
static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent) {
|
||||
Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
int r, res = 0;
|
||||
TileInfo ti, parent_ti;
|
||||
|
||||
// Gather some information about the tile..
|
||||
FindLandscapeHeightByTile(&ti, current->tile);
|
||||
FindLandscapeHeightByTile(&parent_ti, parent->path.node.tile);
|
||||
|
||||
// Check if we hit the end-tile
|
||||
if (TILES_BETWEEN(current->tile,PathFinderInfo->end_tile_tl,PathFinderInfo->end_tile_br)) {
|
||||
// We are at the end-tile, check if we had a direction or something...
|
||||
if (PathFinderInfo->end_direction != AI_PATHFINDER_NO_DIRECTION && AiNew_GetDirection(current->tile, parent->path.node.tile) != PathFinderInfo->end_direction)
|
||||
// We are not pointing the right way, invalid tile
|
||||
return AYSTAR_INVALID_NODE;
|
||||
// If it was valid, drop out.. we don't build on the endtile
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Give everything a small penalty
|
||||
res += AI_PATHFINDER_PENALTY;
|
||||
|
||||
if (!PathFinderInfo->rail_or_road) {
|
||||
// Road has the lovely advantage it can use other road... check if
|
||||
// the current tile is road, and if so, give a good bonus
|
||||
if (AI_PATHFINDER_IS_ROAD(current->tile)) {
|
||||
res -= AI_PATHFINDER_ROAD_ALREADY_EXISTS_BONUS;
|
||||
}
|
||||
}
|
||||
|
||||
// We should give a penalty when the tile is going up or down.. this is one way to do so!
|
||||
// Too bad we have to count it from the parent.. but that is not so bad
|
||||
if (parent_ti.tileh != 0 && parent->path.parent != NULL) {
|
||||
// Skip if the tile was from a bridge or tunnel
|
||||
if (parent->path.node.user_data[0] == 0 && current->user_data[0] == 0) {
|
||||
if (PathFinderInfo->rail_or_road) {
|
||||
r = GetRailFoundation(parent_ti.tileh, 1 << AiNew_GetRailDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile));
|
||||
// Maybe is BRIDGE_NO_FOUNDATION a bit strange here, but it contains just the right information..
|
||||
if (r >= 15 || (r == 0 && (BRIDGE_NO_FOUNDATION & (1 << ti.tileh)))) {
|
||||
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
|
||||
}
|
||||
} else {
|
||||
if (!(AI_PATHFINDER_IS_ROAD(parent->path.node.tile) && IS_TILETYPE(parent->path.node.tile, MP_TUNNELBRIDGE))) {
|
||||
r = GetRoadFoundation(parent_ti.tileh, AiNew_GetRoadDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile));
|
||||
if (r >= 15 || r == 0)
|
||||
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Are we part of a tunnel?
|
||||
if ((AI_PATHFINDER_FLAG_TUNNEL & current->user_data[0]) != 0) {
|
||||
// Tunnels are very expensive when build on long routes..
|
||||
// Ironicly, we are using BridgeCode here ;)
|
||||
r = AI_PATHFINDER_TUNNEL_PENALTY * GetBridgeLength(current->tile, parent->path.node.tile);
|
||||
res += r + (r >> 8);
|
||||
}
|
||||
|
||||
// Are we part of a bridge?
|
||||
if ((AI_PATHFINDER_FLAG_BRIDGE & current->user_data[0]) != 0) {
|
||||
// That means for every length a penalty
|
||||
res += AI_PATHFINDER_BRIDGE_PENALTY * GetBridgeLength(current->tile, parent->path.node.tile);
|
||||
// Check if we are going up or down, first for the starting point
|
||||
// In user_data[0] is at the 8th bit the direction
|
||||
if (!(BRIDGE_NO_FOUNDATION & (1 << parent_ti.tileh))) {
|
||||
if (GetBridgeFoundation(parent_ti.tileh, (current->user_data[0] >> 8) & 1) < 15)
|
||||
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
}
|
||||
// Second for the end point
|
||||
if (!(BRIDGE_NO_FOUNDATION & (1 << ti.tileh))) {
|
||||
if (GetBridgeFoundation(ti.tileh, (current->user_data[0] >> 8) & 1) < 15)
|
||||
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
}
|
||||
if (parent_ti.tileh == 0)
|
||||
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
if (ti.tileh == 0)
|
||||
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
}
|
||||
|
||||
// To prevent the AI from taking the fastest way in tiles, but not the fastest way
|
||||
// in speed, we have to give a good penalty to direction changing
|
||||
// This way, we get almost the fastest way in tiles, and a very good speed on the track
|
||||
if (!PathFinderInfo->rail_or_road) {
|
||||
if (parent->path.parent != NULL &&
|
||||
AiNew_GetDirection(current->tile, parent->path.node.tile) != AiNew_GetDirection(parent->path.node.tile, parent->path.parent->node.tile)) {
|
||||
// When road exists, we don't like turning, but its free, so don't be to piggy about it
|
||||
if (AI_PATHFINDER_IS_ROAD(parent->path.node.tile))
|
||||
res += AI_PATHFINDER_DIRECTION_CHANGE_ON_EXISTING_ROAD_PENALTY;
|
||||
else
|
||||
res += AI_PATHFINDER_DIRECTION_CHANGE_PENALTY;
|
||||
}
|
||||
} else {
|
||||
// For rail we have 1 exeption: diagonal rail..
|
||||
// So we fetch 2 raildirection. That of the current one, and of the one before that
|
||||
if (parent->path.parent != NULL && parent->path.parent->parent != NULL) {
|
||||
int dir1 = AiNew_GetRailDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile);
|
||||
int dir2 = AiNew_GetRailDirection(parent->path.parent->parent->node.tile, parent->path.parent->node.tile, parent->path.node.tile);
|
||||
// First, see if we are on diagonal path, that is better then straight path
|
||||
if (dir1 > 1) { res -= AI_PATHFINDER_DIAGONAL_BONUS; }
|
||||
|
||||
// First see if they are different
|
||||
if (dir1 != dir2) {
|
||||
// dir 2 and 3 are 1 diagonal track, and 4 and 5.
|
||||
if (!(((dir1 == 2 || dir1 == 3) && (dir2 == 2 || dir2 == 3)) || ((dir1 == 4 || dir1 == 5) && (dir2 == 4 || dir2 == 5)))) {
|
||||
// It is not, so we changed of direction
|
||||
res += AI_PATHFINDER_DIRECTION_CHANGE_PENALTY;
|
||||
}
|
||||
if (parent->path.parent->parent->parent != NULL) {
|
||||
int dir3 = AiNew_GetRailDirection(parent->path.parent->parent->parent->node.tile, parent->path.parent->parent->node.tile, parent->path.parent->node.tile);
|
||||
// Check if we changed 3 tiles of direction in 3 tiles.. bad!!!
|
||||
if ((dir1 == 0 || dir1 == 1) && dir2 > 1 && (dir3 == 0 || dir3 == 1)) {
|
||||
res += AI_PATHFINDER_CURVE_PENALTY;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Res should never be below zero.. if so, make it zero!
|
||||
if (res < 0) { res = 0; }
|
||||
|
||||
// Return our value
|
||||
return res;
|
||||
}
|
||||
+668
-571
File diff suppressed because it is too large
Load Diff
+560
-510
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,25 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "airport.h"
|
||||
/* $Id$ */
|
||||
|
||||
AirportFTAClass *CountryAirport;
|
||||
AirportFTAClass *CityAirport;
|
||||
AirportFTAClass *Heliport, *Oilrig;
|
||||
AirportFTAClass *MetropolitanAirport;
|
||||
AirportFTAClass *InternationalAirport;
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "debug.h"
|
||||
#include "map.h"
|
||||
#include "airport.h"
|
||||
#include "macros.h"
|
||||
#include "variables.h"
|
||||
|
||||
static AirportFTAClass* CountryAirport;
|
||||
static AirportFTAClass* CityAirport;
|
||||
static AirportFTAClass* Oilrig;
|
||||
static AirportFTAClass* Heliport;
|
||||
static AirportFTAClass* MetropolitanAirport;
|
||||
static AirportFTAClass* InternationalAirport;
|
||||
|
||||
static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
|
||||
const byte nofterminals, const byte nofterminalgroups,
|
||||
const byte nofhelipads, const byte nofhelipadgroups,
|
||||
const byte *terminals, const byte *helipads,
|
||||
const byte entry_point, const byte acc_planes,
|
||||
const AirportFTAbuildup *FA,
|
||||
const TileIndex *depots);
|
||||
const TileIndexDiffC *depots, const byte nof_depots);
|
||||
static void AirportFTAClass_Destructor(AirportFTAClass *Airport);
|
||||
|
||||
static uint16 AirportGetNofElements(const AirportFTAbuildup *FA);
|
||||
@@ -22,31 +28,82 @@ static byte AirportTestFTA(const AirportFTAClass *Airport);
|
||||
/*static void AirportPrintOut(const AirportFTAClass *Airport, const bool full_report);
|
||||
static byte AirportBlockToString(uint32 block);*/
|
||||
|
||||
void InitializeAirports()
|
||||
void InitializeAirports(void)
|
||||
{
|
||||
// country airport
|
||||
CountryAirport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
|
||||
AirportFTAClass_Constructor(CountryAirport, 2, 1, 0, 0, 16, ALL, _airport_fta_country, _airport_depots_country);
|
||||
CountryAirport = malloc(sizeof(AirportFTAClass));
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
CountryAirport,
|
||||
_airport_terminal_country,
|
||||
NULL,
|
||||
16,
|
||||
ALL,
|
||||
_airport_fta_country,
|
||||
_airport_depots_country,
|
||||
lengthof(_airport_depots_country)
|
||||
);
|
||||
|
||||
// city airport
|
||||
CityAirport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
|
||||
AirportFTAClass_Constructor(CityAirport, 3, 1, 0, 0, 19, ALL, _airport_fta_city, _airport_depots_city);
|
||||
CityAirport = malloc(sizeof(AirportFTAClass));
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
CityAirport,
|
||||
_airport_terminal_city,
|
||||
NULL,
|
||||
19,
|
||||
ALL,
|
||||
_airport_fta_city,
|
||||
_airport_depots_city,
|
||||
lengthof(_airport_depots_city)
|
||||
);
|
||||
|
||||
// metropolitan airport
|
||||
MetropolitanAirport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
|
||||
AirportFTAClass_Constructor(MetropolitanAirport, 3, 1, 0, 0, 20, ALL, _airport_fta_metropolitan, _airport_depots_metropolitan);
|
||||
MetropolitanAirport = malloc(sizeof(AirportFTAClass));
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
MetropolitanAirport,
|
||||
_airport_terminal_metropolitan,
|
||||
NULL,
|
||||
20,
|
||||
ALL,
|
||||
_airport_fta_metropolitan,
|
||||
_airport_depots_metropolitan,
|
||||
lengthof(_airport_depots_metropolitan)
|
||||
);
|
||||
|
||||
// international airport
|
||||
InternationalAirport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
|
||||
AirportFTAClass_Constructor(InternationalAirport, 6, 2, 2, 1, 37, ALL, _airport_fta_international, _airport_depots_international);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
InternationalAirport,
|
||||
_airport_terminal_international,
|
||||
_airport_helipad_international,
|
||||
37,
|
||||
ALL,
|
||||
_airport_fta_international,
|
||||
_airport_depots_international,
|
||||
lengthof(_airport_depots_international)
|
||||
);
|
||||
|
||||
// heliport, oilrig
|
||||
Heliport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
|
||||
AirportFTAClass_Constructor(Heliport, 0, 0, 1, 1, 7, HELICOPTERS_ONLY, _airport_fta_heliport_oilrig, _airport_depots_heliport_oilrig);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
Heliport,
|
||||
NULL,
|
||||
_airport_helipad_heliport_oilrig,
|
||||
7,
|
||||
HELICOPTERS_ONLY,
|
||||
_airport_fta_heliport_oilrig,
|
||||
NULL,
|
||||
0
|
||||
);
|
||||
|
||||
Oilrig = Heliport; // exactly the same structure for heliport/oilrig, so share state machine
|
||||
}
|
||||
|
||||
void UnInitializeAirports()
|
||||
void UnInitializeAirports(void)
|
||||
{
|
||||
AirportFTAClass_Destructor(CountryAirport);
|
||||
AirportFTAClass_Destructor(CityAirport);
|
||||
@@ -56,12 +113,46 @@ void UnInitializeAirports()
|
||||
}
|
||||
|
||||
static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
|
||||
const byte nofterminals, const byte nofterminalgroups,
|
||||
const byte nofhelipads, const byte nofhelipadgroups,
|
||||
const byte *terminals, const byte *helipads,
|
||||
const byte entry_point, const byte acc_planes,
|
||||
const AirportFTAbuildup *FA,
|
||||
const TileIndex *depots)
|
||||
const TileIndexDiffC *depots, const byte nof_depots)
|
||||
{
|
||||
byte nofterminals, nofhelipads;
|
||||
byte nofterminalgroups = 0;
|
||||
byte nofhelipadgroups = 0;
|
||||
const byte * curr;
|
||||
int i;
|
||||
nofterminals = nofhelipads = 0;
|
||||
|
||||
//now we read the number of terminals we have
|
||||
if (terminals != NULL) {
|
||||
i = terminals[0];
|
||||
nofterminalgroups = i;
|
||||
curr = terminals;
|
||||
while (i-- > 0) {
|
||||
curr++;
|
||||
assert(*curr != 0); //we don't want to have an empty group
|
||||
nofterminals += *curr;
|
||||
}
|
||||
|
||||
}
|
||||
Airport->terminals = terminals;
|
||||
|
||||
//read helipads
|
||||
if (helipads != NULL) {
|
||||
i = helipads[0];
|
||||
nofhelipadgroups = i;
|
||||
curr = helipads;
|
||||
while (i-- > 0) {
|
||||
curr++;
|
||||
assert(*curr != 0); //no empty groups please
|
||||
nofhelipads += *curr;
|
||||
}
|
||||
|
||||
}
|
||||
Airport->helipads = helipads;
|
||||
|
||||
// if there are more terminals than 6, internal variables have to be changed, so don't allow that
|
||||
// same goes for helipads
|
||||
if (nofterminals > MAX_TERMINALS) { printf("Currently only maximum of %2d terminals are supported (you wanted %2d)\n", MAX_TERMINALS, nofterminals);}
|
||||
@@ -69,38 +160,32 @@ static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
|
||||
// terminals/helipads are divided into groups. Groups are computed by dividing the number
|
||||
// of terminals by the number of groups. Half in half. If #terminals is uneven, first group
|
||||
// will get the less # of terminals
|
||||
if (nofterminalgroups > nofterminals) { printf("# of terminalgroups (%2d) must be less or equal to terminals (%2d)", nofterminals, nofterminalgroups);}
|
||||
if (nofhelipadgroups > nofhelipads) { printf("# of helipadgroups (%2d) must be less or equal to helipads (%2d)", nofhelipads, nofhelipadgroups);}
|
||||
|
||||
assert(nofterminals <= MAX_TERMINALS);
|
||||
assert(nofhelipads <= MAX_HELIPADS);
|
||||
assert(nofterminalgroups <= nofterminals);
|
||||
assert(nofhelipadgroups <= nofhelipads);
|
||||
|
||||
Airport->nofelements = AirportGetNofElements(FA);
|
||||
// check
|
||||
if (entry_point >= Airport->nofelements) {printf("Entry point (%2d) must be within the airport positions (which is max %2d)\n", entry_point, Airport->nofelements);}
|
||||
assert(entry_point < Airport->nofelements);
|
||||
|
||||
Airport->nofterminals = nofterminals;
|
||||
Airport->nofterminalgroups = nofterminalgroups;
|
||||
Airport->nofhelipads = nofhelipads;
|
||||
Airport->nofhelipadgroups = nofhelipadgroups;
|
||||
Airport->acc_planes = acc_planes;
|
||||
Airport->entry_point = entry_point;
|
||||
Airport->airport_depots = (const uint16*)depots;
|
||||
Airport->airport_depots = depots;
|
||||
Airport->nof_depots = nof_depots;
|
||||
|
||||
|
||||
// build the state machine
|
||||
AirportBuildAutomata(Airport, FA);
|
||||
DEBUG(misc, 1) ("#Elements %2d; #Terminals %2d in %d group(s); #Helipads %2d in %d group(s)", Airport->nofelements,
|
||||
Airport->nofterminals, Airport->nofterminalgroups, Airport->nofhelipads, Airport->nofhelipadgroups);
|
||||
DEBUG(misc, 1) ("#Elements %2d; #Terminals %2d in %d group(s); #Helipads %2d in %d group(s); Entry Point %d",
|
||||
Airport->nofelements, nofterminals, nofterminalgroups, nofhelipads, nofhelipadgroups, Airport->entry_point
|
||||
);
|
||||
|
||||
|
||||
{
|
||||
byte _retval = AirportTestFTA(Airport);
|
||||
if (_retval != MAX_ELEMENTS) {printf("ERROR with element: %d\n", _retval-1);}
|
||||
assert(_retval == MAX_ELEMENTS);
|
||||
byte ret = AirportTestFTA(Airport);
|
||||
if (ret != MAX_ELEMENTS) printf("ERROR with element: %d\n", ret - 1);
|
||||
assert(ret == MAX_ELEMENTS);
|
||||
}
|
||||
// print out full information
|
||||
// true -- full info including heading, block, etc
|
||||
@@ -130,12 +215,13 @@ static uint16 AirportGetNofElements(const AirportFTAbuildup *FA)
|
||||
int i;
|
||||
uint16 nofelements = 0;
|
||||
int temp = FA[0].position;
|
||||
|
||||
for (i = 0; i < MAX_ELEMENTS; i++) {
|
||||
if (temp != FA[i].position) {
|
||||
nofelements++;
|
||||
temp = FA[i].position;
|
||||
}
|
||||
if (FA[i].position == MAX_ELEMENTS) {break;}
|
||||
if (FA[i].position == MAX_ELEMENTS) break;
|
||||
}
|
||||
return nofelements;
|
||||
}
|
||||
@@ -145,7 +231,7 @@ static void AirportBuildAutomata(AirportFTAClass *Airport, const AirportFTAbuild
|
||||
AirportFTA *FAutomata;
|
||||
AirportFTA *current;
|
||||
uint16 internalcounter, i;
|
||||
FAutomata = (AirportFTA *)malloc(sizeof(AirportFTA) * Airport->nofelements);
|
||||
FAutomata = malloc(sizeof(AirportFTA) * Airport->nofelements);
|
||||
Airport->layout = FAutomata;
|
||||
internalcounter = 0;
|
||||
|
||||
@@ -157,12 +243,13 @@ static void AirportBuildAutomata(AirportFTAClass *Airport, const AirportFTAbuild
|
||||
current->next_position = FA[internalcounter].next_in_chain;
|
||||
|
||||
// outgoing nodes from the same position, create linked list
|
||||
while (current->position == FA[internalcounter+1].position) {
|
||||
AirportFTA *newNode = (AirportFTA *)malloc(sizeof(AirportFTA));
|
||||
newNode->position = FA[internalcounter+1].position;
|
||||
newNode->heading = FA[internalcounter+1].heading;
|
||||
newNode->block = FA[internalcounter+1].block;
|
||||
newNode->next_position = FA[internalcounter+1].next_in_chain;
|
||||
while (current->position == FA[internalcounter + 1].position) {
|
||||
AirportFTA* newNode = malloc(sizeof(AirportFTA));
|
||||
|
||||
newNode->position = FA[internalcounter + 1].position;
|
||||
newNode->heading = FA[internalcounter + 1].heading;
|
||||
newNode->block = FA[internalcounter + 1].block;
|
||||
newNode->next_position = FA[internalcounter + 1].next_in_chain;
|
||||
// create link
|
||||
current->next_in_chain = newNode;
|
||||
current = current->next_in_chain;
|
||||
@@ -181,14 +268,14 @@ static byte AirportTestFTA(const AirportFTAClass *Airport)
|
||||
|
||||
for (i = 0; i < Airport->nofelements; i++) {
|
||||
position = Airport->layout[i].position;
|
||||
if (position != next_element) {return i;}
|
||||
if (position != next_element) return i;
|
||||
temp = &Airport->layout[i];
|
||||
|
||||
do {
|
||||
if (temp->heading > MAX_HEADINGS && temp->heading != 255) {return i;}
|
||||
if (temp->heading == 0 && temp->next_in_chain != 0) {return i;}
|
||||
if (position != temp->position) {return i;}
|
||||
if (temp->next_position >= Airport->nofelements) {return i;}
|
||||
if (temp->heading > MAX_HEADINGS && temp->heading != 255) return i;
|
||||
if (temp->heading == 0 && temp->next_in_chain != 0) return i;
|
||||
if (position != temp->position) return i;
|
||||
if (temp->next_position >= Airport->nofelements) return i;
|
||||
temp = temp->next_in_chain;
|
||||
} while (temp != NULL);
|
||||
next_element++;
|
||||
@@ -196,7 +283,8 @@ static byte AirportTestFTA(const AirportFTAClass *Airport)
|
||||
return MAX_ELEMENTS;
|
||||
}
|
||||
|
||||
static const char* const _airport_heading_strings[MAX_HEADINGS+2] = {
|
||||
#if 0
|
||||
static const char* const _airport_heading_strings[] = {
|
||||
"TO_ALL",
|
||||
"HANGAR",
|
||||
"TERM1",
|
||||
@@ -219,7 +307,6 @@ static const char* const _airport_heading_strings[MAX_HEADINGS+2] = {
|
||||
"DUMMY" // extra heading for 255
|
||||
};
|
||||
|
||||
/*
|
||||
static void AirportPrintOut(const AirportFTAClass *Airport, const bool full_report)
|
||||
{
|
||||
AirportFTA *temp;
|
||||
@@ -233,16 +320,18 @@ static void AirportPrintOut(const AirportFTAClass *Airport, const bool full_repo
|
||||
heading = (temp->heading == 255) ? MAX_HEADINGS+1 : temp->heading;
|
||||
printf("Pos:%2d NPos:%2d Heading:%15s Block:%2d\n", temp->position, temp->next_position,
|
||||
_airport_heading_strings[heading], AirportBlockToString(temp->block));
|
||||
} else {
|
||||
printf("P:%2d NP:%2d", temp->position, temp->next_position);
|
||||
}
|
||||
else { printf("P:%2d NP:%2d", temp->position, temp->next_position);}
|
||||
while (temp->next_in_chain != NULL) {
|
||||
temp = temp->next_in_chain;
|
||||
if (full_report) {
|
||||
heading = (temp->heading == 255) ? MAX_HEADINGS+1 : temp->heading;
|
||||
printf("Pos:%2d NPos:%2d Heading:%15s Block:%2d\n", temp->position, temp->next_position,
|
||||
_airport_heading_strings[heading], AirportBlockToString(temp->block));
|
||||
} else {
|
||||
printf("P:%2d NP:%2d", temp->position, temp->next_position);
|
||||
}
|
||||
else { printf("P:%2d NP:%2d", temp->position, temp->next_position);}
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
@@ -258,7 +347,8 @@ static byte AirportBlockToString(uint32 block)
|
||||
if (block & 0x0000000c) { block >>= 2; i += 2; }
|
||||
if (block & 0x00000002) { i += 1; }
|
||||
return i;
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
|
||||
const AirportFTAClass* GetAirport(const byte airport_type)
|
||||
{
|
||||
@@ -280,3 +370,14 @@ const AirportFTAClass* GetAirport(const byte airport_type)
|
||||
}
|
||||
return Airport;
|
||||
}
|
||||
|
||||
uint32 GetValidAirports(void)
|
||||
{
|
||||
uint32 bytemask = _avail_aircraft; /// sets the first 3 bytes, 0 - 2, @see AdjustAvailAircraft()
|
||||
|
||||
// 1980-1-1 is --> 21915
|
||||
// 1990-1-1 is --> 25568
|
||||
if (_date >= 21915) SETBIT(bytemask, 3); // metropilitan airport 1980
|
||||
if (_date >= 25568) SETBIT(bytemask, 4); // international airport 1990
|
||||
return bytemask;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef AIRPORT_H
|
||||
#define AIRPORT_H
|
||||
|
||||
@@ -13,7 +15,7 @@ enum {
|
||||
AT_HELIPORT = 2,
|
||||
AT_METROPOLITAN = 3,
|
||||
AT_INTERNATIONAL = 4,
|
||||
AT_OILRIG = 5
|
||||
AT_OILRIG = 15
|
||||
};
|
||||
|
||||
// do not change unless you change v->subtype too. This aligns perfectly with its current setting
|
||||
@@ -26,13 +28,12 @@ enum {
|
||||
// Finite sTate mAchine --> FTA
|
||||
typedef struct AirportFTAClass {
|
||||
byte nofelements; // number of positions the airport consists of
|
||||
byte nofterminals; // number of terminals this airport has
|
||||
byte nofterminalgroups; // terminals belong to so many groups (MAX is the nofterminals)
|
||||
byte nofhelipads; // number of helipads this airport has
|
||||
byte nofhelipadgroups; // helipads belong to so many groups (MAX is the nofhelipads)
|
||||
const byte *terminals;
|
||||
const byte *helipads;
|
||||
byte entry_point; // when an airplane arrives at this airport, enter it at position entry_point
|
||||
byte acc_planes; // accept airplanes or helicopters or both
|
||||
const uint16 *airport_depots; // gives the position of the depots on the airports
|
||||
const TileIndexDiffC *airport_depots; // gives the position of the depots on the airports
|
||||
byte nof_depots; // number of depots this airport has
|
||||
struct AirportFTA *layout; // state machine for airport
|
||||
} AirportFTAClass;
|
||||
|
||||
@@ -45,8 +46,15 @@ typedef struct AirportFTA {
|
||||
struct AirportFTA *next_in_chain; // possible extra movement choices from this position
|
||||
} AirportFTA;
|
||||
|
||||
void InitializeAirports();
|
||||
void UnInitializeAirports();
|
||||
void InitializeAirports(void);
|
||||
void UnInitializeAirports(void);
|
||||
const AirportFTAClass* GetAirport(const byte airport_type);
|
||||
|
||||
/** Get buildable airport bitmask.
|
||||
* @return get all buildable airports at this given time, bitmasked.
|
||||
* Bit 0 means the small airport is buildable, etc.
|
||||
* @todo set availability of airports by year, instead of airplane
|
||||
*/
|
||||
uint32 GetValidAirports(void);
|
||||
|
||||
#endif /* AIRPORT_H */
|
||||
|
||||
+94
-70
@@ -1,34 +1,41 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
#include "functions.h"
|
||||
#include "map.h"
|
||||
#include "window.h"
|
||||
#include "gui.h"
|
||||
#include "viewport.h"
|
||||
#include "gfx.h"
|
||||
#include "sound.h"
|
||||
#include "command.h"
|
||||
#include "vehicle.h"
|
||||
#include "station.h"
|
||||
#include "airport.h"
|
||||
#include "depot.h"
|
||||
|
||||
static byte _selected_airport_type;
|
||||
|
||||
static void ShowBuildAirportPicker();
|
||||
static void ShowBuildAirportPicker(void);
|
||||
|
||||
|
||||
static void CcBuildAirport(bool success, uint tile, uint32 p1, uint32 p2)
|
||||
void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (success) {
|
||||
SndPlayTileFx(0x1D, tile);
|
||||
SndPlayTileFx(SND_1F_SPLAT, tile);
|
||||
ResetObjectToPlace();
|
||||
}
|
||||
}
|
||||
|
||||
static void PlaceAirport(uint tile)
|
||||
static void PlaceAirport(TileIndex tile)
|
||||
{
|
||||
DoCommandP(tile, _selected_airport_type, 0, CcBuildAirport, CMD_BUILD_AIRPORT | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_A001_CAN_T_BUILD_AIRPORT_HERE));
|
||||
}
|
||||
|
||||
static void PlaceAir_DemolishArea(uint tile)
|
||||
static void PlaceAir_DemolishArea(TileIndex tile)
|
||||
{
|
||||
VpStartPlaceSizing(tile, 4);
|
||||
}
|
||||
@@ -36,50 +43,47 @@ static void PlaceAir_DemolishArea(uint tile)
|
||||
|
||||
static void BuildAirClick_Airport(Window *w)
|
||||
{
|
||||
if (HandlePlacePushButton(w, 2, 0xAA4, 1, PlaceAirport)) ShowBuildAirportPicker();
|
||||
if (HandlePlacePushButton(w, 3, SPR_CURSOR_AIRPORT, 1, PlaceAirport)) ShowBuildAirportPicker();
|
||||
}
|
||||
|
||||
static void BuildAirClick_Demolish(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 3, ANIMCURSOR_DEMOLISH, 1, PlaceAir_DemolishArea);
|
||||
HandlePlacePushButton(w, 4, ANIMCURSOR_DEMOLISH, 1, PlaceAir_DemolishArea);
|
||||
}
|
||||
|
||||
static void BuildAirClick_Lower(Window *w)
|
||||
static void BuildAirClick_Landscaping(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 4, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerLand);
|
||||
}
|
||||
|
||||
static void BuildAirClick_Raise(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 5, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseLand);
|
||||
}
|
||||
|
||||
static void BuildAirClick_Purchase(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 6, 0x12B8, 1, PlaceProc_BuyLand);
|
||||
ShowTerraformToolbar();
|
||||
}
|
||||
|
||||
typedef void OnButtonClick(Window *w);
|
||||
static OnButtonClick * const _build_air_button_proc[] = {
|
||||
BuildAirClick_Airport,
|
||||
BuildAirClick_Demolish,
|
||||
BuildAirClick_Lower,
|
||||
BuildAirClick_Raise,
|
||||
BuildAirClick_Purchase,
|
||||
BuildAirClick_Landscaping,
|
||||
};
|
||||
|
||||
static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
switch(e->event) {
|
||||
switch (e->event) {
|
||||
case WE_PAINT:
|
||||
DrawWindowWidgets(w);
|
||||
break;
|
||||
|
||||
case WE_CLICK:
|
||||
if (e->click.widget-2 >= 0)
|
||||
_build_air_button_proc[e->click.widget - 2](w);
|
||||
if (e->click.widget - 3 >= 0)
|
||||
_build_air_button_proc[e->click.widget - 3](w);
|
||||
break;
|
||||
|
||||
case WE_KEYPRESS: {
|
||||
switch (e->keypress.keycode) {
|
||||
case '1': BuildAirClick_Airport(w); break;
|
||||
case '2': BuildAirClick_Demolish(w); break;
|
||||
case 'l': BuildAirClick_Landscaping(w); break;
|
||||
default: return;
|
||||
}
|
||||
} break;
|
||||
|
||||
case WE_PLACE_OBJ:
|
||||
_place_proc(e->place.tile);
|
||||
break;
|
||||
@@ -96,87 +100,103 @@ static void BuildAirToolbWndProc(Window *w, WindowEvent *e)
|
||||
break;
|
||||
|
||||
case WE_ABORT_PLACE_OBJ:
|
||||
w->click_state = 0;
|
||||
UnclickWindowButtons(w);
|
||||
SetWindowDirty(w);
|
||||
w = FindWindowById(WC_BUILD_STATION, 0);
|
||||
if (w != 0)
|
||||
WP(w,def_d).close = true;
|
||||
break;
|
||||
|
||||
case WE_DESTROY:
|
||||
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const Widget _air_toolbar_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 129, 0, 13, STR_A000_AIRPORT_CONSTRUCT, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 41, 14, 35, 0x2E8, STR_A01E_BUILD_AIRPORT},
|
||||
{ WWT_PANEL, 7, 42, 63, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC},
|
||||
{ WWT_PANEL, 7, 64, 85, 14, 35, 0x2B7, STR_018E_LOWER_A_CORNER_OF_LAND},
|
||||
{ WWT_PANEL, 7, 86, 107, 14, 35, 0x2B6, STR_018F_RAISE_A_CORNER_OF_LAND},
|
||||
{ WWT_PANEL, 7, 108, 129, 14, 35, 0x12B7, STR_0329_PURCHASE_LAND_FOR_FUTURE},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 73, 0, 13, STR_A000_AIRPORTS, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, RESIZE_NONE, 7, 74, 85, 0, 13, 0x0, STR_STICKY_BUTTON},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 41, 14, 35, 0x2E8, STR_A01E_BUILD_AIRPORT},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 42, 63, 14, 35, 0x2BF, STR_018D_DEMOLISH_BUILDINGS_ETC},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 64, 85, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
|
||||
static const WindowDesc _air_toolbar_desc = {
|
||||
510, 22, 130, 36,
|
||||
640-86, 22, 86, 36,
|
||||
WC_BUILD_TOOLBAR,0,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
|
||||
_air_toolbar_widgets,
|
||||
BuildAirToolbWndProc
|
||||
};
|
||||
|
||||
void ShowBuildAirToolbar()
|
||||
void ShowBuildAirToolbar(void)
|
||||
{
|
||||
if (_current_player == OWNER_SPECTATOR) return;
|
||||
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
|
||||
AllocateWindowDescFront(&_air_toolbar_desc, 0);
|
||||
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
|
||||
}
|
||||
|
||||
static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
switch(e->event) {
|
||||
switch (e->event) {
|
||||
case WE_PAINT: {
|
||||
int sel;
|
||||
int rad = 4; // default catchment radious
|
||||
uint32 avail_airports;
|
||||
|
||||
if (WP(w,def_d).close)
|
||||
return;
|
||||
w->disabled_state = 0;
|
||||
if (WP(w,def_d).close) return;
|
||||
|
||||
sel = _selected_airport_type;
|
||||
// FIXME -- BuildAirportPickerWndProc - set availability of airports by year, instead of airplane
|
||||
if (!(_avail_aircraft & 1)) { w->disabled_state |= (1<<3); if (sel == AT_SMALL) sel = AT_LARGE; }
|
||||
if (!(_avail_aircraft & 2)) { w->disabled_state |= (1<<4); if (sel == AT_LARGE) sel = AT_SMALL; }
|
||||
if (!(_avail_aircraft & 4)) { w->disabled_state |= (1<<5); } // heliport
|
||||
// 1980-1-1 is --> 21915
|
||||
// 1990-1-1 is --> 25568
|
||||
if (_date < 21915) {w->disabled_state |= (1<<6);} // metropilitan airport 1980
|
||||
if (_date < 25568) {w->disabled_state |= (1<<7);} // international airport 1990
|
||||
avail_airports = GetValidAirports();
|
||||
|
||||
if (!HASBIT(avail_airports, 0) && sel == AT_SMALL) sel = AT_LARGE;
|
||||
if (!HASBIT(avail_airports, 1) && sel == AT_LARGE) sel = AT_SMALL;
|
||||
|
||||
/* 'Country Airport' starts at widget 3, and if its bit is set, it is
|
||||
* available, so take its opposite value to set the disabled_state. There
|
||||
* are only 5 available airports, so XOR with 0x1F (1 1111) */
|
||||
w->disabled_state = (avail_airports ^ 0x1F) << 3;
|
||||
|
||||
_selected_airport_type = sel;
|
||||
// select default the coverage area to 'Off' (8)
|
||||
w->click_state = ((1<<3) << sel) | ((1<<8) << _station_show_coverage);
|
||||
SetTileSelectSize(_airport_size_x[sel],_airport_size_y[sel]);
|
||||
if (_station_show_coverage) SetTileSelectBigSize(-4, -4, 8, 8);
|
||||
|
||||
if (_patches.modified_catchment) {
|
||||
switch (sel) {
|
||||
case AT_OILRIG: rad = CA_AIR_OILPAD; break;
|
||||
case AT_HELIPORT: rad = CA_AIR_HELIPORT; break;
|
||||
case AT_SMALL: rad = CA_AIR_SMALL; break;
|
||||
case AT_LARGE: rad = CA_AIR_LARGE; break;
|
||||
case AT_METROPOLITAN: rad = CA_AIR_METRO; break;
|
||||
case AT_INTERNATIONAL: rad = CA_AIR_INTER; break;
|
||||
}
|
||||
}
|
||||
|
||||
if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
|
||||
DrawWindowWidgets(w);
|
||||
// strings such as 'Size' and 'Coverage Area'
|
||||
DrawStringCentered(74, 16, STR_305B_SIZE, 0);
|
||||
DrawStringCentered(74, 78, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0);
|
||||
DrawStationCoverageAreaText(2, 104, (uint)-1);
|
||||
DrawStationCoverageAreaText(2, 104, (uint)-1, rad);
|
||||
break;
|
||||
}
|
||||
|
||||
case WE_CLICK: {
|
||||
switch(e->click.widget) {
|
||||
case 0:
|
||||
ResetObjectToPlace();
|
||||
break;
|
||||
switch (e->click.widget) {
|
||||
case 3: case 4: case 5: case 6: case 7:
|
||||
_selected_airport_type = e->click.widget - 3;
|
||||
SndPlayFx(0x13);
|
||||
SndPlayFx(SND_15_BEEP);
|
||||
SetWindowDirty(w);
|
||||
break;
|
||||
case 8: case 9:
|
||||
_station_show_coverage = e->click.widget - 8;
|
||||
SndPlayFx(0x13);
|
||||
SndPlayFx(SND_15_BEEP);
|
||||
SetWindowDirty(w);
|
||||
break;
|
||||
}
|
||||
@@ -190,20 +210,24 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
CheckRedrawStationCoverage(w);
|
||||
} break;
|
||||
|
||||
case WE_DESTROY:
|
||||
if (!WP(w,def_d).close) ResetObjectToPlace();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const Widget _build_airport_picker_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 147, 0, 13, STR_3001_AIRPORT_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 147, 14, 130, 0x0, STR_NULL},
|
||||
{WWT_NODISTXTBTN, 14, 2, 73, 27, 38, STR_3059_SMALL, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{WWT_NODISTXTBTN, 14, 74, 145, 27, 38, STR_305A_LARGE, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{WWT_NODISTXTBTN, 14, 2, 145, 63, 74, STR_306B_HELIPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{WWT_NODISTXTBTN, 14, 2, 145, 39, 50, STR_305AA_LARGE, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{WWT_NODISTXTBTN, 14, 2, 145, 51, 62, STR_305AB_LARGE, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{ WWT_CLOSEBOX, 14, 14, 73, 88, 98, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
|
||||
{ WWT_CLOSEBOX, 14, 74, 133, 88, 98, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3001_AIRPORT_SELECTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 130, 0x0, STR_NULL},
|
||||
{WWT_NODISTXTBTN, RESIZE_NONE, 14, 2, 73, 27, 38, STR_3059_SMALL, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{WWT_NODISTXTBTN, RESIZE_NONE, 14, 74, 145, 27, 38, STR_305A_LARGE, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{WWT_NODISTXTBTN, RESIZE_NONE, 14, 2, 145, 63, 74, STR_306B_HELIPORT, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{WWT_NODISTXTBTN, RESIZE_NONE, 14, 2, 145, 39, 50, STR_305AA_LARGE, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{WWT_NODISTXTBTN, RESIZE_NONE, 14, 2, 145, 51, 62, STR_305AB_LARGE, STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 88, 98, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 88, 98, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
@@ -215,12 +239,12 @@ static const WindowDesc _build_airport_desc = {
|
||||
BuildAirportPickerWndProc
|
||||
};
|
||||
|
||||
static void ShowBuildAirportPicker()
|
||||
static void ShowBuildAirportPicker(void)
|
||||
{
|
||||
AllocateWindowDesc(&_build_airport_desc);
|
||||
}
|
||||
|
||||
void InitializeAirportGui()
|
||||
void InitializeAirportGui(void)
|
||||
{
|
||||
_selected_airport_type = AT_SMALL;
|
||||
_last_built_aircraft_depot_tile = 0;
|
||||
|
||||
+24
-11
@@ -1,12 +1,9 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef AIRPORT_MOVEMENT_H
|
||||
#define AIRPORT_MOVEMENT_H
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "macros.h"
|
||||
|
||||
// don't forget to change the airport_depots too for larger mapsizes. TILE_X_BITS 16
|
||||
// won't fit in uint16 for example and overflow will occur in the checking code!
|
||||
// TrueLight -- So make it a TileIndex..
|
||||
|
||||
typedef struct AirportMovingData {
|
||||
int x,y;
|
||||
@@ -267,7 +264,8 @@ static const AirportMovingData _airport_moving_data_oilrig[9] = {
|
||||
/////**********Movement Machine on Airports*********************///////
|
||||
// first element of depots array tells us how many depots there are (to know size of array)
|
||||
// this may be changed later when airports are moved to external file
|
||||
static const TileIndex _airport_depots_country[] = {1, TILE_XY(3,0)};
|
||||
static const TileIndexDiffC _airport_depots_country[] = {{3, 0}};
|
||||
static const byte _airport_terminal_country[] = {1, 2};
|
||||
static const AirportFTAbuildup _airport_fta_country[] = {
|
||||
{ 0,HANGAR,NOTHING_block,1},
|
||||
{ 1,255,AIRPORT_BUSY_block,0}, {1,HANGAR,0,0}, {1,TERM1,TERM1_block,2}, {1,TERM2,0,4}, {1,HELITAKEOFF,0,19}, {1,0,0,6},
|
||||
@@ -297,7 +295,8 @@ static const AirportFTAbuildup _airport_fta_country[] = {
|
||||
{MAX_ELEMENTS,0,0,0} // end marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
static const TileIndex _airport_depots_city[] = {1, TILE_XY(5,0)};
|
||||
static const TileIndexDiffC _airport_depots_city[] = {{5, 0}};
|
||||
static const byte _airport_terminal_city[] = {1, 3};
|
||||
static const AirportFTAbuildup _airport_fta_city[] = {
|
||||
{ 0,HANGAR,NOTHING_block,1}, {0,TAKEOFF,OUT_WAY_block,1}, {0,0,0,1},
|
||||
{ 1,255,TAXIWAY_BUSY_block,0}, {1,HANGAR,0,0}, {1,TERM2,0,6}, {1,TERM3,0,6}, {1,0,0,7}, // for all else, go to 7
|
||||
@@ -331,7 +330,8 @@ static const AirportFTAbuildup _airport_fta_city[] = {
|
||||
{MAX_ELEMENTS,0,0,0} // end marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
static const TileIndex _airport_depots_metropolitan[] = {1, TILE_XY(5,0)};
|
||||
static const TileIndexDiffC _airport_depots_metropolitan[] = {{5, 0}};
|
||||
static const byte _airport_terminal_metropolitan[] = {1, 3};
|
||||
static const AirportFTAbuildup _airport_fta_metropolitan[] = {
|
||||
{ 0,HANGAR,NOTHING_block,1},
|
||||
{ 1,255,TAXIWAY_BUSY_block,0}, {1,HANGAR,0,0}, {1,TERM2,0,6}, {1,TERM3,0,6}, {1,0,0,7}, // for all else, go to 7
|
||||
@@ -367,7 +367,9 @@ static const AirportFTAbuildup _airport_fta_metropolitan[] = {
|
||||
{MAX_ELEMENTS,0,0,0} // end marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
static const TileIndex _airport_depots_international[] = {2, TILE_XY(0,3), TILE_XY(6,1)};
|
||||
static const TileIndexDiffC _airport_depots_international[] = {{0, 3}, {6, 1}};
|
||||
static const byte _airport_terminal_international[] = {2, 3, 3};
|
||||
static const byte _airport_helipad_international[] = {1, 2};
|
||||
static const AirportFTAbuildup _airport_fta_international[] = {
|
||||
{ 0,HANGAR,NOTHING_block,2}, {0,255,TERM_GROUP1_block,0}, {0,255,TERM_GROUP2_ENTER1_block,1}, {0,HELITAKEOFF,HELIPAD1_block,2}, {0,0,0,2},
|
||||
{ 1,HANGAR,NOTHING_block,3}, {1,255,HANGAR2_AREA_block,1}, {1,HELITAKEOFF,HELIPAD2_block,3}, {1,0,0,3},
|
||||
@@ -429,7 +431,8 @@ static const AirportFTAbuildup _airport_fta_international[] = {
|
||||
{MAX_ELEMENTS,0,0,0} // end marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
static const TileIndex _airport_depots_heliport_oilrig[] = {0};
|
||||
// heliports, oilrigs don't have depots
|
||||
static const byte _airport_helipad_heliport_oilrig[] = {1, 1};
|
||||
static const AirportFTAbuildup _airport_fta_heliport_oilrig[] = {
|
||||
{0,HELIPAD1,HELIPAD1_block,1},
|
||||
{1,HELITAKEOFF,NOTHING_block,0}, // takeoff
|
||||
@@ -444,12 +447,22 @@ static const AirportFTAbuildup _airport_fta_heliport_oilrig[] = {
|
||||
{MAX_ELEMENTS,0,0,0} // end marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
static const AirportMovingData * const _airport_moving_datas[6] = {
|
||||
static const AirportMovingData * const _airport_moving_datas[] = {
|
||||
_airport_moving_data_country, // Country Airfield (small) 4x3
|
||||
_airport_moving_data_town, // City Airport (large) 6x6
|
||||
_airport_moving_data_heliport, // Heliport
|
||||
_airport_moving_data_metropolitan, // Metropolitain Airport (large) - 2 runways
|
||||
_airport_moving_data_international, // International Airport (xlarge) - 2 runways
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
_airport_moving_data_oilrig // Oilrig
|
||||
};
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file has the core function for AyStar
|
||||
* AyStar is a fast pathfinding routine and is used for things like
|
||||
@@ -15,17 +17,19 @@
|
||||
*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "openttd.h"
|
||||
#include "aystar.h"
|
||||
// This looks in the Hash if a node exists in ClosedList
|
||||
// If so, it returns the PathNode, else NULL
|
||||
PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, AyStarNode *node) {
|
||||
static PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, AyStarNode *node)
|
||||
{
|
||||
return (PathNode*)Hash_Get(&aystar->ClosedListHash, node->tile, node->direction);
|
||||
}
|
||||
|
||||
// This adds a node to the ClosedList
|
||||
// It makes a copy of the data
|
||||
void AyStarMain_ClosedList_Add(AyStar *aystar, PathNode *node) {
|
||||
static void AyStarMain_ClosedList_Add(AyStar *aystar, PathNode *node)
|
||||
{
|
||||
// Add a node to the ClosedList
|
||||
PathNode *new_node = malloc(sizeof(PathNode));
|
||||
*new_node = *node;
|
||||
@@ -34,14 +38,16 @@ void AyStarMain_ClosedList_Add(AyStar *aystar, PathNode *node) {
|
||||
|
||||
// Checks if a node is in the OpenList
|
||||
// If so, it returns the OpenListNode, else NULL
|
||||
OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, AyStarNode *node) {
|
||||
static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, AyStarNode *node)
|
||||
{
|
||||
return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction);
|
||||
}
|
||||
|
||||
// Gets the best node from OpenList
|
||||
// returns the best node, or NULL of none is found
|
||||
// Also it deletes the node from the OpenList
|
||||
OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar) {
|
||||
static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar)
|
||||
{
|
||||
// Return the item the Queue returns.. the best next OpenList item.
|
||||
OpenListNode* res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue);
|
||||
if (res != NULL)
|
||||
@@ -52,7 +58,8 @@ OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar) {
|
||||
|
||||
// Adds a node to the OpenList
|
||||
// It makes a copy of node, and puts the pointer of parent in the struct
|
||||
void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, AyStarNode *node, int f, int g, int userdata) {
|
||||
static void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, AyStarNode *node, int f, int g)
|
||||
{
|
||||
// Add a new Node to the OpenList
|
||||
OpenListNode* new_node = malloc(sizeof(OpenListNode));
|
||||
new_node->g = g;
|
||||
@@ -101,7 +108,7 @@ int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *pare
|
||||
|
||||
// Check if this item is already in the OpenList
|
||||
if ((check = AyStarMain_OpenList_IsInList(aystar, current)) != NULL) {
|
||||
int i;
|
||||
uint i;
|
||||
// Yes, check if this g value is lower..
|
||||
if (new_g > check->g) return AYSTAR_DONE;
|
||||
aystar->OpenListQueue.del(&aystar->OpenListQueue, check, 0);
|
||||
@@ -115,7 +122,7 @@ int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *pare
|
||||
aystar->OpenListQueue.push(&aystar->OpenListQueue, check, new_f);
|
||||
} else {
|
||||
// A new node, add him to the OpenList
|
||||
AyStarMain_OpenList_Add(aystar, closedlist_parent, current, new_f, new_g, 0);
|
||||
AyStarMain_OpenList_Add(aystar, closedlist_parent, current, new_f, new_g);
|
||||
}
|
||||
|
||||
return AYSTAR_DONE;
|
||||
@@ -215,7 +222,7 @@ void AyStarMain_Clear(AyStar *aystar) {
|
||||
int AyStarMain_Main(AyStar *aystar) {
|
||||
int r, i = 0;
|
||||
// Loop through the OpenList
|
||||
// Quit if result is no AYSTAR_STILL_BUSY or is more then loops_per_tick
|
||||
// Quit if result is no AYSTAR_STILL_BUSY or is more than loops_per_tick
|
||||
while ((r = aystar->loop(aystar)) == AYSTAR_STILL_BUSY && (aystar->loops_per_tick == 0 || ++i < aystar->loops_per_tick)) { }
|
||||
#ifdef AYSTAR_DEBUG
|
||||
if (r == AYSTAR_FOUND_END_NODE)
|
||||
@@ -243,12 +250,14 @@ int AyStarMain_Main(AyStar *aystar) {
|
||||
* if wanted. You should make sure that clear() is called before adding nodes
|
||||
* if the AyStar has been used before (though the normal main loop calls
|
||||
* clear() automatically when the algorithm finishes
|
||||
* g is the cost for starting with this node.
|
||||
*/
|
||||
void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node) {
|
||||
void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g) {
|
||||
#ifdef AYSTAR_DEBUG
|
||||
printf("[AyStar] Starting A* Algorithm from node (%d, %d, %d)\n", GET_TILE_X(start_node->tile), GET_TILE_Y(start_node->tile), start_node->direction);
|
||||
printf("[AyStar] Starting A* Algorithm from node (%d, %d, %d)\n",
|
||||
TileX(start_node->tile), TileY(start_node->tile), start_node->direction);
|
||||
#endif
|
||||
AyStarMain_OpenList_Add(aystar, NULL, start_node, 0, 0, 0);
|
||||
AyStarMain_OpenList_Add(aystar, NULL, start_node, 0, g);
|
||||
}
|
||||
|
||||
void init_AyStar(AyStar* aystar, Hash_HashProc hash, uint num_buckets) {
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file has the header for AyStar
|
||||
* AyStar is a fast pathfinding routine and is used for things like
|
||||
@@ -27,7 +29,7 @@ enum{
|
||||
|
||||
typedef struct AyStarNode AyStarNode;
|
||||
struct AyStarNode {
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
uint direction;
|
||||
uint user_data[2];
|
||||
};
|
||||
@@ -56,6 +58,14 @@ typedef struct AyStar AyStar;
|
||||
* AYSTAR_FOUND_END_NODE : indicates this is the end tile
|
||||
* AYSTAR_DONE : indicates this is not the end tile (or direction was wrong)
|
||||
*/
|
||||
/*
|
||||
* The 2nd parameter should be OpenListNode, and NOT AyStarNode. AyStarNode is
|
||||
* part of OpenListNode and so it could be accessed without any problems.
|
||||
* The good part about OpenListNode is, and how AIs use it, that you can
|
||||
* access the parent of the current node, and so check if you, for example
|
||||
* don't try to enter the file tile with a 90-degree curve. So please, leave
|
||||
* this an OpenListNode, it works just fine -- TrueLight
|
||||
*/
|
||||
typedef int32 AyStar_EndNodeCheck(AyStar *aystar, OpenListNode *current);
|
||||
|
||||
/*
|
||||
@@ -89,7 +99,7 @@ typedef void AyStar_GetNeighbours(AyStar *aystar, OpenListNode *current);
|
||||
typedef void AyStar_FoundEndNode(AyStar *aystar, OpenListNode *current);
|
||||
|
||||
// For internal use, see aystar.c
|
||||
typedef void AyStar_AddStartNode(AyStar *aystar, AyStarNode* start_node);
|
||||
typedef void AyStar_AddStartNode(AyStar *aystar, AyStarNode* start_node, uint g);
|
||||
typedef int AyStar_Main(AyStar *aystar);
|
||||
typedef int AyStar_Loop(AyStar *aystar);
|
||||
typedef int AyStar_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
@@ -153,7 +163,7 @@ struct AyStar {
|
||||
};
|
||||
|
||||
|
||||
void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node);
|
||||
void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g);
|
||||
int AyStarMain_Main(AyStar *aystar);
|
||||
int AyStarMain_Loop(AyStar *aystar);
|
||||
int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *parent);
|
||||
@@ -166,4 +176,4 @@ void AyStarMain_Clear(AyStar *aystar);
|
||||
void init_AyStar(AyStar* aystar, Hash_HashProc hash, uint num_buckets);
|
||||
|
||||
|
||||
#endif
|
||||
#endif /* AYSTAR_H */
|
||||
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
#ifdef __BEOS__
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "hal.h"
|
||||
|
||||
// BeOS System Includes
|
||||
#include <MidiSynthFile.h>
|
||||
|
||||
BMidiSynthFile midiSynthFile;
|
||||
|
||||
static char *bemidi_start(char **parm) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void bemidi_stop(void) {
|
||||
midiSynthFile.UnloadFile();
|
||||
}
|
||||
|
||||
static void bemidi_play_song(const char *filename) {
|
||||
bemidi_stop();
|
||||
entry_ref midiRef;
|
||||
get_ref_for_path(filename, &midiRef);
|
||||
midiSynthFile.LoadFile(&midiRef);
|
||||
midiSynthFile.Start();
|
||||
}
|
||||
|
||||
static void bemidi_stop_song(void) {
|
||||
midiSynthFile.UnloadFile();
|
||||
}
|
||||
|
||||
static bool bemidi_is_playing(void) {
|
||||
if(midiSynthFile.IsFinished() == true)
|
||||
{
|
||||
return 0;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void bemidi_set_volume(byte vol) {
|
||||
fprintf(stderr, "BeMidi: Set volume not implemented\n");
|
||||
}
|
||||
|
||||
const HalMusicDriver _bemidi_music_driver = {
|
||||
bemidi_start,
|
||||
bemidi_stop,
|
||||
bemidi_play_song,
|
||||
bemidi_stop_song,
|
||||
bemidi_is_playing,
|
||||
bemidi_set_volume,
|
||||
};
|
||||
|
||||
#endif // __BEOS__
|
||||
@@ -0,0 +1,25 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file bridge.h Header file for bridges */
|
||||
|
||||
#ifndef BRIDGE_H
|
||||
#define BRIDGE_H
|
||||
|
||||
/** Struct containing information about a single bridge type
|
||||
*/
|
||||
typedef struct Bridge {
|
||||
byte avail_year; ///< the year in which the bridge becomes available
|
||||
byte min_length; ///< the minimum length of the bridge (not counting start and end tile)
|
||||
byte max_length; ///< the maximum length of the bridge (not counting start and end tile)
|
||||
uint16 price; ///< the relative price of the bridge
|
||||
uint16 speed; ///< maximum travel speed
|
||||
PalSpriteID sprite; ///< the sprite which is used in the GUI (possibly with a recolor sprite)
|
||||
StringID material; ///< the string that contains the bridge description
|
||||
PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
|
||||
byte flags; ///< bit 0 set: disable drawing of far pillars.
|
||||
} Bridge;
|
||||
|
||||
extern const Bridge orig_bridge[MAX_BRIDGES];
|
||||
extern Bridge _bridge[MAX_BRIDGES];
|
||||
|
||||
#endif /* BRIDGE_H */
|
||||
+56
-53
@@ -1,36 +1,40 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
/* $Id$ */
|
||||
|
||||
/** @file bridge_gui.c Graphical user interface for bridge construction*/
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "functions.h"
|
||||
#include "map.h"
|
||||
#include "window.h"
|
||||
#include "gui.h"
|
||||
#include "viewport.h"
|
||||
#include "gfx.h"
|
||||
#include "command.h"
|
||||
#include "sound.h"
|
||||
#include "variables.h"
|
||||
#include "bridge.h"
|
||||
|
||||
static struct BridgeData {
|
||||
int count;
|
||||
uint count;
|
||||
TileIndex start_tile;
|
||||
TileIndex end_tile;
|
||||
byte type;
|
||||
byte indexes[MAX_BRIDGES];
|
||||
int32 costs[MAX_BRIDGES];
|
||||
} _bridge;
|
||||
} _bridgedata;
|
||||
|
||||
extern const uint16 _bridge_type_price_mod[MAX_BRIDGES];
|
||||
|
||||
extern const PalSpriteID _bridge_sprites[MAX_BRIDGES];
|
||||
extern const uint16 _bridge_speeds[MAX_BRIDGES];
|
||||
extern const StringID _bridge_material[MAX_BRIDGES];
|
||||
|
||||
static void CcBuildBridge(bool success, uint tile, uint32 p1, uint32 p2)
|
||||
void CcBuildBridge(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (success) { SndPlayTileFx(0x25, tile); }
|
||||
if (success) SndPlayTileFx(SND_27_BLACKSMITH_ANVIL, tile);
|
||||
}
|
||||
|
||||
static void BuildBridge(Window *w, int i)
|
||||
{
|
||||
DeleteWindow(w);
|
||||
DoCommandP(_bridge.end_tile, _bridge.start_tile, _bridge.indexes[i] | (_bridge.type << 8), CcBuildBridge,
|
||||
DoCommandP(_bridgedata.end_tile, _bridgedata.start_tile,
|
||||
_bridgedata.indexes[i] | (_bridgedata.type << 8), CcBuildBridge,
|
||||
CMD_BUILD_BRIDGE | CMD_AUTO | CMD_MSG(STR_5015_CAN_T_BUILD_BRIDGE_HERE));
|
||||
}
|
||||
|
||||
@@ -38,25 +42,25 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
switch(e->event) {
|
||||
case WE_PAINT: {
|
||||
int i;
|
||||
uint i;
|
||||
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
for(i=0; i < 4 && i + w->vscroll.pos < _bridge.count; i++) {
|
||||
int ind = _bridge.indexes[i + w->vscroll.pos];
|
||||
for (i = 0; i < 4 && i + w->vscroll.pos < _bridgedata.count; i++) {
|
||||
const Bridge *b = &_bridge[_bridgedata.indexes[i + w->vscroll.pos]];
|
||||
|
||||
SET_DPARAM32(2, _bridge.costs[i + w->vscroll.pos]);
|
||||
SET_DPARAM16(1, (_bridge_speeds[ind] >> 4) * 10);
|
||||
SET_DPARAM16(0, _bridge_material[ind]);
|
||||
DrawSprite(_bridge_sprites[ind], 3, 15 + i * 22);
|
||||
SetDParam(2, _bridgedata.costs[i + w->vscroll.pos]);
|
||||
SetDParam(1, (b->speed >> 4) * 10);
|
||||
SetDParam(0, b->material);
|
||||
DrawSprite(b->sprite, 3, 15 + i * 22);
|
||||
|
||||
DrawString(44, 15 + i*22 , STR_500D, 0);
|
||||
DrawString(44, 15 + i * 22 , STR_500D, 0);
|
||||
}
|
||||
} break;
|
||||
|
||||
case WE_KEYPRESS: {
|
||||
uint i = e->keypress.keycode - '1';
|
||||
if (i < 9 && i < (uint)_bridge.count) {
|
||||
if (i < 9 && i < _bridgedata.count) {
|
||||
e->keypress.cont = false;
|
||||
BuildBridge(w, i);
|
||||
}
|
||||
@@ -65,9 +69,9 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
|
||||
}
|
||||
|
||||
case WE_CLICK:
|
||||
if (e->click.widget == 2) {
|
||||
if (e->click.widget == 2) {
|
||||
uint ind = ((int)e->click.pt.y - 14) / 22;
|
||||
if (ind < 4 && (ind += w->vscroll.pos) < (uint)_bridge.count)
|
||||
if (ind < 4 && (ind += w->vscroll.pos) < _bridgedata.count)
|
||||
BuildBridge(w, ind);
|
||||
}
|
||||
break;
|
||||
@@ -75,10 +79,10 @@ static void BuildBridgeWndProc(Window *w, WindowEvent *e)
|
||||
}
|
||||
|
||||
static const Widget _build_bridge_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 199, 0, 13, STR_100D_SELECT_RAIL_BRIDGE, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_MATRIX, 7, 0, 188, 14, 101, 0x401, STR_101F_BRIDGE_SELECTION_CLICK},
|
||||
{ WWT_SCROLLBAR, 7, 189, 199, 14, 101, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 199, 0, 13, STR_100D_SELECT_RAIL_BRIDGE, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_MATRIX, RESIZE_NONE, 7, 0, 187, 14, 101, 0x401, STR_101F_BRIDGE_SELECTION_CLICK},
|
||||
{ WWT_SCROLLBAR, RESIZE_NONE, 7, 188, 199, 14, 101, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
@@ -92,10 +96,10 @@ static const WindowDesc _build_bridge_desc = {
|
||||
|
||||
|
||||
static const Widget _build_road_bridge_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 199, 0, 13, STR_1803_SELECT_ROAD_BRIDGE, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_MATRIX, 7, 0, 188, 14, 101, 0x401, STR_101F_BRIDGE_SELECTION_CLICK},
|
||||
{ WWT_SCROLLBAR, 7, 189, 199, 14, 101, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 199, 0, 13, STR_1803_SELECT_ROAD_BRIDGE, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_MATRIX, RESIZE_NONE, 7, 0, 187, 14, 101, 0x401, STR_101F_BRIDGE_SELECTION_CLICK},
|
||||
{ WWT_SCROLLBAR, RESIZE_NONE, 7, 188, 199, 14, 101, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
@@ -108,57 +112,56 @@ static const WindowDesc _build_road_bridge_desc = {
|
||||
};
|
||||
|
||||
|
||||
void ShowBuildBridgeWindow(uint start, uint end, byte bridge_type)
|
||||
void ShowBuildBridgeWindow(TileIndex start, TileIndex end, byte bridge_type)
|
||||
{
|
||||
int j = 0;
|
||||
uint j = 0;
|
||||
int32 ret;
|
||||
uint16 errmsg;
|
||||
StringID errmsg;
|
||||
|
||||
DeleteWindowById(WC_BUILD_BRIDGE, 0);
|
||||
|
||||
_bridge.type = bridge_type;
|
||||
_bridge.start_tile = start;
|
||||
_bridge.end_tile = end;
|
||||
_bridgedata.type = bridge_type;
|
||||
_bridgedata.start_tile = start;
|
||||
_bridgedata.end_tile = end;
|
||||
|
||||
errmsg = 0xFFFF;
|
||||
errmsg = INVALID_STRING_ID;
|
||||
|
||||
// only query bridge building possibility once, result is the same for all bridges!
|
||||
// returns CMD_ERROR on failure, and priCe on success
|
||||
// returns CMD_ERROR on failure, and price on success
|
||||
ret = DoCommandByTile(end, start, (bridge_type << 8), DC_AUTO | DC_QUERY_COST, CMD_BUILD_BRIDGE);
|
||||
|
||||
if (ret == CMD_ERROR) {
|
||||
if (CmdFailed(ret)) {
|
||||
errmsg = _error_message;
|
||||
}
|
||||
// check which bridges can be built
|
||||
else {
|
||||
} else {
|
||||
// check which bridges can be built
|
||||
int bridge_len; // length of the middle parts of the bridge
|
||||
int tot_bridge_len; // total length of bridge
|
||||
int tot_bridgedata_len; // total length of bridge
|
||||
|
||||
// get absolute bridge length
|
||||
bridge_len = GetBridgeLength(start, end);
|
||||
tot_bridge_len = bridge_len + 2;
|
||||
tot_bridgedata_len = bridge_len + 2;
|
||||
|
||||
tot_bridge_len = CalcBridgeLenCostFactor(tot_bridge_len);
|
||||
tot_bridgedata_len = CalcBridgeLenCostFactor(tot_bridgedata_len);
|
||||
|
||||
for (bridge_type = 0; bridge_type != MAX_BRIDGES; bridge_type++) { // loop for all bridgetypes
|
||||
|
||||
if (CheckBridge_Stuff(bridge_type, bridge_len)) {
|
||||
const Bridge *b = &_bridge[bridge_type];
|
||||
// bridge is accepted, add to list
|
||||
// add to terraforming & bulldozing costs the cost of the bridge itself (not computed with DC_QUERY_COST)
|
||||
_bridge.costs[j] = ret + (((int64)tot_bridge_len * _price.build_bridge * _bridge_type_price_mod[bridge_type]) >> 8);
|
||||
_bridge.indexes[j] = bridge_type;
|
||||
_bridgedata.costs[j] = ret + (((int64)tot_bridgedata_len * _price.build_bridge * b->price) >> 8);
|
||||
_bridgedata.indexes[j] = bridge_type;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_bridge.count = j;
|
||||
_bridgedata.count = j;
|
||||
|
||||
if (j != 0) {
|
||||
Window *w = AllocateWindowDesc((_bridge.type & 0x80) ? &_build_road_bridge_desc : &_build_bridge_desc);
|
||||
Window *w = AllocateWindowDesc((_bridgedata.type & 0x80) ? &_build_road_bridge_desc : &_build_bridge_desc);
|
||||
w->vscroll.cap = 4;
|
||||
w->vscroll.count = (byte)j;
|
||||
} else {
|
||||
ShowErrorMessage(errmsg, STR_5015_CAN_T_BUILD_BRIDGE_HERE, GET_TILE_X(end) * 16, GET_TILE_Y(end) * 16);
|
||||
ShowErrorMessage(errmsg, STR_5015_CAN_T_BUILD_BRIDGE_HERE, TileX(end) * 16, TileY(end) * 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "callback_table.h"
|
||||
#include "functions.h"
|
||||
|
||||
// If you add a callback for DoCommandP, also add the callback in here
|
||||
// see below for the full list!
|
||||
// If you don't do it, it won't work across the network!!
|
||||
|
||||
/* aircraft_gui.c */
|
||||
CommandCallback CcBuildAircraft;
|
||||
CommandCallback CcCloneAircraft;
|
||||
|
||||
/* airport_gui.c */
|
||||
CommandCallback CcBuildAirport;
|
||||
|
||||
/* bridge_gui.c */
|
||||
CommandCallback CcBuildBridge;
|
||||
|
||||
/* dock_gui.c */
|
||||
CommandCallback CcBuildDocks;
|
||||
CommandCallback CcBuildCanal;
|
||||
|
||||
/* main_gui.c */
|
||||
CommandCallback CcPlaySound10;
|
||||
CommandCallback CcPlaceSign;
|
||||
CommandCallback CcTerraform;
|
||||
CommandCallback CcBuildTown;
|
||||
|
||||
/* rail_gui.c */
|
||||
CommandCallback CcPlaySound1E;
|
||||
CommandCallback CcRailDepot;
|
||||
CommandCallback CcStation;
|
||||
CommandCallback CcBuildRailTunnel;
|
||||
|
||||
/* road_gui.c */
|
||||
CommandCallback CcPlaySound1D;
|
||||
CommandCallback CcBuildRoadTunnel;
|
||||
CommandCallback CcRoadDepot;
|
||||
|
||||
/* roadveh_gui.c */
|
||||
CommandCallback CcBuildRoadVeh;
|
||||
CommandCallback CcCloneRoadVeh;
|
||||
|
||||
/* ship_gui.c */
|
||||
CommandCallback CcBuildShip;
|
||||
CommandCallback CcCloneShip;
|
||||
|
||||
/* train_gui.c */
|
||||
CommandCallback CcBuildWagon;
|
||||
CommandCallback CcBuildLoco;
|
||||
CommandCallback CcCloneTrain;
|
||||
|
||||
CommandCallback *_callback_table[] = {
|
||||
/* 0x00 */ NULL,
|
||||
/* 0x01 */ CcBuildAircraft,
|
||||
/* 0x02 */ CcBuildAirport,
|
||||
/* 0x03 */ CcBuildBridge,
|
||||
/* 0x04 */ CcBuildCanal,
|
||||
/* 0x05 */ CcBuildDocks,
|
||||
/* 0x06 */ CcBuildLoco,
|
||||
/* 0x07 */ CcBuildRoadVeh,
|
||||
/* 0x08 */ CcBuildShip,
|
||||
/* 0x09 */ CcBuildTown,
|
||||
/* 0x0A */ CcBuildRoadTunnel,
|
||||
/* 0x0B */ CcBuildRailTunnel,
|
||||
/* 0x0C */ CcBuildWagon,
|
||||
/* 0x0D */ CcRoadDepot,
|
||||
/* 0x0E */ CcRailDepot,
|
||||
/* 0x0F */ CcPlaceSign,
|
||||
/* 0x10 */ CcPlaySound10,
|
||||
/* 0x11 */ CcPlaySound1D,
|
||||
/* 0x12 */ CcPlaySound1E,
|
||||
/* 0x13 */ CcStation,
|
||||
/* 0x14 */ CcTerraform,
|
||||
/* 0x15 */ CcCloneAircraft,
|
||||
/* 0x16 */ CcCloneRoadVeh,
|
||||
/* 0x17 */ CcCloneShip,
|
||||
/* 0x18 */ CcCloneTrain,
|
||||
};
|
||||
|
||||
const int _callback_table_count = lengthof(_callback_table);
|
||||
@@ -0,0 +1,11 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef CALLBACK_TABLE_H
|
||||
#define CALLBACK_TABLE_H
|
||||
|
||||
#include "functions.h"
|
||||
|
||||
extern CommandCallback *_callback_table[];
|
||||
extern const int _callback_table_count;
|
||||
|
||||
#endif /* CALLBACK_TABLE_H */
|
||||
+483
@@ -1,3 +1,486 @@
|
||||
0.4.5 (2006-01-31)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- Feature: [newgrf] Implement varaction2 property 0x41 and 0xDA. (2361)
|
||||
- Feature: giving server_ip a value of 'all' will make the server listen on any interface (2374)
|
||||
- Feature: shortcut CTRL + U that clears the current input-box (2385)
|
||||
- Feature: [newgrf] Implement the mechanism for handling newgrf callbacks (2389)
|
||||
- Feature: [newgrf] Implement the 'refit capacity' callback (2389)
|
||||
- Feature: saving games happen in a seperate thread (2391)
|
||||
- Feature: [newgrf] Implement powered wagons, and the callback that goes with it (2414)
|
||||
- Feature: [newgrf] Implement shorter train vehicles (2428)
|
||||
- Feature: New display option: 'transparent station signs' (2438)
|
||||
- Feature: You can now give transfer order to set up feeder systems (2441)
|
||||
- Feature: Removing tracks with the 'remove' tool, automatically removes signals on the tracks (2469)
|
||||
- Feature: [localisation] Allow changing the order of parameters in translated strings (2573)
|
||||
- Feature: [localisation] New way to specify plural forms (2592)
|
||||
- Feature: [localisation] Support genders (2594)
|
||||
- Feature: [localisation] Support cases (2597)
|
||||
- Feature: add support for truncating strings to a given (pixel) length (2607)
|
||||
- Feature: Overhaul DirectMusic MIDI backend, remove "experimental" status (2712)
|
||||
- Feature: Change the driver probing algorithm: Use the first music/sound/video which succeeds initialising instead of bailing out after the first. No need to specify -snull if no soundcard is present anymore (2728)
|
||||
- Feature: The Main Toolbar Dropdown Menu can now display disabled items (2734)
|
||||
- Feature: Clone vehicles (2764)
|
||||
- Feature: When starting without a config file determine the language on basis of the current locale (2777)
|
||||
- Feature: [NewGRF] Add support for "extended bytes" (2872)
|
||||
- Feature: [localisation] Major step twoards ISO-8859-15: Implement missing characters (2879)
|
||||
- Feature: Implement the console command rm to remove savegames (2941)
|
||||
- Feature: Danish town names (2957)
|
||||
- Feature: Menu option to toggle console (2958)
|
||||
- Feature: Calculate proportions of non-square giant screenshot correctly (2963)
|
||||
- Feature: [newgrf] Implement current set of action D (ParamSet) operations (2968)
|
||||
- Feature: [newgrf] Show a wagon's speed limit in purchase list (2969)
|
||||
- Feature: [newgrf] Support loading VarAction2 parameter for variables 0x60-0x7F (2971)
|
||||
- Feature: [newgrf] Add patch option for wagon speed limits (2982)
|
||||
- Feature: [newgrf] Support loading of bridge attributes and tables from GRF (3004)
|
||||
- Feature: Native Support for Win64 (3008)
|
||||
- Feature: OSX now uses quicktime to play midi files (3022)
|
||||
- Feature: [OSX] Command+Q now works in main menu (3027)
|
||||
- Feature: Allow unbanning players based on banlist-id (as well as IP) (3067)
|
||||
- Feature: 'status' and 'clients' now show the IP of the players (3067)
|
||||
- Feature: Make it possible to create a screenshot from the console that is both big and has no console, or any combination of (3068)
|
||||
- Feature: [newgrf] Add support for rail vehicle weight greater than 255 tons (3071)
|
||||
- Feature: 'HOME' icon to saveload dialogs that jumps to the default save/load directory based on the dialog (3096)
|
||||
- Feature: Turkish translation (3120)
|
||||
- Feature: [newgrf] Support positioning of rail vehicle visual effects (3132)
|
||||
- Feature: [newgrf] Support for articulated rail vehicles (3139)
|
||||
- Feature: [newgrf] Add support for cargo refitting specification by cargo classes (3148)
|
||||
- Feature: [newgrf] Action 7/9 new value : is it TTDPatch or OpenTTD? (3152)
|
||||
- Feature: Drag and drop rocky areas in scenario editor (3153)
|
||||
- Feature: Added patch option to link the terraform toolbar to the rail, road, water and airport toolbars (3157)
|
||||
- Feature: Right-Click-Scrolling optionally moves in the opposite direction (3222)
|
||||
- Feature: Native cocoa sound and video drivers for OSX (3281)
|
||||
- Feature: [newgrf] Allow train running cost class to differ from engine class (3388)
|
||||
- Feature: Kick and ban now with IP numbers (3407)
|
||||
- Feature: Allow seeing and setting the maximum amount of companies and spectators for a server. This can be changed/viewed during runtime as well in the console (3427)
|
||||
- Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending) (3441)
|
||||
- Feature: Make it possible to ban offline clients (3469)
|
||||
- Fix: The refit window now shows the correct refit options (2365)
|
||||
- Fix: Refitting to a cargo which is already carried by some vehicles takes their capacities into account for display (2365)
|
||||
- Fix: Add 'multihead' TTDPatch option to OpenTTD newgrf flags-emulation (2368)
|
||||
- Fix: make install tried to install scenarios in the (non-existing) personal dir when USE_HOMEDIR is specified (2371)
|
||||
- Fix: [console] update the example scripts in the scripts/ directory to reflect the new console functionality (2372)
|
||||
- Fix: [console] any line starting with a '#' is a comment so ignore it (2372)
|
||||
- Fix: [console] The special variables whose value can only be set by a custom process should, also print out their newly set value there (2372)
|
||||
- Fix: [newgrf] Ignore action 0 prop 0x20 (air drag) (2377)
|
||||
- Fix: [newgrf] Further property stubs, help prevents subsequent incorrect reading of newgrf data (2378)
|
||||
- Fix: Build year for mail compartment of planes was not set correctly, affected station ratings (2380)
|
||||
- Fix: Endgame window on easy difficulty resulted in infinite loop (2381)
|
||||
- Fix: Check the airport type when building an airport (2382)
|
||||
- Fix: Monkey-testing turned up some command crashes (2383)
|
||||
- Fix: Check selling land and setting player colour. Also an extra map-bounds check for terraforming (2384)
|
||||
- Fix: [realistic accel] Very slow trains no longer get an increase in maximum speed when part of them is in a depot (2388)
|
||||
- Fix: [newgrf] Load power for dual-headed engines correctly (2400)
|
||||
- Fix: [newgrf] When resolving callbacks, dont ignore wagon overrides (2410)
|
||||
- Fix: Station ratings aren't affected by speed limits from realistic acceleration anymore (2411)
|
||||
- Fix: building vehicles without depot crashed the game (2412)
|
||||
- Fix: certain resolutions caused a crash when minimap was partly dragged outside the game window (2424)
|
||||
- Fix: Deleting canals under bridges removed bridges first in certain configurations (2436)
|
||||
- Fix: [NPF] Vehicles try to drive into a tunnel entrance from above (2471)
|
||||
- Fix: [newgrf] Some road vehicle action 0 properties were loaded as the wrong type (int8,int16,int32) causing undefined results. (like cargo types being wrong) (2474)
|
||||
- Fix: The console variable autoclean_unprotected was linked to the variable _network_autoclean_protected (2498)
|
||||
- Fix: Old bug in the PCX writer: The first pixel column contained garbage, the picture was shifted one to the right, and the last column was dropped (2512)
|
||||
- Fix: Using the mouse wheel could lead to a crash if mouse was not over a widget (2530)
|
||||
- Fix: blinking 'lock' gfx in multiplayer games (2548)
|
||||
- Fix: Remove original train pathfinder. Enhanced old pathfinder. (2553)
|
||||
- Fix: Spaces in the path to the MIDI files caused the win32 MIDI player to fail (2563)
|
||||
- Fix: set server map name to the loaded name of the game/scenario (2610)
|
||||
- Fix: Improve the old pathfinder. Changed it to A* instead of Dijkstra. Benchmark shows that NTP is now around 10x faster than NPF (2635)
|
||||
- Fix: Correctly save and load company_value, it's 64 bits wide, not 32 bits (2684)
|
||||
- Fix: Volume control works now for the DirectMusic MIDI backend (2712)
|
||||
- Fix: Change the fence algorithm so it removes fences when no farm tile is adjacent (2739)
|
||||
- Fix: Tree tiles above the snow line got redrawn disproportionately often (2750)
|
||||
- Fix: Depots could build trains of the wrong track type (2764)
|
||||
- Fix: Sort the directories in the scenarion/savegame list (2860)
|
||||
- Fix: On OS/2 show the trailing \ if the current directory is a root directory (2860)
|
||||
- Fix: Return a proper version number, when testing the TTDPatch version in the SkipIf action (2862)
|
||||
- Fix: Change the way NewGRFs are loaded, this saves quite some sprite slots - about 2000 for DBSetXL for example (2868)
|
||||
- Fix: Several format string vulnerabilities and buffer overflows in the network code (2899)
|
||||
- Fix: fixed issue where autorenewed vehicles didn't get all stats updated (2912)
|
||||
- Fix: Exit the child of the extmidi backend with _exit() instead of exit(), because we don't want any atexit handlers - especially flushing output streams - to run, if exec() fails (2938)
|
||||
- Fix: Server crash with "say"-command (2950)
|
||||
- Fix: Fix win32 midi volume level control which didn't work (2960)
|
||||
- Fix: [OSX] quitting the game no longer leaves a process behind that eats all the CPU power (3281)
|
||||
- Fix: Fix for [ 1216203 ] UFO-broken waypoint (2961)
|
||||
- Fix: [newgrf] Include missing grf feature canal
|
||||
- Fix: [newgrf] Add bounds checking to VehicleChangeInfo for vehicles
|
||||
- Fix: [newgrf] Wagon speed limits don't apply for wagons with livery overrides
|
||||
- Fix: Align settings pool items to the size of void* to fix bus errors on 64bit architectures which require aligned variables (2976)
|
||||
- Fix: restart_game_date is an UINT16, not a BYTE. Now setting the game restart year via the console should work (2987)
|
||||
- Fix: [newgrf] Some GRF files don't specify a name or description, in which case the Action 8 is 8 bytes, not 9 (3005)
|
||||
- Fix: The finnish markka was never abbreviated with capital letters (3021)
|
||||
- Fix: Improve handling of non-existent sprite sets (3044)
|
||||
- Fix: Don't attempt to map and empty sprite group to a vehicle (3045)
|
||||
- Fix: Fixed typo and hang for BeOS Networking (3053)
|
||||
- Fix: On Win98 and lower when you go to the root directory of a drive (eg. C:\) you were stuck there indefinitely and couldn't change any directories or see any files (3056)
|
||||
- Fix: Complete rewrite of autoreplace; multiheaded train engines are replaced correctly (3081)
|
||||
- Fix: A new train is now made if the front unit is an engine and the former front engine is moved away (3144)
|
||||
- Fix: There are only 2 possible directions for ship depots, not 4 (3199)
|
||||
- Fix: Allow bribing up to the maximum rating for bribing, don't disable this option at some arbitrary value early (3201)
|
||||
- Fix: Don't lower land on tunnel, even with diag tracks on it (3228)
|
||||
- Fix: Crash when making a screenshotin the main menu (3235)
|
||||
- Fix: Crash when starting a scenarion via 'New Game' fails (3235)
|
||||
- Fix: Determine clicked status of sticky icon from window flags rather than the widget click state (3247)
|
||||
- Fix: Graphical glitch with autorail tool on a certain tile-types (3254)
|
||||
- Fix: Center the X of the window close button (3302)
|
||||
- Fix: [newgrf] Unload engine names before loading grf files (3316)
|
||||
- Fix: Network window crash when it receives invalid information for example from the integrated nightly, so validate the network-input when it is received (3322)
|
||||
- Fix: Build failed if SDL is built without pthread support (3326)
|
||||
- Fix: Move initialization of vehicle random_bits to DC_EXEC blocks to allow use of Random() instead of InteractiveRandom(), which will alleviate some possib le network desyncs (3352)
|
||||
- Fix: The default AI tried to change the service intervals of vehicles via the CMD_CHANGE_TRAIN_SERVICE_INT command - regardless of the type of the vehicle (3367)
|
||||
- Fix: Out-of-bounds array access when road vehicles overtook in a curve caused desyncs (3371)
|
||||
- Fix: Update signal states when building or removing rail station blocks (3372)
|
||||
- Fix: Don't allow trains to get bigger than 100 via drag and drop (3374)
|
||||
- Fix: Don't reset date in the scenario editor when pressing RandomLand (3376)
|
||||
- Fix: [newgrf] Running cost should be halved for dual head vehicles (3384)
|
||||
- Fix: No fence was placed when placing fences and the neighbouring tile is a rail configuration which permits a fence but has a signal (3389)
|
||||
- Fix: [newgrf] Ignore non-climate dependent cargo types (3394)
|
||||
- Fix: [newgrf] Only add a random number of days to an engine's base introduction date if that date is not 0 (3410)
|
||||
- Fix: When changing the server password via the console, actually set the password as well as flag whether it is required (3411)
|
||||
- Fix: Under certain conditions placing a road tile parallel under a bridge would, instead of failing, succeed and place a perpendicular piece (3413)
|
||||
- Fix: Disable the Fund New Industry menu item and window when connected to a server as a spectator (3414)
|
||||
- Fix: Disable the clone and refit buttons in the train view when viewing another player's vehicles, or as a spectator (3415)
|
||||
- Fix: Disallow building an oil rig above sea level (3416)
|
||||
- Fix: When removing a town-owned tunnel the player's rating was not reduced (3418)
|
||||
- Fix: (Possible) game crash on removing track/road under bridge if a vehicle was on the track/road under the bridge and the track/road sloped (3419)
|
||||
- Fix: [newgrf] Only power should decide whether a rail vehicle is an engine or a wagon. (fixes SHIKI 810 in jpsetw.grf) (3424)
|
||||
- Fix: Incorrect validating of tree-planting command which can allow a buffer-overflow (3446)
|
||||
- Fix: [newgrf] When changing the sprite ID of a vehicle, if it is not FD (custom graphics), the value needs to changed from a 16bit array offset to an array index. (fixes tropicstw.grf) (3449)
|
||||
- Fix: You couldn't remove an item from a list-type of config ingame from the configuration file (3475)
|
||||
- Fix: [newgrf] Always reinitialize the ttdpatch flags as patch settings may have changed (3486)
|
||||
- Fix: Price for demolishing a bridge was dependent on orientation and map size (3487)
|
||||
|
||||
|
||||
0.4.0.1 (2005-05-21)
|
||||
------------------------------------------------------------------------
|
||||
|
||||
- Feature: Add 'clear' command and CTRL+L to empty console window
|
||||
- Feature: add the possibility to print out the current debug-level
|
||||
- Fix: [MacOSX] default path for midi player on mac is now correct again
|
||||
- Fix: Updated makefile for FreeBSD
|
||||
- Fix: Text overflows in about box
|
||||
- Fix: Link error while compiling as dedicated server
|
||||
- Fix: Do not execute empty commands
|
||||
- Fix: Make OpenTTD icon look good on Win2K and earlier
|
||||
- Fix: NetworkUDPRemoveAdvertise wasn't completely correct
|
||||
- Fix: Signs in multiplayer didn't work
|
||||
- Fix: Dedicated server desyncs
|
||||
- Fix: [ 1197216 ] Error: !invalid string id 0 in GetString, dedicated server endgame crash
|
||||
- Fix: Don't allow things to be renamed to nothing
|
||||
- Fix: Windows installer deletes spritecache files on uninstall
|
||||
- Fix: Depot window did not get redrawn when a non-train-engine was sold
|
||||
- Fix: Do not scroll the game with the arrow keys when the chatbox is open
|
||||
- Fix: Remove warning from release build when assertions are no longer active
|
||||
- Fix: It was possible to open more than one tree window
|
||||
|
||||
|
||||
0.4.0 (2005-05-15)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: Bigger maps. Enjoy playing up to 2028x2048 (64 times as big as you were used to!)
|
||||
- Feature: New realistic acceleration; should be much better. Inlcudes gigger penalty on narrow curves and speedlimits in depots/stations
|
||||
- Feature: It is now possible to build multiple road stations (up to 8) on a single station (multibus).
|
||||
- Feature: New PathFinder (NPF). Support for train/road and ship based on A*. No more braindead pathfinding
|
||||
- Feature: Dynamic towns/industries/stations/vehicles/signs/orders/everything, up to 64K
|
||||
- Feature: Brand new OldLoader so OpenTTD is TTD(Patch) compatible again. Also endian safe
|
||||
- Feature: Even better newgrf support, except for callbacks, everything works (ok, almost)
|
||||
- Feature: Improved multiplayer. More console options, less desyncs and more fun
|
||||
- Feature: Protected OpenTTD from interference of hacked clients, so it should be safe to play again.
|
||||
- Feature: [ 1093261 ] Saving vehicle sorting criteria for each vehicle type
|
||||
- Feature: [ 1107690 ] Resizable orders GUI
|
||||
- Feature: [ 1166978 ] Focus keyboard on input-box in Multiplayer Menu
|
||||
- Feature: [ 1174313 ] terrain hotkeys nonfunctional in scenario editor (D,Q,W,E,R,T,Y,U fltr)
|
||||
- Feature: Complete rework of console and new commands like ls, save, load, help, etc.
|
||||
- Feature: Signs are shown in the colour of the player who created them
|
||||
- Feature: Add cheat option to set production of raw-material industries in game
|
||||
- Feature: Replace trian GUI remembers railtype selected from the dropdown menu
|
||||
- Feature: Improved Autoreplace
|
||||
- Feature: many more smaller features :D
|
||||
- Fix: [ 1108618 ] A wrong error message was displayed when trying to
|
||||
- Fix: [ 1110407 ] Game does not crash any more when a newgrf file doesn't exist
|
||||
- Fix: [ 1112469 ] Clearing land for free by reallocating HQ
|
||||
- Fix: [ 1112469 ] Clearing land for free by reallocating HQ
|
||||
- Fix: [ 1113037 ] crash when accessing hi-scores in editor, it is now disabled.
|
||||
- Fix: [ 1113399 ] Game no longer crashes when right-clicking a disabled Full Load button
|
||||
- Fix: [ 1114100 ] Dedicated server boots again
|
||||
- Fix: [ 1114950 ] Game crashed sometimes when there were no industries in the map
|
||||
- Fix: [ 1115200 ] In the main menu, when starting a new game while the load game dialog is open, openttd asserts.
|
||||
- Fix: [ 1117538 ] non-stop orders are no longer accidently skipped
|
||||
- Fix: [ 1116619 ] Generate the correct smoke type for diesel trains
|
||||
- Fix: [ 1119308 ] Max passengers / mail variables are now 32 bit
|
||||
- Fix: [ 1109400 ] Better test if a string actually contains any console command
|
||||
- Fix: [ 1108637 ] 'Play scenario' now loads game options and difficulty, 'Load game' starts game with user-selected values.
|
||||
- Fix: [ 1143587 ] carriages of newgrfs can be refitted again
|
||||
- Fix: [ 1117730 ] Production values of temperate-climate banks can now be altered
|
||||
- Fix: [ 1118810 ] openttd: ship_cmd.c:642 ... Assertion failed. Mapwrap fixed in ship_cmd.c (was implicitely ok before biggermaps).
|
||||
- Fix: [ 1117327 ] Assertion error on kick. When a company is cleaned all its windows need to be closed. For global vehicle lists, the no-staiton index of -1 was not taken into account
|
||||
- Fix: [ 1114261 ] Speeding up when pressing ALT+TAB (Windows)
|
||||
- Fix: [ 1149403 ] Signals dissaper after typing text and pressing enter!. Signs in Scenario Editor have no owner so ignore that.
|
||||
- Fix: [ 1149766 ] Single tile Bridge in Volcano City scenario. Some bridges still had the old single-tile bridge bug that was caused by improper town growth in combination with DC_AUTO. Fixed the scenario.
|
||||
- Fix: [ 1119147 ] Stop startup memory corruption crash using optimized MSVC6. MSVC6 workaround as it's too stupid again for its own good
|
||||
- Fix: [ 1101874 ] Dedicated server now accepts '-g' (load game) as param
|
||||
- Fix: [ 1155696 ] Crash with german umlauts in station names.
|
||||
- Fix: [ 1158618 ] Segmentation fault when loading savegame, out of bounds array check.
|
||||
- Fix: [ 1149487 ] Autosave ignoring settings
|
||||
- Fix: [ 1024703 ] Infinite access for A:\ (win32). Patch [1171208]. Only requery drive(s) if the user changes a directory, also surpress the OS error box that pops up on some windows machines.
|
||||
- Fix: [ 1095110 ] Create Lake and draggable Create Desert tools
|
||||
- Fix: [ 1172878 ] Trains "Go to depot" button: click twice skip to next order
|
||||
- Fix: [ 1146215 ] Engine power not updated w/auto replace" autoreplace now forces an update of the cache.
|
||||
- Fix: [ 1173690 ] Path displaying as "C:\\" in saveload window win32-only
|
||||
- Fix: [ 1179892 ] click & drag removal of road assertion fail.
|
||||
- Fix: [ 1174237 ] Max loan always in euros, use _opt_ptr instead of _opt
|
||||
- Fix: [ 1184201 ] AI orders its vehicles to a competitor's truck stop.
|
||||
- Fix: [ 1188986 ] Song in main menu screen should loop when it ends.
|
||||
- Fix: [ 1188777 ] Non-existing sprite #5125 (presignal). The DOS grf file trgi.grf has 6 less sprites than the windows one.
|
||||
- Fix: [ 1190625 ] Changing mapsize crashes game with highlighting.
|
||||
- Fix: [ 1190896 1184378 ] [NPF] Trains ignoring their railtype (mono, maglev)
|
||||
- Fix: [ 1202115 ] Clicking shipslist on bouy asserts GetPlayer().
|
||||
- Fix: [ 1187613 ] No HQ present for competitor, disable 'View HQ' button
|
||||
- Fix: [ 1193048 ] Pre-signal stays red when there is only a single exit signal
|
||||
- Fix: [ 1185176 ] Train in tunnel is not properly detected by signal code
|
||||
- Fix: [newgrf] rotors of custom helicopters are displayed correctly in the hangar window
|
||||
- Fix: Scenario Editor now handles human-made roads better (try to build a city layout before placing the city, finally that works very nice)
|
||||
- Fix: [Newgrf] helicopters are correctly recognized
|
||||
- Fix: [autoreplace] made sure that planes only show planes in replace GUI and helicopters only show helicopters
|
||||
- Fix: (Work around?) crash when generating tropical maps
|
||||
- Fix: [autoreplace] Cheaters can no longer exploit autoreplace to get vehicles, that's not invented yet
|
||||
- Fix: [autoreplace] Fixed a stupid bug introduced in r1687, that made a crash if anybody tried to autoreplace anything but an aircraft
|
||||
- Fix: expand railroad stations beyond maximum spread
|
||||
- Fix: [autoreplace] fixed a typo that could prevent autoreplaced aircraft from automatically go to a hangar
|
||||
- Fix: Hacked clients can no longer be used to build vehicles that are not available yet
|
||||
- Fix: Minimum profit of vehicles was calculated wrong for Performance Rating
|
||||
- Fix: no longer a station where you only unload is bad for your town-rating
|
||||
- Fix: Crash in scenario-editor with terraforming out-of-map bounds.
|
||||
- Fix: Game would crash if you full-screened with the 'fullscreen' button than chose a resolution from the dropdown box that was no longer valid.
|
||||
- Fix: Scrolling with the arrow keys is now smooth and it now also scrolls exactly in tile direction if e.g. up and left are pressed
|
||||
- Fix: many more fixes but I am too tired to list them all
|
||||
|
||||
|
||||
0.3.6 (2005-01-24)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: resizable windows. All useful windows are already made resizable.
|
||||
- Feature: highscore chart (accessible from the difficulty window) with top5 companies for a given difficulty (select the difficulty in the menu)
|
||||
- Feature: endgame score on 1 jan 2051 where you are added to the highscore if sufficiently large points have been accumulated. Game is paused while
|
||||
- Feature: Visually enhanced autorail placing
|
||||
When using the autorail tool, the rail pieces which are going to be build are highlighted.
|
||||
If a piece is shown in red, this indicates that the slope/rail combination is impossible. It does not tell you if
|
||||
the rail line construction might not be possible because of other obstacles, e.g. houses or water.
|
||||
- Feature: Autoreplace Vehicles (accessible from the vehicle lists)
|
||||
This feature works much like autorenew, but it will get you a new engine type instead of a new one of the same type. Once
|
||||
ordered, it will automatically replace the engines while they visits a depot. The GUI for setting this up have been added on the
|
||||
vehicle overview windows (Bjarni)
|
||||
- Feature: A counter to tell how many engines you have of each type to the autoreplace vehicle windows (Bjarni)
|
||||
- Feature: A display for the total map population to the town display
|
||||
- Feature: [network] RCon (Remote Connection).
|
||||
A server can set: 'set rcon_pw <password>' to enable rcon
|
||||
A client can now do: 'rcon <password> "<command>"'
|
||||
!!Warning!!: do not give your rcon password to people you do not thrust!
|
||||
- Feature: hotkeys for dock and airport toolbar (see http://wiki.openttd.org/index.php/Hotkeys)
|
||||
- Feature: [Network] banning system (mostly tnx to guru3) A server can ban people via ClientList using 'ban', 'unban', 'banlist'.
|
||||
- Feature: [Network] server can now pause and unpause a game through the console. Use 'pause' and 'unpause'
|
||||
- Feature: [OS/2] OS/2 support is now finished (Fixes for networking, file selection, keyboard input, plus many other minor issues)
|
||||
- Feature: [SDL] Show revision number in window title
|
||||
- Feature: [Unix] Check which gcc version is present and only set available compiler flags
|
||||
- Feature: [Windows] CTRL+V (Paste) now works on all editboxes. This includes 'Add Server', chat, etc.
|
||||
- Feature: [Windows] dedicated server is now functioning correctly
|
||||
- Feature: Addded keyboard shortcuts for the order window
|
||||
- Feature: Aircraft refit options have been restricted to "sane" values.
|
||||
- Feature: allows setting the production values of the rawmaterial producing industries in the editor
|
||||
- Feature: console support for loading maps. Use 'load', 'list_files' and 'goto_dir' to navigate and load games.
|
||||
- Feature: Display server port in the multiplayer game info window
|
||||
- Feature: dynamite in landscaping toolbar (hotkey 'D')
|
||||
- Feature: Improved Network Lobby GUI with a green dot if company income is positive (else red dot) and lock icon if company is password protected
|
||||
- Feature: Make ottd compile on Zeta
|
||||
- Feature: MD5 hash check for TTD files (The original TTD files are now checked with a MD5 sum to determine which version of the grf files is used and to warn about possible file corruptions. Thanks to ledow for the original patch)
|
||||
- Feature: New companies receive a 5-year protection period against buying-up
|
||||
- Feature: norwegian townnames (Simen Graaten)
|
||||
- Feature: Order Checking is only execute for ONE vehicle in an order-share system
|
||||
- Feature: Passengers aircraft now ignore the amount of mail for "full load any" options
|
||||
- Feature: place multiple accepting industies nearby in the editor mode if the appropriate patches are set
|
||||
- Feature: population in label of the town (patch setting)
|
||||
- Feature: scrolling credits list (in alphabetical order)
|
||||
- Feature: Train window now shows the number of vehicles per row (mpetrov)
|
||||
- Feature: [ 1039061 ] Swiss town-names (vulvulune)
|
||||
- Feature: [ 1090950 ] Adding 16:10 resolutions for mainly laptops (doode)
|
||||
- Feature: [ 1098254 ] (dis)Allow Shares. Add patch options to allow buying/selling of shares (Hackykid)
|
||||
- Fix: [ 1031451 ] Catchment area shows when buying sign
|
||||
- Fix: [ 1040119 ] Flood and wagons in depot
|
||||
- Fix: [ 1050990 ] Buying trains sometimes accounted for incorrectly.
|
||||
- Fix: [ 1084074 ] Delayed news messages
|
||||
- Fix: [ 1090495 ] Slopes under high bridges weren't flooded
|
||||
- Fix: [ 1092473 ] In scenario editor, when trees are placed randomly, they are no longer placed on farmland
|
||||
- Fix: [ 1092661 ] On create, the scrollbar of the server-list was not updated
|
||||
- Fix: [ 1092707 ] placing rocks in scenario editor. You can place rocks on trees and vice versa
|
||||
- Fix: [ 1093200 ] Drive side in new games. Setting the driver side is possible during the game until someone buys road vehicles. In networked games only the server can change it.
|
||||
- Fix: [ 1093466 ] no more glitches with many maps in the scenario list when creating server
|
||||
- Fix: [ 1093485 ] Dissappearing rocks in Scenario Editor
|
||||
- Fix: [ 1094092 ] Toolbars accessible via keyboard in spectator mode
|
||||
- Fix: [ 1095020 ] When all stations in an aircraft's order list are demolished, the plane eventually crashes (running out of fuel)
|
||||
- Fix: [ 1095143 ] Servers list now also saves the port
|
||||
- Fix: [ 1098553 ] Crash when all vehicles from a vehicles per station list had been removed
|
||||
- Fix: [ 1099101 ] starting year patch goes out of range. Clamped year between 1920-2090
|
||||
- Fix: [ 1099225 ] Bug Fix - Vehicle Lists not updated at Acqusition (thx tamlin and mpetrov)
|
||||
- Fix: [ 1099451 ] Game crashes after the click on Rename (see also Bug 10992). There was no check for non-selected engine
|
||||
- Fix: [ 1100736 ] wrong tooltip for place desert button
|
||||
- Fix: [ 1100767 ] fast forward in main menu
|
||||
- Fix: [ 1101179 ] Crash if generating land while industry window is open. This also happened for towns and the land information window
|
||||
- Fix: [ 1101906 ] Configure Patches window text overflow
|
||||
- Fix: [ 1101963 ] console in dedicated server
|
||||
- Fix: [ 1102275 ] Game crashed when clicking "new face" or "company color" twice
|
||||
- Fix: [ 1102776 ], [ 1099535 ] Vehicle lists are now redrawn when a vehicle arrives in a depot. Station-specific vehicle lists are now redrawn daily as well (not only the master list)
|
||||
- Fix: [ 1103113 ] font size changing. Dedicated server did not have code filtering, 'tab' could result in bigger fonts
|
||||
- Fix: [ 1103187 ] Order Check messages are now validated before displayed
|
||||
- Fix: [ 1103301 ] Railroad tracks on slopes weren't flooded
|
||||
- Fix: [ 1104350 ] Crashed trains do not initiate the lost vehicle message anymore
|
||||
- Fix: [ 110452 ] On horizontal/vertical tracks you are also charged for building/removing signals on the parallel track on the same tile.
|
||||
- Fix: [ 1104969 ] Aircraft in hangar messages are now revalidated before display
|
||||
- Fix: [ 1105112 ] Destroyed train locks crossings
|
||||
- Fix: [ 1105281 ] upgrade rail fails when train under bridge
|
||||
- Fix: [ 1105959 ] Trains don't think they're on a slope any more while they drive around in a tunnel
|
||||
- Fix: [ 1105963 ] Buoys can now only be removed if no ship has it in their schedule. (This makes buoys more useable in multiplayer games again, as buoys can't be deleted by other players if they are used.)
|
||||
- Fix: [ 1106354 ] Graph's keys get confused
|
||||
- Fix: [ 1106930 ] placing signals with 2x1 drags is treated as placing a single signal
|
||||
- Fix: [ 1107350 ] console ignoring return character occasionally.
|
||||
- Fix: [ 1108008 ] Scenario creation bug; engines are of correct year when scenario is saved
|
||||
- Fix: [ 1092474 ] little red box in scenario editor
|
||||
- Fix: [ 1099197 ] scrolling through console sometimes crashed the whole game.
|
||||
- Fix: [ 1099209 ] Catchment area with drag&drop stations
|
||||
- Fix: [Network] 'kick 1' did crash dedicated servers
|
||||
- Fix: [Network] A server no longer crashes when a client sends an invalid DoCommand, but drops the client instead.
|
||||
- Fix: [Network] Added packet protection. No longer a client or server
|
||||
- Fix: [Network] Bug in bind system. Advertising failed on systems with more then 1 ip, and server_bind active to one of them.
|
||||
- Fix: [Network] Disabled 'money-cheat' (read: bug which could give people a lot of money)
|
||||
- Fix: [SDL] now the binary never links to SDL if DEDICATED is set.
|
||||
- Fix: [Windows] somehow mousewheel was disabled on windows using SDL; reenabled again
|
||||
- Fix: a modified client could try to replace a vehicle to an invalid engine ID and crash the server.
|
||||
- Fix: autoreplace vehicle lists are now redrawn when a new vehicle becomes available
|
||||
- Fix: Buy Vehicle GUI now shows HPs bigger than 32000 correctly
|
||||
- Fix: Console alias, load_game functionality and load fix
|
||||
- Fix: correct error message for when trying to build a railroad station over a bus/truck/etc-station.
|
||||
- Fix: Correct landscaping buttons in monorail and maglev toolbars
|
||||
- Fix: dedicated server also writes to log file if active
|
||||
- Fix: Desert-landscape does no longer crash
|
||||
- Fix: Expand town is a bit more agressive
|
||||
- Fix: finally zooming in/out always works.
|
||||
- Fix: fixed chat-bug (that from a certain moment, nobody could talk)
|
||||
- Fix: fixed weight for double-head trains and with that the acceleration (now maglev lvl4 can reach their top speed, and are faster than lvl3)
|
||||
- Fix: Full-Loading trains no longer get "lost" after a while (Hackykid)
|
||||
- Fix: Graphs were not updated correctly when one graph with a certain selection was already open and another graph window was opened
|
||||
- Fix: in multiplayer clientlist can only be opened once
|
||||
- Fix: Loan does not count against the company value
|
||||
- Fix: nasty bug where one could build one station OVER the other
|
||||
- Fix: No crash when creating a game with New English town names any more
|
||||
- Fix: now helicopters will use a hangar in schedule to be replaced in, even if they are only set to service there. Since helicopters are serviced at helipads, they will only go there if they needs to be replaced or renewed. They will also use a hangar in an airport in the schedule if needed. (Bjarni)
|
||||
- Fix: only a server can rename a town in a MP game
|
||||
- Fix: really old maps do load again (Darkvater / TrueLight)
|
||||
- Fix: Refit engine button is now disabled when cargo capacity equals zero
|
||||
- Fix: server issue where some company names were wrong
|
||||
- Fix: Ship Vehicle Lists are now redrawn correctly
|
||||
- Fix: signal stays red if a track is removed (Darkvater / Tron / TrueLight)
|
||||
- Fix: solve AI related order-problem
|
||||
- Fix: starting openttd with -g <invalid_name> now acts normal
|
||||
- Fix: The cost for an autorenew was not always send to the right player ;)
|
||||
- Fix: Autorenewing multiheaded train engines now costs the correct amount. Used to be twice the correct price
|
||||
- Fix: the scrollbar in the network gui (server list) now updates when scrolling (HackyKid)
|
||||
- Fix: Train crashes should no longer desync the game.
|
||||
- Fix: When deleting an order, the next pointer was not cleared, resulting in some unusual behavoir from time to time
|
||||
- Fix: You can now also delete automatically found servers by pressing "del"
|
||||
- Fix: You should no longer be able to delete bridges on any type of underground when there is a vehicle on it
|
||||
- Add: A brand new set of icons.
|
||||
- Change: AutoRenew is now a client-side patch instead of a game-side patch
|
||||
- Change: Removed the 'close ALL windows' from the toolbar since shift+del does this.
|
||||
- Language: Updated all languages
|
||||
- Fix: Many more things....
|
||||
|
||||
|
||||
0.3.5 (2004-12-24)
|
||||
------------------------------------------------------------------------
|
||||
- Feature: [Network] New network, very stable, a lot of new features
|
||||
- Feature: [Network] Ingame Serverlist (with online game-servers to join)
|
||||
- Feature: [Network] Webbased Serverlist: http://servers.openttd.org/
|
||||
- Feature: [Network] Added dedicated server support
|
||||
- Feature: [Network] Cheat protection in MultiPlayer
|
||||
- Feature: [Network] Patch settings are also synced with the server
|
||||
- Feature: [Network] Chat
|
||||
- Feature: Custom currency settings
|
||||
- Feature: Per-station vehicle lists
|
||||
- Feature: More realistically sized catchment areas
|
||||
- Feature: Sticky windows
|
||||
- Feature: Even better support for newgrf-files
|
||||
- Feature: Implement improved vehicle loading algorithm
|
||||
- Feature: Even more advanced console
|
||||
- Feature: Game compiles under BEOS_SERVER
|
||||
- Feature: Game compiles under OS/2 (no network-support)
|
||||
- Feature: OpenTTD runs with the grf files of the DOS version
|
||||
- Feature: [Big Endian computers, which are mac and MorphOS]: are able to load savegames by TTD(Patch)
|
||||
- Feature: Many more new things...
|
||||
- Add: 'l' openes the landscaping toolbar globally
|
||||
- Add: Make the town sometimes build streets on slopes
|
||||
- Add: Manpage
|
||||
- Add: New checkpoint grahpics
|
||||
- Add: SHIFT+DEL now deletes all non-vital windows (only status bar and main bar remain)
|
||||
- Add: Windows now shows revision, release information in title bar
|
||||
- Add: Windows snap at each other
|
||||
- Change: [OSX build] Moved data and lang folders inside OpenTTD. This got rid of the package system too, making installing/updating easier
|
||||
- Fix: [OSX build] Music is now on by default again
|
||||
- Fix: [OSX build] Made error opens the console
|
||||
- Fix: [SDL] Added a confirmation dialog when quitting the game
|
||||
- Fix: A train can leave and enter the same depot at the same time, then the trai simply got stuck
|
||||
- Fix: Crash when making png screenshot with odd resolution (Tron)
|
||||
- Fix: Directories in *nix are now sorted alphabetically in ascending order (Tron).
|
||||
- Fix: Do not consider a road station as street when growing the town
|
||||
- Fix: Engines from other climates do not appear any more when never_expire_vehicles is enabled
|
||||
- Fix: Game options (like drive side) are not taken from the scenario when using 'new game' command
|
||||
- Fix: Order checker now correctly detects station with invalid facilities
|
||||
- Fix: Polished GUI in a lot of ways
|
||||
- Fix: Saving or loading a map doesnt pauses the game anymore
|
||||
- Fix: Some bridge part isn't displayed transparent in transparent mode
|
||||
- Fix: Starting with -r option allows all resolutions (Tron)
|
||||
- Fix: The pathfinder no longer sees rail with an other owner as a possible route.
|
||||
- Fix: Unable to select other screenshot format in Game Option
|
||||
- Fix: Unwanted town renaming
|
||||
- Fix: Vehicles slow down under bridge if the track is on a foundation
|
||||
- Fix: You can no longer change name of waypoints whom are owned by somebody else
|
||||
- Fix: [ 1090313 ] Shares are now also sold when a company goes bankrupt
|
||||
- Fix: [ 1087701 ] It is no longer possible to crash trains of other companies by building a depot close to a station. (even more: trains do no longer enter tiles that do not belong to his owner)
|
||||
- Fix: [ 1087403 ] Crashed trains aren't reported to have too few orders any more
|
||||
- Fix: [ 1086375 ] Backup-order-list was not closed with an OT_NOTHING,
|
||||
- Fix: [ 1085255 ] Docks now have a button to display the catchment area
|
||||
- Fix: [ 1070274 ] Invisible trains. Weird macros and MSVC optimizing don't always mix. (Tron)
|
||||
- Fix: [ 1068269 ] Number of passangers and mail in exclusive test offer window is swapped
|
||||
- Fix: [ 1066504 ] Pause key pauses the game
|
||||
- Fix: [ 1066121 ] Resetting file name after deleting a file (dannys9)
|
||||
- Fix: [ 1066114 ] Code error in win32.c Thanks Shai
|
||||
- Fix: [ 1065247 ] Windows can be placed behind toolbar
|
||||
- Fix: [ 1064742 ] Editor Map-Menu wrong String
|
||||
- Fix: [ 1058809 ] Always report a bus/lorry station as unpassable
|
||||
- Fix: [ 1053397 ] Refit train window stays open
|
||||
- Fix: [ 1050993 ] Incorrect Tooltip in Road Vehicle List.
|
||||
- Fix: [ 1048596 ] Monorail and Maglev sounds are swapped
|
||||
- Fix: [ 1040119 ] Flooded wagons in depots don't keep constantly exploding any more
|
||||
- Fix: [ 1035303 ] Bug about lowering tracks built on slopes
|
||||
- Fix: [ 1035066 ] 'Allow goto depot' turned off, no checkpoints in orders
|
||||
- Fix: [ 1034318 ] Place sign and blue message box
|
||||
- Fix: [ 1033947 ] Wrong mapping between music titles and songs
|
||||
- Fix: [ 1030393 ] Some screensizes crashes OTTD. Fix in general bug that only allows resolutions which were multiple of 8 in width and height. Also use closest possible resolution in fullscreen if window size is not a valid resolution (Tron)
|
||||
- Fix: [ 1030275 ] 'Service at' orders ignored after 2090. After 2090 year is reset to 1. Jan 2090, so most of the time, last service was in the future and no service ensured.
|
||||
- Fix: [ 1029064 ] Building a station acted weird in some rare situations
|
||||
- Fix: [ 1022227 ] Ships could unload cargo at stations without docks
|
||||
- Fix: [ 999669 ] Wrong trees (toyland's) in sub-tropical landscape style
|
||||
- Fix: [ 993500 ] High bridge rendering error
|
||||
- Fix: [ 991101 ] Disabled buttons flicker no more
|
||||
- Fix: [ 985925 ] Start/stop flag in train depots always works, regardless of the horizontal scroll position
|
||||
- Fix: [ 985439 ] Un-owned rail. Trains could cross competitor's tracks if there was a road-crossing over it.
|
||||
- Fix: [ 982611 ] Pathfinding bug; train likes the roundabout. If train needs servicing it will now look 16 tiles along the track instead of 12 tiles manhattan style (blathijs)
|
||||
- Fix: [ 967096 ] Fullscreen. New button 'Fullscreen' in 'Game Options' menu which lets you set fullscreen ingame.
|
||||
- Fix: [ 958098 ] No longer road/rail crossing signals hang when a train is reversed at the wrong moment (Yeah, our longest open bug finally fixed :) :) :))
|
||||
- Fix: [ 926105 ] Ctrl + d bug. Longest outstanding bug has been fixed \o/ 2004-03-30 (Tron)
|
||||
- Language: Added Spanish
|
||||
- Language: Added Catalan
|
||||
- Language: Added Icelandic
|
||||
- Language: Updated most languages
|
||||
- Fix: Many more things....
|
||||
|
||||
|
||||
0.3.4 (2004-09-14)
|
||||
------------------------------------------------------------------------
|
||||
- Add: Dutch translation
|
||||
|
||||
+287
-246
@@ -1,7 +1,16 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "openttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "functions.h"
|
||||
#include "map.h"
|
||||
#include "player.h"
|
||||
#include "tile.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
#include "variables.h"
|
||||
#include "table/sprites.h"
|
||||
|
||||
typedef struct TerraformerHeightMod {
|
||||
TileIndex tile;
|
||||
@@ -28,13 +37,11 @@ static int TerraformAllowTileProcess(TerraformerState *ts, TileIndex tile)
|
||||
TileIndex *t;
|
||||
int count;
|
||||
|
||||
if ((GET_TILE_X(tile) == TILE_X_MAX) || (GET_TILE_Y(tile) == TILE_Y_MAX))
|
||||
return -1;
|
||||
if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY()) return -1;
|
||||
|
||||
t = ts->tile_table;
|
||||
for(count = ts->tile_table_count; count != 0; count--,t++) {
|
||||
if (*t == tile)
|
||||
return 0;
|
||||
for (count = ts->tile_table_count; count != 0; count--, t++) {
|
||||
if (*t == tile) return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
@@ -45,12 +52,11 @@ static int TerraformGetHeightOfTile(TerraformerState *ts, TileIndex tile)
|
||||
TerraformerHeightMod *mod = ts->modheight;
|
||||
int count;
|
||||
|
||||
for(count = ts->modheight_count; count != 0; count--, mod++) {
|
||||
if (mod->tile == tile)
|
||||
return mod->height;
|
||||
for (count = ts->modheight_count; count != 0; count--, mod++) {
|
||||
if (mod->tile == tile) return mod->height;
|
||||
}
|
||||
|
||||
return _map_type_and_height[tile] & 0xF;
|
||||
return TileHeight(tile);
|
||||
}
|
||||
|
||||
static void TerraformAddDirtyTile(TerraformerState *ts, TileIndex tile)
|
||||
@@ -60,12 +66,10 @@ static void TerraformAddDirtyTile(TerraformerState *ts, TileIndex tile)
|
||||
|
||||
count = ts->tile_table_count;
|
||||
|
||||
if (count >= 625)
|
||||
return;
|
||||
if (count >= 625) return;
|
||||
|
||||
for(t = ts->tile_table; count != 0; count--,t++) {
|
||||
if (*t == tile)
|
||||
return;
|
||||
if (*t == tile) return;
|
||||
}
|
||||
|
||||
ts->tile_table[ts->tile_table_count++] = tile;
|
||||
@@ -73,63 +77,70 @@ static void TerraformAddDirtyTile(TerraformerState *ts, TileIndex tile)
|
||||
|
||||
static void TerraformAddDirtyTileAround(TerraformerState *ts, TileIndex tile)
|
||||
{
|
||||
TerraformAddDirtyTile(ts, tile+TILE_XY(0,-1));
|
||||
TerraformAddDirtyTile(ts, tile+TILE_XY(-1,-1));
|
||||
TerraformAddDirtyTile(ts, tile+TILE_XY(-1,0));
|
||||
TerraformAddDirtyTile(ts, tile + TileDiffXY( 0, -1));
|
||||
TerraformAddDirtyTile(ts, tile + TileDiffXY(-1, -1));
|
||||
TerraformAddDirtyTile(ts, tile + TileDiffXY(-1, 0));
|
||||
TerraformAddDirtyTile(ts, tile);
|
||||
}
|
||||
|
||||
static int TerraformProc(TerraformerState *ts, uint tile, int mode)
|
||||
static int TerraformProc(TerraformerState *ts, TileIndex tile, int mode)
|
||||
{
|
||||
int r;
|
||||
int32 ret;
|
||||
bool skip_clear = false;
|
||||
|
||||
assert(tile < TILES_X * TILES_Y);
|
||||
assert(tile < MapSize());
|
||||
|
||||
if ((r=TerraformAllowTileProcess(ts, tile)) <= 0)
|
||||
return r;
|
||||
|
||||
if ((_map_type_and_height[tile] >> 4) == MP_RAILWAY) {
|
||||
if (IsTileType(tile, MP_RAILWAY)) {
|
||||
static const byte _railway_modes[4] = {8, 0x10, 4, 0x20};
|
||||
static const byte _railway_dangslopes[4] = {0xd, 0xe, 7, 0xb};
|
||||
static const byte _railway_dangslopes2[4] = {0x2, 0x1, 0x8, 0x4};
|
||||
|
||||
// Nothing could be built at the steep slope - this avoids a bug
|
||||
// when you have a single diagonal track in one corner on a
|
||||
// basement and then you raise the other corner.
|
||||
if ((GetTileSlope(tile, NULL)&0xF) == _railway_dangslopes[mode]) {
|
||||
// basement and then you raise/lower the other corner.
|
||||
int tileh = GetTileSlope(tile, NULL) & 0xF;
|
||||
if (tileh == _railway_dangslopes[mode] ||
|
||||
tileh == _railway_dangslopes2[mode]) {
|
||||
_terraform_err_tile = tile;
|
||||
_error_message = STR_1008_MUST_REMOVE_RAILROAD_TRACK;
|
||||
return -1;
|
||||
}
|
||||
|
||||
// If we have a single diagonal track there, the other side of
|
||||
// tile can be terraformed.
|
||||
if ((_map5[tile]&~0x40) == _railway_modes[mode])
|
||||
return 0;
|
||||
if ((_m[tile].m5 & ~0x40) == _railway_modes[mode]) {
|
||||
if (ts->direction == 1) return 0;
|
||||
skip_clear = true;
|
||||
}
|
||||
}
|
||||
|
||||
ret = DoCommandByTile(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
if (!skip_clear) {
|
||||
int32 ret = DoCommandByTile(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
|
||||
if (ret == CMD_ERROR) {
|
||||
_terraform_err_tile = tile;
|
||||
return -1;
|
||||
if (CmdFailed(ret)) {
|
||||
_terraform_err_tile = tile;
|
||||
return -1;
|
||||
}
|
||||
|
||||
ts->cost += ret;
|
||||
}
|
||||
|
||||
ts->cost += ret;
|
||||
|
||||
if (ts->tile_table_count >= 625)
|
||||
return -1;
|
||||
if (ts->tile_table_count >= 625) return -1;
|
||||
ts->tile_table[ts->tile_table_count++] = tile;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool TerraformTileHeight(TerraformerState *ts, uint tile, int height)
|
||||
static bool TerraformTileHeight(TerraformerState *ts, TileIndex tile, int height)
|
||||
{
|
||||
int nh;
|
||||
TerraformerHeightMod *mod;
|
||||
int count;
|
||||
|
||||
assert(tile < TILES_X * TILES_Y);
|
||||
assert(tile < MapSize());
|
||||
|
||||
if (height < 0) {
|
||||
_error_message = STR_1003_ALREADY_AT_SEA_LEVEL;
|
||||
@@ -138,54 +149,49 @@ static bool TerraformTileHeight(TerraformerState *ts, uint tile, int height)
|
||||
|
||||
_error_message = STR_1004_TOO_HIGH;
|
||||
|
||||
if (height > 0xF)
|
||||
return false;
|
||||
if (height > 15) return false;
|
||||
|
||||
nh = TerraformGetHeightOfTile(ts, tile);
|
||||
if (nh < 0 || height == nh)
|
||||
return false;
|
||||
if (nh < 0 || height == nh) return false;
|
||||
|
||||
if (TerraformProc(ts, tile, 0)<0)
|
||||
return false;
|
||||
|
||||
if (TerraformProc(ts, tile + TILE_XY(0,-1), 1)<0)
|
||||
return false;
|
||||
|
||||
if (TerraformProc(ts, tile + TILE_XY(-1,-1), 2)<0)
|
||||
return false;
|
||||
|
||||
if (TerraformProc(ts, tile + TILE_XY(-1,0), 3)<0)
|
||||
return false;
|
||||
if (TerraformProc(ts, tile, 0) < 0) return false;
|
||||
if (TerraformProc(ts, tile + TileDiffXY( 0, -1), 1) < 0) return false;
|
||||
if (TerraformProc(ts, tile + TileDiffXY(-1, -1), 2) < 0) return false;
|
||||
if (TerraformProc(ts, tile + TileDiffXY(-1, 0), 3) < 0) return false;
|
||||
|
||||
mod = ts->modheight;
|
||||
count = ts->modheight_count;
|
||||
|
||||
for(;;) {
|
||||
for (;;) {
|
||||
if (count == 0) {
|
||||
if (ts->modheight_count >= 576)
|
||||
return false;
|
||||
ts->modheight_count++;
|
||||
break;
|
||||
}
|
||||
if (mod->tile == (TileIndex)tile)
|
||||
break;
|
||||
if (mod->tile == tile) break;
|
||||
mod++;
|
||||
count--;
|
||||
}
|
||||
|
||||
mod->tile = (TileIndex)tile;
|
||||
mod->tile = tile;
|
||||
mod->height = (byte)height;
|
||||
|
||||
ts->cost += _price.terraform;
|
||||
|
||||
{
|
||||
int direction = ts->direction, r;
|
||||
const TileIndexDiff *ttm;
|
||||
const TileIndexDiffC *ttm;
|
||||
|
||||
static const TileIndexDiff _terraform_tilepos[5] = {TILE_XY(1,0), TILE_XY(-2,0), TILE_XY(1,1), TILE_XY(0,-2), 0 };
|
||||
static const TileIndexDiffC _terraform_tilepos[] = {
|
||||
{ 1, 0},
|
||||
{-2, 0},
|
||||
{ 1, 1},
|
||||
{ 0, -2}
|
||||
};
|
||||
|
||||
for(ttm = _terraform_tilepos; *ttm != 0; ttm++) {
|
||||
tile += *ttm;
|
||||
for(ttm = _terraform_tilepos; ttm != endof(_terraform_tilepos); ttm++) {
|
||||
tile += ToTileIndexDiff(*ttm);
|
||||
|
||||
r = TerraformGetHeightOfTile(ts, tile);
|
||||
if (r != height && r-direction != height && r+direction != height) {
|
||||
@@ -198,15 +204,15 @@ static bool TerraformTileHeight(TerraformerState *ts, uint tile, int height)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Terraform land
|
||||
* p1 - corners
|
||||
* p2 - direction
|
||||
/** Terraform land
|
||||
* @param x,y coordinates to terraform
|
||||
* @param p1 corners to terraform.
|
||||
* @param p2 direction; eg up or down
|
||||
*/
|
||||
|
||||
int32 CmdTerraformLand(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
TerraformerState ts;
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
int direction;
|
||||
|
||||
TerraformerHeightMod modheight_data[576];
|
||||
@@ -224,29 +230,32 @@ int32 CmdTerraformLand(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
ts.modheight = modheight_data;
|
||||
ts.tile_table = tile_table_data;
|
||||
|
||||
tile = TILE_FROM_XY(x,y);
|
||||
tile = TileVirtXY(x, y);
|
||||
|
||||
/* Make an extra check for map-bounds cause we add tiles to the originating tile */
|
||||
if (tile + TileDiffXY(1, 1) >= MapSize()) return CMD_ERROR;
|
||||
|
||||
if (p1 & 1) {
|
||||
if (!TerraformTileHeight(&ts, tile+TILE_XY(1,0),
|
||||
(_map_type_and_height[tile+TILE_XY(1,0)]&0xF) + direction))
|
||||
if (!TerraformTileHeight(&ts, tile + TileDiffXY(1, 0),
|
||||
TileHeight(tile + TileDiffXY(1, 0)) + direction))
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
if (p1 & 2) {
|
||||
if (!TerraformTileHeight(&ts, tile+TILE_XY(1,1),
|
||||
(_map_type_and_height[tile+TILE_XY(1,1)]&0xF) + direction))
|
||||
if (!TerraformTileHeight(&ts, tile + TileDiffXY(1, 1),
|
||||
TileHeight(tile + TileDiffXY(1, 1)) + direction))
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
if (p1 & 4) {
|
||||
if (!TerraformTileHeight(&ts, tile+TILE_XY(0,1),
|
||||
(_map_type_and_height[tile+TILE_XY(0,1)]&0xF) + direction))
|
||||
if (!TerraformTileHeight(&ts, tile + TileDiffXY(0, 1),
|
||||
TileHeight(tile + TileDiffXY(0, 1)) + direction))
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
if (p1 & 8) {
|
||||
if (!TerraformTileHeight(&ts, tile+TILE_XY(0,0),
|
||||
(_map_type_and_height[tile+TILE_XY(0,0)]&0xF) + direction))
|
||||
if (!TerraformTileHeight(&ts, tile + TileDiffXY(0, 0),
|
||||
TileHeight(tile + TileDiffXY(0, 0)) + direction))
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
@@ -255,20 +264,21 @@ int32 CmdTerraformLand(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
int count;
|
||||
TileIndex *ti = ts.tile_table;
|
||||
|
||||
for(count = ts.tile_table_count; count != 0; count--, ti++) {
|
||||
for (count = ts.tile_table_count; count != 0; count--, ti++) {
|
||||
uint z, t;
|
||||
uint tile = *ti;
|
||||
TileIndex tile = *ti;
|
||||
|
||||
z = TerraformGetHeightOfTile(&ts, tile + TILE_XY(0,0));
|
||||
t = TerraformGetHeightOfTile(&ts, tile + TILE_XY(1,0));
|
||||
z = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(0, 0));
|
||||
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(1, 0));
|
||||
if (t <= z) z = t;
|
||||
t = TerraformGetHeightOfTile(&ts, tile + TILE_XY(1,1));
|
||||
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(1, 1));
|
||||
if (t <= z) z = t;
|
||||
t = TerraformGetHeightOfTile(&ts, tile + TILE_XY(0,1));
|
||||
t = TerraformGetHeightOfTile(&ts, tile + TileDiffXY(0, 1));
|
||||
if (t <= z) z = t;
|
||||
|
||||
if (!CheckTunnelInWay(tile, z*8))
|
||||
if (!CheckTunnelInWay(tile, z * 8)) {
|
||||
return_cmd_error(STR_1002_EXCAVATION_WOULD_DAMAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,7 +287,7 @@ int32 CmdTerraformLand(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
int count;
|
||||
TileIndex *ti = ts.tile_table;
|
||||
for(count = ts.tile_table_count; count != 0; count--, ti++) {
|
||||
for (count = ts.tile_table_count; count != 0; count--, ti++) {
|
||||
DoCommandByTile(*ti, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||
}
|
||||
}
|
||||
@@ -286,15 +296,12 @@ int32 CmdTerraformLand(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
int count;
|
||||
TerraformerHeightMod *mod;
|
||||
uint til;
|
||||
|
||||
mod = ts.modheight;
|
||||
for(count = ts.modheight_count; count != 0; count--, mod++) {
|
||||
til = mod->tile;
|
||||
|
||||
// Change tile height
|
||||
_map_type_and_height[til] = (_map_type_and_height[til]&~0x0F)|mod->height;
|
||||
for (count = ts.modheight_count; count != 0; count--, mod++) {
|
||||
TileIndex til = mod->tile;
|
||||
|
||||
SetTileHeight(til, mod->height);
|
||||
TerraformAddDirtyTileAround(&ts, til);
|
||||
}
|
||||
}
|
||||
@@ -303,7 +310,7 @@ int32 CmdTerraformLand(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
int count;
|
||||
TileIndex *ti = ts.tile_table;
|
||||
for(count = ts.tile_table_count; count != 0; count--, ti++) {
|
||||
for (count = ts.tile_table_count; count != 0; count--, ti++) {
|
||||
MarkTileDirtyByTile(*ti);
|
||||
}
|
||||
}
|
||||
@@ -312,29 +319,34 @@ int32 CmdTerraformLand(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* p1 - start
|
||||
/** Levels a selected (rectangle) area of land
|
||||
* @param x,y end tile of area-drag
|
||||
* @param p1 start tile of area drag
|
||||
* @param p2 unused
|
||||
*/
|
||||
|
||||
int32 CmdLevelLand(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
int size_x, size_y;
|
||||
int sx, sy;
|
||||
uint h, curh;
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
int32 ret, cost, money;
|
||||
|
||||
if (p1 >= MapSize()) return CMD_ERROR;
|
||||
|
||||
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
||||
|
||||
// remember level height
|
||||
h = _map_type_and_height[p1]&0xF;
|
||||
h = TileHeight(p1);
|
||||
|
||||
ex >>= 4; ey >>= 4;
|
||||
|
||||
// make sure sx,sy are smaller than ex,ey
|
||||
sx = GET_TILE_X(p1);
|
||||
sy = GET_TILE_Y(p1);
|
||||
sx = TileX(p1);
|
||||
sy = TileY(p1);
|
||||
if (ex < sx) intswap(ex, sx);
|
||||
if (ey < sy) intswap(ey, sy);
|
||||
tile = TILE_XY(sx,sy);
|
||||
tile = TileXY(sx, sy);
|
||||
|
||||
size_x = ex-sx+1;
|
||||
size_y = ey-sy+1;
|
||||
@@ -342,11 +354,11 @@ int32 CmdLevelLand(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
|
||||
money = GetAvailableMoneyForCommand();
|
||||
cost = 0;
|
||||
|
||||
BEGIN_TILE_LOOP(tile2, size_x, size_y, tile)
|
||||
curh = _map_type_and_height[tile2]&0xF;
|
||||
BEGIN_TILE_LOOP(tile2, size_x, size_y, tile) {
|
||||
curh = TileHeight(tile2);
|
||||
while (curh != h) {
|
||||
ret = DoCommandByTile(tile2, 8, (curh > h)?0:1, flags & ~DC_EXEC, CMD_TERRAFORM_LAND);
|
||||
if (ret == CMD_ERROR) break;
|
||||
ret = DoCommandByTile(tile2, 8, (curh > h) ? 0 : 1, flags & ~DC_EXEC, CMD_TERRAFORM_LAND);
|
||||
if (CmdFailed(ret)) break;
|
||||
cost += ret;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
@@ -354,42 +366,39 @@ int32 CmdLevelLand(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
|
||||
_additional_cash_required = ret;
|
||||
return cost - ret;
|
||||
}
|
||||
DoCommandByTile(tile2, 8, (curh > h)?0:1, flags, CMD_TERRAFORM_LAND);
|
||||
DoCommandByTile(tile2, 8, (curh > h) ? 0 : 1, flags, CMD_TERRAFORM_LAND);
|
||||
}
|
||||
|
||||
curh += (curh > h) ? -1 : 1;
|
||||
}
|
||||
END_TILE_LOOP(tile2, size_x, size_y, tile)
|
||||
} END_TILE_LOOP(tile2, size_x, size_y, tile)
|
||||
|
||||
if (cost == 0) return CMD_ERROR;
|
||||
return cost;
|
||||
return (cost == 0) ? CMD_ERROR : cost;
|
||||
}
|
||||
|
||||
/* Purchase a land area
|
||||
* p1 = unused
|
||||
* p2 = unused
|
||||
/** Purchase a land area. Actually you only purchase one tile, so
|
||||
* the name is a bit confusing ;p
|
||||
* @param x,y the tile the player is purchasing
|
||||
* @param p1 unused
|
||||
* @param p2 unused
|
||||
*/
|
||||
|
||||
int32 CmdPurchaseLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
int32 cost;
|
||||
|
||||
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
||||
|
||||
tile = TILE_FROM_XY(x,y);
|
||||
tile = TileVirtXY(x, y);
|
||||
|
||||
if (!EnsureNoVehicle(tile))
|
||||
return CMD_ERROR;
|
||||
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
|
||||
|
||||
if (IS_TILETYPE(tile, MP_UNMOVABLE) &&
|
||||
_map5[tile] == 3 &&
|
||||
_map_owner[tile] == _current_player)
|
||||
if (IsTileType(tile, MP_UNMOVABLE) && _m[tile].m5 == 3 &&
|
||||
IsTileOwner(tile, _current_player))
|
||||
return_cmd_error(STR_5807_YOU_ALREADY_OWN_IT);
|
||||
|
||||
cost = DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||
if (cost == CMD_ERROR)
|
||||
return CMD_ERROR;
|
||||
if (CmdFailed(cost)) return CMD_ERROR;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
ModifyTile(tile,
|
||||
@@ -402,90 +411,114 @@ int32 CmdPurchaseLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
}
|
||||
|
||||
|
||||
int32 ClearTile_Clear(uint tile, byte flags) {
|
||||
static const int32 * _clear_price_table[] = {
|
||||
NULL,
|
||||
&_price.clear_1, &_price.clear_1,&_price.clear_1,
|
||||
&_price.purchase_land,&_price.purchase_land,&_price.purchase_land,&_price.purchase_land,
|
||||
&_price.clear_2,&_price.clear_2,&_price.clear_2,&_price.clear_2,
|
||||
&_price.clear_3,&_price.clear_3,&_price.clear_3,&_price.clear_3,
|
||||
&_price.purchase_land,&_price.purchase_land,&_price.purchase_land,&_price.purchase_land,
|
||||
&_price.purchase_land,&_price.purchase_land,&_price.purchase_land,&_price.purchase_land,
|
||||
&_price.clear_2,&_price.clear_2,&_price.clear_2,&_price.clear_2,
|
||||
static int32 ClearTile_Clear(TileIndex tile, byte flags)
|
||||
{
|
||||
static const int32 null = 0;
|
||||
static const int32* clear_price_table[] = {
|
||||
&null,
|
||||
&_price.clear_1,
|
||||
&_price.clear_1,
|
||||
&_price.clear_1,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.clear_2,
|
||||
&_price.clear_2,
|
||||
&_price.clear_2,
|
||||
&_price.clear_2,
|
||||
&_price.clear_3,
|
||||
&_price.clear_3,
|
||||
&_price.clear_3,
|
||||
&_price.clear_3,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.purchase_land,
|
||||
&_price.clear_2,
|
||||
&_price.clear_2,
|
||||
&_price.clear_2,
|
||||
&_price.clear_2,
|
||||
};
|
||||
const int32 *price = _clear_price_table[_map5[tile] & 0x1F];
|
||||
const int32 *price = clear_price_table[GB(_m[tile].m5, 0, 5)];
|
||||
|
||||
if (flags & DC_EXEC)
|
||||
DoClearSquare(tile);
|
||||
if (flags & DC_EXEC) DoClearSquare(tile);
|
||||
|
||||
if (price == NULL)
|
||||
return 0;
|
||||
return *price;
|
||||
}
|
||||
|
||||
/** Sell a land area. Actually you only sell one tile, so
|
||||
* the name is a bit confusing ;p
|
||||
* @param x,y the tile the player is selling
|
||||
* @param p1 unused
|
||||
* @param p2 unused
|
||||
*/
|
||||
int32 CmdSellLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
|
||||
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
||||
|
||||
tile = TILE_FROM_XY(x,y);
|
||||
tile = TileVirtXY(x, y);
|
||||
|
||||
if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER)
|
||||
return CMD_ERROR;
|
||||
if (!IsTileType(tile, MP_UNMOVABLE) || _m[tile].m5 != 3) return CMD_ERROR;
|
||||
if (!CheckTileOwnership(tile) && _current_player != OWNER_WATER) return CMD_ERROR;
|
||||
|
||||
if (!EnsureNoVehicle(tile))
|
||||
return CMD_ERROR;
|
||||
|
||||
if (!EnsureNoVehicle(tile)) return CMD_ERROR;
|
||||
|
||||
if (flags & DC_EXEC)
|
||||
DoClearSquare(tile);
|
||||
|
||||
return - _price.purchase_land*2;
|
||||
return - _price.purchase_land * 2;
|
||||
}
|
||||
|
||||
|
||||
#include "table/clear_land.h"
|
||||
|
||||
|
||||
void DrawClearLandTile(TileInfo *ti, byte set)
|
||||
void DrawClearLandTile(const TileInfo *ti, byte set)
|
||||
{
|
||||
DrawGroundSprite(0xF54 + _tileh_to_sprite[ti->tileh] + set * 19);
|
||||
DrawGroundSprite(SPR_FLAT_BARE_LAND + _tileh_to_sprite[ti->tileh] + set * 19);
|
||||
}
|
||||
|
||||
void DrawHillyLandTile(TileInfo *ti)
|
||||
void DrawHillyLandTile(const TileInfo *ti)
|
||||
{
|
||||
if (ti->tileh != 0) {
|
||||
DrawGroundSprite(0xFA0 + _tileh_to_sprite[ti->tileh]);
|
||||
DrawGroundSprite(SPR_FLAT_ROUGH_LAND + _tileh_to_sprite[ti->tileh]);
|
||||
} else {
|
||||
DrawGroundSprite(_landscape_clear_sprites[((ti->x^ti->y) >> 4) & 0x7]);
|
||||
DrawGroundSprite(_landscape_clear_sprites[GB(ti->x ^ ti->y, 4, 3)]);
|
||||
}
|
||||
}
|
||||
|
||||
void DrawClearLandFence(TileInfo *ti, byte img)
|
||||
void DrawClearLandFence(const TileInfo *ti)
|
||||
{
|
||||
byte m4 = _m[ti->tile].m4;
|
||||
byte z = ti->z;
|
||||
|
||||
if (ti->tileh & 2) {
|
||||
z += 8;
|
||||
if (ti->tileh == 0x17)
|
||||
z += 8;
|
||||
if (ti->tileh == 0x17) z += 8;
|
||||
}
|
||||
|
||||
if (img & 0x38) {
|
||||
DrawGroundSpriteAt(_clear_land_fence_sprites_1[((img >> 3) & 7) - 1] + _fence_mod_by_tileh[ti->tileh], ti->x, ti->y, z);
|
||||
if (GB(m4, 5, 3) != 0) {
|
||||
DrawGroundSpriteAt(_clear_land_fence_sprites_1[GB(m4, 5, 3) - 1] + _fence_mod_by_tileh[ti->tileh], ti->x, ti->y, z);
|
||||
}
|
||||
|
||||
if (img & 0x7) {
|
||||
DrawGroundSpriteAt(_clear_land_fence_sprites_1[(img & 7) - 1] + _fence_mod_by_tileh_2[ti->tileh], ti->x, ti->y, z);
|
||||
if (GB(m4, 2, 3) != 0) {
|
||||
DrawGroundSpriteAt(_clear_land_fence_sprites_1[GB(m4, 2, 3) - 1] + _fence_mod_by_tileh_2[ti->tileh], ti->x, ti->y, z);
|
||||
}
|
||||
}
|
||||
|
||||
static void DrawTile_Clear(TileInfo *ti)
|
||||
{
|
||||
|
||||
switch((ti->map5 & (7<<2)) >> 2) {
|
||||
switch (GB(ti->map5, 2, 3)) {
|
||||
case 0:
|
||||
DrawClearLandTile(ti, (ti->map5 & 3));
|
||||
DrawClearLandTile(ti, GB(ti->map5, 0, 2));
|
||||
break;
|
||||
|
||||
case 1:
|
||||
@@ -493,100 +526,111 @@ static void DrawTile_Clear(TileInfo *ti)
|
||||
break;
|
||||
|
||||
case 2:
|
||||
DrawGroundSprite(0xFB7 + _tileh_to_sprite[ti->tileh]);
|
||||
DrawGroundSprite(SPR_FLAT_ROCKY_LAND_1 + _tileh_to_sprite[ti->tileh]);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
DrawGroundSprite( _clear_land_sprites_1[_map3_lo[ti->tile]&0xF] + _tileh_to_sprite[ti->tileh]);
|
||||
DrawGroundSprite(_clear_land_sprites_1[GB(_m[ti->tile].m3, 0, 4)] + _tileh_to_sprite[ti->tileh]);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
DrawGroundSprite( _clear_land_sprites_2[ti->map5&3] + _tileh_to_sprite[ti->tileh]);
|
||||
DrawGroundSprite(_clear_land_sprites_2[GB(ti->map5, 0, 2)] + _tileh_to_sprite[ti->tileh]);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
DrawGroundSprite( _clear_land_sprites_3[ti->map5&3] + _tileh_to_sprite[ti->tileh]);
|
||||
DrawGroundSprite(_clear_land_sprites_3[GB(ti->map5, 0, 2)] + _tileh_to_sprite[ti->tileh]);
|
||||
break;
|
||||
}
|
||||
|
||||
DrawClearLandFence(ti, _map3_hi[ti->tile] >> 2);
|
||||
DrawClearLandFence(ti);
|
||||
}
|
||||
|
||||
uint GetSlopeZ_Clear(TileInfo *ti) { return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z; }
|
||||
static uint GetSlopeZ_Clear(const TileInfo* ti)
|
||||
{
|
||||
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
|
||||
}
|
||||
|
||||
uint GetSlopeTileh_Clear(TileInfo *ti)
|
||||
static uint GetSlopeTileh_Clear(const TileInfo *ti)
|
||||
{
|
||||
return ti->tileh;
|
||||
}
|
||||
|
||||
static void GetAcceptedCargo_Clear(uint tile, AcceptedCargo *ac)
|
||||
static void GetAcceptedCargo_Clear(TileIndex tile, AcceptedCargo ac)
|
||||
{
|
||||
/* unused */
|
||||
}
|
||||
|
||||
static void AnimateTile_Clear(uint tile)
|
||||
static void AnimateTile_Clear(TileIndex tile)
|
||||
{
|
||||
/* unused */
|
||||
}
|
||||
|
||||
void TileLoopClearHelper(uint tile)
|
||||
void TileLoopClearHelper(TileIndex tile)
|
||||
{
|
||||
byte img_1, img_2;
|
||||
static byte img_by_map5[8] = { 0,0,0,2, 1,1,0,0, };
|
||||
uint dirty = -1;
|
||||
byte self;
|
||||
byte neighbour;
|
||||
TileIndex dirty = INVALID_TILE;
|
||||
|
||||
img_1 = 0;
|
||||
if (IS_TILETYPE(tile, MP_CLEAR)) {
|
||||
img_1 = img_by_map5[(_map5[tile] & 0x1C) >> 2];
|
||||
} else if (IS_TILETYPE(tile, MP_TREES) && (_map2[tile] & 0x30) == 0x20) {
|
||||
img_1 = 1;
|
||||
switch (GetTileType(tile)) {
|
||||
case MP_CLEAR:
|
||||
self = (GB(_m[tile].m5, 0, 5) == 15);
|
||||
break;
|
||||
|
||||
default:
|
||||
self = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
img_2 = 0;
|
||||
if (IS_TILETYPE(TILE_ADDXY(tile, 1, 0), MP_CLEAR)) {
|
||||
img_2 = img_by_map5[(_map5[TILE_ADDXY(tile, 1, 0)] & 0x1C) >> 2];
|
||||
} else if (IS_TILETYPE(TILE_ADDXY(tile, 1, 0), MP_TREES) && (_map2[TILE_ADDXY(tile, 1, 0)] & 0x30) == 0x20) {
|
||||
img_2 = 1;
|
||||
switch (GetTileType(TILE_ADDXY(tile, 1, 0))) {
|
||||
case MP_CLEAR:
|
||||
neighbour = (GB(_m[TILE_ADDXY(tile, 1, 0)].m5, 0, 5) == 15);
|
||||
break;
|
||||
|
||||
default:
|
||||
neighbour = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(_map3_hi[tile] & 0xE0)) {
|
||||
if ( (img_1&2) != (img_2&2) ) {
|
||||
_map3_hi[tile] |= 3 << 5;
|
||||
if (GB(_m[tile].m4, 5, 3) == 0) {
|
||||
if (self != neighbour) {
|
||||
SB(_m[tile].m4, 5, 3, 3);
|
||||
dirty = tile;
|
||||
}
|
||||
} else {
|
||||
if (img_1 == 1 && img_2 == 1) {
|
||||
_map3_hi[tile] &= ~(3 << 5);
|
||||
if (self == 0 && neighbour == 0) {
|
||||
SB(_m[tile].m4, 5, 3, 0);
|
||||
dirty = tile;
|
||||
}
|
||||
}
|
||||
|
||||
img_2 = 0;
|
||||
if (IS_TILETYPE(TILE_ADDXY(tile, 0, 1), MP_CLEAR)) {
|
||||
img_2 = img_by_map5[(_map5[TILE_ADDXY(tile, 0, 1)] & 0x1C) >> 2];
|
||||
} else if (IS_TILETYPE(TILE_ADDXY(tile, 0, 1), MP_TREES) && (_map2[TILE_ADDXY(tile, 0, 1)] & 0x30) == 0x20) {
|
||||
img_2 = 1;
|
||||
switch (GetTileType(TILE_ADDXY(tile, 0, 1))) {
|
||||
case MP_CLEAR:
|
||||
neighbour = (GB(_m[TILE_ADDXY(tile, 0, 1)].m5, 0, 5) == 15);
|
||||
break;
|
||||
|
||||
default:
|
||||
neighbour = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(_map3_hi[tile] & 0x1C)) {
|
||||
if ( (img_1&2) != (img_2&2) ) {
|
||||
_map3_hi[tile] |= 3 << 2;
|
||||
if (GB(_m[tile].m4, 2, 3) == 0) {
|
||||
if (self != neighbour) {
|
||||
SB(_m[tile].m4, 2, 3, 3);
|
||||
dirty = tile;
|
||||
}
|
||||
} else {
|
||||
if (img_1 == 1 && img_2 == 1) {
|
||||
_map3_hi[tile] &= ~(3 << 2);
|
||||
if (self == 0 && neighbour == 0) {
|
||||
SB(_m[tile].m4, 2, 3, 0);
|
||||
dirty = tile;
|
||||
}
|
||||
}
|
||||
|
||||
if (dirty != -1)
|
||||
MarkTileDirtyByTile(dirty);
|
||||
if (dirty != INVALID_TILE) MarkTileDirtyByTile(dirty);
|
||||
}
|
||||
|
||||
|
||||
/* convert into snowy tiles */
|
||||
static void TileLoopClearAlps(uint tile)
|
||||
static void TileLoopClearAlps(TileIndex tile)
|
||||
{
|
||||
int k;
|
||||
byte m5,tmp;
|
||||
@@ -594,8 +638,8 @@ static void TileLoopClearAlps(uint tile)
|
||||
/* distance from snow line, in steps of 8 */
|
||||
k = GetTileZ(tile) - _opt.snow_line;
|
||||
|
||||
m5 = _map5[tile] & 0x1C;
|
||||
tmp = _map5[tile] & 3;
|
||||
m5 = _m[tile].m5 & 0x1C;
|
||||
tmp = _m[tile].m5 & 3;
|
||||
|
||||
if (k < -8) {
|
||||
/* snow_m2_down */
|
||||
@@ -643,30 +687,29 @@ static void TileLoopClearAlps(uint tile)
|
||||
return;
|
||||
}
|
||||
|
||||
_map5[tile] = m5;
|
||||
_m[tile].m5 = m5;
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
|
||||
static void TileLoopClearDesert(uint tile)
|
||||
static void TileLoopClearDesert(TileIndex tile)
|
||||
{
|
||||
if ( (_map5[tile] & 0x1C) == 0x14)
|
||||
return;
|
||||
if ((_m[tile].m5 & 0x1C) == 0x14) return;
|
||||
|
||||
if (GetMapExtraBits(tile) == 1) {
|
||||
_map5[tile] = 0x17;
|
||||
_m[tile].m5 = 0x17;
|
||||
} else {
|
||||
if (GetMapExtraBits(tile+TILE_XY(1,0)) != 1 &&
|
||||
GetMapExtraBits(tile+TILE_XY(-1,0)) != 1 &&
|
||||
GetMapExtraBits(tile+TILE_XY(0,1)) != 1 &&
|
||||
GetMapExtraBits(tile+TILE_XY(0,-1)) != 1)
|
||||
return;
|
||||
_map5[tile] = 0x15;
|
||||
if (GetMapExtraBits(tile + TileDiffXY( 1, 0)) != 1 &&
|
||||
GetMapExtraBits(tile + TileDiffXY(-1, 0)) != 1 &&
|
||||
GetMapExtraBits(tile + TileDiffXY( 0, 1)) != 1 &&
|
||||
GetMapExtraBits(tile + TileDiffXY( 0, -1)) != 1)
|
||||
return;
|
||||
_m[tile].m5 = 0x15;
|
||||
}
|
||||
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
|
||||
static void TileLoop_Clear(uint tile)
|
||||
static void TileLoop_Clear(TileIndex tile)
|
||||
{
|
||||
byte m5,m3;
|
||||
|
||||
@@ -678,24 +721,22 @@ static void TileLoop_Clear(uint tile)
|
||||
TileLoopClearAlps(tile);
|
||||
}
|
||||
|
||||
m5 = _map5[tile];
|
||||
if ( (m5 & 0x1C) == 0x10 || (m5 & 0x1C) == 0x14)
|
||||
return;
|
||||
m5 = _m[tile].m5;
|
||||
if ((m5 & 0x1C) == 0x10 || (m5 & 0x1C) == 0x14) return;
|
||||
|
||||
if ( (m5 & 0x1C) != 0xC) {
|
||||
if ( (m5 & 3) == 3)
|
||||
return;
|
||||
if ((m5 & 0x1C) != 0xC) {
|
||||
if ((m5 & 3) == 3) return;
|
||||
|
||||
if (_game_mode != GM_EDITOR) {
|
||||
m5 += 0x20;
|
||||
if (m5 >= 0x20) {
|
||||
// Didn't overflow
|
||||
_map5[tile] = m5;
|
||||
_m[tile].m5 = m5;
|
||||
return;
|
||||
}
|
||||
/* did overflow, so continue */
|
||||
} else {
|
||||
m5 = ((byte)Random() > 21) ? (2) : (6);
|
||||
m5 = (GB(Random(), 0, 8) > 21) ? 2 : 6;
|
||||
}
|
||||
m5++;
|
||||
} else if (_game_mode != GM_EDITOR) {
|
||||
@@ -703,48 +744,48 @@ static void TileLoop_Clear(uint tile)
|
||||
m5 += 0x20;
|
||||
if (m5 >= 0x20) {
|
||||
// Didn't overflow
|
||||
_map5[tile] = m5;
|
||||
_m[tile].m5 = m5;
|
||||
return;
|
||||
}
|
||||
/* overflowed */
|
||||
m3 = _map3_lo[tile] + 1;
|
||||
m3 = _m[tile].m3 + 1;
|
||||
assert( (m3 & 0xF) != 0);
|
||||
if ( (m3 & 0xF) >= 9) /* NOTE: will not work properly if m3&0xF == 0xF */
|
||||
m3 &= ~0xF;
|
||||
_map3_lo[tile] = m3;
|
||||
_m[tile].m3 = m3;
|
||||
}
|
||||
|
||||
_map5[tile] = m5;
|
||||
_m[tile].m5 = m5;
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
|
||||
void GenerateClearTile()
|
||||
void GenerateClearTile(void)
|
||||
{
|
||||
int i,j;
|
||||
uint tile,tile_new;
|
||||
uint32 r;
|
||||
uint i;
|
||||
TileIndex tile;
|
||||
|
||||
/* add hills */
|
||||
i = (Random() & 0x3FF) | 0x400;
|
||||
i = ScaleByMapSize(GB(Random(), 0, 10) + 0x400);
|
||||
do {
|
||||
tile = TILE_MASK(Random());
|
||||
if (IS_TILETYPE(tile, MP_CLEAR))
|
||||
_map5[tile] = (byte)((_map5[tile] & ~(3<<2)) | (1<<2));
|
||||
tile = RandomTile();
|
||||
if (IsTileType(tile, MP_CLEAR)) SB(_m[tile].m5, 2, 2, 1);
|
||||
} while (--i);
|
||||
|
||||
/* add grey squares */
|
||||
i = (Random() & 0x7F) | 0x80;
|
||||
i = ScaleByMapSize(GB(Random(), 0, 7) + 0x80);
|
||||
do {
|
||||
r = Random();
|
||||
tile = TILE_MASK(r);
|
||||
if (IS_TILETYPE(tile, MP_CLEAR)) {
|
||||
j = ((r >> 16) & 0xF) + 5;
|
||||
uint32 r = Random();
|
||||
tile = RandomTileSeed(r);
|
||||
if (IsTileType(tile, MP_CLEAR)) {
|
||||
uint j = GB(r, 16, 4) + 5;
|
||||
for(;;) {
|
||||
_map5[tile] = (byte)((_map5[tile] & ~(3<<2)) | (2<<2));
|
||||
TileIndex tile_new;
|
||||
|
||||
SB(_m[tile].m5, 2, 2, 2);
|
||||
do {
|
||||
if (--j == 0) goto get_out;
|
||||
tile_new = tile + _tileoffs_by_dir[Random() & 3];
|
||||
} while (!IS_TILETYPE(tile_new, MP_CLEAR));
|
||||
tile_new = tile + TileOffsByDir(GB(Random(), 0, 2));
|
||||
} while (!IsTileType(tile_new, MP_CLEAR));
|
||||
tile = tile_new;
|
||||
}
|
||||
get_out:;
|
||||
@@ -752,17 +793,17 @@ get_out:;
|
||||
} while (--i);
|
||||
}
|
||||
|
||||
static void ClickTile_Clear(uint tile)
|
||||
static void ClickTile_Clear(TileIndex tile)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
||||
uint32 GetTileTrackStatus_Clear(uint tile, TransportType mode)
|
||||
static uint32 GetTileTrackStatus_Clear(TileIndex tile, TransportType mode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const StringID _clear_land_str[4+8-1] = {
|
||||
static const StringID _clear_land_str[] = {
|
||||
STR_080B_ROUGH_LAND,
|
||||
STR_080A_ROCKS,
|
||||
STR_080E_FIELDS,
|
||||
@@ -776,21 +817,21 @@ static const StringID _clear_land_str[4+8-1] = {
|
||||
STR_080D_GRASS,
|
||||
};
|
||||
|
||||
static void GetTileDesc_Clear(uint tile, TileDesc *td)
|
||||
static void GetTileDesc_Clear(TileIndex tile, TileDesc *td)
|
||||
{
|
||||
int i = (_map5[tile]>>2) & 7;
|
||||
if (i == 0)
|
||||
i = (_map5[tile] & 3) + 8;
|
||||
uint i = GB(_m[tile].m5, 2, 3);
|
||||
if (i == 0) i = GB(_m[tile].m5, 0, 2) + 8;
|
||||
td->str = _clear_land_str[i - 1];
|
||||
td->owner = _map_owner[tile];
|
||||
td->owner = GetTileOwner(tile);
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Clear(uint tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Clear(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
void InitializeClearLand() {
|
||||
void InitializeClearLand(void)
|
||||
{
|
||||
_opt.snow_line = _patches.snow_line_height * 8;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,17 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "openttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "functions.h"
|
||||
#include "map.h"
|
||||
#include "gui.h"
|
||||
#include "command.h"
|
||||
#include "player.h"
|
||||
#include "network.h"
|
||||
#include "variables.h"
|
||||
|
||||
const char* _cmd_text = NULL;
|
||||
|
||||
#define DEF_COMMAND(yyyy) int32 yyyy(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
|
||||
@@ -19,8 +28,8 @@ DEF_COMMAND(CmdBuildRailroadStation);
|
||||
DEF_COMMAND(CmdRemoveFromRailroadStation);
|
||||
DEF_COMMAND(CmdConvertRail);
|
||||
|
||||
DEF_COMMAND(CmdBuildSignals);
|
||||
DEF_COMMAND(CmdRemoveSignals);
|
||||
DEF_COMMAND(CmdBuildSingleSignal);
|
||||
DEF_COMMAND(CmdRemoveSingleSignal);
|
||||
|
||||
DEF_COMMAND(CmdTerraformLand);
|
||||
|
||||
@@ -30,13 +39,11 @@ DEF_COMMAND(CmdSellLandArea);
|
||||
DEF_COMMAND(CmdBuildTunnel);
|
||||
|
||||
DEF_COMMAND(CmdBuildTrainDepot);
|
||||
DEF_COMMAND(CmdBuildTrainCheckpoint);
|
||||
DEF_COMMAND(CmdRenameCheckpoint);
|
||||
DEF_COMMAND(CmdRemoveTrainCheckpoint);
|
||||
DEF_COMMAND(CmdBuildTrainWaypoint);
|
||||
DEF_COMMAND(CmdRenameWaypoint);
|
||||
DEF_COMMAND(CmdRemoveTrainWaypoint);
|
||||
|
||||
DEF_COMMAND(CmdBuildTruckStation);
|
||||
|
||||
DEF_COMMAND(CmdBuildBusStation);
|
||||
DEF_COMMAND(CmdBuildRoadStop);
|
||||
|
||||
DEF_COMMAND(CmdBuildLongRoad);
|
||||
DEF_COMMAND(CmdRemoveLongRoad);
|
||||
@@ -62,7 +69,7 @@ DEF_COMMAND(CmdStartStopTrain);
|
||||
|
||||
DEF_COMMAND(CmdSellRailWagon);
|
||||
|
||||
DEF_COMMAND(CmdTrainGotoDepot);
|
||||
DEF_COMMAND(CmdSendTrainToDepot);
|
||||
DEF_COMMAND(CmdForceTrainProceed);
|
||||
DEF_COMMAND(CmdReverseTrainDirection);
|
||||
|
||||
@@ -70,14 +77,12 @@ DEF_COMMAND(CmdModifyOrder);
|
||||
DEF_COMMAND(CmdSkipOrder);
|
||||
DEF_COMMAND(CmdDeleteOrder);
|
||||
DEF_COMMAND(CmdInsertOrder);
|
||||
DEF_COMMAND(CmdChangeTrainServiceInt);
|
||||
DEF_COMMAND(CmdChangeServiceInt);
|
||||
DEF_COMMAND(CmdRestoreOrderIndex);
|
||||
|
||||
DEF_COMMAND(CmdBuildIndustry);
|
||||
//DEF_COMMAND(CmdDestroyIndustry);
|
||||
|
||||
DEF_COMMAND(CmdBuildCompanyHQ);
|
||||
DEF_COMMAND(CmdDestroyCompanyHQ);
|
||||
DEF_COMMAND(CmdSetPlayerFace);
|
||||
DEF_COMMAND(CmdSetPlayerColor);
|
||||
|
||||
@@ -98,7 +103,6 @@ DEF_COMMAND(CmdSellAircraft);
|
||||
DEF_COMMAND(CmdStartStopAircraft);
|
||||
DEF_COMMAND(CmdBuildAircraft);
|
||||
DEF_COMMAND(CmdSendAircraftToHangar);
|
||||
DEF_COMMAND(CmdChangeAircraftServiceInt);
|
||||
DEF_COMMAND(CmdRefitAircraft);
|
||||
|
||||
DEF_COMMAND(CmdPlaceSign);
|
||||
@@ -109,10 +113,8 @@ DEF_COMMAND(CmdStartStopRoadVeh);
|
||||
DEF_COMMAND(CmdSellRoadVeh);
|
||||
DEF_COMMAND(CmdSendRoadVehToDepot);
|
||||
DEF_COMMAND(CmdTurnRoadVeh);
|
||||
DEF_COMMAND(CmdChangeRoadVehServiceInt);
|
||||
|
||||
DEF_COMMAND(CmdPause);
|
||||
DEF_COMMAND(CmdResume);
|
||||
|
||||
DEF_COMMAND(CmdBuyShareInCompany);
|
||||
DEF_COMMAND(CmdSellShareInCompany);
|
||||
@@ -124,30 +126,21 @@ DEF_COMMAND(CmdRenameTown);
|
||||
DEF_COMMAND(CmdDoTownAction);
|
||||
|
||||
DEF_COMMAND(CmdSetRoadDriveSide);
|
||||
DEF_COMMAND(CmdSetTownNameType);
|
||||
|
||||
DEF_COMMAND(CmdChangeDifficultyLevel);
|
||||
DEF_COMMAND(CmdChangePatchSetting);
|
||||
|
||||
DEF_COMMAND(CmdStartStopShip);
|
||||
DEF_COMMAND(CmdSellShip);
|
||||
DEF_COMMAND(CmdBuildShip);
|
||||
DEF_COMMAND(CmdSendShipToDepot);
|
||||
DEF_COMMAND(CmdChangeShipServiceInt);
|
||||
DEF_COMMAND(CmdRefitShip);
|
||||
|
||||
|
||||
DEF_COMMAND(CmdStartNewGame);
|
||||
DEF_COMMAND(CmdLoadGame);
|
||||
DEF_COMMAND(CmdCreateScenario);
|
||||
DEF_COMMAND(CmdSetSinglePlayer);
|
||||
|
||||
DEF_COMMAND(CmdSetNewLandscapeType);
|
||||
|
||||
DEF_COMMAND(CmdGenRandomNewGame);
|
||||
DEF_COMMAND(CmdCloneOrder);
|
||||
|
||||
DEF_COMMAND(CmdClearArea);
|
||||
|
||||
DEF_COMMAND(CmdGiveMoney);
|
||||
DEF_COMMAND(CmdMoneyCheat);
|
||||
DEF_COMMAND(CmdBuildCanal);
|
||||
DEF_COMMAND(CmdBuildLock);
|
||||
@@ -158,179 +151,199 @@ DEF_COMMAND(CmdLevelLand);
|
||||
|
||||
DEF_COMMAND(CmdRefitRailVehicle);
|
||||
|
||||
DEF_COMMAND(CmdStartScenario);
|
||||
DEF_COMMAND(CmdBuildSignalTrack);
|
||||
DEF_COMMAND(CmdRemoveSignalTrack);
|
||||
|
||||
DEF_COMMAND(CmdReplaceVehicle);
|
||||
|
||||
DEF_COMMAND(CmdCloneVehicle);
|
||||
|
||||
DEF_COMMAND(CmdBuildManySignals);
|
||||
|
||||
/* The master command table */
|
||||
static CommandProc * const _command_proc_table[] = {
|
||||
CmdBuildRailroadTrack, /* 0 */
|
||||
CmdRemoveRailroadTrack, /* 1 */
|
||||
CmdBuildSingleRail, /* 2 */
|
||||
CmdRemoveSingleRail, /* 3 */
|
||||
CmdLandscapeClear, /* 4 */
|
||||
CmdBuildBridge, /* 5 */
|
||||
CmdBuildRailroadStation, /* 6 */
|
||||
CmdBuildTrainDepot, /* 7 */
|
||||
CmdBuildSignals, /* 8 */
|
||||
CmdRemoveSignals, /* 9 */
|
||||
CmdTerraformLand, /* 10 */
|
||||
CmdPurchaseLandArea, /* 11 */
|
||||
CmdSellLandArea, /* 12 */
|
||||
CmdBuildTunnel, /* 13 */
|
||||
CmdRemoveFromRailroadStation, /* 14 */
|
||||
CmdConvertRail, /* 15 */
|
||||
CmdBuildTrainCheckpoint, /* 16 */
|
||||
CmdRenameCheckpoint, /* 17 */
|
||||
CmdRemoveTrainCheckpoint, /* 18 */
|
||||
CmdBuildTruckStation, /* 19 */
|
||||
NULL, /* 20 */
|
||||
CmdBuildBusStation, /* 21 */
|
||||
NULL, /* 22 */
|
||||
CmdBuildLongRoad, /* 23 */
|
||||
CmdRemoveLongRoad, /* 24 */
|
||||
CmdBuildRoad, /* 25 */
|
||||
CmdRemoveRoad, /* 26 */
|
||||
CmdBuildRoadDepot, /* 27 */
|
||||
NULL, /* 28 */
|
||||
CmdBuildAirport, /* 29 */
|
||||
CmdBuildDock, /* 30 */
|
||||
CmdBuildShipDepot, /* 31 */
|
||||
CmdBuildBuoy, /* 32 */
|
||||
CmdPlantTree, /* 33 */
|
||||
CmdBuildRailVehicle, /* 34 */
|
||||
CmdMoveRailVehicle, /* 35 */
|
||||
CmdStartStopTrain, /* 36 */
|
||||
NULL, /* 37 */
|
||||
CmdSellRailWagon, /* 38 */
|
||||
CmdTrainGotoDepot, /* 39 */
|
||||
CmdForceTrainProceed, /* 40 */
|
||||
CmdReverseTrainDirection, /* 41 */
|
||||
static const Command _command_proc_table[] = {
|
||||
{CmdBuildRailroadTrack, 0}, /* 0 */
|
||||
{CmdRemoveRailroadTrack, 0}, /* 1 */
|
||||
{CmdBuildSingleRail, 0}, /* 2 */
|
||||
{CmdRemoveSingleRail, 0}, /* 3 */
|
||||
{CmdLandscapeClear, 0}, /* 4 */
|
||||
{CmdBuildBridge, 0}, /* 5 */
|
||||
{CmdBuildRailroadStation, 0}, /* 6 */
|
||||
{CmdBuildTrainDepot, 0}, /* 7 */
|
||||
{CmdBuildSingleSignal, 0}, /* 8 */
|
||||
{CmdRemoveSingleSignal, 0}, /* 9 */
|
||||
{CmdTerraformLand, 0}, /* 10 */
|
||||
{CmdPurchaseLandArea, 0}, /* 11 */
|
||||
{CmdSellLandArea, 0}, /* 12 */
|
||||
{CmdBuildTunnel, 0}, /* 13 */
|
||||
{CmdRemoveFromRailroadStation, 0}, /* 14 */
|
||||
{CmdConvertRail, 0}, /* 15 */
|
||||
{CmdBuildTrainWaypoint, 0}, /* 16 */
|
||||
{CmdRenameWaypoint, 0}, /* 17 */
|
||||
{CmdRemoveTrainWaypoint, 0}, /* 18 */
|
||||
{NULL, 0}, /* 19 */
|
||||
{NULL, 0}, /* 20 */
|
||||
{CmdBuildRoadStop, 0}, /* 21 */
|
||||
{NULL, 0}, /* 22 */
|
||||
{CmdBuildLongRoad, 0}, /* 23 */
|
||||
{CmdRemoveLongRoad, 0}, /* 24 */
|
||||
{CmdBuildRoad, 0}, /* 25 */
|
||||
{CmdRemoveRoad, 0}, /* 26 */
|
||||
{CmdBuildRoadDepot, 0}, /* 27 */
|
||||
{NULL, 0}, /* 28 */
|
||||
{CmdBuildAirport, 0}, /* 29 */
|
||||
{CmdBuildDock, 0}, /* 30 */
|
||||
{CmdBuildShipDepot, 0}, /* 31 */
|
||||
{CmdBuildBuoy, 0}, /* 32 */
|
||||
{CmdPlantTree, 0}, /* 33 */
|
||||
{CmdBuildRailVehicle, 0}, /* 34 */
|
||||
{CmdMoveRailVehicle, 0}, /* 35 */
|
||||
{CmdStartStopTrain, 0}, /* 36 */
|
||||
{NULL, 0}, /* 37 */
|
||||
{CmdSellRailWagon, 0}, /* 38 */
|
||||
{CmdSendTrainToDepot, 0}, /* 39 */
|
||||
{CmdForceTrainProceed, 0}, /* 40 */
|
||||
{CmdReverseTrainDirection, 0}, /* 41 */
|
||||
|
||||
CmdModifyOrder, /* 42 */
|
||||
CmdSkipOrder, /* 43 */
|
||||
CmdDeleteOrder, /* 44 */
|
||||
CmdInsertOrder, /* 45 */
|
||||
{CmdModifyOrder, 0}, /* 42 */
|
||||
{CmdSkipOrder, 0}, /* 43 */
|
||||
{CmdDeleteOrder, 0}, /* 44 */
|
||||
{CmdInsertOrder, 0}, /* 45 */
|
||||
|
||||
CmdChangeTrainServiceInt, /* 46 */
|
||||
{CmdChangeServiceInt, 0}, /* 46 */
|
||||
|
||||
CmdBuildIndustry, /* 47 */
|
||||
CmdBuildCompanyHQ, /* 48 */
|
||||
CmdSetPlayerFace, /* 49 */
|
||||
CmdSetPlayerColor, /* 50 */
|
||||
{CmdBuildIndustry, 0}, /* 47 */
|
||||
{CmdBuildCompanyHQ, 0}, /* 48 */
|
||||
{CmdSetPlayerFace, 0}, /* 49 */
|
||||
{CmdSetPlayerColor, 0}, /* 50 */
|
||||
|
||||
CmdIncreaseLoan, /* 51 */
|
||||
CmdDecreaseLoan, /* 52 */
|
||||
{CmdIncreaseLoan, 0}, /* 51 */
|
||||
{CmdDecreaseLoan, 0}, /* 52 */
|
||||
|
||||
CmdWantEnginePreview, /* 53 */
|
||||
{CmdWantEnginePreview, 0}, /* 53 */
|
||||
|
||||
CmdNameVehicle, /* 54 */
|
||||
CmdRenameEngine, /* 55 */
|
||||
{CmdNameVehicle, 0}, /* 54 */
|
||||
{CmdRenameEngine, 0}, /* 55 */
|
||||
|
||||
CmdChangeCompanyName, /* 56 */
|
||||
CmdChangePresidentName, /* 57 */
|
||||
{CmdChangeCompanyName, 0}, /* 56 */
|
||||
{CmdChangePresidentName, 0}, /* 57 */
|
||||
|
||||
CmdRenameStation, /* 58 */
|
||||
{CmdRenameStation, 0}, /* 58 */
|
||||
|
||||
CmdSellAircraft, /* 59 */
|
||||
CmdStartStopAircraft, /* 60 */
|
||||
CmdBuildAircraft, /* 61 */
|
||||
CmdSendAircraftToHangar, /* 62 */
|
||||
CmdChangeAircraftServiceInt, /* 63 */
|
||||
CmdRefitAircraft, /* 64 */
|
||||
{CmdSellAircraft, 0}, /* 59 */
|
||||
{CmdStartStopAircraft, 0}, /* 60 */
|
||||
|
||||
CmdPlaceSign, /* 65 */
|
||||
CmdRenameSign, /* 66 */
|
||||
{CmdBuildAircraft, 0}, /* 61 */
|
||||
{CmdSendAircraftToHangar, 0}, /* 62 */
|
||||
{NULL, 0}, /* 63 */
|
||||
{CmdRefitAircraft, 0}, /* 64 */
|
||||
|
||||
CmdBuildRoadVeh, /* 67 */
|
||||
CmdStartStopRoadVeh, /* 68 */
|
||||
CmdSellRoadVeh, /* 69 */
|
||||
CmdSendRoadVehToDepot, /* 70 */
|
||||
CmdTurnRoadVeh, /* 71 */
|
||||
CmdChangeRoadVehServiceInt, /* 72 */
|
||||
{CmdPlaceSign, 0}, /* 65 */
|
||||
{CmdRenameSign, 0}, /* 66 */
|
||||
|
||||
CmdPause, /* 73 */
|
||||
{CmdBuildRoadVeh, 0}, /* 67 */
|
||||
{CmdStartStopRoadVeh, 0}, /* 68 */
|
||||
{CmdSellRoadVeh, 0}, /* 69 */
|
||||
{CmdSendRoadVehToDepot, 0}, /* 70 */
|
||||
{CmdTurnRoadVeh, 0}, /* 71 */
|
||||
{NULL, 0}, /* 72 */
|
||||
|
||||
CmdBuyShareInCompany, /* 74 */
|
||||
CmdSellShareInCompany, /* 75 */
|
||||
CmdBuyCompany, /* 76 */
|
||||
{CmdPause, CMD_SERVER}, /* 73 */
|
||||
|
||||
CmdBuildTown, /* 77 */
|
||||
NULL, /* 78 */
|
||||
NULL, /* 79 */
|
||||
CmdRenameTown, /* 80 */
|
||||
CmdDoTownAction, /* 81 */
|
||||
{CmdBuyShareInCompany, 0}, /* 74 */
|
||||
{CmdSellShareInCompany, 0}, /* 75 */
|
||||
{CmdBuyCompany, 0}, /* 76 */
|
||||
|
||||
CmdSetRoadDriveSide, /* 82 */
|
||||
CmdSetTownNameType, /* 83 */
|
||||
NULL, /* 84 */
|
||||
CmdChangeDifficultyLevel, /* 85 */
|
||||
{CmdBuildTown, CMD_OFFLINE}, /* 77 */
|
||||
{NULL, 0}, /* 78 */
|
||||
{NULL, 0}, /* 79 */
|
||||
{CmdRenameTown, CMD_SERVER}, /* 80 */
|
||||
{CmdDoTownAction, 0}, /* 81 */
|
||||
|
||||
CmdStartStopShip, /* 86 */
|
||||
CmdSellShip, /* 87 */
|
||||
CmdBuildShip, /* 88 */
|
||||
CmdSendShipToDepot, /* 89 */
|
||||
CmdChangeShipServiceInt, /* 90 */
|
||||
CmdRefitShip, /* 91 */
|
||||
{CmdSetRoadDriveSide, CMD_SERVER}, /* 82 */
|
||||
{NULL, 0}, /* 83 */
|
||||
{NULL, 0}, /* 84 */
|
||||
{CmdChangeDifficultyLevel, CMD_SERVER}, /* 85 */
|
||||
|
||||
CmdStartNewGame, /* 92 */
|
||||
CmdLoadGame, /* 93 */
|
||||
CmdCreateScenario, /* 94 */
|
||||
CmdSetSinglePlayer, /* 95 */
|
||||
NULL, /* 96 */
|
||||
CmdSetNewLandscapeType, /* 97 */
|
||||
{CmdStartStopShip, 0}, /* 86 */
|
||||
{CmdSellShip, 0}, /* 87 */
|
||||
{CmdBuildShip, 0}, /* 88 */
|
||||
{CmdSendShipToDepot, 0}, /* 89 */
|
||||
{NULL, 0}, /* 90 */
|
||||
{CmdRefitShip, 0}, /* 91 */
|
||||
|
||||
CmdGenRandomNewGame, /* 98 */
|
||||
{NULL, 0}, /* 92 */
|
||||
{NULL, 0}, /* 93 */
|
||||
{NULL, 0}, /* 94 */
|
||||
{NULL, 0}, /* 95 */
|
||||
{NULL, 0}, /* 96 */
|
||||
{NULL, 0}, /* 97 */
|
||||
{NULL, 0}, /* 98 */
|
||||
|
||||
CmdCloneOrder, /* 99 */
|
||||
{CmdCloneOrder, 0}, /* 99 */
|
||||
|
||||
CmdClearArea, /* 100 */
|
||||
CmdResume, /* 101 */
|
||||
{CmdClearArea, 0}, /* 100 */
|
||||
{NULL, 0}, /* 101 */
|
||||
|
||||
CmdMoneyCheat, /* 102 */
|
||||
CmdBuildCanal, /* 103 */
|
||||
CmdPlayerCtrl, /* 104 */
|
||||
{CmdMoneyCheat, CMD_OFFLINE}, /* 102 */
|
||||
{CmdBuildCanal, 0}, /* 103 */
|
||||
{CmdPlayerCtrl, 0}, /* 104 */
|
||||
|
||||
CmdLevelLand, /* 105 */
|
||||
{CmdLevelLand, 0}, /* 105 */
|
||||
|
||||
CmdRefitRailVehicle, /* 106 */
|
||||
CmdRestoreOrderIndex, /* 107 */
|
||||
CmdBuildLock, /* 108 */
|
||||
CmdStartScenario, /* 109 */
|
||||
CmdBuildManySignals, /* 110 */
|
||||
//CmdDestroyIndustry, /* 109 */
|
||||
CmdDestroyCompanyHQ, /* 111 */
|
||||
{CmdRefitRailVehicle, 0}, /* 106 */
|
||||
{CmdRestoreOrderIndex, 0}, /* 107 */
|
||||
{CmdBuildLock, 0}, /* 108 */
|
||||
{NULL, 0}, /* 109 */
|
||||
{CmdBuildSignalTrack, 0}, /* 110 */
|
||||
{CmdRemoveSignalTrack, 0}, /* 111 */
|
||||
{NULL, 0}, /* 112 */
|
||||
{CmdGiveMoney, 0}, /* 113 */
|
||||
{CmdChangePatchSetting, CMD_SERVER}, /* 114 */
|
||||
{CmdReplaceVehicle, 0}, /* 115 */
|
||||
{CmdCloneVehicle, 0}, /* 116 */
|
||||
};
|
||||
|
||||
/* This function range-checks a cmd, and checks if the cmd is not NULL */
|
||||
bool IsValidCommand(uint cmd)
|
||||
{
|
||||
cmd &= 0xFF;
|
||||
|
||||
return
|
||||
cmd < lengthof(_command_proc_table) &&
|
||||
_command_proc_table[cmd].proc != NULL;
|
||||
}
|
||||
|
||||
byte GetCommandFlags(uint cmd) {return _command_proc_table[cmd & 0xFF].flags;}
|
||||
|
||||
int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
|
||||
{
|
||||
return DoCommand(GET_TILE_X(tile)*16, GET_TILE_Y(tile)*16, p1, p2, flags, procc);
|
||||
return DoCommand(TileX(tile) * 16, TileY(tile) * 16, p1, p2, flags, procc);
|
||||
}
|
||||
|
||||
|
||||
//extern void _stdcall Sleep(int s);
|
||||
static int _docommand_recursive;
|
||||
|
||||
int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc)
|
||||
{
|
||||
int32 res;
|
||||
CommandProc *proc;
|
||||
|
||||
proc = _command_proc_table[procc];
|
||||
|
||||
if (_docommand_recursive == 0) {
|
||||
_error_message = INVALID_STRING_ID;
|
||||
// update last build coord of player
|
||||
if ( (x|y) != 0 && _current_player < MAX_PLAYERS) {
|
||||
DEREF_PLAYER(_current_player)->last_build_coordinate = TILE_FROM_XY(x,y);
|
||||
}
|
||||
/* Do not even think about executing out-of-bounds tile-commands */
|
||||
if (TileVirtXY(x, y) >= MapSize()) {
|
||||
_cmd_text = NULL;
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
proc = _command_proc_table[procc].proc;
|
||||
|
||||
if (_docommand_recursive == 0) _error_message = INVALID_STRING_ID;
|
||||
|
||||
_docommand_recursive++;
|
||||
|
||||
// only execute the test call if it's toplevel, or we're not execing.
|
||||
if (_docommand_recursive == 1 || !(flags & DC_EXEC) || (flags & DC_FORCETEST) ) {
|
||||
res = proc(x, y, flags&~DC_EXEC, p1, p2);
|
||||
if ((uint32)res >> 16 == 0x8000) {
|
||||
if (CmdFailed(res)) {
|
||||
if (res & 0xFFFF) _error_message = res & 0xFFFF;
|
||||
goto error;
|
||||
}
|
||||
@@ -342,33 +355,40 @@ int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc)
|
||||
|
||||
if (!(flags & DC_EXEC)) {
|
||||
_docommand_recursive--;
|
||||
_cmd_text = NULL;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
// execute the command here.
|
||||
_yearly_expenses_type = 0;
|
||||
/* Execute the command here. All cost-relevant functions set the expenses type
|
||||
* themselves with "SET_EXPENSES_TYPE(...);" at the beginning of the function */
|
||||
res = proc(x, y, flags, p1, p2);
|
||||
if ((uint32)res >> 16 == 0x8000) {
|
||||
if (CmdFailed(res)) {
|
||||
if (res & 0xFFFF) _error_message = res & 0xFFFF;
|
||||
error:
|
||||
_docommand_recursive--;
|
||||
_cmd_text = NULL;
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
// if toplevel, subtract the money.
|
||||
if (--_docommand_recursive == 0) {
|
||||
SubtractMoneyFromPlayer(res);
|
||||
// XXX - Old AI hack which doesn't use DoCommandDP; update last build coord of player
|
||||
if ( (x|y) != 0 && _current_player < MAX_PLAYERS) {
|
||||
GetPlayer(_current_player)->last_build_coordinate = TileVirtXY(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
_cmd_text = NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
int32 GetAvailableMoneyForCommand()
|
||||
int32 GetAvailableMoneyForCommand(void)
|
||||
{
|
||||
uint pid = _current_player;
|
||||
PlayerID pid = _current_player;
|
||||
if (pid >= MAX_PLAYERS) return 0x7FFFFFFF; // max int
|
||||
return DEREF_PLAYER(pid)->player_money;
|
||||
return GetPlayer(pid)->player_money;
|
||||
}
|
||||
|
||||
// toplevel network safe docommand function for the current player. must not be called recursively.
|
||||
@@ -380,27 +400,26 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
|
||||
uint32 flags;
|
||||
bool notest;
|
||||
|
||||
int x = GET_TILE_X(tile)*16;
|
||||
int y = GET_TILE_Y(tile)*16;
|
||||
int x = TileX(tile) * 16;
|
||||
int y = TileY(tile) * 16;
|
||||
|
||||
/* Do not even think about executing out-of-bounds tile-commands */
|
||||
if (tile >= MapSize()) {
|
||||
_cmd_text = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
assert(_docommand_recursive == 0);
|
||||
|
||||
if (_networking && !(cmd & CMD_NET_INSTANT) && _pause) {
|
||||
// When the game is paused, and we are in a network game
|
||||
// we do not allow any commands. This is because
|
||||
// of some technical reasons
|
||||
ShowErrorMessage(-1, STR_MULTIPLAYER_PAUSED, x, y);
|
||||
_docommand_recursive = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
_error_message = INVALID_STRING_ID;
|
||||
_error_message_2 = cmd >> 16;
|
||||
_additional_cash_required = 0;
|
||||
|
||||
// spectator has no rights.
|
||||
if (_current_player == OWNER_SPECTATOR) {
|
||||
/** Spectator has no rights except for the dedicated server which
|
||||
* is a spectator but is the server, so can do anything */
|
||||
if (_current_player == OWNER_SPECTATOR && !_network_dedicated) {
|
||||
ShowErrorMessage(_error_message, _error_message_2, x, y);
|
||||
_cmd_text = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -410,24 +429,35 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
|
||||
|
||||
// get pointer to command handler
|
||||
assert((cmd & 0xFF) < lengthof(_command_proc_table));
|
||||
proc = _command_proc_table[cmd & 0xFF];
|
||||
proc = _command_proc_table[cmd & 0xFF].proc;
|
||||
if (proc == NULL) {
|
||||
_cmd_text = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
// this command is a notest command?
|
||||
// Some commands have a different output in dryrun than the realrun
|
||||
// e.g.: if you demolish a whole town, the dryrun would say okay.
|
||||
// but by really destroying, your rating drops and at a certain point
|
||||
// it will fail. so res and res2 are different
|
||||
// CMD_REMOVE_ROAD: This command has special local authority
|
||||
// restrictions which may cause the test run to fail (the previous
|
||||
// road fragments still stay there and the town won't let you
|
||||
// disconnect the road system), but the exec will succeed and this
|
||||
// fact will trigger an assertion failure. --pasky
|
||||
notest =
|
||||
(cmd & 0xFF) == CMD_CLEAR_AREA ||
|
||||
(cmd & 0xFF) == CMD_CONVERT_RAIL ||
|
||||
(cmd & 0xFF) == CMD_LEVEL_LAND ||
|
||||
(cmd & 0xFF) == CMD_TRAIN_GOTO_DEPOT;
|
||||
|
||||
if (_networking && (cmd & CMD_ASYNC)) notest = true;
|
||||
(cmd & 0xFF) == CMD_REMOVE_ROAD ||
|
||||
(cmd & 0xFF) == CMD_REMOVE_LONG_ROAD;
|
||||
|
||||
_docommand_recursive = 1;
|
||||
|
||||
// cost estimation only?
|
||||
if (_shift_pressed && _current_player == _local_player && !(cmd & CMD_DONT_NETWORK)) {
|
||||
if (_shift_pressed && IsLocalPlayer() && !(cmd & (CMD_NETWORK_COMMAND | CMD_SHOW_NO_ERROR))) {
|
||||
// estimate the cost.
|
||||
res = proc(x, y, flags, p1, p2);
|
||||
if ((uint32)res >> 16 == 0x8000) {
|
||||
if (CmdFailed(res)) {
|
||||
if (res & 0xFFFF) _error_message = res & 0xFFFF;
|
||||
ShowErrorMessage(_error_message, _error_message_2, x, y);
|
||||
} else {
|
||||
@@ -435,46 +465,53 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
|
||||
}
|
||||
|
||||
_docommand_recursive = 0;
|
||||
_cmd_text = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// unless the command is a notest command, check if it can be executed.
|
||||
if (!notest) {
|
||||
if (!((cmd & CMD_NO_TEST_IF_IN_NETWORK) && _networking)) {
|
||||
// first test if the command can be executed.
|
||||
res = proc(x,y, flags, p1, p2);
|
||||
if ((uint32)res >> 16 == 0x8000) {
|
||||
if (CmdFailed(res)) {
|
||||
if (res & 0xFFFF) _error_message = res & 0xFFFF;
|
||||
goto show_error;
|
||||
}
|
||||
// no money?
|
||||
if (res != 0 && !CheckPlayerHasMoney(res)) goto show_error;
|
||||
// no money? Only check if notest is off
|
||||
if (!notest && res != 0 && !CheckPlayerHasMoney(res)) goto show_error;
|
||||
}
|
||||
|
||||
// put the command in a network queue and execute it later?
|
||||
if (_networking && !(cmd & CMD_DONT_NETWORK)) {
|
||||
if (!(cmd & CMD_NET_INSTANT)) {
|
||||
NetworkSendCommand(tile, p1, p2, cmd, callback);
|
||||
_docommand_recursive = 0;
|
||||
return true;
|
||||
} else {
|
||||
// Instant Command ... Relay and Process then
|
||||
NetworkSendCommand(tile, p1, p2, cmd, callback);
|
||||
}
|
||||
#ifdef ENABLE_NETWORK
|
||||
/** If we are in network, and the command is not from the network
|
||||
* send it to the command-queue and abort execution
|
||||
* If we are a dedicated server temporarily switch local player, otherwise
|
||||
* the other parties won't be able to execute our command and will desync.
|
||||
* @todo Rewrite dedicated server to something more than a dirty hack!
|
||||
*/
|
||||
if (_networking && !(cmd & CMD_NETWORK_COMMAND)) {
|
||||
if (_network_dedicated) _local_player = 0;
|
||||
NetworkSend_Command(tile, p1, p2, cmd, callback);
|
||||
if (_network_dedicated) _local_player = OWNER_SPECTATOR;
|
||||
_docommand_recursive = 0;
|
||||
_cmd_text = NULL;
|
||||
return true;
|
||||
}
|
||||
#endif /* ENABLE_NETWORK */
|
||||
|
||||
// update last build coordinate of player.
|
||||
if ( tile != 0 && _current_player < MAX_PLAYERS) DEREF_PLAYER(_current_player)->last_build_coordinate = tile;
|
||||
if ( tile != 0 && _current_player < MAX_PLAYERS) GetPlayer(_current_player)->last_build_coordinate = tile;
|
||||
|
||||
// actually try and execute the command.
|
||||
_yearly_expenses_type = 0;
|
||||
/* Actually try and execute the command. If no cost-type is given
|
||||
* use the construction one */
|
||||
_yearly_expenses_type = EXPENSES_CONSTRUCTION;
|
||||
res2 = proc(x,y, flags|DC_EXEC, p1, p2);
|
||||
|
||||
if (!notest) {
|
||||
// If notest is on, it means the result of the test can be different than
|
||||
// the real command.. so ignore the test
|
||||
if (!notest && !((cmd & CMD_NO_TEST_IF_IN_NETWORK) && _networking)) {
|
||||
assert(res == res2); // sanity check
|
||||
} else {
|
||||
if ((uint32)res2 >> 16 == 0x8000) {
|
||||
if (CmdFailed(res2)) {
|
||||
if (res2 & 0xFFFF) _error_message = res2 & 0xFFFF;
|
||||
goto show_error;
|
||||
}
|
||||
@@ -482,11 +519,11 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
|
||||
|
||||
SubtractMoneyFromPlayer(res2);
|
||||
|
||||
if (_current_player == _local_player && _game_mode != GM_EDITOR) {
|
||||
if (IsLocalPlayer() && _game_mode != GM_EDITOR) {
|
||||
if (res2 != 0)
|
||||
ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
|
||||
if (_additional_cash_required) {
|
||||
SET_DPARAM32(0, _additional_cash_required);
|
||||
SetDParam(0, _additional_cash_required);
|
||||
ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, _error_message_2, x,y);
|
||||
if (res2 == 0) goto callb_err;
|
||||
}
|
||||
@@ -495,16 +532,18 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
|
||||
_docommand_recursive = 0;
|
||||
|
||||
if (callback) callback(true, tile, p1, p2);
|
||||
_cmd_text = NULL;
|
||||
return true;
|
||||
|
||||
show_error:
|
||||
// show error message if the command fails?
|
||||
if (_current_player == _local_player && _error_message_2 != 0)
|
||||
if (IsLocalPlayer() && _error_message_2 != 0)
|
||||
ShowErrorMessage(_error_message, _error_message_2, x,y);
|
||||
|
||||
callb_err:
|
||||
_docommand_recursive = 0;
|
||||
|
||||
if (callback) callback(false, tile, p1, p2);
|
||||
_cmd_text = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef COMMAND_H
|
||||
#define COMMAND_H
|
||||
|
||||
@@ -20,12 +22,11 @@ enum {
|
||||
CMD_REMOVE_FROM_RAILROAD_STATION = 14,
|
||||
CMD_CONVERT_RAIL = 15,
|
||||
|
||||
CMD_BUILD_TRAIN_CHECKPOINT = 16,
|
||||
CMD_RENAME_CHECKPOINT = 17,
|
||||
CMD_REMOVE_TRAIN_CHECKPOINT = 18,
|
||||
CMD_BUILD_TRAIN_WAYPOINT = 16,
|
||||
CMD_RENAME_WAYPOINT = 17,
|
||||
CMD_REMOVE_TRAIN_WAYPOINT = 18,
|
||||
|
||||
CMD_BUILD_TRUCK_STATION = 19,
|
||||
CMD_BUILD_BUS_STATION = 21,
|
||||
CMD_BUILD_ROAD_STOP = 21,
|
||||
CMD_BUILD_LONG_ROAD = 23,
|
||||
CMD_REMOVE_LONG_ROAD = 24,
|
||||
CMD_BUILD_ROAD = 25,
|
||||
@@ -57,7 +58,7 @@ enum {
|
||||
CMD_DELETE_ORDER = 44,
|
||||
CMD_INSERT_ORDER = 45,
|
||||
|
||||
CMD_CHANGE_TRAIN_SERVICE_INT = 46,
|
||||
CMD_CHANGE_SERVICE_INT = 46,
|
||||
|
||||
CMD_BUILD_INDUSTRY = 47,
|
||||
|
||||
@@ -80,7 +81,6 @@ enum {
|
||||
CMD_START_STOP_AIRCRAFT = 60,
|
||||
CMD_BUILD_AIRCRAFT = 61,
|
||||
CMD_SEND_AIRCRAFT_TO_HANGAR = 62,
|
||||
CMD_CHANGE_AIRCRAFT_SERVICE_INT = 63,
|
||||
CMD_REFIT_AIRCRAFT = 64,
|
||||
|
||||
CMD_PLACE_SIGN = 65,
|
||||
@@ -91,7 +91,6 @@ enum {
|
||||
CMD_SELL_ROAD_VEH = 69,
|
||||
CMD_SEND_ROADVEH_TO_DEPOT = 70,
|
||||
CMD_TURN_ROADVEH = 71,
|
||||
CMD_CHANGE_ROADVEH_SERVICE_INT = 72,
|
||||
|
||||
CMD_PAUSE = 73,
|
||||
|
||||
@@ -105,8 +104,6 @@ enum {
|
||||
CMD_DO_TOWN_ACTION = 81,
|
||||
|
||||
CMD_SET_ROAD_DRIVE_SIDE = 82,
|
||||
CMD_SET_TOWN_NAME_TYPE = 83,
|
||||
|
||||
|
||||
CMD_CHANGE_DIFFICULTY_LEVEL = 85,
|
||||
|
||||
@@ -114,23 +111,11 @@ enum {
|
||||
CMD_SELL_SHIP = 87,
|
||||
CMD_BUILD_SHIP = 88,
|
||||
CMD_SEND_SHIP_TO_DEPOT = 89,
|
||||
CMD_CHANGE_SHIP_SERVICE_INT = 90,
|
||||
CMD_REFIT_SHIP = 91,
|
||||
|
||||
CMD_START_NEW_GAME = 92,
|
||||
CMD_LOAD_GAME = 93,
|
||||
CMD_CREATE_SCENARIO = 94,
|
||||
CMD_SET_SINGLE_PLAYER = 95,
|
||||
|
||||
CMD_SET_NEW_LANDSCAPE_TYPE = 97,
|
||||
|
||||
CMD_GEN_RANDOM_NEW_GAME = 98,
|
||||
|
||||
CMD_CLONE_ORDER = 99,
|
||||
CMD_CLEAR_AREA = 100,
|
||||
|
||||
CMD_RESUME = 101,
|
||||
|
||||
CMD_MONEY_CHEAT = 102,
|
||||
CMD_BUILD_CANAL = 103,
|
||||
|
||||
@@ -141,11 +126,16 @@ enum {
|
||||
CMD_RESTORE_ORDER_INDEX = 107,
|
||||
CMD_BUILD_LOCK = 108,
|
||||
|
||||
CMD_START_SCENARIO = 109,
|
||||
CMD_BUILD_MANY_SIGNALS = 110,
|
||||
CMD_BUILD_SIGNAL_TRACK = 110,
|
||||
CMD_REMOVE_SIGNAL_TRACK = 111,
|
||||
|
||||
CMD_GIVE_MONEY = 113,
|
||||
CMD_CHANGE_PATCH_SETTING = 114,
|
||||
|
||||
CMD_REPLACE_VEHICLE = 115,
|
||||
|
||||
CMD_CLONE_VEHICLE = 116,
|
||||
|
||||
//CMD_DESTROY_INDUSTRY = 109,
|
||||
CMD_DESTROY_COMPANY_HQ = 111,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -166,18 +156,46 @@ enum {
|
||||
enum {
|
||||
CMD_AUTO = 0x200,
|
||||
CMD_NO_WATER = 0x400,
|
||||
CMD_DONT_NETWORK = 0x800, // execute the command without sending it on the network
|
||||
CMD_ASYNC = 0x1000, // execute the command asynchronously without testing first in networking
|
||||
CMD_NET_INSTANT = 0x2000,
|
||||
CMD_NETWORK_COMMAND = 0x800, // execute the command without sending it on the network
|
||||
CMD_NO_TEST_IF_IN_NETWORK = 0x1000, // When enabled, the command will bypass the no-DC_EXEC round if in network
|
||||
CMD_SHOW_NO_ERROR = 0x2000,
|
||||
};
|
||||
|
||||
/** Command flags for the command table
|
||||
* @see _command_proc_table
|
||||
*/
|
||||
enum {
|
||||
CMD_SERVER = 0x1, /// the command can only be initiated by the server
|
||||
CMD_OFFLINE = 0x2, /// the command cannot be executed in a multiplayer game; single-player only
|
||||
};
|
||||
|
||||
typedef struct Command {
|
||||
CommandProc *proc;
|
||||
byte flags;
|
||||
} Command;
|
||||
|
||||
//#define return_cmd_error(errcode) do { _error_message=(errcode); return CMD_ERROR; } while(0)
|
||||
#define return_cmd_error(errcode) do { return CMD_ERROR | (errcode); } while (0)
|
||||
|
||||
/**
|
||||
* Check the return value of a DoCommand*() function
|
||||
* @param res the resulting value from the command to be checked
|
||||
* @return Return true if the command failed, false otherwise
|
||||
*/
|
||||
static inline bool CmdFailed(int32 res)
|
||||
{
|
||||
// lower 16bits are the StringID of the possible error
|
||||
return res <= (CMD_ERROR | INVALID_STRING_ID);
|
||||
}
|
||||
|
||||
/* command.c */
|
||||
int32 DoCommand(int x, int y, uint32 p1, uint32 p2, uint32 flags, uint procc);
|
||||
int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
|
||||
|
||||
int32 GetAvailableMoneyForCommand();
|
||||
extern const char* _cmd_text; // Text, which gets sent with a command
|
||||
|
||||
bool IsValidCommand(uint cmd);
|
||||
byte GetCommandFlags(uint cmd);
|
||||
int32 GetAvailableMoneyForCommand(void);
|
||||
|
||||
#endif /* COMMAND_H */
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/bin/sh -
|
||||
|
||||
SDLCONFIG=`which sdl-config || which sdl11-config || which sdl12-config || echo `
|
||||
if [ -n "$SDLCONFIG" ] ; then
|
||||
echo "SDL config is located at: $SDLCONFIG"
|
||||
sed -e"s@XX_SDL_CONFIG_PLACEHOLDER_XX@$SDLCONFIG@g" < Jamfile.next > tmp && mv tmp Jamfile
|
||||
else
|
||||
echo "********************************"
|
||||
echo "ERROR! SDL CONFIG WAS NOT FOUND!"
|
||||
echo "********************************"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Configure complete. Now use 'jam' to build"
|
||||
echo "Add -sWITH_PNG=<dir to png.h> to build with PNG support"
|
||||
echo "Add -sWITH_ZLIB=1 to enable zlib savegame support"
|
||||
echo "Add -sRELEASE=1 to build an optimized executable"
|
||||
echo "Add -sWITH_BONE_NETWORKING=1 to build with BeOS BONE networking support"
|
||||
echo "Add -sBEOS_MIDI=1 to enable BeOS native MIDI (libmidi.so) music output"
|
||||
echo ""
|
||||
echo "For people using make:"
|
||||
echo "write make (or gmake)"
|
||||
echo "configure have nothing to do with the makefile"
|
||||
|
||||
@@ -1,129 +1,160 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef CONSOLE_H
|
||||
#define CONSOLE_H
|
||||
|
||||
// ** console ** //
|
||||
// maximum length of a typed in command
|
||||
#define ICON_CMDLN_SIZE 255
|
||||
// maximum length of a totally expanded command
|
||||
#define ICON_MAX_STREAMSIZE 1024
|
||||
|
||||
enum {
|
||||
ICONSOLE_OPENED=0,
|
||||
ICONSOLE_CLOSED,
|
||||
} _iconsole_modes;
|
||||
|
||||
// ** console parser ** //
|
||||
|
||||
enum {
|
||||
ICONSOLE_VAR_NONE=0,
|
||||
typedef enum IConsoleVarTypes {
|
||||
ICONSOLE_VAR_BOOLEAN,
|
||||
ICONSOLE_VAR_BYTE,
|
||||
ICONSOLE_VAR_UINT16,
|
||||
ICONSOLE_VAR_UINT32,
|
||||
ICONSOLE_VAR_INT16,
|
||||
ICONSOLE_VAR_INT32,
|
||||
ICONSOLE_VAR_STRING,
|
||||
ICONSOLE_VAR_POINTER,
|
||||
ICONSOLE_VAR_REFERENCE,
|
||||
ICONSOLE_VAR_UNKNOWN,
|
||||
} _iconsole_var_types;
|
||||
ICONSOLE_VAR_STRING
|
||||
} IConsoleVarTypes;
|
||||
|
||||
enum {
|
||||
typedef enum IConsoleModes {
|
||||
ICONSOLE_FULL,
|
||||
ICONSOLE_OPENED,
|
||||
ICONSOLE_CLOSED
|
||||
} IConsoleModes;
|
||||
|
||||
typedef enum IConsoleHookTypes {
|
||||
ICONSOLE_HOOK_ACCESS,
|
||||
ICONSOLE_HOOK_BEFORE_CHANGE,
|
||||
ICONSOLE_HOOK_BEFORE_EXEC,
|
||||
ICONSOLE_HOOK_AFTER_CHANGE,
|
||||
ICONSOLE_HOOK_AFTER_EXEC,
|
||||
} _iconsole_hook_types;
|
||||
ICONSOLE_HOOK_PRE_ACTION,
|
||||
ICONSOLE_HOOK_POST_ACTION
|
||||
} IConsoleHookTypes;
|
||||
|
||||
typedef struct {
|
||||
// -------------- //
|
||||
void * addr;
|
||||
byte * name;
|
||||
// -------------- //
|
||||
void * hook_access;
|
||||
void * hook_before_exec;
|
||||
void * hook_after_exec;
|
||||
// -------------- //
|
||||
void * _next;
|
||||
} _iconsole_cmd;
|
||||
/** --Hooks--
|
||||
* Hooks are certain triggers get get accessed/executed on either
|
||||
* access, before execution/change or after execution/change. This allows
|
||||
* for general flow of permissions or special action needed in some cases
|
||||
*/
|
||||
typedef bool IConsoleHook(void);
|
||||
typedef struct IConsoleHooks{
|
||||
IConsoleHook *access; // trigger when accessing the variable/command
|
||||
IConsoleHook *pre; // trigger before the variable/command is changed/executed
|
||||
IConsoleHook *post; // trigger after the variable/command is changed/executed
|
||||
} IConsoleHooks;
|
||||
|
||||
typedef struct {
|
||||
// --------------- //
|
||||
void * addr;
|
||||
const byte * name;
|
||||
byte type;
|
||||
// -------------- //
|
||||
void * hook_access;
|
||||
void * hook_before_change;
|
||||
void * hook_after_change;
|
||||
// -------------- //
|
||||
void * _next;
|
||||
bool _malloc;
|
||||
} _iconsole_var;
|
||||
/** --Commands--
|
||||
* Commands are commands, or functions. They get executed once and any
|
||||
* effect they produce are carried out. The arguments to the commands
|
||||
* are given to them, each input word seperated by a double-quote (") is an argument
|
||||
* If you want to handle multiple words as one, enclose them in double-quotes
|
||||
* eg. 'say "hello sexy boy"'
|
||||
*/
|
||||
typedef bool (IConsoleCmdProc)(byte argc, char *argv[]);
|
||||
|
||||
struct IConsoleCmd;
|
||||
typedef struct IConsoleCmd {
|
||||
char *name; // name of command
|
||||
struct IConsoleCmd *next; // next command in list
|
||||
|
||||
IConsoleCmdProc *proc; // process executed when command is typed
|
||||
IConsoleHooks hook; // any special trigger action that needs executing
|
||||
} IConsoleCmd;
|
||||
|
||||
/** --Variables--
|
||||
* Variables are pointers to real ingame variables which allow for
|
||||
* changing while ingame. After changing they keep their new value
|
||||
* and can be used for debugging, gameplay, etc. It accepts:
|
||||
* - no arguments; just print out current value
|
||||
* - '= <new value>' to assign a new value to the variable
|
||||
* - '++' to increase value by one
|
||||
* - '--' to decrease value by one
|
||||
*/
|
||||
struct IConsoleVar;
|
||||
typedef struct IConsoleVar {
|
||||
char *name; // name of the variable
|
||||
struct IConsoleVar *next; // next variable in list
|
||||
|
||||
void *addr; // the address where the variable is pointing at
|
||||
uint32 size; // size of the variable, used for strings
|
||||
char *help; // the optional help string shown when requesting information
|
||||
IConsoleVarTypes type; // type of variable (for correct assignment/output)
|
||||
IConsoleCmdProc *proc; // some variables need really special handling, use a callback function for that
|
||||
IConsoleHooks hook; // any special trigger action that needs executing
|
||||
} IConsoleVar;
|
||||
|
||||
/** --Aliases--
|
||||
* Aliases are like shortcuts for complex functions, variable assignments,
|
||||
* etc. You can use a simple alias to rename a longer command (eg 'lv' for
|
||||
* 'list_vars' for example), or concatenate more commands into one
|
||||
* (eg. 'ng' for 'load %A; unpause; debug_level 5'). Aliases can parse the arguments
|
||||
* given to them in the command line.
|
||||
* - "%A - %Z" substitute arguments 1 t/m 26
|
||||
* - "%+" lists all parameters keeping them seperated
|
||||
* - "%!" also lists all parameters but presenting them to the aliased command as one argument
|
||||
* - ";" allows for combining commands (see example 'ng')
|
||||
*/
|
||||
struct IConsoleAlias;
|
||||
typedef struct IConsoleAlias {
|
||||
char *name; // name of the alias
|
||||
struct IConsoleAlias *next; // next alias in list
|
||||
|
||||
char *cmdline; // command(s) that is/are being aliased
|
||||
} IConsoleAlias;
|
||||
|
||||
// ** console parser ** //
|
||||
IConsoleCmd *_iconsole_cmds; // list of registred commands
|
||||
IConsoleVar *_iconsole_vars; // list of registred vars
|
||||
IConsoleAlias *_iconsole_aliases; // list of registred aliases
|
||||
|
||||
_iconsole_cmd * _iconsole_cmds; // list of registred commands
|
||||
_iconsole_var * _iconsole_vars; // list of registred vars
|
||||
|
||||
// ** console colors ** //
|
||||
VARDEF byte _iconsole_color_default;
|
||||
VARDEF byte _iconsole_color_error;
|
||||
VARDEF byte _iconsole_color_warning;
|
||||
VARDEF byte _iconsole_color_debug;
|
||||
VARDEF byte _iconsole_color_commands;
|
||||
|
||||
// ** ttd.c functions ** //
|
||||
|
||||
void SetDebugString(const char *s);
|
||||
// ** console colors/modes ** //
|
||||
VARDEF byte _icolour_def;
|
||||
VARDEF byte _icolour_err;
|
||||
VARDEF byte _icolour_warn;
|
||||
VARDEF byte _icolour_dbg;
|
||||
VARDEF byte _icolour_cmd;
|
||||
VARDEF IConsoleModes _iconsole_mode;
|
||||
|
||||
// ** console functions ** //
|
||||
|
||||
void IConsoleClearCommand();
|
||||
void IConsoleInit();
|
||||
void IConsoleClear();
|
||||
void IConsoleFree();
|
||||
void IConsoleResize();
|
||||
void IConsoleSwitch();
|
||||
void IConsoleClose();
|
||||
void IConsoleOpen();
|
||||
|
||||
// ** console cmd buffer ** //
|
||||
void IConsoleCmdBufferAdd(const byte *cmd);
|
||||
void IConsoleCmdBufferNavigate(signed char direction);
|
||||
void IConsoleInit(void);
|
||||
void IConsoleFree(void);
|
||||
void IConsoleClearBuffer(void);
|
||||
void IConsoleResize(void);
|
||||
void IConsoleSwitch(void);
|
||||
void IConsoleClose(void);
|
||||
void IConsoleOpen(void);
|
||||
|
||||
// ** console output ** //
|
||||
void IConsolePrint(byte color_code, const byte* string);
|
||||
void CDECL IConsolePrintF(byte color_code, const char *s, ...);
|
||||
void IConsoleDebug(byte* string);
|
||||
void IConsoleError(const byte* string);
|
||||
void IConsoleWarning(const byte* string);
|
||||
void IConsolePrint(uint16 color_code, const char *string);
|
||||
void CDECL IConsolePrintF(uint16 color_code, const char *s, ...);
|
||||
void IConsoleDebug(const char *string);
|
||||
void IConsoleWarning(const char *string);
|
||||
void IConsoleError(const char *string);
|
||||
|
||||
// *** Commands *** //
|
||||
|
||||
void IConsoleCmdRegister(const byte * name, void * addr);
|
||||
_iconsole_cmd * IConsoleCmdGet(const byte * name);
|
||||
void IConsoleCmdRegister(const char *name, IConsoleCmdProc *proc);
|
||||
void IConsoleAliasRegister(const char *name, const char *cmd);
|
||||
IConsoleCmd *IConsoleCmdGet(const char *name);
|
||||
IConsoleAlias *IConsoleAliasGet(const char *name);
|
||||
|
||||
// *** Variables *** //
|
||||
|
||||
void IConsoleVarRegister(const byte * name, void * addr, byte type);
|
||||
void IConsoleVarMemRegister(const byte * name, byte type);
|
||||
void IConsoleVarInsert(_iconsole_var * var, const byte * name);
|
||||
_iconsole_var * IConsoleVarGet(const byte * name);
|
||||
_iconsole_var * IConsoleVarAlloc(byte type);
|
||||
void IConsoleVarFree(_iconsole_var * var);
|
||||
void IConsoleVarSetString(_iconsole_var * var, const byte * string);
|
||||
void IConsoleVarSetValue(_iconsole_var * var, int value);
|
||||
void IConsoleVarDump(_iconsole_var * var, const byte * dump_desc);
|
||||
void IConsoleVarRegister(const char *name, void *addr, IConsoleVarTypes type, const char *help);
|
||||
void IConsoleVarStringRegister(const char *name, void *addr, uint32 size, const char *help);
|
||||
IConsoleVar* IConsoleVarGet(const char *name);
|
||||
void IConsoleVarPrintGetValue(const IConsoleVar *var);
|
||||
void IConsoleVarPrintSetValue(const IConsoleVar *var);
|
||||
|
||||
// *** Parser *** //
|
||||
void IConsoleCmdExec(const char *cmdstr);
|
||||
void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[]);
|
||||
|
||||
void IConsoleCmdExec(const byte* cmdstr);
|
||||
// ** console std lib (register ingame commands/aliases/variables) ** //
|
||||
void IConsoleStdLibRegister(void);
|
||||
|
||||
// ** console std lib ** //
|
||||
void IConsoleStdLibRegister();
|
||||
|
||||
// ** hook code ** //
|
||||
void IConsoleVarHook(const byte * name, byte type, void * proc);
|
||||
void IConsoleCmdHook(const byte * name, byte type, void * proc);
|
||||
bool IConsoleVarHookHandle(_iconsole_var * hook_var, byte type);
|
||||
bool IConsoleCmdHookHandle(_iconsole_cmd * hook_cmd, byte type);
|
||||
// ** Hooking code ** //
|
||||
void IConsoleCmdHookAdd(const char *name, IConsoleHookTypes type, IConsoleHook *proc);
|
||||
void IConsoleVarHookAdd(const char *name, IConsoleHookTypes type, IConsoleHook *proc);
|
||||
void IConsoleVarProcAdd(const char *name, IConsoleCmdProc *proc);
|
||||
|
||||
// ** Supporting functions **//
|
||||
bool GetArgumentInteger(uint32 *value, const char *arg);
|
||||
#endif /* CONSOLE_H */
|
||||
|
||||
+1279
-285
File diff suppressed because it is too large
Load Diff
+100
@@ -0,0 +1,100 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "currency.h"
|
||||
#include "news.h"
|
||||
#include "variables.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
// exchange rate prefix
|
||||
// | separator | postfix
|
||||
// | | Euro year | |
|
||||
// | | | | |
|
||||
CurrencySpec _currency_specs[] = {
|
||||
{ 1, ',', CF_NOEURO, "\xA3", "" }, // british pounds
|
||||
{ 2, ',', CF_NOEURO, "$", "" }, // us dollars
|
||||
{ 2, ',', CF_ISEURO, "¤", "" }, // Euro
|
||||
{ 200, ',', CF_NOEURO, "\xA5", "" }, // yen
|
||||
{ 19, ',', 2002, "", " S." }, // austrian schilling
|
||||
{ 57, ',', 2002, "BEF ", "" }, // belgian franc
|
||||
{ 2, ',', CF_NOEURO, "CHF ", "" }, // swiss franc
|
||||
{ 50, ',', CF_NOEURO, "", " Kc" }, // czech koruna // TODO: Should use the "c" with an upside down "^"
|
||||
{ 4, '.', 2002, "DM ", "" }, // deutsche mark
|
||||
{ 10, '.', CF_NOEURO, "", " kr" }, // danish krone
|
||||
{ 200, '.', 2002, "Pts ", "" }, // spanish pesetas
|
||||
{ 8, ',', 2002, "", " mk" }, // finnish markka
|
||||
{ 10, '.', 2002, "FF ", "" }, // french francs
|
||||
{ 480, ',', 2002, "", "Dr." }, // greek drachma
|
||||
{ 376, ',', 2002, "", " Ft" }, // hungarian forint
|
||||
{ 130, '.', CF_NOEURO, "", " Kr" }, // icelandic krona
|
||||
{ 2730, ',', 2002, "", " L." }, // italian lira
|
||||
{ 3, ',', 2002, "NLG ", "" }, // dutch gulden
|
||||
{ 11, '.', CF_NOEURO, "", " Kr" }, // norwegian krone
|
||||
{ 6, ' ', CF_NOEURO, "", " zl" }, // polish zloty
|
||||
{ 6, '.', CF_NOEURO, "", " Lei" }, // romanian Lei
|
||||
{ 5, ' ', CF_NOEURO, "", " p" }, // russian rouble
|
||||
{ 13, '.', CF_NOEURO, "", " Kr" }, // swedish krona
|
||||
{ 1, ' ', CF_NOEURO, "", "" }, // custom currency
|
||||
};
|
||||
|
||||
const StringID _currency_string_list[] = {
|
||||
STR_CURR_GBP,
|
||||
STR_CURR_USD,
|
||||
STR_CURR_EUR,
|
||||
STR_CURR_YEN,
|
||||
STR_CURR_ATS,
|
||||
STR_CURR_BEF,
|
||||
STR_CURR_CHF,
|
||||
STR_CURR_CZK,
|
||||
STR_CURR_DEM,
|
||||
STR_CURR_DKK,
|
||||
STR_CURR_ESP,
|
||||
STR_CURR_FIM,
|
||||
STR_CURR_FRF,
|
||||
STR_CURR_GRD,
|
||||
STR_CURR_HUF,
|
||||
STR_CURR_ISK,
|
||||
STR_CURR_ITL,
|
||||
STR_CURR_NLG,
|
||||
STR_CURR_NOK,
|
||||
STR_CURR_PLN,
|
||||
STR_CURR_ROL,
|
||||
STR_CURR_RUR,
|
||||
STR_CURR_SEK,
|
||||
STR_CURR_CUSTOM,
|
||||
INVALID_STRING_ID
|
||||
};
|
||||
|
||||
// NOTE: Make sure both lists are in the same order
|
||||
// + 1 string list terminator
|
||||
assert_compile(lengthof(_currency_specs) + 1 == lengthof(_currency_string_list));
|
||||
|
||||
|
||||
// get a mask of the allowed currencies depending on the year
|
||||
uint GetMaskOfAllowedCurrencies(void)
|
||||
{
|
||||
uint mask = 0;
|
||||
uint i;
|
||||
|
||||
for (i = 0; i != lengthof(_currency_specs); i++) {
|
||||
uint16 to_euro = _currency_specs[i].to_euro;
|
||||
|
||||
if (to_euro != CF_NOEURO && to_euro != CF_ISEURO && _cur_year >= to_euro - MAX_YEAR_BEGIN_REAL) continue;
|
||||
if (to_euro == CF_ISEURO && _cur_year < 2000 - MAX_YEAR_BEGIN_REAL) continue;
|
||||
mask |= (1 << i);
|
||||
}
|
||||
mask |= (1 << 23); // always allow custom currency
|
||||
return mask;
|
||||
}
|
||||
|
||||
|
||||
void CheckSwitchToEuro(void)
|
||||
{
|
||||
if (_currency_specs[_opt.currency].to_euro != CF_NOEURO &&
|
||||
_currency_specs[_opt.currency].to_euro != CF_ISEURO &&
|
||||
MAX_YEAR_BEGIN_REAL + _cur_year >= _currency_specs[_opt.currency].to_euro) {
|
||||
_opt.currency = 2; // this is the index of euro above.
|
||||
AddNewsItem(STR_EURO_INTRODUCE, NEWS_FLAGS(NM_NORMAL, 0, NT_ECONOMY, 0), 0, 0);
|
||||
}
|
||||
}
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef CURRENCY_H
|
||||
#define CURRENCY_H
|
||||
|
||||
enum {
|
||||
CF_NOEURO = 0,
|
||||
CF_ISEURO = 1,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint16 rate;
|
||||
char separator;
|
||||
uint16 to_euro;
|
||||
char prefix[16];
|
||||
char suffix[16];
|
||||
} CurrencySpec;
|
||||
|
||||
extern CurrencySpec _currency_specs[];
|
||||
extern const StringID _currency_string_list[];
|
||||
|
||||
// XXX small hack, but makes the rest of the code a bit nicer to read
|
||||
#define _custom_currency (_currency_specs[23])
|
||||
#define _currency ((const CurrencySpec*)&_currency_specs[_opt_ptr->currency])
|
||||
|
||||
uint GetMaskOfAllowedCurrencies(void);
|
||||
void CheckSwitchToEuro(void);
|
||||
|
||||
#endif /* CURRENCY_H */
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,126 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include "openttd.h"
|
||||
#include "console.h"
|
||||
#include "debug.h"
|
||||
#include "functions.h"
|
||||
#include "string.h"
|
||||
|
||||
int _debug_ai_level;
|
||||
int _debug_driver_level;
|
||||
int _debug_grf_level;
|
||||
int _debug_map_level;
|
||||
int _debug_misc_level;
|
||||
int _debug_ms_level;
|
||||
int _debug_net_level;
|
||||
int _debug_spritecache_level;
|
||||
int _debug_oldloader_level;
|
||||
int _debug_ntp_level;
|
||||
int _debug_npf_level;
|
||||
|
||||
|
||||
void CDECL debug(const char *s, ...)
|
||||
{
|
||||
va_list va;
|
||||
char buf[1024];
|
||||
|
||||
va_start(va, s);
|
||||
vsnprintf(buf, lengthof(buf), s, va);
|
||||
va_end(va);
|
||||
fprintf(stderr, "dbg: %s\n", buf);
|
||||
IConsoleDebug(buf);
|
||||
}
|
||||
|
||||
typedef struct DebugLevel {
|
||||
const char *name;
|
||||
int *level;
|
||||
} DebugLevel;
|
||||
|
||||
#define DEBUG_LEVEL(x) { #x, &_debug_##x##_level }
|
||||
static const DebugLevel debug_level[] = {
|
||||
DEBUG_LEVEL(ai),
|
||||
DEBUG_LEVEL(driver),
|
||||
DEBUG_LEVEL(grf),
|
||||
DEBUG_LEVEL(map),
|
||||
DEBUG_LEVEL(misc),
|
||||
DEBUG_LEVEL(ms),
|
||||
DEBUG_LEVEL(net),
|
||||
DEBUG_LEVEL(spritecache),
|
||||
DEBUG_LEVEL(oldloader),
|
||||
DEBUG_LEVEL(ntp),
|
||||
DEBUG_LEVEL(npf)
|
||||
};
|
||||
#undef DEBUG_LEVEL
|
||||
|
||||
void SetDebugString(const char *s)
|
||||
{
|
||||
int v;
|
||||
char *end;
|
||||
const char *t;
|
||||
|
||||
// global debugging level?
|
||||
if (*s >= '0' && *s <= '9') {
|
||||
const DebugLevel *i;
|
||||
|
||||
v = strtoul(s, &end, 0);
|
||||
s = end;
|
||||
|
||||
for (i = debug_level; i != endof(debug_level); ++i) *i->level = v;
|
||||
}
|
||||
|
||||
// individual levels
|
||||
for (;;) {
|
||||
const DebugLevel *i;
|
||||
int *p;
|
||||
|
||||
// skip delimiters
|
||||
while (*s == ' ' || *s == ',' || *s == '\t') s++;
|
||||
if (*s == '\0') break;
|
||||
|
||||
t = s;
|
||||
while (*s >= 'a' && *s <= 'z') s++;
|
||||
|
||||
// check debugging levels
|
||||
p = NULL;
|
||||
for (i = debug_level; i != endof(debug_level); ++i)
|
||||
if (s == t + strlen(i->name) && strncmp(t, i->name, s - t) == 0) {
|
||||
p = i->level;
|
||||
break;
|
||||
}
|
||||
|
||||
if (*s == '=') s++;
|
||||
v = strtoul(s, &end, 0);
|
||||
s = end;
|
||||
if (p != NULL) {
|
||||
*p = v;
|
||||
} else {
|
||||
ShowInfoF("Unknown debug level '%.*s'", s - t, t);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Print out the current debug-level
|
||||
* Just return a string with the values of all the debug categorites
|
||||
* @return string with debug-levels
|
||||
*/
|
||||
const char *GetDebugString(void)
|
||||
{
|
||||
const DebugLevel *i;
|
||||
static char dbgstr[100];
|
||||
char dbgval[20];
|
||||
|
||||
memset(dbgstr, 0, sizeof(dbgstr));
|
||||
i = debug_level;
|
||||
snprintf(dbgstr, sizeof(dbgstr), "%s=%d", i->name, *i->level);
|
||||
|
||||
for (i++; i != endof(debug_level); i++) {
|
||||
snprintf(dbgval, sizeof(dbgval), ", %s=%d", i->name, *i->level);
|
||||
ttd_strlcat(dbgstr, dbgval, sizeof(dbgstr));
|
||||
}
|
||||
|
||||
return dbgstr;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#ifdef NO_DEBUG_MESSAGES
|
||||
#define DEBUG(name, level)
|
||||
#else
|
||||
#define DEBUG(name, level) if (level == 0 || _debug_ ## name ## _level >= level) debug
|
||||
|
||||
extern int _debug_ai_level;
|
||||
extern int _debug_driver_level;
|
||||
extern int _debug_grf_level;
|
||||
extern int _debug_map_level;
|
||||
extern int _debug_misc_level;
|
||||
extern int _debug_ms_level;
|
||||
extern int _debug_net_level;
|
||||
extern int _debug_spritecache_level;
|
||||
extern int _debug_oldloader_level;
|
||||
extern int _debug_ntp_level;
|
||||
extern int _debug_npf_level;
|
||||
#endif
|
||||
|
||||
void CDECL debug(const char *s, ...);
|
||||
|
||||
void SetDebugString(const char *s);
|
||||
const char *GetDebugString(void);
|
||||
|
||||
#endif /* DEBUG_H */
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef ENABLE_NETWORK
|
||||
|
||||
#if defined(UNIX) && !defined(__MORPHOS__)
|
||||
|
||||
#include "openttd.h"
|
||||
#include "variables.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void DedicatedFork(void)
|
||||
{
|
||||
/* Fork the program */
|
||||
pid_t pid = fork();
|
||||
switch (pid) {
|
||||
case -1:
|
||||
perror("Unable to fork");
|
||||
exit(1);
|
||||
|
||||
case 0: { // We're the child
|
||||
FILE* f;
|
||||
|
||||
/* Open the log-file to log all stuff too */
|
||||
f = fopen(_log_file, "a");
|
||||
if (f == NULL) {
|
||||
perror("Unable to open logfile");
|
||||
exit(1);
|
||||
}
|
||||
/* Redirect stdout and stderr to log-file */
|
||||
if (dup2(fileno(f), fileno(stdout)) == -1) {
|
||||
perror("Rerouting stdout");
|
||||
exit(1);
|
||||
}
|
||||
if (dup2(fileno(f), fileno(stderr)) == -1) {
|
||||
perror("Rerouting stderr");
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
// We're the parent
|
||||
printf("Loading dedicated server...\n");
|
||||
printf(" - Forked to background with pid %d\n", pid);
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
void DedicatedFork(void) {}
|
||||
|
||||
#endif /* ENABLE_NETWORK */
|
||||
@@ -0,0 +1,145 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "depot.h"
|
||||
#include "functions.h"
|
||||
#include "tile.h"
|
||||
#include "map.h"
|
||||
#include "table/strings.h"
|
||||
#include "saveload.h"
|
||||
#include "order.h"
|
||||
|
||||
enum {
|
||||
/* Max depots: 64000 (8 * 8000) */
|
||||
DEPOT_POOL_BLOCK_SIZE_BITS = 3, /* In bits, so (1 << 3) == 8 */
|
||||
DEPOT_POOL_MAX_BLOCKS = 8000,
|
||||
};
|
||||
|
||||
/**
|
||||
* Called if a new block is added to the depot-pool
|
||||
*/
|
||||
static void DepotPoolNewBlock(uint start_item)
|
||||
{
|
||||
Depot *depot;
|
||||
|
||||
FOR_ALL_DEPOTS_FROM(depot, start_item)
|
||||
depot->index = start_item++;
|
||||
}
|
||||
|
||||
/* Initialize the town-pool */
|
||||
MemoryPool _depot_pool = { "Depots", DEPOT_POOL_MAX_BLOCKS, DEPOT_POOL_BLOCK_SIZE_BITS, sizeof(Depot), &DepotPoolNewBlock, 0, 0, NULL };
|
||||
|
||||
|
||||
/**
|
||||
* Gets a depot from a tile
|
||||
*
|
||||
* @return Returns the depot if the tile had a depot, else it returns NULL
|
||||
*/
|
||||
Depot *GetDepotByTile(TileIndex tile)
|
||||
{
|
||||
Depot *depot;
|
||||
|
||||
FOR_ALL_DEPOTS(depot) {
|
||||
if (depot->xy == tile)
|
||||
return depot;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a new depot
|
||||
*/
|
||||
Depot *AllocateDepot(void)
|
||||
{
|
||||
Depot *depot;
|
||||
|
||||
FOR_ALL_DEPOTS(depot) {
|
||||
if (!IsValidDepot(depot)) {
|
||||
uint index = depot->index;
|
||||
|
||||
memset(depot, 0, sizeof(Depot));
|
||||
depot->index = index;
|
||||
|
||||
return depot;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if we can add a block to the pool */
|
||||
if (AddBlockToPool(&_depot_pool))
|
||||
return AllocateDepot();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a depot
|
||||
*/
|
||||
void DoDeleteDepot(TileIndex tile)
|
||||
{
|
||||
Order order;
|
||||
Depot *depot;
|
||||
|
||||
/* Get the depot */
|
||||
depot = GetDepotByTile(tile);
|
||||
|
||||
/* Clear the tile */
|
||||
DoClearSquare(tile);
|
||||
|
||||
/* Clear the depot */
|
||||
depot->xy = 0;
|
||||
|
||||
/* Clear the depot from all order-lists */
|
||||
order.type = OT_GOTO_DEPOT;
|
||||
order.station = depot->index;
|
||||
DeleteDestinationFromVehicleOrder(order);
|
||||
|
||||
/* Delete the depot-window */
|
||||
DeleteWindowById(WC_VEHICLE_DEPOT, tile);
|
||||
}
|
||||
|
||||
void InitializeDepot(void)
|
||||
{
|
||||
CleanPool(&_depot_pool);
|
||||
AddBlockToPool(&_depot_pool);
|
||||
}
|
||||
|
||||
|
||||
static const SaveLoad _depot_desc[] = {
|
||||
SLE_CONDVAR(Depot, xy, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
|
||||
SLE_CONDVAR(Depot, xy, SLE_UINT32, 6, 255),
|
||||
SLE_VAR(Depot,town_index, SLE_UINT16),
|
||||
SLE_END()
|
||||
};
|
||||
|
||||
static void Save_DEPT(void)
|
||||
{
|
||||
Depot *depot;
|
||||
|
||||
FOR_ALL_DEPOTS(depot) {
|
||||
if (IsValidDepot(depot)) {
|
||||
SlSetArrayIndex(depot->index);
|
||||
SlObject(depot, _depot_desc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Load_DEPT(void)
|
||||
{
|
||||
int index;
|
||||
|
||||
while ((index = SlIterateArray()) != -1) {
|
||||
Depot *depot;
|
||||
|
||||
if (!AddBlockIfNeeded(&_depot_pool, index))
|
||||
error("Depots: failed loading savegame: too many depots");
|
||||
|
||||
depot = GetDepot(index);
|
||||
SlObject(depot, _depot_desc);
|
||||
}
|
||||
}
|
||||
|
||||
const ChunkHandler _depot_chunk_handlers[] = {
|
||||
{ 'DEPT', Save_DEPT, Load_DEPT, CH_ARRAY | CH_LAST},
|
||||
};
|
||||
@@ -0,0 +1,148 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef DEPOT_H
|
||||
#define DEPOT_H
|
||||
|
||||
/** @file depot.h Header files for depots (not hangars)
|
||||
* @see depot.c */
|
||||
|
||||
#include "pool.h"
|
||||
#include "tile.h"
|
||||
#include "variables.h"
|
||||
|
||||
struct Depot {
|
||||
TileIndex xy;
|
||||
uint16 town_index;
|
||||
uint16 index;
|
||||
};
|
||||
|
||||
extern MemoryPool _depot_pool;
|
||||
|
||||
/**
|
||||
* Get the pointer to the depot with index 'index'
|
||||
*/
|
||||
static inline Depot *GetDepot(uint index)
|
||||
{
|
||||
return (Depot*)GetItemFromPool(&_depot_pool, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current size of the DepotPool
|
||||
*/
|
||||
static inline uint16 GetDepotPoolSize(void)
|
||||
{
|
||||
return _depot_pool.total_items;
|
||||
}
|
||||
|
||||
static inline bool IsDepotIndex(uint index)
|
||||
{
|
||||
return index < GetDepotPoolSize();
|
||||
}
|
||||
|
||||
#define FOR_ALL_DEPOTS_FROM(d, start) for (d = GetDepot(start); d != NULL; d = (d->index + 1 < GetDepotPoolSize()) ? GetDepot(d->index + 1) : NULL)
|
||||
#define FOR_ALL_DEPOTS(d) FOR_ALL_DEPOTS_FROM(d, 0)
|
||||
|
||||
#define MIN_SERVINT_PERCENT 5
|
||||
#define MAX_SERVINT_PERCENT 90
|
||||
#define MIN_SERVINT_DAYS 30
|
||||
#define MAX_SERVINT_DAYS 800
|
||||
|
||||
/** Get the service interval domain.
|
||||
* Get the new proposed service interval for the vehicle is indeed, clamped
|
||||
* within the given bounds. @see MIN_SERVINT_PERCENT ,etc.
|
||||
* @param index proposed service interval
|
||||
*/
|
||||
static inline uint16 GetServiceIntervalClamped(uint index)
|
||||
{
|
||||
return (_patches.servint_ispercent) ? clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
|
||||
}
|
||||
|
||||
VARDEF TileIndex _last_built_train_depot_tile;
|
||||
VARDEF TileIndex _last_built_road_depot_tile;
|
||||
VARDEF TileIndex _last_built_aircraft_depot_tile;
|
||||
VARDEF TileIndex _last_built_ship_depot_tile;
|
||||
|
||||
/**
|
||||
* Check if a depot really exists.
|
||||
*/
|
||||
static inline bool IsValidDepot(const Depot* depot)
|
||||
{
|
||||
return depot->xy != 0; /* XXX: Replace by INVALID_TILE someday */
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a tile is a depot of the given type.
|
||||
*/
|
||||
static inline bool IsTileDepotType(TileIndex tile, TransportType type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case TRANSPORT_RAIL:
|
||||
return IsTileType(tile, MP_RAILWAY) && (_m[tile].m5 & 0xFC) == 0xC0;
|
||||
|
||||
case TRANSPORT_ROAD:
|
||||
return IsTileType(tile, MP_STREET) && (_m[tile].m5 & 0xF0) == 0x20;
|
||||
|
||||
case TRANSPORT_WATER:
|
||||
return IsTileType(tile, MP_WATER) && (_m[tile].m5 & ~3) == 0x80;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the direction the exit of the depot on the given tile is facing.
|
||||
*/
|
||||
static inline DiagDirection GetDepotDirection(TileIndex tile, TransportType type)
|
||||
{
|
||||
assert(IsTileDepotType(tile, type));
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case TRANSPORT_RAIL:
|
||||
case TRANSPORT_ROAD:
|
||||
/* Rail and road store a diagonal direction in bits 0 and 1 */
|
||||
return (DiagDirection)GB(_m[tile].m5, 0, 2);
|
||||
case TRANSPORT_WATER:
|
||||
/* Water is stubborn, it stores the directions in a different order. */
|
||||
switch (GB(_m[tile].m5, 0, 2)) {
|
||||
case 0: return DIAGDIR_NE;
|
||||
case 1: return DIAGDIR_SW;
|
||||
case 2: return DIAGDIR_NW;
|
||||
case 3: return DIAGDIR_SE;
|
||||
}
|
||||
default:
|
||||
return INVALID_DIAGDIR; /* Not reached */
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Find out if the slope of the tile is suitable to build a depot of given direction
|
||||
@param direction The direction in which the depot's exit points. Starts with 0 as NE and goes Clockwise
|
||||
@param tileh The slope of the tile in question
|
||||
@return true if the construction is possible
|
||||
|
||||
|
||||
This is checked by the ugly 0x4C >> direction magic, which does the following:
|
||||
0x4C is 0100 1100 and tileh has only bits 0..3 set (steep tiles are ruled out)
|
||||
So: for direction (only the significant bits are shown)<p>
|
||||
00 (exit towards NE) we need either bit 2 or 3 set in tileh: 0x4C >> 0 = 1100<p>
|
||||
01 (exit towards SE) we need either bit 1 or 2 set in tileh: 0x4C >> 1 = 0110<p>
|
||||
02 (exit towards SW) we need either bit 0 or 1 set in tileh: 0x4C >> 2 = 0011<p>
|
||||
03 (exit towards NW) we need either bit 0 or 4 set in tileh: 0x4C >> 3 = 1001<p>
|
||||
So ((0x4C >> p2) & tileh) determines whether the depot can be built on the current tileh
|
||||
*/
|
||||
static inline bool CanBuildDepotByTileh(uint32 direction, uint tileh)
|
||||
{
|
||||
return (0x4C >> direction) & tileh;
|
||||
}
|
||||
|
||||
|
||||
Depot *GetDepotByTile(TileIndex tile);
|
||||
void InitializeDepot(void);
|
||||
Depot *AllocateDepot(void);
|
||||
void DoDeleteDepot(TileIndex tile);
|
||||
|
||||
#endif /* DEPOT_H */
|
||||
+244
-232
@@ -1,34 +1,48 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "openttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "functions.h"
|
||||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "vehicle.h"
|
||||
#include "command.h"
|
||||
#include "news.h"
|
||||
#include "gfx.h"
|
||||
#include "station.h"
|
||||
#include "waypoint.h"
|
||||
#include "town.h"
|
||||
#include "industry.h"
|
||||
#include "player.h"
|
||||
#include "airport_movement.h"
|
||||
#include "sound.h"
|
||||
#include "variables.h"
|
||||
#include "table/sprites.h"
|
||||
|
||||
static void DisasterClearSquare(uint tile)
|
||||
static void DisasterClearSquare(TileIndex tile)
|
||||
{
|
||||
int type;
|
||||
if (!EnsureNoVehicle(tile)) return;
|
||||
|
||||
if (!EnsureNoVehicle(tile))
|
||||
return;
|
||||
switch (GetTileType(tile)) {
|
||||
case MP_RAILWAY:
|
||||
if (IS_HUMAN_PLAYER(GetTileOwner(tile)) && !IsRailWaypoint(tile)) DoClearSquare(tile);
|
||||
break;
|
||||
|
||||
type = _map_type_and_height[tile] >> 4;
|
||||
case MP_HOUSE: {
|
||||
PlayerID p = _current_player;
|
||||
_current_player = OWNER_NONE;
|
||||
DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
_current_player = p;
|
||||
break;
|
||||
}
|
||||
|
||||
if (type == MP_RAILWAY) {
|
||||
if (IS_HUMAN_PLAYER(_map_owner[tile]))
|
||||
case MP_TREES:
|
||||
case MP_CLEAR:
|
||||
DoClearSquare(tile);
|
||||
} else if (type == MP_HOUSE) {
|
||||
byte p = _current_player;
|
||||
_current_player = OWNER_NONE;
|
||||
DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
_current_player = p;
|
||||
} else if (type == MP_TREES || type == MP_CLEAR) {
|
||||
DoClearSquare(tile);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +80,7 @@ static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, byte dir
|
||||
v->x_pos = x;
|
||||
v->y_pos = y;
|
||||
v->z_pos = z;
|
||||
v->tile = TILE_FROM_XY(x,y);
|
||||
v->tile = TileVirtXY(x, y);
|
||||
v->direction = direction;
|
||||
v->subtype = subtype;
|
||||
v->x_offs = -1;
|
||||
@@ -77,7 +91,9 @@ static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, byte dir
|
||||
v->owner = OWNER_NONE;
|
||||
v->vehstatus = VS_UNCLICKABLE;
|
||||
v->u.disaster.image_override = 0;
|
||||
v->next_order = 0;
|
||||
v->current_order.type = OT_NOTHING;
|
||||
v->current_order.flags = 0;
|
||||
v->current_order.station = 0;
|
||||
|
||||
DisasterVehicleUpdateImage(v);
|
||||
VehiclePositionChanged(v);
|
||||
@@ -99,7 +115,7 @@ static void SetDisasterVehiclePos(Vehicle *v, int x, int y, byte z)
|
||||
v->x_pos = x;
|
||||
v->y_pos = y;
|
||||
v->z_pos = z;
|
||||
v->tile = TILE_FROM_XY(x,y);
|
||||
v->tile = TileVirtXY(x, y);
|
||||
|
||||
DisasterVehicleUpdateImage(v);
|
||||
VehiclePositionChanged(v);
|
||||
@@ -135,11 +151,11 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
|
||||
Station *st;
|
||||
int x,y;
|
||||
byte z;
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
|
||||
++v->tick_counter;
|
||||
|
||||
if (v->next_order < 2) {
|
||||
if (v->current_order.station < 2) {
|
||||
if (v->tick_counter&1)
|
||||
return;
|
||||
|
||||
@@ -147,48 +163,48 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
|
||||
|
||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||
|
||||
if (v->next_order == 1) {
|
||||
if (v->current_order.station == 1) {
|
||||
if (++v->age == 38) {
|
||||
v->next_order = 2;
|
||||
v->current_order.station = 2;
|
||||
v->age = 0;
|
||||
}
|
||||
|
||||
if ((v->tick_counter&7)==0) {
|
||||
CreateEffectVehicleRel(v, 0, -17, 2, EV_SMOKE_3);
|
||||
CreateEffectVehicleRel(v, 0, -17, 2, EV_SMOKE);
|
||||
}
|
||||
} else if (v->next_order == 0) {
|
||||
} else if (v->current_order.station == 0) {
|
||||
tile = v->tile; /**/
|
||||
|
||||
if (IS_TILETYPE(tile, MP_STATION) &&
|
||||
IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
|
||||
IS_HUMAN_PLAYER(_map_owner[tile])) {
|
||||
|
||||
v->next_order = 1;
|
||||
if (IsValidTile(tile) &&
|
||||
IsTileType(tile, MP_STATION) &&
|
||||
IS_BYTE_INSIDE(_m[tile].m5, 8, 0x43) &&
|
||||
IS_HUMAN_PLAYER(GetTileOwner(tile))) {
|
||||
v->current_order.station = 1;
|
||||
v->age = 0;
|
||||
|
||||
SET_DPARAM16(0, _map2[tile]);
|
||||
SetDParam(0, _m[tile].m2);
|
||||
AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
|
||||
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
|
||||
v->index,
|
||||
0);
|
||||
}
|
||||
}
|
||||
if (v->y_pos >= (TILES_Y+9) * 16 - 1)
|
||||
if (v->y_pos >= ((int)MapSizeY() + 9) * 16 - 1)
|
||||
DeleteDisasterVeh(v);
|
||||
return;
|
||||
}
|
||||
|
||||
if (v->next_order > 2) {
|
||||
if (v->current_order.station > 2) {
|
||||
if (++v->age <= 13320)
|
||||
return;
|
||||
|
||||
tile = v->tile; /**/
|
||||
|
||||
if (IS_TILETYPE(tile, MP_STATION) &&
|
||||
IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
|
||||
IS_HUMAN_PLAYER(_map_owner[tile])) {
|
||||
|
||||
st = DEREF_STATION(_map2[tile]);
|
||||
if (IsValidTile(tile) &&
|
||||
IsTileType(tile, MP_STATION) &&
|
||||
IS_BYTE_INSIDE(_m[tile].m5, 8, 0x43) &&
|
||||
IS_HUMAN_PLAYER(GetTileOwner(tile))) {
|
||||
st = GetStation(_m[tile].m2);
|
||||
CLRBITS(st->airport_flags, RUNWAY_IN_block);
|
||||
}
|
||||
|
||||
@@ -205,32 +221,33 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
|
||||
SetDisasterVehiclePos(v, x, y, z);
|
||||
|
||||
if (++v->age == 1) {
|
||||
CreateEffectVehicleRel(v, 0, 7, 8, EV_CRASHED_SMOKE);
|
||||
SndPlayVehicleFx(0x10, v);
|
||||
v->u.disaster.image_override = 0xF42;
|
||||
CreateEffectVehicleRel(v, 0, 7, 8, EV_EXPLOSION_LARGE);
|
||||
SndPlayVehicleFx(SND_12_EXPLOSION, v);
|
||||
v->u.disaster.image_override = SPR_BLIMP_CRASHING;
|
||||
} else if (v->age == 70) {
|
||||
v->u.disaster.image_override = 0xF43;
|
||||
v->u.disaster.image_override = SPR_BLIMP_CRASHED;
|
||||
} else if (v->age <= 300) {
|
||||
if (!(v->tick_counter&7)) {
|
||||
uint32 r = Random();
|
||||
|
||||
CreateEffectVehicleRel(v,
|
||||
-7 + (r&0xF),
|
||||
-7 + (r>>4&0xF),
|
||||
5 + (r>>8&0x7),
|
||||
EV_DEMOLISH);
|
||||
GB(r, 0, 4) - 7,
|
||||
GB(r, 4, 4) - 7,
|
||||
GB(r, 8, 3) + 5,
|
||||
EV_EXPLOSION_SMALL);
|
||||
}
|
||||
} else if (v->age == 350) {
|
||||
v->next_order = 3;
|
||||
v->current_order.station = 3;
|
||||
v->age = 0;
|
||||
}
|
||||
|
||||
tile = v->tile;/**/
|
||||
if (IS_TILETYPE(tile, MP_STATION) &&
|
||||
IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
|
||||
IS_HUMAN_PLAYER(_map_owner[tile])) {
|
||||
if (IsValidTile(tile) &&
|
||||
IsTileType(tile, MP_STATION) &&
|
||||
IS_BYTE_INSIDE(_m[tile].m5, 8, 0x43) &&
|
||||
IS_HUMAN_PLAYER(GetTileOwner(tile))) {
|
||||
|
||||
st = DEREF_STATION(_map2[tile]);
|
||||
st = GetStation(_m[tile].m2);
|
||||
SETBITS(st->airport_flags, RUNWAY_IN_block);
|
||||
}
|
||||
}
|
||||
@@ -244,23 +261,23 @@ static void DisasterTick_UFO(Vehicle *v)
|
||||
uint dist;
|
||||
byte z;
|
||||
|
||||
v->u.disaster.image_override = (++v->tick_counter & 8) ? 0xF45 : 0xF44;
|
||||
v->u.disaster.image_override = (++v->tick_counter & 8) ? SPR_UFO_SMALL_SCOUT_DARKER : SPR_UFO_SMALL_SCOUT;
|
||||
|
||||
if (v->next_order == 0) {
|
||||
if (v->current_order.station == 0) {
|
||||
// fly around randomly
|
||||
int x = GET_TILE_X(v->dest_tile)*16;
|
||||
int y = GET_TILE_Y(v->dest_tile)*16;
|
||||
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
|
||||
int x = TileX(v->dest_tile) * 16;
|
||||
int y = TileY(v->dest_tile) * 16;
|
||||
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
|
||||
v->direction = GetDirectionTowards(v, x, y);
|
||||
GetNewVehiclePos(v, &gp);
|
||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||
return;
|
||||
}
|
||||
if (++v->age < 6) {
|
||||
v->dest_tile = TILE_MASK(Random());
|
||||
v->dest_tile = RandomTile();
|
||||
return;
|
||||
}
|
||||
v->next_order = 1;
|
||||
v->current_order.station = 1;
|
||||
|
||||
FOR_ALL_VEHICLES(u) {
|
||||
if (u->type == VEH_Road && IS_HUMAN_PLAYER(u->owner)) {
|
||||
@@ -273,7 +290,7 @@ static void DisasterTick_UFO(Vehicle *v)
|
||||
DeleteDisasterVeh(v);
|
||||
} else {
|
||||
// target a vehicle
|
||||
u = &_vehicles[v->dest_tile];
|
||||
u = GetVehicle(v->dest_tile);
|
||||
if (u->type != VEH_Road) {
|
||||
DeleteDisasterVeh(v);
|
||||
return;
|
||||
@@ -308,8 +325,8 @@ static void DisasterTick_UFO(Vehicle *v)
|
||||
|
||||
// destroy?
|
||||
if (v->age > 50) {
|
||||
CreateEffectVehicleRel(v, 0, 7, 8, EV_CRASHED_SMOKE);
|
||||
SndPlayVehicleFx(0x10, v);
|
||||
CreateEffectVehicleRel(v, 0, 7, 8, EV_EXPLOSION_LARGE);
|
||||
SndPlayVehicleFx(SND_12_EXPLOSION, v);
|
||||
DeleteDisasterVeh(v);
|
||||
}
|
||||
}
|
||||
@@ -317,12 +334,11 @@ static void DisasterTick_UFO(Vehicle *v)
|
||||
|
||||
static void DestructIndustry(Industry *i)
|
||||
{
|
||||
uint tile;
|
||||
byte index = i - _industries;
|
||||
TileIndex tile;
|
||||
|
||||
for(tile=0; tile != TILES_X*TILES_Y; tile++) {
|
||||
if (IS_TILETYPE(tile, MP_INDUSTRY) && _map2[tile] == index) {
|
||||
_map_owner[tile] = 0;
|
||||
for (tile = 0; tile != MapSize(); tile++) {
|
||||
if (IsTileType(tile, MP_INDUSTRY) && _m[tile].m2 == i->index) {
|
||||
_m[tile].m1 = 0;
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
}
|
||||
@@ -334,7 +350,8 @@ static void DisasterTick_2(Vehicle *v)
|
||||
GetNewVehiclePosResult gp;
|
||||
|
||||
v->tick_counter++;
|
||||
v->u.disaster.image_override = (v->next_order == 1 && v->tick_counter&4) ? 0xF4F : 0;
|
||||
v->u.disaster.image_override =
|
||||
(v->current_order.station == 1 && v->tick_counter & 4) ? SPR_F_15_FIRING : 0;
|
||||
|
||||
GetNewVehiclePos(v, &gp);
|
||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||
@@ -344,55 +361,55 @@ static void DisasterTick_2(Vehicle *v)
|
||||
return;
|
||||
}
|
||||
|
||||
if (v->next_order == 2) {
|
||||
if (v->current_order.station == 2) {
|
||||
if (!(v->tick_counter&3)) {
|
||||
Industry *i = DEREF_INDUSTRY(v->dest_tile);
|
||||
int x = GET_TILE_X(i->xy)*16;
|
||||
int y = GET_TILE_Y(i->xy)*16;
|
||||
Industry *i = GetIndustry(v->dest_tile);
|
||||
int x = TileX(i->xy) * 16;
|
||||
int y = TileY(i->xy) * 16;
|
||||
uint32 r = Random();
|
||||
|
||||
CreateEffectVehicleAbove(
|
||||
x + (r & 0x3F),
|
||||
y + (r >> 6 & 0x3F),
|
||||
(r >> 12 & 0xF),
|
||||
EV_DEMOLISH);
|
||||
GB(r, 0, 6) + x,
|
||||
GB(r, 6, 6) + y,
|
||||
GB(r, 12, 4),
|
||||
EV_EXPLOSION_SMALL);
|
||||
|
||||
if (++v->age >= 55)
|
||||
v->next_order = 3;
|
||||
v->current_order.station = 3;
|
||||
}
|
||||
} else if (v->next_order == 1) {
|
||||
} else if (v->current_order.station == 1) {
|
||||
if (++v->age == 112) {
|
||||
Industry *i;
|
||||
|
||||
v->next_order = 2;
|
||||
v->current_order.station = 2;
|
||||
v->age = 0;
|
||||
|
||||
i = DEREF_INDUSTRY(v->dest_tile);
|
||||
i = GetIndustry(v->dest_tile);
|
||||
DestructIndustry(i);
|
||||
|
||||
SET_DPARAM16(0, i->town->index);
|
||||
SetDParam(0, i->town->index);
|
||||
AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
|
||||
SndPlayTileFx(0x10, i->xy);
|
||||
SndPlayTileFx(SND_12_EXPLOSION, i->xy);
|
||||
}
|
||||
} else if (v->next_order == 0) {
|
||||
} else if (v->current_order.station == 0) {
|
||||
int x,y;
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
int ind;
|
||||
|
||||
x = v->x_pos - 15*16;
|
||||
y = v->y_pos;
|
||||
|
||||
if ( (uint)x > (TILES_X-1) * 16-1)
|
||||
if ( (uint)x > MapMaxX() * 16-1)
|
||||
return;
|
||||
|
||||
tile = TILE_FROM_XY(x,y);
|
||||
if (!IS_TILETYPE(tile, MP_INDUSTRY))
|
||||
tile = TileVirtXY(x, y);
|
||||
if (!IsTileType(tile, MP_INDUSTRY))
|
||||
return;
|
||||
|
||||
v->dest_tile = ind = _map2[tile];
|
||||
v->dest_tile = ind = _m[tile].m2;
|
||||
|
||||
if (DEREF_INDUSTRY(ind)->type == IT_OIL_REFINERY) {
|
||||
v->next_order = 1;
|
||||
if (GetIndustry(ind)->type == IT_OIL_REFINERY) {
|
||||
v->current_order.station = 1;
|
||||
v->age = 0;
|
||||
}
|
||||
}
|
||||
@@ -404,65 +421,66 @@ static void DisasterTick_3(Vehicle *v)
|
||||
GetNewVehiclePosResult gp;
|
||||
|
||||
v->tick_counter++;
|
||||
v->u.disaster.image_override = (v->next_order == 1 && v->tick_counter&4) ? 0xF53 : 0;
|
||||
v->u.disaster.image_override =
|
||||
(v->current_order.station == 1 && v->tick_counter & 4) ? SPR_AH_64A_FIRING : 0;
|
||||
|
||||
GetNewVehiclePos(v, &gp);
|
||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||
|
||||
if (gp.x > TILES_X * 16 + 9*16 - 1) {
|
||||
if (gp.x > (int)MapSizeX() * 16 + 9*16 - 1) {
|
||||
DeleteDisasterVeh(v);
|
||||
return;
|
||||
}
|
||||
|
||||
if (v->next_order == 2) {
|
||||
if (v->current_order.station == 2) {
|
||||
if (!(v->tick_counter&3)) {
|
||||
Industry *i = DEREF_INDUSTRY(v->dest_tile);
|
||||
int x = GET_TILE_X(i->xy)*16;
|
||||
int y = GET_TILE_Y(i->xy)*16;
|
||||
Industry *i = GetIndustry(v->dest_tile);
|
||||
int x = TileX(i->xy) * 16;
|
||||
int y = TileY(i->xy) * 16;
|
||||
uint32 r = Random();
|
||||
|
||||
CreateEffectVehicleAbove(
|
||||
x + (r & 0x3F),
|
||||
y + (r >> 6 & 0x3F),
|
||||
(r >> 12 & 0xF),
|
||||
EV_DEMOLISH);
|
||||
GB(r, 0, 6) + x,
|
||||
GB(r, 6, 6) + y,
|
||||
GB(r, 12, 4),
|
||||
EV_EXPLOSION_SMALL);
|
||||
|
||||
if (++v->age >= 55)
|
||||
v->next_order = 3;
|
||||
v->current_order.station = 3;
|
||||
}
|
||||
} else if (v->next_order == 1) {
|
||||
} else if (v->current_order.station == 1) {
|
||||
if (++v->age == 112) {
|
||||
Industry *i;
|
||||
|
||||
v->next_order = 2;
|
||||
v->current_order.station = 2;
|
||||
v->age = 0;
|
||||
|
||||
i = DEREF_INDUSTRY(v->dest_tile);
|
||||
i = GetIndustry(v->dest_tile);
|
||||
DestructIndustry(i);
|
||||
|
||||
SET_DPARAM16(0, i->town->index);
|
||||
SetDParam(0, i->town->index);
|
||||
AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
|
||||
SndPlayTileFx(0x10, i->xy);
|
||||
SndPlayTileFx(SND_12_EXPLOSION, i->xy);
|
||||
}
|
||||
} else if (v->next_order == 0) {
|
||||
} else if (v->current_order.station == 0) {
|
||||
int x,y;
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
int ind;
|
||||
|
||||
x = v->x_pos - 15*16;
|
||||
y = v->y_pos;
|
||||
|
||||
if ( (uint)x > (TILES_X-1) * 16-1)
|
||||
if ( (uint)x > MapMaxX() * 16-1)
|
||||
return;
|
||||
|
||||
tile = TILE_FROM_XY(x,y);
|
||||
if (!IS_TILETYPE(tile, MP_INDUSTRY))
|
||||
tile = TileVirtXY(x, y);
|
||||
if (!IsTileType(tile, MP_INDUSTRY))
|
||||
return;
|
||||
|
||||
v->dest_tile = ind = _map2[tile];
|
||||
v->dest_tile = ind = _m[tile].m2;
|
||||
|
||||
if (DEREF_INDUSTRY(ind)->type == IT_FACTORY) {
|
||||
v->next_order = 1;
|
||||
if (GetIndustry(ind)->type == IT_FACTORY) {
|
||||
v->current_order.station = 1;
|
||||
v->age = 0;
|
||||
}
|
||||
}
|
||||
@@ -474,8 +492,7 @@ static void DisasterTick_3b(Vehicle *v)
|
||||
if (++v->tick_counter & 1)
|
||||
return;
|
||||
|
||||
if (++v->cur_image == 0xF40 + 1)
|
||||
v->cur_image = 0xF3E;
|
||||
if (++v->cur_image > SPR_ROTOR_MOVING_3) v->cur_image = SPR_ROTOR_MOVING_1;
|
||||
|
||||
VehiclePositionChanged(v);
|
||||
BeginVehicleMove(v);
|
||||
@@ -490,13 +507,14 @@ static void DisasterTick_4(Vehicle *v)
|
||||
byte z;
|
||||
Vehicle *u,*w;
|
||||
Town *t;
|
||||
uint tile,tile_org;
|
||||
TileIndex tile;
|
||||
TileIndex tile_org;
|
||||
|
||||
v->tick_counter++;
|
||||
|
||||
if (v->next_order == 1) {
|
||||
int x = GET_TILE_X(v->dest_tile)*16 + 8;
|
||||
int y = GET_TILE_Y(v->dest_tile)*16 + 8;
|
||||
if (v->current_order.station == 1) {
|
||||
int x = TileX(v->dest_tile) * 16 + 8;
|
||||
int y = TileY(v->dest_tile) * 16 + 8;
|
||||
if (abs(v->x_pos - x) + abs(v->y_pos - y) >= 8) {
|
||||
v->direction = GetDirectionTowards(v, x, y);
|
||||
|
||||
@@ -511,7 +529,7 @@ static void DisasterTick_4(Vehicle *v)
|
||||
return;
|
||||
}
|
||||
|
||||
v->next_order = 2;
|
||||
v->current_order.station = 2;
|
||||
|
||||
FOR_ALL_VEHICLES(u) {
|
||||
if (u->type == VEH_Train || u->type == VEH_Road) {
|
||||
@@ -523,7 +541,7 @@ static void DisasterTick_4(Vehicle *v)
|
||||
}
|
||||
|
||||
t = ClosestTownFromTile(v->dest_tile, (uint)-1);
|
||||
SET_DPARAM16(0, t->index);
|
||||
SetDParam(0, t->index);
|
||||
AddNewsItem(STR_B004_UFO_LANDS_NEAR,
|
||||
NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ACCIDENT, 0),
|
||||
v->tile,
|
||||
@@ -545,11 +563,11 @@ static void DisasterTick_4(Vehicle *v)
|
||||
u->next = w;
|
||||
InitializeDisasterVehicle(w, -6*16, v->y_pos, 0, 5, 12);
|
||||
w->vehstatus |= VS_DISASTER;
|
||||
} else if (v->next_order < 1) {
|
||||
} else if (v->current_order.station < 1) {
|
||||
|
||||
int x = GET_TILE_X(v->dest_tile)*16;
|
||||
int y = GET_TILE_Y(v->dest_tile)*16;
|
||||
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
|
||||
int x = TileX(v->dest_tile) * 16;
|
||||
int y = TileY(v->dest_tile) * 16;
|
||||
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= 16) {
|
||||
v->direction = GetDirectionTowards(v, x, y);
|
||||
GetNewVehiclePos(v, &gp);
|
||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||
@@ -557,16 +575,16 @@ static void DisasterTick_4(Vehicle *v)
|
||||
}
|
||||
|
||||
if (++v->age < 6) {
|
||||
v->dest_tile = TILE_MASK(Random());
|
||||
v->dest_tile = RandomTile();
|
||||
return;
|
||||
}
|
||||
v->next_order = 1;
|
||||
v->current_order.station = 1;
|
||||
|
||||
tile_org = tile = TILE_MASK(Random());
|
||||
tile_org = tile = RandomTile();
|
||||
do {
|
||||
if (IS_TILETYPE(tile, MP_RAILWAY) &&
|
||||
(_map5[tile]&~3)!=0xC0 && IS_HUMAN_PLAYER(_map_owner[tile]))
|
||||
break;
|
||||
if (IsTileType(tile, MP_RAILWAY) &&
|
||||
(_m[tile].m5 & ~3) != 0xC0 && IS_HUMAN_PLAYER(GetTileOwner(tile)))
|
||||
break;
|
||||
tile = TILE_MASK(tile+1);
|
||||
} while (tile != tile_org);
|
||||
v->dest_tile = tile;
|
||||
@@ -587,35 +605,35 @@ static void DisasterTick_4b(Vehicle *v)
|
||||
GetNewVehiclePos(v, &gp);
|
||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||
|
||||
if (gp.x > TILES_X * 16 + 9*16 - 1) {
|
||||
if (gp.x > (int)MapSizeX() * 16 + 9*16 - 1) {
|
||||
DeleteDisasterVeh(v);
|
||||
return;
|
||||
}
|
||||
|
||||
if (v->next_order == 0) {
|
||||
u = &_vehicles[v->u.disaster.unk2];
|
||||
if (v->current_order.station == 0) {
|
||||
u = GetVehicle(v->u.disaster.unk2);
|
||||
if (abs(v->x_pos - u->x_pos) > 16)
|
||||
return;
|
||||
v->next_order = 1;
|
||||
v->current_order.station = 1;
|
||||
|
||||
CreateEffectVehicleRel(u, 0, 7, 8, EV_CRASHED_SMOKE);
|
||||
SndPlayVehicleFx(0x10, u);
|
||||
CreateEffectVehicleRel(u, 0, 7, 8, EV_EXPLOSION_LARGE);
|
||||
SndPlayVehicleFx(SND_12_EXPLOSION, u);
|
||||
|
||||
DeleteDisasterVeh(u);
|
||||
|
||||
for(i=0; i!=80; i++) {
|
||||
uint32 r = Random();
|
||||
CreateEffectVehicleAbove(
|
||||
v->x_pos-32+(r&0x3F),
|
||||
v->y_pos-32+(r>>5&0x3F),
|
||||
GB(r, 0, 6) + v->x_pos - 32,
|
||||
GB(r, 5, 6) + v->y_pos - 32,
|
||||
0,
|
||||
EV_DEMOLISH);
|
||||
EV_EXPLOSION_SMALL);
|
||||
}
|
||||
|
||||
BEGIN_TILE_LOOP(tile,6,6,v->tile - TILE_XY(3,3))
|
||||
BEGIN_TILE_LOOP(tile, 6, 6, v->tile - TileDiffXY(3, 3))
|
||||
tile = TILE_MASK(tile);
|
||||
DisasterClearSquare(tile);
|
||||
END_TILE_LOOP(tile,6,6,v->tile - TILE_XY(3,3))
|
||||
END_TILE_LOOP(tile, 6, 6, v->tile - TileDiffXY(3, 3))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,7 +642,7 @@ static void DisasterTick_5_and_6(Vehicle *v)
|
||||
{
|
||||
uint32 r;
|
||||
GetNewVehiclePosResult gp;
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
|
||||
v->tick_counter++;
|
||||
|
||||
@@ -639,7 +657,7 @@ static void DisasterTick_5_and_6(Vehicle *v)
|
||||
if (!(v->tick_counter&1))
|
||||
return;
|
||||
|
||||
tile = v->tile + _tileoffs_by_dir[v->direction >> 1];
|
||||
tile = v->tile + TileOffsByDir(v->direction >> 1);
|
||||
if (IsValidTile(tile) &&
|
||||
(r=GetTileTrackStatus(tile,TRANSPORT_WATER),(byte)(r+(r >> 8)) == 0x3F) &&
|
||||
!CHANCE16(1,90)) {
|
||||
@@ -648,7 +666,7 @@ static void DisasterTick_5_and_6(Vehicle *v)
|
||||
return;
|
||||
}
|
||||
|
||||
v->direction = (v->direction + ((Random()&1)?2:-2))&7;
|
||||
v->direction = (v->direction + (GB(Random(), 0, 1) ? 2 : -2)) & 7;
|
||||
}
|
||||
|
||||
|
||||
@@ -672,20 +690,16 @@ void DisasterVehicle_Tick(Vehicle *v)
|
||||
_disastervehicle_tick_procs[v->subtype](v);
|
||||
}
|
||||
|
||||
void HandleClickOnDisasterVeh(Vehicle *v)
|
||||
{
|
||||
// not used
|
||||
}
|
||||
|
||||
void OnNewDay_DisasterVehicle(Vehicle *v)
|
||||
{
|
||||
// not used
|
||||
}
|
||||
|
||||
typedef void DisasterInitProc();
|
||||
typedef void DisasterInitProc(void);
|
||||
|
||||
// Zeppeliner which crashes on a small airport
|
||||
static void Disaster0_Init()
|
||||
static void Disaster0_Init(void)
|
||||
{
|
||||
Vehicle *v = ForceAllocateSpecialVehicle(), *u;
|
||||
Station *st;
|
||||
@@ -694,16 +708,15 @@ static void Disaster0_Init()
|
||||
if (v == NULL)
|
||||
return;
|
||||
|
||||
for(st=_stations;;) {
|
||||
/* Pick a random place, unless we find
|
||||
a small airport */
|
||||
x = TileX(Random()) * 16 + 8;
|
||||
|
||||
FOR_ALL_STATIONS(st) {
|
||||
if (st->xy && st->airport_tile != 0 &&
|
||||
st->airport_type <= 1 &&
|
||||
IS_HUMAN_PLAYER(st->owner)) {
|
||||
x = (GET_TILE_X(st->xy) + 2) * 16;
|
||||
break;
|
||||
}
|
||||
|
||||
if (++st == endof(_stations)) {
|
||||
x = (GET_TILE_X(Random())) * 16 + 8;
|
||||
x = (TileX(st->xy) + 2) * 16;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -714,12 +727,12 @@ static void Disaster0_Init()
|
||||
u = ForceAllocateSpecialVehicle();
|
||||
if (u != NULL) {
|
||||
v->next = u;
|
||||
InitializeDisasterVehicle(u,x,0,0,3,1);
|
||||
InitializeDisasterVehicle(u, x, 0, 0, 3, 1);
|
||||
u->vehstatus |= VS_DISASTER;
|
||||
}
|
||||
}
|
||||
|
||||
static void Disaster1_Init()
|
||||
static void Disaster1_Init(void)
|
||||
{
|
||||
Vehicle *v = ForceAllocateSpecialVehicle(), *u;
|
||||
int x;
|
||||
@@ -727,10 +740,10 @@ static void Disaster1_Init()
|
||||
if (v == NULL)
|
||||
return;
|
||||
|
||||
x = (GET_TILE_X(Random())) * 16 + 8;
|
||||
x = TileX(Random()) * 16 + 8;
|
||||
|
||||
InitializeDisasterVehicle(v, x, 0, 135, 3, 2);
|
||||
v->dest_tile = TILE_XY(TILES_X/2,TILES_Y/2);
|
||||
v->dest_tile = TileXY(MapSizeX() / 2, MapSizeY() / 2);
|
||||
v->age = 0;
|
||||
|
||||
// Allocate shadow too?
|
||||
@@ -742,13 +755,15 @@ static void Disaster1_Init()
|
||||
}
|
||||
}
|
||||
|
||||
static void Disaster2_Init()
|
||||
static void Disaster2_Init(void)
|
||||
{
|
||||
Industry *i, *found;
|
||||
Vehicle *v,*u;
|
||||
int x,y;
|
||||
|
||||
for(found=NULL,i=_industries; i != endof(_industries); i++) {
|
||||
found = NULL;
|
||||
|
||||
FOR_ALL_INDUSTRIES(i) {
|
||||
if (i->xy != 0 &&
|
||||
i->type == IT_OIL_REFINERY &&
|
||||
(found==NULL || CHANCE16(1,2))) {
|
||||
@@ -763,8 +778,8 @@ static void Disaster2_Init()
|
||||
if (v == NULL)
|
||||
return;
|
||||
|
||||
x = (TILES_X+9) * 16 - 1;
|
||||
y = GET_TILE_Y(found->xy)*16 + 37;
|
||||
x = (MapSizeX() + 9) * 16 - 1;
|
||||
y = TileY(found->xy) * 16 + 37;
|
||||
|
||||
InitializeDisasterVehicle(v,x,y, 135,1,4);
|
||||
|
||||
@@ -776,13 +791,15 @@ static void Disaster2_Init()
|
||||
}
|
||||
}
|
||||
|
||||
static void Disaster3_Init()
|
||||
static void Disaster3_Init(void)
|
||||
{
|
||||
Industry *i, *found;
|
||||
Vehicle *v,*u,*w;
|
||||
int x,y;
|
||||
|
||||
for(found=NULL,i=_industries; i != endof(_industries); i++) {
|
||||
found = NULL;
|
||||
|
||||
FOR_ALL_INDUSTRIES(i) {
|
||||
if (i->xy != 0 &&
|
||||
i->type == IT_FACTORY &&
|
||||
(found==NULL || CHANCE16(1,2))) {
|
||||
@@ -798,7 +815,7 @@ static void Disaster3_Init()
|
||||
return;
|
||||
|
||||
x = -16 * 16;
|
||||
y = GET_TILE_Y(found->xy)*16 + 37;
|
||||
y = TileY(found->xy) * 16 + 37;
|
||||
|
||||
InitializeDisasterVehicle(v,x,y, 135,5,6);
|
||||
|
||||
@@ -816,19 +833,18 @@ static void Disaster3_Init()
|
||||
}
|
||||
}
|
||||
|
||||
static void Disaster4_Init()
|
||||
static void Disaster4_Init(void)
|
||||
{
|
||||
Vehicle *v = ForceAllocateSpecialVehicle(), *u;
|
||||
int x,y;
|
||||
|
||||
if (v == NULL)
|
||||
return;
|
||||
if (v == NULL) return;
|
||||
|
||||
x = (GET_TILE_X(Random())) * 16 + 8;
|
||||
x = TileX(Random()) * 16 + 8;
|
||||
|
||||
y = (TILES_X-1)*16-1;
|
||||
y = MapMaxX() * 16 - 1;
|
||||
InitializeDisasterVehicle(v, x, y, 135, 7, 9);
|
||||
v->dest_tile = TILE_XY(TILES_X/2,TILES_Y/2);
|
||||
v->dest_tile = TileXY(MapSizeX() / 2, MapSizeY() / 2);
|
||||
v->age = 0;
|
||||
|
||||
// Allocate shadow too?
|
||||
@@ -841,74 +857,73 @@ static void Disaster4_Init()
|
||||
}
|
||||
|
||||
// Submarine type 1
|
||||
static void Disaster5_Init()
|
||||
static void Disaster5_Init(void)
|
||||
{
|
||||
Vehicle *v = ForceAllocateSpecialVehicle();
|
||||
int x,y;
|
||||
byte dir;
|
||||
uint32 r;
|
||||
|
||||
if (v == NULL)
|
||||
return;
|
||||
if (v == NULL) return;
|
||||
|
||||
r = Random();
|
||||
x = (GET_TILE_X(r)) * 16 + 8;
|
||||
x = TileX(r) * 16 + 8;
|
||||
|
||||
y = 8;
|
||||
dir = 3;
|
||||
if (r & 0x80000000) { y = (TILES_X-1) * 16 - 8 - 1; dir = 7; }
|
||||
if (r & 0x80000000) { y = MapMaxX() * 16 - 8 - 1; dir = 7; }
|
||||
InitializeDisasterVehicle(v, x, y, 0, dir,13);
|
||||
v->age = 0;
|
||||
}
|
||||
|
||||
// Submarine type 2
|
||||
static void Disaster6_Init()
|
||||
static void Disaster6_Init(void)
|
||||
{
|
||||
Vehicle *v = ForceAllocateSpecialVehicle();
|
||||
int x,y;
|
||||
byte dir;
|
||||
uint32 r;
|
||||
|
||||
if (v == NULL)
|
||||
return;
|
||||
if (v == NULL) return;
|
||||
|
||||
r = Random();
|
||||
x = (GET_TILE_X(r)) * 16 + 8;
|
||||
x = TileX(r) * 16 + 8;
|
||||
|
||||
y = 8;
|
||||
dir = 3;
|
||||
if (r & 0x80000000) { y = (TILES_X-1) * 16 - 8 - 1; dir = 7; }
|
||||
if (r & 0x80000000) { y = MapMaxX() * 16 - 8 - 1; dir = 7; }
|
||||
InitializeDisasterVehicle(v, x, y, 0, dir,14);
|
||||
v->age = 0;
|
||||
}
|
||||
|
||||
static void Disaster7_Init()
|
||||
static void Disaster7_Init(void)
|
||||
{
|
||||
int index = GB(Random(), 0, 4);
|
||||
Industry *i;
|
||||
int maxloop = 15;
|
||||
int index = Random() & 0xF;
|
||||
uint m;
|
||||
|
||||
do {
|
||||
for(i=_industries; i != endof(_industries); i++) {
|
||||
if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) {
|
||||
for (m = 0; m < 15; m++) {
|
||||
FOR_ALL_INDUSTRIES(i) {
|
||||
if (i->xy != 0 && i->type == IT_COAL_MINE && --index < 0) {
|
||||
|
||||
SET_DPARAM16(0, i->town->index);
|
||||
SetDParam(0, i->town->index);
|
||||
AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
|
||||
NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TILE_XY(1,1), 0);
|
||||
NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0);
|
||||
|
||||
{
|
||||
uint tile = i->xy;
|
||||
int step = _tileoffs_by_dir[Random() & 3];
|
||||
int count = 30;
|
||||
do {
|
||||
TileIndex tile = i->xy;
|
||||
TileIndexDiff step = TileOffsByDir(GB(Random(), 0, 2));
|
||||
uint n;
|
||||
|
||||
for (n = 0; n < 30; n++) {
|
||||
DisasterClearSquare(tile);
|
||||
tile = TILE_MASK(tile + step);
|
||||
} while (--count);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
} while (--maxloop != 0);
|
||||
}
|
||||
}
|
||||
|
||||
static DisasterInitProc * const _disaster_initprocs[] = {
|
||||
@@ -922,59 +937,56 @@ static DisasterInitProc * const _disaster_initprocs[] = {
|
||||
Disaster7_Init,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
byte min,max;
|
||||
} DisasterYears;
|
||||
|
||||
#define MK(a,b) {a-20,b-20}
|
||||
static const DisasterYears _dis_years[8] = {
|
||||
MK(30,55),
|
||||
MK(40,70),
|
||||
MK(60,90),
|
||||
MK(70,100),
|
||||
MK(100,200),
|
||||
MK(40,65),
|
||||
MK(75,110),
|
||||
MK(50,85),
|
||||
#define MK(a, b) { (a) - MAX_YEAR_BEGIN_REAL, (b) - MAX_YEAR_BEGIN_REAL }
|
||||
static const struct {
|
||||
byte min;
|
||||
byte max;
|
||||
} _dis_years[] = {
|
||||
MK(1930, 1955),
|
||||
MK(1940, 1970),
|
||||
MK(1960, 1990),
|
||||
MK(1970, 2000),
|
||||
MK(2000, 2100),
|
||||
MK(1940, 1965),
|
||||
MK(1975, 2010),
|
||||
MK(1950, 1985)
|
||||
};
|
||||
#undef MK
|
||||
|
||||
|
||||
void DoDisaster()
|
||||
static void DoDisaster(void)
|
||||
{
|
||||
byte buf[8];
|
||||
byte buf[lengthof(_dis_years)];
|
||||
byte year = _cur_year;
|
||||
int i,j;
|
||||
uint i;
|
||||
uint j;
|
||||
|
||||
for(i=j=0; i!=lengthof(_dis_years); i++) {
|
||||
if (year >= _dis_years[i].min &&
|
||||
year < _dis_years[i].max)
|
||||
buf[j++] = i;
|
||||
j = 0;
|
||||
for (i = 0; i != lengthof(_dis_years); i++) {
|
||||
if (year >= _dis_years[i].min && year < _dis_years[i].max) buf[j++] = i;
|
||||
}
|
||||
|
||||
if (j == 0)
|
||||
return;
|
||||
if (j == 0) return;
|
||||
|
||||
_disaster_initprocs[buf[(uint16)Random() * j >> 16]]();
|
||||
_disaster_initprocs[buf[RandomRange(j)]]();
|
||||
}
|
||||
|
||||
|
||||
static void ResetDisasterDelay()
|
||||
static void ResetDisasterDelay(void)
|
||||
{
|
||||
_disaster_delay = (int)(Random() & 0x1FF) + 730;
|
||||
_disaster_delay = GB(Random(), 0, 9) + 730;
|
||||
}
|
||||
|
||||
void DisasterDailyLoop()
|
||||
void DisasterDailyLoop(void)
|
||||
{
|
||||
if (--_disaster_delay != 0)
|
||||
return;
|
||||
if (--_disaster_delay != 0) return;
|
||||
|
||||
ResetDisasterDelay();
|
||||
|
||||
if (_opt.diff.disasters != 0)
|
||||
DoDisaster();
|
||||
if (_opt.diff.disasters != 0) DoDisaster();
|
||||
}
|
||||
|
||||
void StartupDisasters() {
|
||||
void StartupDisasters(void)
|
||||
{
|
||||
ResetDisasterDelay();
|
||||
}
|
||||
|
||||
|
||||
+164
-121
@@ -1,119 +1,116 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "table/sprites.h"
|
||||
#include "table/strings.h"
|
||||
#include "functions.h"
|
||||
#include "map.h"
|
||||
#include "window.h"
|
||||
#include "station.h"
|
||||
#include "gui.h"
|
||||
#include "viewport.h"
|
||||
#include "gfx.h"
|
||||
#include "sound.h"
|
||||
#include "command.h"
|
||||
#include "variables.h"
|
||||
|
||||
static void ShowBuildDockStationPicker();
|
||||
static void ShowBuildDocksDepotPicker();
|
||||
static void ShowBuildDockStationPicker(void);
|
||||
static void ShowBuildDocksDepotPicker(void);
|
||||
|
||||
static byte _ship_depot_direction;
|
||||
|
||||
static void CcBuildDocks(bool success, uint tile, uint32 p1, uint32 p2)
|
||||
void CcBuildDocks(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (success) {
|
||||
SndPlayTileFx(0, tile);
|
||||
SndPlayTileFx(SND_02_SPLAT, tile);
|
||||
ResetObjectToPlace();
|
||||
}
|
||||
}
|
||||
|
||||
static void CcBuildCanal(bool success, uint tile, uint32 p1, uint32 p2)
|
||||
void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (success) { SndPlayTileFx(0, tile); }
|
||||
if (success) SndPlayTileFx(SND_02_SPLAT, tile);
|
||||
}
|
||||
|
||||
|
||||
static void PlaceDocks_Dock(uint tile)
|
||||
static void PlaceDocks_Dock(TileIndex tile)
|
||||
{
|
||||
DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_DOCK | CMD_AUTO | CMD_MSG(STR_9802_CAN_T_BUILD_DOCK_HERE));
|
||||
}
|
||||
|
||||
static void PlaceDocks_Depot(uint tile)
|
||||
static void PlaceDocks_Depot(TileIndex tile)
|
||||
{
|
||||
DoCommandP(tile, _ship_depot_direction, 0, CcBuildDocks, CMD_BUILD_SHIP_DEPOT | CMD_AUTO | CMD_MSG(STR_3802_CAN_T_BUILD_SHIP_DEPOT));
|
||||
}
|
||||
|
||||
static void PlaceDocks_Buoy(uint tile)
|
||||
static void PlaceDocks_Buoy(TileIndex tile)
|
||||
{
|
||||
DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_BUOY | CMD_AUTO | CMD_MSG(STR_9835_CAN_T_POSITION_BUOY_HERE));
|
||||
}
|
||||
|
||||
static void PlaceDocks_DemolishArea(uint tile)
|
||||
static void PlaceDocks_DemolishArea(TileIndex tile)
|
||||
{
|
||||
VpStartPlaceSizing(tile, VPM_X_AND_Y);
|
||||
VpStartPlaceSizing(tile, VPM_X_AND_Y | GUI_PlaceProc_DemolishArea);
|
||||
}
|
||||
|
||||
static void PlaceDocks_BuildCanal(uint tile)
|
||||
static void PlaceDocks_BuildCanal(TileIndex tile)
|
||||
{
|
||||
VpStartPlaceSizing(tile, VPM_X_OR_Y);
|
||||
}
|
||||
|
||||
static void PlaceDocks_BuildLock(uint tile)
|
||||
static void PlaceDocks_BuildLock(TileIndex tile)
|
||||
{
|
||||
DoCommandP(tile, 0, 0, CcBuildDocks, CMD_BUILD_LOCK | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_LOCKS));
|
||||
}
|
||||
|
||||
|
||||
static void BuildDocksClick_Dock(Window *w)
|
||||
{
|
||||
|
||||
if (HandlePlacePushButton(w, 2, 0xE54, 3, PlaceDocks_Dock)) ShowBuildDockStationPicker();
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Depot(Window *w)
|
||||
{
|
||||
if (HandlePlacePushButton(w, 3, 0x2D1, 1, PlaceDocks_Depot)) ShowBuildDocksDepotPicker();
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Buoy(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 4, 0x2BE, 1, PlaceDocks_Buoy);
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Demolish(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 5, ANIMCURSOR_DEMOLISH, 1, PlaceDocks_DemolishArea);
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Lower(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 6, ANIMCURSOR_LOWERLAND, 2, PlaceProc_LowerLand);
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Raise(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 7, ANIMCURSOR_RAISELAND, 2, PlaceProc_RaiseLand);
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Purchase(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 8, 0x12B8, 1, PlaceProc_BuyLand);
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Canal(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 9, SPR_OPENTTD_BASE + 11, 1, PlaceDocks_BuildCanal);
|
||||
HandlePlacePushButton(w, 3, SPR_CURSOR_CANAL, 1, PlaceDocks_BuildCanal);
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Lock(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 10, SPR_OPENTTD_BASE + 64, 1, PlaceDocks_BuildLock);
|
||||
HandlePlacePushButton(w, 4, SPR_CURSOR_LOCK, 1, PlaceDocks_BuildLock);
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Demolish(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 6, ANIMCURSOR_DEMOLISH, 1, PlaceDocks_DemolishArea);
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Depot(Window *w)
|
||||
{
|
||||
if (HandlePlacePushButton(w, 7, SPR_CURSOR_SHIP_DEPOT, 1, PlaceDocks_Depot)) ShowBuildDocksDepotPicker();
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Dock(Window *w)
|
||||
{
|
||||
|
||||
if (HandlePlacePushButton(w, 8, SPR_CURSOR_DOCK, 3, PlaceDocks_Dock)) ShowBuildDockStationPicker();
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Buoy(Window *w)
|
||||
{
|
||||
HandlePlacePushButton(w, 9, SPR_CURSOR_BOUY, 1, PlaceDocks_Buoy);
|
||||
}
|
||||
|
||||
static void BuildDocksClick_Landscaping(Window *w)
|
||||
{
|
||||
ShowTerraformToolbar();
|
||||
}
|
||||
|
||||
typedef void OnButtonClick(Window *w);
|
||||
static OnButtonClick * const _build_docks_button_proc[] = {
|
||||
BuildDocksClick_Dock,
|
||||
BuildDocksClick_Depot,
|
||||
BuildDocksClick_Buoy,
|
||||
BuildDocksClick_Demolish,
|
||||
BuildDocksClick_Lower,
|
||||
BuildDocksClick_Raise,
|
||||
BuildDocksClick_Purchase,
|
||||
BuildDocksClick_Canal,
|
||||
BuildDocksClick_Lock,
|
||||
NULL,
|
||||
BuildDocksClick_Demolish,
|
||||
BuildDocksClick_Depot,
|
||||
BuildDocksClick_Dock,
|
||||
BuildDocksClick_Buoy,
|
||||
BuildDocksClick_Landscaping,
|
||||
};
|
||||
|
||||
static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
|
||||
@@ -123,9 +120,22 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
|
||||
DrawWindowWidgets(w);
|
||||
break;
|
||||
|
||||
case WE_CLICK: {
|
||||
if (e->click.widget - 2 >= 0) _build_docks_button_proc[e->click.widget - 2](w);
|
||||
} break;
|
||||
case WE_CLICK:
|
||||
if (e->click.widget - 3 >= 0 && e->click.widget != 5) _build_docks_button_proc[e->click.widget - 3](w);
|
||||
break;
|
||||
|
||||
case WE_KEYPRESS:
|
||||
switch (e->keypress.keycode) {
|
||||
case '1': BuildDocksClick_Canal(w); break;
|
||||
case '2': BuildDocksClick_Lock(w); break;
|
||||
case '3': BuildDocksClick_Demolish(w); break;
|
||||
case '4': BuildDocksClick_Depot(w); break;
|
||||
case '5': BuildDocksClick_Dock(w); break;
|
||||
case '6': BuildDocksClick_Buoy(w); break;
|
||||
case 'l': BuildDocksClick_Landscaping(w); break;
|
||||
default: return;
|
||||
}
|
||||
break;
|
||||
|
||||
case WE_PLACE_OBJ:
|
||||
_place_proc(e->place.tile);
|
||||
@@ -138,85 +148,113 @@ static void BuildDocksToolbWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
case WE_PLACE_MOUSEUP:
|
||||
if (e->click.pt.x != -1) {
|
||||
if (e->place.userdata == VPM_X_AND_Y)
|
||||
DoCommandP(e->place.tile, e->place.starttile, 0, CcPlaySound10, CMD_CLEAR_AREA | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
|
||||
else if(e->place.userdata == VPM_X_OR_Y)
|
||||
if ((e->place.userdata & 0xF) == VPM_X_AND_Y) { // dragged actions
|
||||
GUIPlaceProcDragXY(e);
|
||||
} else if (e->place.userdata == VPM_X_OR_Y) {
|
||||
DoCommandP(e->place.tile, e->place.starttile, 0, CcBuildCanal, CMD_BUILD_CANAL | CMD_AUTO | CMD_MSG(STR_CANT_BUILD_CANALS));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WE_ABORT_PLACE_OBJ:
|
||||
w->click_state = 0;
|
||||
UnclickWindowButtons(w);
|
||||
SetWindowDirty(w);
|
||||
|
||||
w = FindWindowById(WC_BUILD_STATION, 0);
|
||||
if (w != NULL) WP(w,def_d).close=true;
|
||||
if (w != NULL) WP(w,def_d).close = true;
|
||||
|
||||
w = FindWindowById(WC_BUILD_DEPOT, 0);
|
||||
if (w != NULL) WP(w,def_d).close=true;
|
||||
if (w != NULL) WP(w,def_d).close = true;
|
||||
break;
|
||||
|
||||
case WE_PLACE_PRESIZE: {
|
||||
uint tile_from, tile_to;
|
||||
TileIndex tile_from;
|
||||
TileIndex tile_to;
|
||||
|
||||
tile_from = tile_to = e->place.tile;
|
||||
switch(GetTileSlope(tile_from, NULL)) {
|
||||
case 3: tile_to += TILE_XY(-1,0); break;
|
||||
case 6: tile_to += TILE_XY(0,-1); break;
|
||||
case 9: tile_to += TILE_XY(0,1); break;
|
||||
case 12:tile_to += TILE_XY(1,0); break;
|
||||
switch (GetTileSlope(tile_from, NULL)) {
|
||||
case 3: tile_to += TileDiffXY(-1, 0); break;
|
||||
case 6: tile_to += TileDiffXY( 0, -1); break;
|
||||
case 9: tile_to += TileDiffXY( 0, 1); break;
|
||||
case 12: tile_to += TileDiffXY( 1, 0); break;
|
||||
}
|
||||
VpSetPresizeRange(tile_from, tile_to);
|
||||
} break;
|
||||
|
||||
case WE_DESTROY:
|
||||
if (_patches.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const Widget _build_docks_toolb_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 197, 0, 13, STR_9801_DOCK_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 21, 14, 35, 746, STR_981D_BUILD_SHIP_DOCK},
|
||||
{ WWT_PANEL, 7, 22, 43, 14, 35, 748, STR_981E_BUILD_SHIP_DEPOT_FOR_BUILDING},
|
||||
{ WWT_PANEL, 7, 44, 65, 14, 35, 693, STR_9834_POSITION_BUOY_WHICH_CAN},
|
||||
{ WWT_PANEL, 7, 66, 87, 14, 35, 703, STR_018D_DEMOLISH_BUILDINGS_ETC},
|
||||
{ WWT_PANEL, 7, 88, 109, 14, 35, 695, STR_018E_LOWER_A_CORNER_OF_LAND},
|
||||
{ WWT_PANEL, 7, 110, 131, 14, 35, 694, STR_018F_RAISE_A_CORNER_OF_LAND},
|
||||
{ WWT_PANEL, 7, 132, 153, 14, 35, 4791, STR_0329_PURCHASE_LAND_FOR_FUTURE},
|
||||
{ WWT_PANEL, 7, 154, 175, 14, 35, SPR_OPENTTD_BASE+65, STR_BUILD_CANALS_TIP},
|
||||
{ WWT_PANEL, 7, 176, 197, 14, 35, SPR_CANALS_BASE+69, STR_BUILD_LOCKS_TIP},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 145, 0, 13, STR_9801_DOCK_CONSTRUCTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, RESIZE_NONE, 7, 146, 157, 0, 13, 0x0, STR_STICKY_BUTTON},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 21, 14, 35, SPR_IMG_BUILD_CANAL, STR_BUILD_CANALS_TIP},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 22, 43, 14, 35, SPR_IMG_BUILD_LOCK, STR_BUILD_LOCKS_TIP},
|
||||
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 44, 47, 14, 35, 0x0, STR_NULL},
|
||||
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 48, 69, 14, 35, 703, STR_018D_DEMOLISH_BUILDINGS_ETC},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 70, 91, 14, 35, 748, STR_981E_BUILD_SHIP_DEPOT_FOR_BUILDING},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 92, 113, 14, 35, 746, STR_981D_BUILD_SHIP_DOCK},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 114, 135, 14, 35, 693, STR_9834_POSITION_BUOY_WHICH_CAN},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 136, 157, 14, 35, SPR_IMG_LANDSCAPING, STR_LANDSCAPING_TOOLBAR_TIP},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const WindowDesc _build_docks_toolbar_desc = {
|
||||
640-197, 22, 198, 36,
|
||||
640-158, 22, 158, 36,
|
||||
WC_BUILD_TOOLBAR,0,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
|
||||
_build_docks_toolb_widgets,
|
||||
BuildDocksToolbWndProc
|
||||
};
|
||||
|
||||
void ShowBuildDocksToolbar()
|
||||
void ShowBuildDocksToolbar(void)
|
||||
{
|
||||
if (_current_player == OWNER_SPECTATOR) return;
|
||||
DeleteWindowById(WC_BUILD_TOOLBAR, 0);
|
||||
AllocateWindowDesc(&_build_docks_toolbar_desc);
|
||||
if (_patches.link_terraform_toolbar) ShowTerraformToolbar();
|
||||
}
|
||||
|
||||
static void BuildDockStationWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
switch(e->event) {
|
||||
switch (e->event) {
|
||||
case WE_PAINT: {
|
||||
if (WP(w,def_d).close)
|
||||
return;
|
||||
int rad;
|
||||
|
||||
if (WP(w,def_d).close) return;
|
||||
w->click_state = (1<<3) << _station_show_coverage;
|
||||
DrawWindowWidgets(w);
|
||||
DrawStationCoverageAreaText(2, 15, (uint)-1);
|
||||
} break;
|
||||
|
||||
case WE_CLICK: {
|
||||
if (e->click.widget == 0) {
|
||||
ResetObjectToPlace();
|
||||
rad = (_patches.modified_catchment) ? CA_DOCK : 4;
|
||||
|
||||
if (_station_show_coverage) {
|
||||
SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
|
||||
} else {
|
||||
SetTileSelectBigSize(0, 0, 0, 0);
|
||||
}
|
||||
} break;
|
||||
|
||||
case WE_MOUSELOOP: {
|
||||
DrawStringCentered(74, 17, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0);
|
||||
DrawStationCoverageAreaText(4, 50, (uint)-1, rad);
|
||||
break;
|
||||
}
|
||||
|
||||
case WE_CLICK:
|
||||
switch (e->click.widget) {
|
||||
case 3:
|
||||
case 4:
|
||||
_station_show_coverage = e->click.widget - 3;
|
||||
SndPlayFx(SND_15_BEEP);
|
||||
SetWindowDirty(w);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WE_MOUSELOOP:
|
||||
if (WP(w,def_d).close) {
|
||||
DeleteWindow(w);
|
||||
return;
|
||||
@@ -224,31 +262,36 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
|
||||
|
||||
CheckRedrawStationCoverage(w);
|
||||
break;
|
||||
}
|
||||
|
||||
case WE_DESTROY:
|
||||
if (!WP(w,def_d).close) ResetObjectToPlace();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const Widget _build_dock_station_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 147, 0, 13, STR_3068_DOCK, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 147, 14, 45, 0x0, STR_NULL},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 147, 0, 13, STR_3068_DOCK, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 147, 14, 74, 0x0, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 14, 73, 30, 40, STR_02DB_OFF, STR_3065_DON_T_HIGHLIGHT_COVERAGE},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 74, 133, 30, 40, STR_02DA_ON, STR_3064_HIGHLIGHT_COVERAGE_AREA},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const WindowDesc _build_dock_station_desc = {
|
||||
-1, -1, 148, 46,
|
||||
-1, -1, 148, 75,
|
||||
WC_BUILD_STATION,WC_BUILD_TOOLBAR,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET,
|
||||
_build_dock_station_widgets,
|
||||
BuildDockStationWndProc
|
||||
};
|
||||
|
||||
static void ShowBuildDockStationPicker()
|
||||
static void ShowBuildDockStationPicker(void)
|
||||
{
|
||||
AllocateWindowDesc(&_build_dock_station_desc);
|
||||
}
|
||||
|
||||
static void UpdateDocksDirection()
|
||||
static void UpdateDocksDirection(void)
|
||||
{
|
||||
if (_ship_depot_direction != 0) {
|
||||
SetTileSelectSize(1, 2);
|
||||
@@ -259,7 +302,7 @@ static void UpdateDocksDirection()
|
||||
|
||||
static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
switch(e->event) {
|
||||
switch (e->event) {
|
||||
case WE_PAINT:
|
||||
w->click_state = (1<<3) << _ship_depot_direction;
|
||||
DrawWindowWidgets(w);
|
||||
@@ -271,14 +314,11 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
|
||||
return;
|
||||
|
||||
case WE_CLICK: {
|
||||
switch(e->click.widget) {
|
||||
case 0:
|
||||
ResetObjectToPlace();
|
||||
break;
|
||||
switch (e->click.widget) {
|
||||
case 3:
|
||||
case 4:
|
||||
_ship_depot_direction = e->click.widget - 3;
|
||||
SndPlayFx(0x13);
|
||||
SndPlayFx(SND_15_BEEP);
|
||||
UpdateDocksDirection();
|
||||
SetWindowDirty(w);
|
||||
break;
|
||||
@@ -286,18 +326,21 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
|
||||
} break;
|
||||
|
||||
case WE_MOUSELOOP:
|
||||
if (WP(w,def_d).close)
|
||||
DeleteWindow(w);
|
||||
if (WP(w,def_d).close) DeleteWindow(w);
|
||||
break;
|
||||
|
||||
case WE_DESTROY:
|
||||
if (!WP(w,def_d).close) ResetObjectToPlace();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const Widget _build_docks_depot_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 203, 0, 13, STR_3800_SHIP_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 203, 14, 85, 0x0, STR_NULL},
|
||||
{ WWT_PANEL, 14, 3, 100, 17, 82, 0x0, STR_3803_SELECT_SHIP_DEPOT_ORIENTATION},
|
||||
{ WWT_PANEL, 14, 103, 200, 17, 82, 0x0, STR_3803_SELECT_SHIP_DEPOT_ORIENTATION},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 203, 0, 13, STR_3800_SHIP_DEPOT_ORIENTATION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 203, 14, 85, 0x0, STR_NULL},
|
||||
{ WWT_PANEL, RESIZE_NONE, 14, 3, 100, 17, 82, 0x0, STR_3803_SELECT_SHIP_DEPOT_ORIENTATION},
|
||||
{ WWT_PANEL, RESIZE_NONE, 14, 103, 200, 17, 82, 0x0, STR_3803_SELECT_SHIP_DEPOT_ORIENTATION},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
@@ -310,14 +353,14 @@ static const WindowDesc _build_docks_depot_desc = {
|
||||
};
|
||||
|
||||
|
||||
static void ShowBuildDocksDepotPicker()
|
||||
static void ShowBuildDocksDepotPicker(void)
|
||||
{
|
||||
AllocateWindowDesc(&_build_docks_depot_desc);
|
||||
UpdateDocksDirection();
|
||||
}
|
||||
|
||||
|
||||
void InitializeDockGui()
|
||||
void InitializeDockGui(void)
|
||||
{
|
||||
_ship_depot_direction = 0;
|
||||
}
|
||||
|
||||
+2
-1
@@ -24,6 +24,7 @@ On BeOS, run ./configure and then use jam. There are a variaty of options you ca
|
||||
On Windows, insert your "Transport Tycoon Deluxe for Windows 95" disk. You can use a DOS version, but your graphics will be purple. NB: Even if your version of Transport Tycoon Deluxe ran on Windows 95, it may still be the DOS version. Then run the OpenTTD installer.
|
||||
|
||||
On UNIX platforms; decompress your OpenTTD archive, or otherwise run the installer. You should be left with an OpenTTD directory on your system. In this directory, make a subdirectory called 'data', and into this place the sample.cat file and all the .grf files from the install CD of 'Transport Tycoon Deluxe for Windows 95".
|
||||
(Alternatively you can use the TTD GRF files from the DOS version: TRG1.GRF, TRGC.GRF, TRGH.GRF, TRGI.GRF, TRGT.GRF. A few minor graphical glitches with the DOS graphics remain. E.g. the autorail button in the rail toolbar doesn't look as nice as with the Windows graphics.)
|
||||
|
||||
If you want MIDI music, copy the 'gm' folder from the original game directory/CD to the OpenTTD folder.
|
||||
|
||||
@@ -90,7 +91,7 @@ Virtually any settings - train numbers, start date, what vehicles your competito
|
||||
|
||||
2.11 Network Play
|
||||
|
||||
OpenTTD now supports rudimentary TCP/IP based network play. This is not supported on all platforms. To start a server, use the '-n' CLI switch, and start a client with '-n' and the servers IP adress. The OpenTTD network play runs over port 12345, so you may need to open this on your firewall.
|
||||
See multiplayer.txt for more info.
|
||||
|
||||
2.12 Rail Recycling.
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
It's gone
|
||||
|
||||
The main goal with the package system was to make it as simple as possible to update. The problem was that some files inside the data folder should be updated and not others. Now the data files have been moved inside OpenTTD itself and to make it even easier, the same goes for the lang dir. There will no longer be an issue where people have different versions of grf files, language files and OpenTTD.
|
||||
|
||||
To install simply copy OpenTTD into the folder you want
|
||||
If it is your current folder with outdated grf files, you should remove
|
||||
canalsw.grf
|
||||
openttd.grf
|
||||
opntitle.dat
|
||||
signalsw.grf
|
||||
trkfoundw.grf
|
||||
|
||||
THE TTD GRF FILES ARE STILL NEEDED!
|
||||
They need to be inside a folder called "data" in the same folder as OpenTTD. Create it if you have none. It should contain:
|
||||
sample.cat
|
||||
trg1r.grf
|
||||
trgcr.grf
|
||||
trghr.grf
|
||||
trgir.grf
|
||||
trgtr.grf
|
||||
|
||||
(Alternatively you can use the TTD GRF files from the DOS version: TRG1.GRF, TRGC.GRF, TRGH.GRF, TRGI.GRF, TRGT.GRF. A few minor graphical glitches with the DOS graphics remain. E.g. the autorail button in the rail toolbar doesn't look as nice as with the Windows graphics.)
|
||||
|
||||
You should also use the data folder to add any custom grf files if you like
|
||||
@@ -2,10 +2,8 @@ Since you are reading this, OpenTTD have crashed. This file tells you how
|
||||
to fix the most common problems or make to make a bug report, that the
|
||||
developers can use to track down the problem
|
||||
|
||||
The first thing you need to do is to get the error message. You can access OSX's build-in log by double-clicking Crash_Log_Opener. OTTD will do that if that file is present in the same folder as OTTD and is not renamed. However, major crashes can prevent the autoopen feature and you have to do it manually then
|
||||
If Crash_Log_Opener doesn't work you can view the log by opening Console inside Applications/utilities.
|
||||
|
||||
If you use the Console app, you should look at the buttom of the console.log window
|
||||
If it is an assert, OpenTTD will open the console for you, if it is truly a crash, you have to do it yourself. The Console is located at /Applications/Utilities/Console.
|
||||
The problem is near the button of the page
|
||||
|
||||
The problems are as follows:
|
||||
NOTE: build from source means to download the source and compile
|
||||
|
||||
@@ -31,14 +31,16 @@ You can undo changes to a file with
|
||||
|
||||
3.) Required data files:
|
||||
|
||||
Copy the following files from the WINDOWS version of Transport Tycoon Deluxe to openttd/data/
|
||||
Copy the following files from Transport Tycoon Deluxe to openttd/data/
|
||||
sample.cat
|
||||
trg1r.grf
|
||||
trgcr.grf
|
||||
trghr.grf
|
||||
trgir.grf
|
||||
trgtr.grf
|
||||
|
||||
|
||||
(Alternatively you can use the TTD GRF files from the DOS version: TRG1.GRF, TRGC.GRF, TRGH.GRF, TRGI.GRF, TRGT.GRF. A few minor graphical glitches with the DOS graphics remain. E.g. the autorail button in the rail toolbar doesn't look as nice as with the Windows graphics.)
|
||||
|
||||
|
||||
4.) Compiling and running:
|
||||
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
OpenTTD: OS/2 version
|
||||
=====================
|
||||
|
||||
OpenTTD has been ported to work on OS/2 4.x or later (including
|
||||
eComStation). The game should work as well as it does on Windows
|
||||
or other platforms: the main issues you may encounter are graphics
|
||||
card problems, but that is really the fault of SDL.
|
||||
|
||||
=========================
|
||||
USING OPENTTD FOR OS/2
|
||||
=========================
|
||||
|
||||
LIBRARIES REQUIRED FOR END USERS
|
||||
--------------------------------
|
||||
|
||||
SDL.DLL (SDL 1.2.7) and FSLib.dll are required to use this program:
|
||||
these can be downloaded from the Files section at
|
||||
http://sourceforge.net/projects/openttd/ - see "os2-useful.zip".
|
||||
(Note that a newer version of SDL is now available at
|
||||
ftp://ftp.netlabs.org/pub/sdl/sdl-dev-os2-2004-12-22.zip which may
|
||||
help solve some problems).
|
||||
|
||||
Please note that SDL release 2005-03-30 does NOT work with OpenTTD,
|
||||
at least in my experience and the experience of a couple of other
|
||||
users. If you experience problems with OpenTTD, please try downgrading
|
||||
to SDL 2004-12-22.
|
||||
|
||||
Note that to actually play the game, I have found in my own
|
||||
experience that a version of the Scitech Display Drivers or its later
|
||||
incarnation (see www.scitech.com) are necessary for it to work. If
|
||||
you have trouble with your native drivers, try the Scitech drivers
|
||||
and see if they help the problem.
|
||||
|
||||
KNOWN ISSUES
|
||||
------------
|
||||
|
||||
- If an error occurs during loading, the OS/2 error message window
|
||||
is not always displayed.
|
||||
|
||||
A NOTE ABOUT MUSIC
|
||||
------------------
|
||||
|
||||
OpenTTD includes a music driver which uses the MCI MIDI system. Unfortunately,
|
||||
due to the lack of proper MIDI hardware myself, I have been unable to test it,
|
||||
but during testing, I found that when MIDI was enabled, I got no sound
|
||||
effects. I therefore decided to DISABLE music by default.
|
||||
|
||||
To enable music, start OpenTTD with the command line:
|
||||
|
||||
openttd -m os2
|
||||
|
||||
If I hear enough responses that both music and sound work together (it might
|
||||
just be my system), I'll have the defaults changed.
|
||||
|
||||
A NOTE ABOUT DEDICATED MULTIPLAYER SERVERS
|
||||
------------------------------------------
|
||||
|
||||
To start a dedicated multiplayer server, you should run the dedicated.cmd
|
||||
file. This enables OpenTTD to open up a VIO console window to display
|
||||
its output and gather any necessary input. Running "openttd -D"
|
||||
directly will result in the console not being displayed. You may
|
||||
still pass any other parameters ('-D' is already passed) to
|
||||
dedicated.cmd.
|
||||
|
||||
=========================
|
||||
BUILDING THE OS/2 VERSION
|
||||
=========================
|
||||
|
||||
Compiler
|
||||
--------
|
||||
|
||||
Open Watcom 1.3 was used to build OpenTTD (earlier versions will
|
||||
NOT work). See http://www.openwatcom.org/ to download it. It may
|
||||
also be possible to build OpenTTD with GCC: I attempted this
|
||||
before using Open Watcom, but found the tools available for OS/2
|
||||
at the time to be a bit more tricky to get working.
|
||||
|
||||
Due to complexities in my set-up, I actually used the Win32 version
|
||||
of Open Watcom to initially compile OpenTTD for OS/2. There should
|
||||
be no reason of course why the OS/2 version cannot be used, and I
|
||||
have subsequently built OpenTTD successfully this way.
|
||||
|
||||
Libraries Required
|
||||
------------------
|
||||
|
||||
The following libraries are required. To build zlib and libpng, I
|
||||
simply added the required files (watch out for sample programs, etc)
|
||||
to an IDE project file and built a library. Do not use the makefiles
|
||||
provided, they are not designed for Watcom (apart from SDL):
|
||||
|
||||
- zlib
|
||||
http://www.zlib.org/ - contains a makefile for OS/2, but is out
|
||||
of date and uses EMX, ignore this
|
||||
|
||||
- libpng
|
||||
http://www.libpng.org/ - contains an EMX/gcc makefile, ignore this
|
||||
|
||||
- SDL for OS/2
|
||||
For 0.3.5, I used ftp://ftp.netlabs.org/pub/sdl/SDL-1.2.7-src-20040908a.zip -
|
||||
take SDL.dll and SDL.lib from the src/ directory. Note that 20041222 is
|
||||
out now, which is recommended for stability updates.
|
||||
|
||||
If you do not wish to build the libraries yourself, pre-built versions
|
||||
can be downloaded from the Files section at
|
||||
http://sourceforge.net/projects/openttd/ - see "os2-useful.zip".
|
||||
|
||||
A Note About Subversion Revision Numbers
|
||||
----------------------------------------
|
||||
|
||||
The project file uses a bit of a hack to find out the SVN revision number and
|
||||
create an appropriate rev.c file. You'll need the SVN tools in your path
|
||||
(specifically, "svnversion"). If "svnversion" can't be found, a generic rev.c
|
||||
with the revision set to "norev000" will be created. To specifically force a
|
||||
version number, set the environment variable "RELEASE" to the number (eg, "0.3.6")
|
||||
-before- starting the Open Watcom IDE (which must be launched from the same shell
|
||||
session). Also, beware, as you WILL cause incompatibilities if you try to
|
||||
play a multiplayer game with a different version.
|
||||
|
||||
Compiling
|
||||
---------
|
||||
|
||||
To compile, open the os/os2/openttd.wpj file in the IDE and first build
|
||||
the strgen.exe target. This will build the .lng file generator, and will
|
||||
also attempt to build all the language files (plus the table\strings.h
|
||||
file which is required for openttd.exe to be built). Once strgen.exe and
|
||||
the language files are built successfully, you can build the openttd.exe
|
||||
target.
|
||||
|
||||
Contact Information
|
||||
-------------------
|
||||
|
||||
If you have any questions regarding OS/2 issues, please contact me
|
||||
(owen@owenrudge.net) and I'll try to help you out. For general OpenTTD
|
||||
issues, see the Contacting section of readme.txt.
|
||||
|
||||
- Owen Rudge
|
||||
+104
-89
@@ -1,89 +1,104 @@
|
||||
Compilung OpenTTD using MS VC6.0
|
||||
|
||||
|
||||
Step 1
|
||||
------------------
|
||||
Downloaded:
|
||||
Useful.zip http://sourceforge.net/project/showfiles.php?group_id=103924&package_id=114307&release_id=228633
|
||||
SDL.zip http://www.libsdl.org/release/SDL-1.2.7-win32.zip
|
||||
DirectX7.0 SDK http://www.tt-forums.net/download.php?id=15989
|
||||
(or alternatively the latest DirectX SDK from Microsoft)
|
||||
afxres.h http://www-d0.fnal.gov/d0dist/dist/packages/d0ve/devel/windows/AFXRES.H
|
||||
|
||||
|
||||
Step 2
|
||||
------------------
|
||||
Put the newly downloaded files in the VC lib and include directories
|
||||
(Where D:\program files\ is your local location of VC)
|
||||
|
||||
|
||||
* zconf.h [useful.zip]
|
||||
* zlib.h [useful.zip]
|
||||
* afxres.h
|
||||
in
|
||||
D:\Program Files\Microsoft Visual Studio\VC98\Include
|
||||
|
||||
* zlibstat.lib [usefull.zip]
|
||||
* SDL.lib [SDL.zip
|
||||
* libpng.lib [usefull.zip]
|
||||
in
|
||||
D:\Program Files\Microsoft Visual Studio\VC98\Lib
|
||||
|
||||
You can also make custum directories, for libraries (.lib) and includes/header files (.h) and
|
||||
add it to the VC paths via:
|
||||
Tools -> Options -> Directories -> show directories for:
|
||||
a) include files (the include dir: D:\Program Files\Microsoft Visual Studio\VC98\DirectX 7 SDK\include )
|
||||
b) library files (the lib dir, D:\Program Files\Microsoft Visual Studio\VC98\DirectX 7 SDK\lib )
|
||||
|
||||
|
||||
Step 3: DirextX SDK
|
||||
------------------
|
||||
(This should work with the latest DirectX SDK as well.)
|
||||
The installation with DirectX 7 was odd, so you'd better use the version available via the forum, see also
|
||||
the download link on top.
|
||||
|
||||
Copy the DirectX 7 SDK files, leaving the directory stucture intact, to the directory:
|
||||
D:\Program Files\Microsoft Visual Studio\VC98\
|
||||
thus resulting in
|
||||
D:\Program Files\Microsoft Visual Studio\VC98\DirectX 7 SDK\include and
|
||||
D:\Program Files\Microsoft Visual Studio\VC98\DirectX 7 SDK\lib
|
||||
|
||||
Step 3.1
|
||||
|
||||
Add these two folders to the search path of VC.
|
||||
In VC6.0: Tools -> Options -> Directories -> show directories for:
|
||||
a) include files (the include dir: D:\Program Files\Microsoft Visual Studio\VC98\DirectX 7 SDK\include )
|
||||
b) libraru files (the lib dir, D:\Program Files\Microsoft Visual Studio\VC98\DirectX 7 SDK\lib )
|
||||
|
||||
|
||||
Step 4
|
||||
-----------------
|
||||
Copy the following files from the WINDOWS version of Transport Tycoon Deluxe to the data folder
|
||||
sample.cat
|
||||
trg1r.grf
|
||||
trgcr.grf
|
||||
trghr.grf
|
||||
trgir.grf
|
||||
trgtr.grf
|
||||
|
||||
|
||||
|
||||
Step 5
|
||||
-----------------
|
||||
Compile ...
|
||||
|
||||
|
||||
Step 6
|
||||
-----------------
|
||||
|
||||
Now it should work, it worked for me :)
|
||||
|
||||
Go ahead and make that patch!
|
||||
|
||||
Happy Hacking!
|
||||
|
||||
|
||||
|
||||
------------------
|
||||
written by Dribbel
|
||||
|
||||
Compiling OpenTTD using Microsoft Visual C++ 6.0
|
||||
|
||||
|
||||
Step 1: Ingredients
|
||||
|
||||
Download the following files:
|
||||
|
||||
* Openttd-useful.zip (http://sourceforge.net/project/showfiles.php?group_id=103924&package_id=114307&release_id=228633)
|
||||
* DirectX 8.1 SDK (http://neuron.tuke.sk/~mizanin/eng/Dx81sdk-include-lib.rar) (or alternatively the latest DirectX SDK from Microsoft)
|
||||
* The February 2003 Microsoft Platform SDK (http://www.microsoft.com/msdownload/platformsdk/sdkupdate/XPSP2FULLInstall.htm) (newer SDK's do not work with MSVC6)
|
||||
* afxres.h (http://www-d0.fnal.gov/d0dist/dist/packages/d0ve/devel/windows/AFXRES.H) (maybe you not need this)
|
||||
|
||||
...and of course the newest source from svn://svn.openttd.org/trunk
|
||||
|
||||
You have to have a SVN-client to download the source:
|
||||
|
||||
* Command line version (Subversion 1.2.3 Win32 binaries) (http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91)
|
||||
* GUI TortoiseSVN (http://tortoisesvn.tigris.org/download.html)
|
||||
|
||||
Step 2: Includes and Libraries
|
||||
|
||||
Put the newly downloaded files in the VC lib and include directories (Where "C:\Program Files\Microsoft Visual Studio\VC98" is your local location of VC)
|
||||
|
||||
|
||||
* zconf.h [useful.zip]
|
||||
* zlib.h [useful.zip]
|
||||
* png.h [useful.zip]
|
||||
* pngconf.h [useful.zip]
|
||||
* afxres.h
|
||||
|
||||
in
|
||||
|
||||
C:\Program Files\Microsoft Visual Studio\VC98\Include
|
||||
|
||||
and
|
||||
|
||||
* zlibstat.lib [useful.zip]
|
||||
* libpng.lib [useful.zip]
|
||||
|
||||
in
|
||||
|
||||
C:\Program Files\Microsoft Visual Studio\VC98\Lib
|
||||
|
||||
|
||||
Step 3: DirectX SDK
|
||||
|
||||
(This should work with the latest DirectX SDK as well.)
|
||||
|
||||
There are 2 folder in the compressed file: Include and Lib
|
||||
|
||||
Copy all files from Include folder to
|
||||
|
||||
C:\Program Files\Microsoft Visual Studio\VC98\Include
|
||||
|
||||
and all files from Lib folder to
|
||||
|
||||
C:\Program Files\Microsoft Visual Studio\VC98\Lib
|
||||
|
||||
|
||||
|
||||
You can also make custom directories, which is recommended so you don't overwrite VS6 files, for libraries (.lib) and includes/header files (.h) and add it to the VC paths via:
|
||||
|
||||
Tools -> Options -> Directories -> show directories for:
|
||||
|
||||
a) include files (the include dir: C:\Program Files\Microsoft Visual Studio\VC98\DirectX 8.1 SDK\include )
|
||||
|
||||
b) library files (the lib dir, C:\Program Files\Microsoft Visual Studio\VC98\DirectX 8.1 SDK\lib )
|
||||
|
||||
NOTE: make sure that the directory for the DirectX SDK is the first one in the list, above all others, otherwise compilation will most likely fail!!
|
||||
|
||||
Step 4: TTD Graphics files
|
||||
|
||||
Copy the following files from Transport Tycoon Deluxe to the data folder
|
||||
|
||||
* sample.cat
|
||||
* trg1r.grf
|
||||
* trgcr.grf
|
||||
* trghr.grf
|
||||
* trgir.grf
|
||||
* trgtr.grf
|
||||
|
||||
|
||||
Step 5: Compiling
|
||||
|
||||
Open trunk/openttd.dsw
|
||||
|
||||
Build menu > Set active configuration > Select: "openttd - Win32 Release"
|
||||
|
||||
Compile...
|
||||
|
||||
|
||||
Now it should work, it worked for me :)
|
||||
|
||||
From r1319 you can compile branch/map in Debug mode (by Bociusz)
|
||||
|
||||
For compiling branch/cargo-packets you have to add cargo.c and .h to this tree's openttd.dsp
|
||||
|
||||
If it's not working, and you checked that you using the newest SVN (!) report to Bociusz on IRC (irc://irc.freenode.net/openttd)
|
||||
|
||||
Go ahead and make that patch! Happy Hacking! :)
|
||||
|
||||
Originally written by Dribbel
|
||||
|
||||
Project file updating by Bociusz
|
||||
|
||||
+11
-7
@@ -1,8 +1,12 @@
|
||||
OPENTTD INGAME CONSOLE DOCUMENTATION
|
||||
====================================
|
||||
http://openttd.rulez.org/wiki2/index.php/OpenTTDDevBlackBook
|
||||
http://wiki.openttd.org/index.php/OpenTTDDevBlackBook
|
||||
for detailed information
|
||||
|
||||
*** WARNING **
|
||||
This document is out of date
|
||||
*** WARNING **
|
||||
|
||||
HOTKEY: BACKQUOTE (aka tilde, the key left to "1")
|
||||
|
||||
COMMANDS:
|
||||
@@ -34,19 +38,19 @@ VARIABLES:
|
||||
-> 2 = console error and debug output
|
||||
|
||||
*cursor_rate
|
||||
-> 1-12 = defines the cursor blink interval
|
||||
-> 1-12 = defines the cursor blink interval
|
||||
|
||||
|
||||
VARIABLE HANDLING:
|
||||
------------------
|
||||
|
||||
*developer = 0
|
||||
*developer ++
|
||||
developer = 0
|
||||
developer ++
|
||||
|
||||
*temp_string = test
|
||||
*temp_string = "my little"
|
||||
temp_string = test
|
||||
temp_string = "my little"
|
||||
|
||||
printf "%s world" *temp_string
|
||||
printf "%s world" temp_string
|
||||
|
||||
|
||||
---------------------------------------------------
|
||||
|
||||
+19
-19
@@ -1,20 +1,20 @@
|
||||
Notes about DirectMusic driver for Win32
|
||||
----------------------------------------
|
||||
|
||||
If compiling under MinGW32, you require the DirectX 7.0 files for MinGW32, available from
|
||||
http://alleg.sourceforge.net/files/dx70_mgw.zip.
|
||||
|
||||
If compiling under MSVC 6.0, you require the equivalent for MSVC, available from
|
||||
http://alleg.sourceforge.net/files/dx70_min.zip. MSVC 7.0/7.1 include header files that
|
||||
are recent enough.
|
||||
|
||||
If you do not want to compile the DirectMusic driver, undefine WIN32_ENABLE_DIRECTMUSIC_SUPPORT
|
||||
in stdafx.h.
|
||||
|
||||
Bugs, etc
|
||||
---------
|
||||
|
||||
- The volume control doesn't work properly. I'll fix this soon.
|
||||
|
||||
Owen Rudge
|
||||
Notes about DirectMusic driver for Win32
|
||||
----------------------------------------
|
||||
|
||||
If compiling under MinGW32, you require the DirectX 7.0 files for MinGW32, available from
|
||||
http://alleg.sourceforge.net/files/dx70_mgw.zip.
|
||||
|
||||
If compiling under MSVC 6.0, you require the equivalent for MSVC, available from
|
||||
http://alleg.sourceforge.net/files/dx70_min.zip. MSVC 7.0/7.1 include header files that
|
||||
are recent enough.
|
||||
|
||||
If you do not want to compile the DirectMusic driver, undefine WIN32_ENABLE_DIRECTMUSIC_SUPPORT
|
||||
in stdafx.h.
|
||||
|
||||
Bugs, etc
|
||||
---------
|
||||
|
||||
- The volume control doesn't work properly. I'll fix this soon.
|
||||
|
||||
Owen Rudge
|
||||
14th March 2004
|
||||
+626
-611
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,251 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
|
||||
<meta name="Description" content="Structure of OpenTTD (OTTD) landscape arrays #2">
|
||||
<title>OpenTTD Landscape Internals - #2</title>
|
||||
<style type="text/css">
|
||||
span.abuse { font-family: "Courier New", Courier, mono; background-color: rgb(255, 58, 31); }
|
||||
span.free { font-family: "Courier New", Courier, mono; background-color: rgb(30, 178, 54); }
|
||||
span.used { font-family: "Courier New", Courier, mono; }
|
||||
td.bits { white-space: nowrap; text-align: center; font-family: "Courier New", Courier, mono; }
|
||||
td.caption { white-space: nowrap; text-align: left; }
|
||||
td li { white-space: nowrap; text-align: left; }
|
||||
th { white-space: nowrap; text-align: center; }
|
||||
</style>
|
||||
</head>
|
||||
<body style="direction: ltr;">
|
||||
<h3 style="font-weight: bold;">Landscape</h3>
|
||||
<span style="font-weight: bold;"></span>Five attributes hold the information about a tile.
|
||||
This can be seen in the <a href="landscape.html">Landscape</a> document. This page tries to give an overview of used and free bits of
|
||||
the array so you can quickly see what is used and what is not.
|
||||
<ul>
|
||||
<li><span style="font-weight: bold;"><span class="free">O</span></span> - bit is free</li>
|
||||
<li><span style="font-weight: bold;"><span class="used">X</span></span> - bit is used</li>
|
||||
<li><span style="font-weight: bold;"><span class="abuse"> </span></span> - bit of attribute is abused for different purposes</li>
|
||||
</ul>
|
||||
<p>
|
||||
<ul>
|
||||
<li><span style="font-weight: bold;">type_height</span> - 8 bits in size, stores tile height (lower 4 bits) and tile class (upper 4 bits)</li>
|
||||
<li><span style="font-weight: bold;">m1</span> - 8 bits in size, used to identify the owner of that tile (eg piece of rail, bridge, etc.)</li>
|
||||
<li><span style="font-weight: bold;">m2</span> - 16 bits in size, used to identify the index of the given tile (object) in the (object-)array</li>
|
||||
<li><span style="font-weight: bold;">m3</span> - 8 bits in size, is used for general storage</li>
|
||||
<li><span style="font-weight: bold;">m4</span> - 8 bits in size, is used for general storage</li>
|
||||
<li><span style="font-weight: bold;">m5</span> - 8 bits in size, is used for general storage</li>
|
||||
</ul>
|
||||
|
||||
<table align=center border="1" cellpadding="2" cellspacing="2">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th colspan=2>class</th>
|
||||
<th>m1 (8)</th>
|
||||
<th>m2 (16)</th>
|
||||
<th>m3 (8)</th>
|
||||
<th>m4 (8)</th>
|
||||
<th>type_height (8)</th>
|
||||
<th>m5 (8)</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan=2 class="caption">bits</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">FEDC BA98 7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
<td class="bits">7654 3210</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>0</td>
|
||||
<td class="caption">ground</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX</td>
|
||||
<td class="bits">XXXX XX<span class="free">OO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=3>1</td>
|
||||
<td class="caption">rail</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span> XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO O</span>XXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">depot</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XX<span class="free">OO O</span>XXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">waypoint</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOO</span>X XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XX<span class="free">OO O</span>XXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=3>2</td>
|
||||
<td class="caption">road</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">level crossing</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX XX<span class="free">OO</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="caption">road depot</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">X<span class="free">OOO OOOO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
<td class="caption">town</td>
|
||||
<td class="bits"><span class="abuse">XXXX XXXX</span></td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits">XX<span class="free">OO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">X<span class="free">O</span>XX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>4</td>
|
||||
<td class="caption">trees</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span> XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XX<span class="free">OO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XX<span class="free">OO O</span>XXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>5</td>
|
||||
<td class="caption">station</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOO</span>X XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>6</td>
|
||||
<td class="caption">water</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=6>8</td>
|
||||
<td class="caption">industry</td>
|
||||
<td class="bits"><span class="abuse">X</span><span class="free">OO</span><span class="abuse">X XXXX</span></td>
|
||||
<td class="bits">XXXX XXXX XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bubble/sugar/toffee</td>
|
||||
<td class="bits"><span class="abuse">X</span><span class="free">OOO OOOO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>toy factory</td>
|
||||
<td class="bits"><span class="abuse">X</span><span class="free">OOO OOOO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>gold/copper/coal</td>
|
||||
<td class="bits"><span class="abuse">XX</span><span class="free">OO OO</span><span class="abuse">XX</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>oil wells</td>
|
||||
<td class="bits"><span class="abuse">X</span><span class="free">OOO OO</span><span class="abuse">XX</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>power station</td>
|
||||
<td class="bits"><span class="abuse">X</span><span class="free">O</span><span class="abuse">XX XX</span><span class="free">OO</span></td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td rowspan=2>9</td>
|
||||
<td class="caption">tunnel</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO</span> XXXX</td>
|
||||
<td class="bits">X<span class="free">OOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>bridge</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span> <span class="abuse">XXXX XXXX</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">X<span class="free">OOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>A</td>
|
||||
<td class="caption">various (HQ)</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
<td class="bits">XXXX XXXX</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+99
-57
@@ -1,70 +1,112 @@
|
||||
Multiplayer Manual for OpenTTD
|
||||
----------------------------------------
|
||||
Multiplayer Manual for OpenTTD (0.3.5)
|
||||
=======================================
|
||||
|
||||
1. Starting a Server
|
||||
---------------------
|
||||
|
||||
- Click "multiplayer" on the startup screen
|
||||
- Click "start server"
|
||||
- Type in a game name
|
||||
- Select the type of game ('LAN/Internet' or 'Internet (advertise)'. With the last one
|
||||
other people are able to see you online. Else they need your IP and port to join)
|
||||
- Click "start game" ,"load game" or "load scenario"
|
||||
- Start playing
|
||||
|
||||
|
||||
- click "multiplayer" on the startup screen
|
||||
- click "start server"
|
||||
- type in a game name
|
||||
- click "start game" ,"load game" or "load scenario"
|
||||
|
||||
2. Connecting to a Server
|
||||
|
||||
- click "multiplayer" on the startup screen
|
||||
|
||||
- if you want to connect to any network game in your LAN click "find server"
|
||||
|
||||
- if there were more then one server
|
||||
- select one in the list below the buttons
|
||||
- click on "join game".
|
||||
--------------------------
|
||||
|
||||
- if you want to play over the internet you should have the ip of the game server you want connect to.
|
||||
- click direct connect
|
||||
- Click "multiplayer" on the startup screen
|
||||
|
||||
- If you want to connect to any network game in your LAN click on 'LAN', then on
|
||||
'Find Server'
|
||||
- If you want to see which servers all online on the Internet, click on 'Internet'
|
||||
and 'Find Server'
|
||||
|
||||
- If there were more then one server
|
||||
- select one in the list below the buttons
|
||||
- click on 'join game'
|
||||
|
||||
- If you want to play and you have the ip or hostname of the game server you want connect to.
|
||||
- click add server
|
||||
- type in the ip address or hostname
|
||||
- if you want to add a port use :<port>
|
||||
- if you want to connect as an special player use #<player-no>
|
||||
|
||||
3. Connecting to a Server over the Console
|
||||
|
||||
- open the console and type in the following command:
|
||||
|
||||
- Now you can select a company and press: "Join company", to help that company
|
||||
- Or you can press "Spectate game", to spectate the game
|
||||
- Or you can press "New company", and start your own company (if there are slots free)
|
||||
|
||||
- You see a progressbar how far you are with joining the server.
|
||||
|
||||
- Happy playing
|
||||
|
||||
|
||||
3. Connecting to a Server over the Console
|
||||
-------------------------------------------
|
||||
|
||||
- Open the console and type in the following command:
|
||||
|
||||
]connect <ip/host>:<port>#<player-no>
|
||||
|
||||
|
||||
4. Playing Internet-Games
|
||||
--------------------------
|
||||
|
||||
- since OpenTTD 0.3.4 you can also play internet games over higher latency connections.
|
||||
- to do this the gameservers sync frequency should be highered to a decent value.
|
||||
- open the console [on the server]
|
||||
- type in the following command:
|
||||
|
||||
] *net_sync_freq = <4-80>
|
||||
|
||||
default value: 4
|
||||
|
||||
- this is lowering the sync frequency of the server and your game should be less laggy.
|
||||
- this is a server variable: it has nothing to do with the clients
|
||||
|
||||
- you can also change when the clients ready packet is sent if you still have lags.
|
||||
- open the console
|
||||
- type in the following command:
|
||||
|
||||
] *net_ready_ahead = <1-8>
|
||||
|
||||
default value: 1
|
||||
|
||||
- in that way your client is sending its "i am ready for next sync" a bit earlier
|
||||
thats quite good for games where some players have higher latencies than the others.
|
||||
- this is a client variable: it has nothing to do with the server
|
||||
|
||||
- to change the client timeout time
|
||||
- open the console [on the server]
|
||||
- type in the following command:
|
||||
|
||||
] *net_client_timeout = <30-x>
|
||||
|
||||
default value: 300
|
||||
|
||||
- warning: a too low value will disconnect your clients if they have a short lag
|
||||
|
||||
|
||||
- Since OpenTTD 0.3.5 the network protocol has been rewritten and is very stable, even over slow connections.
|
||||
|
||||
- Server with a red dot behind it have a different version then you have. You will not be able to join those servers.
|
||||
|
||||
- It can happen that a connection is that slow, or you have that many clients connected to your server, that your clients start to loose their connection. Some things you can do about it:
|
||||
|
||||
- net_frame_freq:
|
||||
change it in console with: net_frame_freq = <number>
|
||||
the number should be between the 0 and 10, not much higher. It indicates the delay between clicking and showing up. The higher, the more you notice it, but the less bandwidth you use.
|
||||
A good value for Internet-games is 2 or 3.
|
||||
|
||||
- net_sync_freq:
|
||||
change it in console with: net_sync_freq = <number>
|
||||
the number should be between the 50 and 1000, not much lower, not much higer. It indicates the time between sync-frames. A sync-frame is a frame which checks if all clients are still in sync. When the value it too high, clients can desync in 1960, but the server detects it in 1970. Not really handy. The lower the value, the more bandwidth it uses.
|
||||
|
||||
NB: changing net_frame_freq has more effect on the bandwidth then net_sync_freq. You should never change net_sync_freq!
|
||||
|
||||
|
||||
5. Tips for servers
|
||||
--------------------
|
||||
|
||||
- You can launch a dedicated server by adding -D as parameter
|
||||
- In UNIX like systems, you can fork your dedicated server by adding -f as parameter
|
||||
|
||||
- You can automaticly clean companies that do not have a client connected to them, for, let's say,
|
||||
3 years. You can do this via: 'set autoclean_companies' and 'set autoclean_protected' and
|
||||
'set autoclean_unprotected'. Unprotected removes a password from a company when it is
|
||||
not used for more then the defined amount of months.
|
||||
- You can also do this manually via the console: 'reset_company'.
|
||||
Both ways, the company will go bankrupt.
|
||||
|
||||
- You can let your server automaticly restart a map when, let's say, year 2030 is reached.
|
||||
See 'set restart_game_date' for detail.
|
||||
- If you want to be on the server-list, enable Advertising. To do this, select 'Internet (advertise)'
|
||||
in the Start Server menu, or type in console: 'set server_advertise 1'.
|
||||
|
||||
- You can protect your server with a password via the console: 'set server_pw', or via the
|
||||
Start Server menu.
|
||||
|
||||
- When you have many clients connected to your server via Internet, watch your bandwidth (if
|
||||
you have any limit on it, set by your ISP). 1 client uses +/- 3 kb/s up and down. To decrease
|
||||
this amount, set 'net_frame_freq' to 1 for example. This will reduce it to 1.5 kb/s per client.
|
||||
|
||||
|
||||
6. Some useful things
|
||||
----------------------
|
||||
|
||||
- You can protect your company so nobody else can join uninvited. To do this, check your Company Screen
|
||||
|
||||
- You can give other players some money via the ClientList (under the 'head' in the mainbar).
|
||||
|
||||
- You can chat with other players via ENTER or via SHIFT+T or via the ClientList
|
||||
|
||||
- Servers can now kick players, so don't make them use it!
|
||||
|
||||
- From 0.3.5, desyncs should not happen anymore
|
||||
|
||||
- From 0.3.5, patch-settings are also synced. You can now play without deleting openttd.cfg, and with, for example, extra large trains enabled.
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.Dd July 27, 2005
|
||||
.Dt OPENTTD 6
|
||||
.Sh NAME
|
||||
.Nm openttd
|
||||
.Nd An open source clone of the Microprose game "Transport Tycoon Deluxe"
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl Defhi
|
||||
.Op Fl G Ar seed
|
||||
.Op Fl d Ar [level | cat=lvl[, ...]]
|
||||
.Op Fl g Ar [savegame]
|
||||
.Op Fl n Ar [host[#player][:port]]
|
||||
.Op Fl r Ar widthxheight
|
||||
.Op Fl t Ar date
|
||||
.Op Fl m Ar driver
|
||||
.Op Fl s Ar driver
|
||||
.Op Fl v Ar driver
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width ".Fl n Ar host[#player][:port]"
|
||||
.It Fl D
|
||||
Start a dedicated server
|
||||
.It Fl G Ar seed
|
||||
Seed the pseudo random number generator
|
||||
.It Fl d Ar [level]
|
||||
Set debug verbosity for all categories to
|
||||
.Ar level
|
||||
or 1 if omitted
|
||||
.It Fl d Ar cat=level[, ...]
|
||||
Set debug verbosity for a specific category
|
||||
.It Fl e
|
||||
Start in world editor mode
|
||||
.It Fl f
|
||||
Fork into background (dedicated only, see
|
||||
.Fl D )
|
||||
.It Fl g Ar [savegame]
|
||||
Load
|
||||
.Ar savegame
|
||||
at start or start a new game if omitted
|
||||
.It Fl h
|
||||
Display a summary of all options and available drivers
|
||||
.It Fl i
|
||||
Force to use the DOS palette (use this if you see a lot of magenta)
|
||||
.It Fl m Ar driver
|
||||
Set the music driver, see
|
||||
.Fl h
|
||||
.It Fl n
|
||||
Start a network server
|
||||
.It Fl n Ar host[#player][:port]
|
||||
Join a network game, optionally specify player to play as and port to connect to
|
||||
.It Fl r Ar widthxheight
|
||||
Set the resolution
|
||||
.It Fl s Ar driver
|
||||
Set the sound driver, see
|
||||
.Fl h
|
||||
.It Fl t Ar date
|
||||
Set the starting date
|
||||
.It Fl v Ar driver
|
||||
Set the video driver, see
|
||||
.Fl h
|
||||
.Sh SEE ALSO
|
||||
http://wiki.openttd.org/
|
||||
.Sh HISTORY
|
||||
Transport Tycoon Deluxe was written by Chris Sawyer and published by Microprose.
|
||||
.Nm
|
||||
is a free reimplementation.
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -1,38 +0,0 @@
|
||||
0,9,10,2,3,13,9,9,0,10,4,15,6,11,14,1
|
||||
dark blue=0 =0
|
||||
pale_green=1 =9
|
||||
pink=2 =10
|
||||
yellow=3 =2
|
||||
red=4 =3
|
||||
light blue=5 =13
|
||||
green=6 =9
|
||||
dark green=7 =9
|
||||
blue=8 =0
|
||||
cream=9 =10
|
||||
mauve=10 =4
|
||||
purple=11 =15
|
||||
orange=12 =6
|
||||
brown=13 =11
|
||||
grey=14 =14
|
||||
white=15 =1
|
||||
|
||||
|
||||
=blue=0
|
||||
=white=1
|
||||
=yellow=2
|
||||
=red=3
|
||||
=blue=4
|
||||
=grey=5
|
||||
=orange=6
|
||||
=green=7
|
||||
=light yellow=8
|
||||
=light green=9
|
||||
=cream=10
|
||||
=brown=11
|
||||
=white=12
|
||||
=light blue=13
|
||||
=dark grey=14
|
||||
=purple=15
|
||||
=black=16
|
||||
=dark green=17=not good
|
||||
=dark grey=21
|
||||
@@ -0,0 +1,224 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "debug.h"
|
||||
#include "driver.h"
|
||||
#include "functions.h"
|
||||
#include "hal.h"
|
||||
#include "string.h"
|
||||
|
||||
#include "music/bemidi.h"
|
||||
#include "music/dmusic.h"
|
||||
#include "music/extmidi.h"
|
||||
#include "music/null_m.h"
|
||||
#include "music/os2_m.h"
|
||||
#include "music/win32_m.h"
|
||||
#include "music/qtmidi.h"
|
||||
|
||||
#include "sound/null_s.h"
|
||||
#include "sound/sdl_s.h"
|
||||
#include "sound/cocoa_s.h"
|
||||
#include "sound/win32_s.h"
|
||||
|
||||
#include "video/dedicated_v.h"
|
||||
#include "video/null_v.h"
|
||||
#include "video/sdl_v.h"
|
||||
#include "video/cocoa_v.h"
|
||||
#include "video/win32_v.h"
|
||||
|
||||
typedef struct DriverDesc {
|
||||
const char* name;
|
||||
const char* longname;
|
||||
const HalCommonDriver* drv;
|
||||
} DriverDesc;
|
||||
|
||||
typedef struct DriverClass {
|
||||
const DriverDesc *descs;
|
||||
const char *name;
|
||||
const HalCommonDriver** drv;
|
||||
} DriverClass;
|
||||
|
||||
|
||||
#define M(x, y, z) { x, y, (const HalCommonDriver *)(void *)z }
|
||||
static const DriverDesc _music_driver_descs[] = {
|
||||
#ifdef __BEOS__
|
||||
M("bemidi", "BeOS MIDI Driver", &_bemidi_music_driver),
|
||||
#endif
|
||||
#ifdef __OS2__
|
||||
M("os2", "OS/2 Music Driver", &_os2_music_driver),
|
||||
#endif
|
||||
#ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT
|
||||
M("dmusic", "DirectMusic MIDI Driver", &_dmusic_midi_driver),
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
M("win32", "Win32 MIDI Driver", &_win32_music_driver),
|
||||
#endif
|
||||
#if defined(__APPLE__) && !defined(DEDICATED)
|
||||
M("qt", "QuickTime MIDI Driver", &_qtime_music_driver),
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__)
|
||||
M("extmidi", "External MIDI Driver", &_extmidi_music_driver),
|
||||
#endif
|
||||
#endif
|
||||
M("null", "Null Music Driver", &_null_music_driver),
|
||||
M(NULL, NULL, NULL)
|
||||
};
|
||||
|
||||
static const DriverDesc _sound_driver_descs[] = {
|
||||
#ifdef WIN32
|
||||
M("win32", "Win32 WaveOut Driver", &_win32_sound_driver),
|
||||
#endif
|
||||
#ifdef WITH_SDL
|
||||
M("sdl", "SDL Sound Driver", &_sdl_sound_driver),
|
||||
#endif
|
||||
#ifdef WITH_COCOA
|
||||
M("cocoa", "Cocoa Sound Driver", &_cocoa_sound_driver),
|
||||
#endif
|
||||
M("null", "Null Sound Driver", &_null_sound_driver),
|
||||
M(NULL, NULL, NULL)
|
||||
};
|
||||
|
||||
static const DriverDesc _video_driver_descs[] = {
|
||||
#ifdef WIN32
|
||||
M("win32", "Win32 GDI Video Driver", &_win32_video_driver),
|
||||
#endif
|
||||
#ifdef WITH_SDL
|
||||
M("sdl", "SDL Video Driver", &_sdl_video_driver),
|
||||
#endif
|
||||
#ifdef WITH_COCOA
|
||||
M("cocoa", "Cocoa Video Driver", &_cocoa_video_driver),
|
||||
#endif
|
||||
M("null", "Null Video Driver", &_null_video_driver),
|
||||
#ifdef ENABLE_NETWORK
|
||||
M("dedicated", "Dedicated Video Driver", &_dedicated_video_driver),
|
||||
#endif
|
||||
M(NULL, NULL, NULL)
|
||||
};
|
||||
#undef M
|
||||
|
||||
|
||||
#define M(x, y, z) { x, y, (const HalCommonDriver **)(void *)z }
|
||||
static const DriverClass _driver_classes[] = {
|
||||
M(_video_driver_descs, "video", &_video_driver),
|
||||
M(_sound_driver_descs, "sound", &_sound_driver),
|
||||
M(_music_driver_descs, "music", &_music_driver)
|
||||
};
|
||||
#undef M
|
||||
|
||||
static const DriverDesc* GetDriverByName(const DriverDesc* dd, const char* name)
|
||||
{
|
||||
for (; dd->name != NULL; dd++) {
|
||||
if (strcmp(dd->name, name) == 0) return dd;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void LoadDriver(int driver, const char *name)
|
||||
{
|
||||
const DriverClass *dc = &_driver_classes[driver];
|
||||
const DriverDesc *dd;
|
||||
const char *err;
|
||||
|
||||
if (*name == '\0') {
|
||||
for (dd = dc->descs; dd->name != NULL; dd++) {
|
||||
err = dd->drv->start(NULL);
|
||||
if (err == NULL) break;
|
||||
DEBUG(driver, 1) ("Probing %s driver \"%s\" failed with error: %s",
|
||||
dc->name, dd->name, err
|
||||
);
|
||||
}
|
||||
if (dd->name == NULL) {
|
||||
error("Couldn't find any suitable %s driver", dc->name);
|
||||
}
|
||||
|
||||
DEBUG(driver, 1)
|
||||
("Successfully probed %s driver \"%s\"", dc->name, dd->name);
|
||||
|
||||
*dc->drv = dd->drv;
|
||||
} else {
|
||||
char* parm;
|
||||
char buffer[256];
|
||||
const char* parms[32];
|
||||
|
||||
// Extract the driver name and put parameter list in parm
|
||||
ttd_strlcpy(buffer, name, sizeof(buffer));
|
||||
parm = strchr(buffer, ':');
|
||||
parms[0] = NULL;
|
||||
if (parm != NULL) {
|
||||
uint np = 0;
|
||||
// Tokenize the parm.
|
||||
do {
|
||||
*parm++ = '\0';
|
||||
if (np < lengthof(parms) - 1)
|
||||
parms[np++] = parm;
|
||||
while (*parm != '\0' && *parm != ',')
|
||||
parm++;
|
||||
} while (*parm == ',');
|
||||
parms[np] = NULL;
|
||||
}
|
||||
dd = GetDriverByName(dc->descs, buffer);
|
||||
if (dd == NULL)
|
||||
error("No such %s driver: %s\n", dc->name, buffer);
|
||||
|
||||
if (*dc->drv != NULL) (*dc->drv)->stop();
|
||||
*dc->drv = NULL;
|
||||
|
||||
err = dd->drv->start(parms);
|
||||
if (err != NULL) {
|
||||
error("Unable to load driver %s(%s). The error was: %s\n",
|
||||
dd->name, dd->longname, err
|
||||
);
|
||||
}
|
||||
*dc->drv = dd->drv;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const char* GetDriverParam(const char* const* parm, const char* name)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
if (parm == NULL) return NULL;
|
||||
|
||||
len = strlen(name);
|
||||
for (; *parm != NULL; parm++) {
|
||||
const char* p = *parm;
|
||||
|
||||
if (strncmp(p, name, len) == 0) {
|
||||
if (p[len] == '=') return p + len + 1;
|
||||
if (p[len] == '\0') return p + len;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool GetDriverParamBool(const char* const* parm, const char* name)
|
||||
{
|
||||
return GetDriverParam(parm, name) != NULL;
|
||||
}
|
||||
|
||||
int GetDriverParamInt(const char* const* parm, const char* name, int def)
|
||||
{
|
||||
const char* p = GetDriverParam(parm, name);
|
||||
return p != NULL ? atoi(p) : def;
|
||||
}
|
||||
|
||||
|
||||
char *GetDriverList(char* p)
|
||||
{
|
||||
const DriverClass* dc;
|
||||
|
||||
for (dc = _driver_classes; dc != endof(_driver_classes); dc++) {
|
||||
const DriverDesc* dd;
|
||||
|
||||
p += sprintf(p, "List of %s drivers:\n", dc->name);
|
||||
for (dd = dc->descs; dd->name != NULL; dd++) {
|
||||
p += sprintf(p, "%10s: %s\n", dd->name, dd->longname);
|
||||
}
|
||||
p += sprintf(p, "\n");
|
||||
}
|
||||
|
||||
return p;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef DRIVER_H
|
||||
#define DRIVER_H
|
||||
|
||||
void LoadDriver(int driver, const char *name);
|
||||
|
||||
bool GetDriverParamBool(const char* const* parm, const char* name);
|
||||
int GetDriverParamInt(const char* const* parm, const char* name, int def);
|
||||
|
||||
char *GetDriverList(char* p);
|
||||
|
||||
#endif /* DRIVER_H */
|
||||
+21
-14
@@ -1,59 +1,67 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "openttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "functions.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
#include "table/sprites.h"
|
||||
|
||||
static void DrawTile_Dummy(TileInfo *ti)
|
||||
{
|
||||
DrawGroundSpriteAt(0x3EC, ti->x, ti->y, ti->z);
|
||||
DrawGroundSpriteAt(SPR_SHADOW_CELL, ti->x, ti->y, ti->z);
|
||||
}
|
||||
|
||||
|
||||
static uint GetSlopeZ_Dummy(TileInfo *ti) {
|
||||
return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z;
|
||||
static uint GetSlopeZ_Dummy(const TileInfo* ti)
|
||||
{
|
||||
return GetPartialZ(ti->x & 0xF, ti->y & 0xF, ti->tileh) + ti->z;
|
||||
}
|
||||
|
||||
static uint GetSlopeTileh_Dummy(TileInfo *ti) {
|
||||
static uint GetSlopeTileh_Dummy(const TileInfo* ti)
|
||||
{
|
||||
return ti->tileh;
|
||||
}
|
||||
|
||||
static int32 ClearTile_Dummy(uint tile, byte flags) {
|
||||
static int32 ClearTile_Dummy(TileIndex tile, byte flags)
|
||||
{
|
||||
return_cmd_error(STR_0001_OFF_EDGE_OF_MAP);
|
||||
}
|
||||
|
||||
|
||||
static void GetAcceptedCargo_Dummy(uint tile, AcceptedCargo *ac)
|
||||
static void GetAcceptedCargo_Dummy(TileIndex tile, AcceptedCargo ac)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
||||
static void GetTileDesc_Dummy(uint tile, TileDesc *td)
|
||||
static void GetTileDesc_Dummy(TileIndex tile, TileDesc *td)
|
||||
{
|
||||
td->str = STR_EMPTY;
|
||||
td->owner = OWNER_NONE;
|
||||
}
|
||||
|
||||
static void AnimateTile_Dummy(uint tile)
|
||||
static void AnimateTile_Dummy(TileIndex tile)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
||||
static void TileLoop_Dummy(uint tile)
|
||||
static void TileLoop_Dummy(TileIndex tile)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
||||
static void ClickTile_Dummy(uint tile)
|
||||
static void ClickTile_Dummy(TileIndex tile)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
||||
static void ChangeTileOwner_Dummy(uint tile, byte old_player, byte new_player)
|
||||
static void ChangeTileOwner_Dummy(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
/* not used */
|
||||
}
|
||||
|
||||
static uint32 GetTileTrackStatus_Dummy(uint tile, TransportType mode)
|
||||
static uint32 GetTileTrackStatus_Dummy(TileIndex tile, TransportType mode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -74,4 +82,3 @@ const TileTypeProcs _tile_type_dummy_procs = {
|
||||
NULL, /* vehicle_leave_tile_proc */
|
||||
GetSlopeTileh_Dummy, /* get_slope_tileh_proc */
|
||||
};
|
||||
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef ECONOMY_H
|
||||
#define ECONOMY_H
|
||||
|
||||
void ResetPriceBaseMultipliers(void);
|
||||
void SetPriceBaseMultiplier(uint price, byte factor);
|
||||
|
||||
typedef struct {
|
||||
// Maximum possible loan
|
||||
int32 max_loan;
|
||||
@@ -18,8 +23,8 @@ VARDEF Economy _economy;
|
||||
typedef struct Subsidy {
|
||||
byte cargo_type;
|
||||
byte age;
|
||||
byte from;
|
||||
byte to;
|
||||
uint16 from;
|
||||
uint16 to;
|
||||
} Subsidy;
|
||||
|
||||
|
||||
@@ -47,32 +52,19 @@ typedef struct ScoreInfo {
|
||||
int score; // How much score it will give
|
||||
} ScoreInfo;
|
||||
|
||||
static const ScoreInfo score_info[] = {
|
||||
{SCORE_VEHICLES, 120, 100},
|
||||
{SCORE_STATIONS, 80, 100},
|
||||
{SCORE_MIN_PROFIT, 10000, 100},
|
||||
{SCORE_MIN_INCOME, 50000, 50},
|
||||
{SCORE_MAX_INCOME, 100000, 100},
|
||||
{SCORE_DELIVERED, 40000, 400},
|
||||
{SCORE_CARGO, 8, 50},
|
||||
{SCORE_MONEY, 10000000, 50},
|
||||
{SCORE_LOAN, 250000, 50},
|
||||
{SCORE_TOTAL, 0, 0}
|
||||
};
|
||||
|
||||
int _score_part[MAX_PLAYERS][NUM_SCORE];
|
||||
extern const ScoreInfo _score_info[];
|
||||
extern int _score_part[MAX_PLAYERS][NUM_SCORE];
|
||||
|
||||
int UpdateCompanyRatingAndValue(Player *p, bool update);
|
||||
void UpdatePlayerHouse(Player *p, uint score);
|
||||
|
||||
|
||||
VARDEF Subsidy _subsidies[MAX_PLAYERS];
|
||||
Pair SetupSubsidyDecodeParam(Subsidy *s, bool mode);
|
||||
void DeleteSubsidyWithIndustry(byte index);
|
||||
void DeleteSubsidyWithStation(byte index);
|
||||
void RemoteSubsidyAdd(Subsidy *s_new);
|
||||
Pair SetupSubsidyDecodeParam(const Subsidy* s, bool mode);
|
||||
void DeleteSubsidyWithIndustry(uint16 index);
|
||||
void DeleteSubsidyWithStation(uint16 index);
|
||||
|
||||
int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, byte cargo_type);
|
||||
uint MoveGoodsToStation(uint tile, int w, int h, int type, uint amount);
|
||||
uint MoveGoodsToStation(TileIndex tile, int w, int h, int type, uint amount);
|
||||
|
||||
#endif /* ECONOMY_H */
|
||||
|
||||
+39
-9
@@ -1,3 +1,5 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
// This pretty simple file checks if the system is LITTLE_ENDIAN or BIG_ENDIAN
|
||||
@@ -8,15 +10,43 @@
|
||||
// that says or TTD_LITTLE_ENDIAN, or TTD_BIG_ENDIAN. Makefile takes
|
||||
// care of the real writing to the file.
|
||||
|
||||
int main () {
|
||||
unsigned char EndianTest[2] = { 1, 0 };
|
||||
printf("#ifndef ENDIAN_H\n#define ENDIAN_H\n");
|
||||
if( *(short *) EndianTest == 1 )
|
||||
printf("#define TTD_LITTLE_ENDIAN\n");
|
||||
else
|
||||
printf("#define TTD_BIG_ENDIAN\n");
|
||||
int main (int argc, char *argv[]) {
|
||||
unsigned char EndianTest[2] = { 1, 0 };
|
||||
int force_BE = 0, force_LE = 0, force_PREPROCESSOR = 0;
|
||||
|
||||
printf("#endif\n");
|
||||
if (argc > 1 && strcmp(argv[1], "BE") == 0)
|
||||
force_BE = 1;
|
||||
if (argc > 1 && strcmp(argv[1], "LE") == 0)
|
||||
force_LE = 1;
|
||||
if (argc > 1 && strcmp(argv[1], "PREPROCESSOR") == 0)
|
||||
force_PREPROCESSOR = 1;
|
||||
|
||||
return 0;
|
||||
printf("#ifndef ENDIAN_H\n#define ENDIAN_H\n");
|
||||
|
||||
if (force_LE == 1) {
|
||||
printf("#define TTD_LITTLE_ENDIAN\n");
|
||||
} else {
|
||||
if (force_BE == 1) {
|
||||
printf("#define TTD_BIG_ENDIAN\n");
|
||||
} else {
|
||||
if (force_PREPROCESSOR == 1) {
|
||||
// adding support for universal binaries on OSX
|
||||
// Universal binaries supports both PPC and x86
|
||||
// If a compiler for OSX gets this setting, it will always pick the correct endian and no test is needed
|
||||
printf("#ifdef __BIG_ENDIAN__\n");
|
||||
printf("#define TTD_BIG_ENDIAN\n");
|
||||
printf("#else\n");
|
||||
printf("#define TTD_LITTLE_ENDIAN\n");
|
||||
printf("#endif\n");
|
||||
} else {
|
||||
if ( *(short *) EndianTest == 1 )
|
||||
printf("#define TTD_LITTLE_ENDIAN\n");
|
||||
else
|
||||
printf("#define TTD_BIG_ENDIAN\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("#endif\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,17 +1,34 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef ENGINE_H
|
||||
#define ENGINE_H
|
||||
|
||||
/** @file engine.h
|
||||
*/
|
||||
|
||||
#include "sprite.h"
|
||||
#include "pool.h"
|
||||
|
||||
typedef struct RailVehicleInfo {
|
||||
byte image_index;
|
||||
byte flags; /* 1=multihead engine, 2=wagon */
|
||||
byte base_cost;
|
||||
uint16 max_speed;
|
||||
uint16 power;
|
||||
byte weight;
|
||||
uint16 weight;
|
||||
byte running_cost_base;
|
||||
byte running_cost_class;
|
||||
byte engclass; // 0: steam, 1: diesel, 2: electric
|
||||
byte capacity;
|
||||
byte cargo_type;
|
||||
byte callbackmask; // see CallbackMask enum
|
||||
uint16 pow_wag_power;
|
||||
byte pow_wag_weight;
|
||||
byte visual_effect; // NOTE: this is not 100% implemented yet, at the moment it is only used as a 'fallback' value
|
||||
// for when the 'powered wagon' callback fails. But it should really also determine what
|
||||
// kind of visual effect to generate for a vehicle (default, steam, diesel, electric).
|
||||
// Same goes for the callback result, which atm is only used to check if a wagon is powered.
|
||||
byte shorten_factor; // length on main map for this type is 8 - shorten_factor
|
||||
} RailVehicleInfo;
|
||||
|
||||
typedef struct ShipVehicleInfo {
|
||||
@@ -25,13 +42,39 @@ typedef struct ShipVehicleInfo {
|
||||
byte refittable;
|
||||
} ShipVehicleInfo;
|
||||
|
||||
typedef struct AircraftVehicleInfo {
|
||||
byte image_index;
|
||||
byte base_cost;
|
||||
byte running_cost;
|
||||
byte subtype;
|
||||
byte sfx;
|
||||
byte acceleration;
|
||||
byte max_speed;
|
||||
byte mail_capacity;
|
||||
uint16 passenger_capacity;
|
||||
} AircraftVehicleInfo;
|
||||
|
||||
typedef struct RoadVehicleInfo {
|
||||
byte image_index;
|
||||
byte base_cost;
|
||||
byte running_cost;
|
||||
byte sfx;
|
||||
byte max_speed;
|
||||
byte capacity;
|
||||
byte cargo_type;
|
||||
} RoadVehicleInfo;
|
||||
|
||||
/** Information about a vehicle
|
||||
* @see table/engines.h
|
||||
*/
|
||||
typedef struct EngineInfo {
|
||||
uint16 base_intro;
|
||||
byte unk2;
|
||||
byte unk2; ///< Carriages have the highest bit set in this one
|
||||
byte lifelength;
|
||||
byte base_life;
|
||||
byte railtype_climates;
|
||||
byte railtype:4;
|
||||
byte climates:4;
|
||||
uint32 refit_mask;
|
||||
} EngineInfo;
|
||||
|
||||
typedef struct Engine {
|
||||
@@ -47,6 +90,7 @@ typedef struct Engine {
|
||||
byte preview_wait;
|
||||
byte railtype;
|
||||
byte player_avail;
|
||||
byte type; // type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h
|
||||
} Engine;
|
||||
|
||||
|
||||
@@ -55,63 +99,123 @@ enum {
|
||||
RVI_WAGON = 2,
|
||||
};
|
||||
|
||||
|
||||
void StartupEngines();
|
||||
|
||||
|
||||
struct SpriteSuperSet {
|
||||
// XXX: Would anyone ever need more than 16 spritesets? Maybe we should
|
||||
// use even less, now we take whole 8kb for custom sprites table, oh my!
|
||||
byte sprites_per_set; // means number of directions - 4 or 8
|
||||
// Loaded = in motion, loading = not moving
|
||||
// Each superset contains several spritesets, for various loading stages
|
||||
byte loaded_count;
|
||||
uint16 loaded[16]; // sprite ids
|
||||
byte loading_count;
|
||||
uint16 loading[16]; // sprite ids
|
||||
};
|
||||
|
||||
extern byte _global_cargo_id[NUM_LANDSCAPE][NUM_CARGO];
|
||||
enum {
|
||||
CID_DEFAULT = 29,
|
||||
CID_PURCHASE = 30,
|
||||
NUM_CID = 31,
|
||||
NUM_VEHICLE_TYPES = 6
|
||||
};
|
||||
extern byte _local_cargo_id_ctype[NUM_CID];
|
||||
extern byte _local_cargo_id_landscape[NUM_CID];
|
||||
|
||||
extern uint32 _engine_refit_masks[256];
|
||||
enum {
|
||||
INVALID_ENGINE = 0xFFFF,
|
||||
};
|
||||
|
||||
extern byte _engine_original_sprites[256];
|
||||
void SetWagonOverrideSprites(byte engine, struct SpriteSuperSet *superset, byte *train_id, int trains);
|
||||
void SetCustomEngineSprites(byte engine, byte cargo, struct SpriteSuperSet *superset);
|
||||
void AddTypeToEngines(void);
|
||||
void StartupEngines(void);
|
||||
|
||||
enum GlobalCargo {
|
||||
GC_PASSENGERS = 0,
|
||||
GC_COAL = 1,
|
||||
GC_MAIL = 2,
|
||||
GC_OIL = 3,
|
||||
GC_LIVESTOCK = 4,
|
||||
GC_GOODS = 5,
|
||||
GC_GRAIN = 6, // GC_WHEAT / GC_MAIZE
|
||||
GC_WOOD = 7,
|
||||
GC_IRON_ORE = 8,
|
||||
GC_STEEL = 9,
|
||||
GC_VALUABLES = 10, // GC_GOLD / GC_DIAMONDS
|
||||
GC_PAPER = 11,
|
||||
GC_FOOD = 12,
|
||||
GC_FRUIT = 13,
|
||||
GC_COPPER_ORE = 14,
|
||||
GC_WATER = 15,
|
||||
GC_RUBBER = 16,
|
||||
GC_SUGAR = 17,
|
||||
GC_TOYS = 18,
|
||||
GC_BATTERIES = 19,
|
||||
GC_CANDY = 20,
|
||||
GC_TOFFEE = 21,
|
||||
GC_COLA = 22,
|
||||
GC_COTTON_CANDY = 23,
|
||||
GC_BUBBLES = 24,
|
||||
GC_PLASTIC = 25,
|
||||
GC_FIZZY_DRINKS = 26,
|
||||
GC_PAPER_TEMP = 27,
|
||||
GC_UNDEFINED = 28, // undefined; unused slot in arctic climate
|
||||
GC_DEFAULT = 29,
|
||||
GC_PURCHASE = 30,
|
||||
GC_INVALID = 255,
|
||||
NUM_GLOBAL_CID = 31
|
||||
};
|
||||
|
||||
// This enum lists the implemented callbacks
|
||||
// Use as argument for the GetCallBackResult function (see comments there)
|
||||
enum CallbackID {
|
||||
// Powered wagons, if the result is lower as 0x40 then the wagon is powered
|
||||
// TODO: interpret the rest of the result, aka "visual effects"
|
||||
CBID_WAGON_POWER = 0x10,
|
||||
|
||||
// Vehicle length, returns the amount of 1/8's the vehicle is shorter
|
||||
// only for train vehicles
|
||||
CBID_VEH_LENGTH = 0x11,
|
||||
|
||||
// Refit capacity, the passed vehicle needs to have its ->cargo_type set to
|
||||
// the cargo we are refitting to, returns the new cargo capacity
|
||||
CBID_REFIT_CAP = 0x15,
|
||||
|
||||
CBID_ARTIC_ENGINE = 0x16,
|
||||
};
|
||||
|
||||
// bit positions for rvi->callbackmask, indicates which callbacks are used by an engine
|
||||
// (some callbacks are always used, and dont appear here)
|
||||
enum CallbackMask {
|
||||
CBM_WAGON_POWER = 0,
|
||||
CBM_VEH_LENGTH = 1,
|
||||
CBM_REFIT_CAP = 3,
|
||||
CBM_ARTIC_ENGINE = 4,
|
||||
};
|
||||
|
||||
enum {
|
||||
CALLBACK_FAILED = 0xFFFF
|
||||
};
|
||||
|
||||
VARDEF const uint32 _default_refitmasks[NUM_VEHICLE_TYPES];
|
||||
VARDEF const CargoID _global_cargo_id[NUM_LANDSCAPE][NUM_CARGO];
|
||||
VARDEF const uint32 _landscape_global_cargo_mask[NUM_LANDSCAPE];
|
||||
VARDEF const CargoID _local_cargo_id_ctype[NUM_GLOBAL_CID];
|
||||
VARDEF const uint32 cargo_classes[16];
|
||||
|
||||
void SetWagonOverrideSprites(EngineID engine, struct SpriteGroup *group, byte *train_id, int trains);
|
||||
void SetCustomEngineSprites(EngineID engine, byte cargo, struct SpriteGroup *group);
|
||||
// loaded is in percents, overriding_engine 0xffff is none
|
||||
int GetCustomEngineSprite(byte engine, uint16 overriding_engine, byte cargo, byte loaded, byte in_motion, byte direction);
|
||||
#define GetCustomVehicleSprite(v, direction) \
|
||||
GetCustomEngineSprite(v->engine_type, v->type == VEH_Train ? v->u.rail.first_engine : -1, \
|
||||
_global_cargo_id[_opt.landscape][v->cargo_type], \
|
||||
((v->cargo_count + 1) * 100) / (v->cargo_cap + 1), \
|
||||
!!v->cur_speed, direction);
|
||||
int GetCustomEngineSprite(EngineID engine, const Vehicle *v, byte direction);
|
||||
uint16 GetCallBackResult(uint16 callback_info, EngineID engine, const Vehicle *v);
|
||||
bool UsesWagonOverride(const Vehicle *v);
|
||||
#define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
|
||||
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
|
||||
|
||||
void SetCustomEngineName(int engine, char *name);
|
||||
StringID GetCustomEngineName(int engine);
|
||||
typedef enum VehicleTrigger {
|
||||
VEHICLE_TRIGGER_NEW_CARGO = 1,
|
||||
// Externally triggered only for the first vehicle in chain
|
||||
VEHICLE_TRIGGER_DEPOT = 2,
|
||||
// Externally triggered only for the first vehicle in chain, only if whole chain is empty
|
||||
VEHICLE_TRIGGER_EMPTY = 4,
|
||||
// Not triggered externally (called for the whole chain if we got NEW_CARGO)
|
||||
VEHICLE_TRIGGER_ANY_NEW_CARGO = 8,
|
||||
} VehicleTrigger;
|
||||
void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger);
|
||||
|
||||
void SetCustomEngineName(EngineID engine, const char *name);
|
||||
StringID GetCustomEngineName(EngineID engine);
|
||||
|
||||
|
||||
void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod);
|
||||
void DrawRoadVehEngine(int x, int y, int engine, uint32 image_ormod);
|
||||
void DrawShipEngine(int x, int y, int engine, uint32 image_ormod);
|
||||
void DrawAircraftEngine(int x, int y, int engine, uint32 image_ormod);
|
||||
void DrawTrainEngine(int x, int y, EngineID engine, uint32 image_ormod);
|
||||
void DrawRoadVehEngine(int x, int y, EngineID engine, uint32 image_ormod);
|
||||
void DrawShipEngine(int x, int y, EngineID engine, uint32 image_ormod);
|
||||
void DrawAircraftEngine(int x, int y, EngineID engine, uint32 image_ormod);
|
||||
|
||||
void DrawTrainEngineInfo(int engine, int x, int y, int maxw);
|
||||
void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw);
|
||||
void DrawShipEngineInfo(int engine, int x, int y, int maxw);
|
||||
void DrawAircraftEngineInfo(int engine, int x, int y, int maxw);
|
||||
|
||||
void AcceptEnginePreview(Engine *e, int player);
|
||||
|
||||
void LoadCustomEngineNames();
|
||||
void DeleteCustomEngineNames();
|
||||
void LoadCustomEngineNames(void);
|
||||
void DeleteCustomEngineNames(void);
|
||||
|
||||
bool IsEngineBuildable(uint engine, byte type);
|
||||
|
||||
enum {
|
||||
NUM_NORMAL_RAIL_ENGINES = 54,
|
||||
@@ -121,17 +225,143 @@ enum {
|
||||
NUM_ROAD_ENGINES = 88,
|
||||
NUM_SHIP_ENGINES = 11,
|
||||
NUM_AIRCRAFT_ENGINES = 41,
|
||||
TOTAL_NUM_ENGINES = NUM_NORMAL_RAIL_ENGINES+NUM_MONORAIL_ENGINES+NUM_MAGLEV_ENGINES+NUM_ROAD_ENGINES+NUM_SHIP_ENGINES+NUM_AIRCRAFT_ENGINES,
|
||||
TOTAL_NUM_ENGINES = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES + NUM_AIRCRAFT_ENGINES,
|
||||
AIRCRAFT_ENGINES_INDEX = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES,
|
||||
SHIP_ENGINES_INDEX = NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES,
|
||||
ROAD_ENGINES_INDEX = NUM_TRAIN_ENGINES,
|
||||
};
|
||||
VARDEF Engine _engines[TOTAL_NUM_ENGINES];
|
||||
#define FOR_ALL_ENGINES(e) for (e = _engines; e != endof(_engines); e++)
|
||||
|
||||
static inline Engine* GetEngine(EngineID i)
|
||||
{
|
||||
assert(i < lengthof(_engines));
|
||||
return &_engines[i];
|
||||
}
|
||||
|
||||
VARDEF StringID _engine_name_strings[TOTAL_NUM_ENGINES];
|
||||
|
||||
extern EngineInfo _engine_info[TOTAL_NUM_ENGINES];
|
||||
extern RailVehicleInfo _rail_vehicle_info[];
|
||||
#define ship_vehicle_info(e) _ship_vehicle_info[e - SHIP_ENGINES_INDEX]
|
||||
extern ShipVehicleInfo _ship_vehicle_info[];
|
||||
static inline bool IsEngineIndex(uint index)
|
||||
{
|
||||
return index < TOTAL_NUM_ENGINES;
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Access Vehicle Data */
|
||||
//#include "table/engines.h"
|
||||
extern const EngineInfo orig_engine_info[TOTAL_NUM_ENGINES];
|
||||
extern const RailVehicleInfo orig_rail_vehicle_info[NUM_TRAIN_ENGINES];
|
||||
extern const ShipVehicleInfo orig_ship_vehicle_info[NUM_SHIP_ENGINES];
|
||||
extern const AircraftVehicleInfo orig_aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES];
|
||||
extern const RoadVehicleInfo orig_road_vehicle_info[NUM_ROAD_ENGINES];
|
||||
|
||||
extern EngineInfo _engine_info[TOTAL_NUM_ENGINES];
|
||||
extern RailVehicleInfo _rail_vehicle_info[NUM_TRAIN_ENGINES];
|
||||
extern ShipVehicleInfo _ship_vehicle_info[NUM_SHIP_ENGINES];
|
||||
extern AircraftVehicleInfo _aircraft_vehicle_info[NUM_AIRCRAFT_ENGINES];
|
||||
extern RoadVehicleInfo _road_vehicle_info[NUM_ROAD_ENGINES];
|
||||
|
||||
static inline const RailVehicleInfo* RailVehInfo(EngineID e)
|
||||
{
|
||||
assert(e < lengthof(_rail_vehicle_info));
|
||||
return &_rail_vehicle_info[e];
|
||||
}
|
||||
|
||||
static inline const ShipVehicleInfo* ShipVehInfo(EngineID e)
|
||||
{
|
||||
assert(e >= SHIP_ENGINES_INDEX && e < SHIP_ENGINES_INDEX + lengthof(_ship_vehicle_info));
|
||||
return &_ship_vehicle_info[e - SHIP_ENGINES_INDEX];
|
||||
}
|
||||
|
||||
static inline const AircraftVehicleInfo* AircraftVehInfo(EngineID e)
|
||||
{
|
||||
assert(e >= AIRCRAFT_ENGINES_INDEX && e < AIRCRAFT_ENGINES_INDEX + lengthof(_aircraft_vehicle_info));
|
||||
return &_aircraft_vehicle_info[e - AIRCRAFT_ENGINES_INDEX];
|
||||
}
|
||||
|
||||
static inline const RoadVehicleInfo* RoadVehInfo(EngineID e)
|
||||
{
|
||||
assert(e >= ROAD_ENGINES_INDEX && e < ROAD_ENGINES_INDEX + lengthof(_road_vehicle_info));
|
||||
return &_road_vehicle_info[e - ROAD_ENGINES_INDEX];
|
||||
}
|
||||
|
||||
void UnloadWagonOverrides(void);
|
||||
void UnloadCustomEngineSprites(void);
|
||||
void UnloadCustomEngineNames(void);
|
||||
|
||||
/************************************************************************
|
||||
* Engine Replacement stuff
|
||||
************************************************************************/
|
||||
|
||||
/**
|
||||
* Struct to store engine replacements. DO NOT USE outside of engine.c. Is
|
||||
* placed here so the only exception to this rule, the saveload code, can use
|
||||
* it.
|
||||
*/
|
||||
struct EngineRenew {
|
||||
uint16 index;
|
||||
EngineID from;
|
||||
EngineID to;
|
||||
struct EngineRenew *next;
|
||||
};
|
||||
|
||||
typedef struct EngineRenew EngineRenew;
|
||||
|
||||
/**
|
||||
* Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is
|
||||
* placed here so the only exception to this rule, the saveload code, can use
|
||||
* it.
|
||||
*/
|
||||
extern MemoryPool _engine_renew_pool;
|
||||
|
||||
/**
|
||||
* DO NOT USE outside of engine.c. Is
|
||||
* placed here so the only exception to this rule, the saveload code, can use
|
||||
* it.
|
||||
*/
|
||||
static inline EngineRenew *GetEngineRenew(uint16 index)
|
||||
{
|
||||
return (EngineRenew*)GetItemFromPool(&_engine_renew_pool, index);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A list to group EngineRenew directives together (such as per-player).
|
||||
*/
|
||||
typedef EngineRenew* EngineRenewList;
|
||||
|
||||
/**
|
||||
* Remove all engine replacement settings for the player.
|
||||
* @param er The renewlist for a given player.
|
||||
* @return The new renewlist for the player.
|
||||
*/
|
||||
void RemoveAllEngineReplacement(EngineRenewList* erl);
|
||||
|
||||
/**
|
||||
* Retrieve the engine replacement in a given renewlist for an original engine type.
|
||||
* @param erl The renewlist to search in.
|
||||
* @param engine Engine type to be replaced.
|
||||
* @return The engine type to replace with, or INVALID_ENGINE if no
|
||||
* replacement is in the list.
|
||||
*/
|
||||
EngineID EngineReplacement(EngineRenewList erl, EngineID engine);
|
||||
|
||||
/**
|
||||
* Add an engine replacement to the given renewlist.
|
||||
* @param erl The renewlist to add to.
|
||||
* @param old_engine The original engine type.
|
||||
* @param new_engine The replacement engine type.
|
||||
* @param flags The calling command flags.
|
||||
* @return 0 on success, CMD_ERROR on failure.
|
||||
*/
|
||||
int32 AddEngineReplacement(EngineRenewList* erl, EngineID old_engine, EngineID new_engine, uint32 flags);
|
||||
|
||||
/**
|
||||
* Remove an engine replacement from a given renewlist.
|
||||
* @param erl The renewlist from which to remove the replacement
|
||||
* @param engine The original engine type.
|
||||
* @param flags The calling command flags.
|
||||
* @return 0 on success, CMD_ERROR on failure.
|
||||
*/
|
||||
int32 RemoveEngineReplacement(EngineRenewList* erl, EngineID engine, uint32 flags);
|
||||
|
||||
#endif /* ENGINE_H */
|
||||
|
||||
+135
-70
@@ -1,6 +1,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
#include "functions.h"
|
||||
#include "window.h"
|
||||
#include "gui.h"
|
||||
#include "viewport.h"
|
||||
@@ -8,21 +12,18 @@
|
||||
#include "engine.h"
|
||||
#include "command.h"
|
||||
#include "news.h"
|
||||
|
||||
void DrawShipEngine(int x, int y, int engine, uint32 image_ormod);
|
||||
void DrawShipEngineInfo(int engine, int x, int y, int maxw);
|
||||
#include "variables.h"
|
||||
|
||||
|
||||
StringID GetEngineCategoryName(byte engine)
|
||||
static StringID GetEngineCategoryName(EngineID engine)
|
||||
{
|
||||
if (engine < NUM_NORMAL_RAIL_ENGINES)
|
||||
return STR_8102_RAILROAD_LOCOMOTIVE;
|
||||
|
||||
if (engine < NUM_NORMAL_RAIL_ENGINES + NUM_MONORAIL_ENGINES)
|
||||
return STR_8106_MONORAIL_LOCOMOTIVE;
|
||||
|
||||
if (engine < NUM_TRAIN_ENGINES)
|
||||
return STR_8107_MAGLEV_LOCOMOTIVE;
|
||||
if (engine < NUM_TRAIN_ENGINES) {
|
||||
switch (GetEngine(engine)->railtype) {
|
||||
case RAILTYPE_RAIL: return STR_8102_RAILROAD_LOCOMOTIVE;
|
||||
case RAILTYPE_MONO: return STR_8106_MONORAIL_LOCOMOTIVE;
|
||||
case RAILTYPE_MAGLEV: return STR_8107_MAGLEV_LOCOMOTIVE;
|
||||
}
|
||||
}
|
||||
|
||||
if (engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES)
|
||||
return STR_8103_ROAD_VEHICLE;
|
||||
@@ -34,22 +35,27 @@ StringID GetEngineCategoryName(byte engine)
|
||||
}
|
||||
|
||||
static const Widget _engine_preview_widgets[] = {
|
||||
{ WWT_TEXTBTN, 5, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 5, 11, 299, 0, 13, STR_8100_MESSAGE_FROM_VEHICLE_MANUFACTURE, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_IMGBTN, 5, 0, 299, 14, 191, 0x0, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, 5, 85, 144, 172, 183, STR_00C9_NO, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, 5, 155, 214, 172, 183, STR_00C8_YES, STR_NULL},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 5, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 5, 11, 299, 0, 13, STR_8100_MESSAGE_FROM_VEHICLE_MANUFACTURE, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_IMGBTN, RESIZE_NONE, 5, 0, 299, 14, 191, 0x0, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 5, 85, 144, 172, 183, STR_00C9_NO, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 5, 155, 214, 172, 183, STR_00C8_YES, STR_NULL},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
typedef void DrawEngineProc(int x, int y, int engine, uint32 image_ormod);
|
||||
typedef void DrawEngineInfoProc(int x, int y, int engine, int maxw);
|
||||
typedef void DrawEngineProc(int x, int y, EngineID engine, uint32 image_ormod);
|
||||
typedef void DrawEngineInfoProc(EngineID, int x, int y, int maxw);
|
||||
|
||||
typedef struct DrawEngineInfo {
|
||||
DrawEngineProc *engine_proc;
|
||||
DrawEngineInfoProc *info_proc;
|
||||
} DrawEngineInfo;
|
||||
|
||||
static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw);
|
||||
static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw);
|
||||
static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw);
|
||||
static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw);
|
||||
|
||||
static const DrawEngineInfo _draw_engine_list[4] = {
|
||||
{DrawTrainEngine,DrawTrainEngineInfo},
|
||||
{DrawRoadVehEngine,DrawRoadVehEngineInfo},
|
||||
@@ -59,39 +65,40 @@ static const DrawEngineInfo _draw_engine_list[4] = {
|
||||
|
||||
static void EnginePreviewWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
byte eng;
|
||||
int engine;
|
||||
const DrawEngineInfo *dei;
|
||||
int width;
|
||||
switch (e->event) {
|
||||
case WE_PAINT: {
|
||||
EngineID engine = w->window_number;
|
||||
const DrawEngineInfo* dei;
|
||||
int width;
|
||||
|
||||
switch(e->event) {
|
||||
case WE_PAINT:
|
||||
DrawWindowWidgets(w);
|
||||
engine = w->window_number;
|
||||
|
||||
SET_DPARAM16(0, GetEngineCategoryName(engine));
|
||||
SetDParam(0, GetEngineCategoryName(engine));
|
||||
DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296);
|
||||
|
||||
DrawStringCentered(w->width >> 1, 80, GetCustomEngineName(engine), 0x10);
|
||||
|
||||
eng = (byte)engine;
|
||||
(dei = _draw_engine_list,eng < NUM_TRAIN_ENGINES) ||
|
||||
(dei++,eng < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES) ||
|
||||
(dei++,eng < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) ||
|
||||
(dei = _draw_engine_list,engine < NUM_TRAIN_ENGINES) ||
|
||||
(dei++,engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES) ||
|
||||
(dei++,engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) ||
|
||||
(dei++, true);
|
||||
|
||||
width = w->width;
|
||||
dei->engine_proc(width >> 1, 100, engine, 0);
|
||||
dei->info_proc(engine, width >> 1, 130, width - 52);
|
||||
break;
|
||||
}
|
||||
|
||||
case WE_CLICK:
|
||||
switch(e->click.widget) {
|
||||
case 3: DeleteWindow(w); break;
|
||||
case 4:
|
||||
DoCommandP(0, w->window_number, 0, NULL, CMD_WANT_ENGINE_PREVIEW);
|
||||
DeleteWindow(w);
|
||||
break;
|
||||
switch (e->click.widget) {
|
||||
case 3:
|
||||
DeleteWindow(w);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
DoCommandP(0, w->window_number, 0, NULL, CMD_WANT_ENGINE_PREVIEW);
|
||||
DeleteWindow(w);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -106,7 +113,7 @@ static const WindowDesc _engine_preview_desc = {
|
||||
};
|
||||
|
||||
|
||||
void ShowEnginePreviewWindow(int engine)
|
||||
void ShowEnginePreviewWindow(EngineID engine)
|
||||
{
|
||||
Window *w;
|
||||
|
||||
@@ -114,38 +121,71 @@ void ShowEnginePreviewWindow(int engine)
|
||||
w->window_number = engine;
|
||||
}
|
||||
|
||||
static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
{
|
||||
const RailVehicleInfo *rvi = RailVehInfo(engine);
|
||||
uint multihead = (rvi->flags & RVI_MULTIHEAD) ? 1 : 0;
|
||||
|
||||
SetDParam(0, (_price.build_railvehicle >> 3) * rvi->base_cost >> 5);
|
||||
SetDParam(2, rvi->max_speed * 10 >> 4);
|
||||
SetDParam(3, rvi->power << multihead);
|
||||
SetDParam(1, rvi->weight << multihead);
|
||||
|
||||
SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->running_cost_class] >> 8 << multihead);
|
||||
|
||||
if (rvi->capacity != 0) {
|
||||
SetDParam(5, _cargoc.names_long[rvi->cargo_type]);
|
||||
SetDParam(6, rvi->capacity << multihead);
|
||||
} else {
|
||||
SetDParam(5, STR_8838_N_A);
|
||||
}
|
||||
DrawStringMultiCenter(x, y, STR_885B_COST_WEIGHT_T_SPEED_POWER, maxw);
|
||||
}
|
||||
|
||||
void DrawNewsNewTrainAvail(Window *w)
|
||||
{
|
||||
int engine;
|
||||
EngineID engine;
|
||||
|
||||
DrawNewsBorder(w);
|
||||
|
||||
engine = WP(w,news_d).ni->string_id;
|
||||
SET_DPARAM16(0, GetEngineCategoryName(engine));
|
||||
SetDParam(0, GetEngineCategoryName(engine));
|
||||
DrawStringMultiCenter(w->width >> 1, 20, STR_8859_NEW_NOW_AVAILABLE, w->width - 2);
|
||||
|
||||
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
|
||||
|
||||
SET_DPARAM16(0, GetCustomEngineName(engine));
|
||||
SetDParam(0, GetCustomEngineName(engine));
|
||||
DrawStringMultiCenter(w->width >> 1, 57, STR_885A, w->width - 2);
|
||||
|
||||
DrawTrainEngine(w->width >> 1, 88, engine, 0);
|
||||
GfxFillRect(25, 56, w->width - 56, 112, 0x4323);
|
||||
GfxFillRect(25, 56, w->width - 56, 112, 0x323 | USE_COLORTABLE);
|
||||
DrawTrainEngineInfo(engine, w->width >> 1, 129, w->width - 52);
|
||||
}
|
||||
|
||||
StringID GetNewsStringNewTrainAvail(NewsItem *ni)
|
||||
StringID GetNewsStringNewTrainAvail(const NewsItem *ni)
|
||||
{
|
||||
int engine = ni->string_id;
|
||||
SET_DPARAM16(0, STR_8859_NEW_NOW_AVAILABLE);
|
||||
SET_DPARAM16(1, GetEngineCategoryName(engine));
|
||||
SET_DPARAM16(2, GetCustomEngineName(engine));
|
||||
EngineID engine = ni->string_id;
|
||||
SetDParam(0, STR_8859_NEW_NOW_AVAILABLE);
|
||||
SetDParam(1, GetEngineCategoryName(engine));
|
||||
SetDParam(2, GetCustomEngineName(engine));
|
||||
return STR_02B6;
|
||||
}
|
||||
|
||||
static void DrawAircraftEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
{
|
||||
const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
|
||||
SetDParam(0, (_price.aircraft_base >> 3) * avi->base_cost >> 5);
|
||||
SetDParam(1, avi->max_speed << 3);
|
||||
SetDParam(2, avi->passenger_capacity);
|
||||
SetDParam(3, avi->mail_capacity);
|
||||
SetDParam(4, avi->running_cost * _price.aircraft_running >> 8);
|
||||
|
||||
DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw);
|
||||
}
|
||||
|
||||
void DrawNewsNewAircraftAvail(Window *w)
|
||||
{
|
||||
int engine;
|
||||
EngineID engine;
|
||||
|
||||
DrawNewsBorder(w);
|
||||
|
||||
@@ -154,25 +194,39 @@ void DrawNewsNewAircraftAvail(Window *w)
|
||||
DrawStringMultiCenter(w->width >> 1, 20, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE, w->width - 2);
|
||||
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
|
||||
|
||||
SET_DPARAM16(0, GetCustomEngineName(engine));
|
||||
SetDParam(0, GetCustomEngineName(engine));
|
||||
DrawStringMultiCenter(w->width >> 1, 57, STR_A02D, w->width - 2);
|
||||
|
||||
DrawAircraftEngine(w->width >> 1, 93, engine, 0);
|
||||
GfxFillRect(25, 56, w->width - 56, 110, 0x4323);
|
||||
GfxFillRect(25, 56, w->width - 56, 110, 0x323 | USE_COLORTABLE);
|
||||
DrawAircraftEngineInfo(engine, w->width >> 1, 131, w->width - 52);
|
||||
}
|
||||
|
||||
StringID GetNewsStringNewAircraftAvail(NewsItem *ni)
|
||||
StringID GetNewsStringNewAircraftAvail(const NewsItem *ni)
|
||||
{
|
||||
int engine = ni->string_id;
|
||||
SET_DPARAM16(0, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE);
|
||||
SET_DPARAM16(1, GetCustomEngineName(engine));
|
||||
EngineID engine = ni->string_id;
|
||||
SetDParam(0, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE);
|
||||
SetDParam(1, GetCustomEngineName(engine));
|
||||
return STR_02B6;
|
||||
}
|
||||
|
||||
static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
{
|
||||
const RoadVehicleInfo *rvi = RoadVehInfo(engine);
|
||||
|
||||
SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5);
|
||||
SetDParam(1, rvi->max_speed * 10 >> 5);
|
||||
SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8);
|
||||
|
||||
SetDParam(4, rvi->capacity);
|
||||
SetDParam(3, _cargoc.names_long[rvi->cargo_type]);
|
||||
|
||||
DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw);
|
||||
}
|
||||
|
||||
void DrawNewsNewRoadVehAvail(Window *w)
|
||||
{
|
||||
int engine;
|
||||
EngineID engine;
|
||||
|
||||
DrawNewsBorder(w);
|
||||
|
||||
@@ -180,25 +234,36 @@ void DrawNewsNewRoadVehAvail(Window *w)
|
||||
DrawStringMultiCenter(w->width >> 1, 20, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE, w->width - 2);
|
||||
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
|
||||
|
||||
SET_DPARAM16(0, GetCustomEngineName(engine));
|
||||
SetDParam(0, GetCustomEngineName(engine));
|
||||
DrawStringMultiCenter(w->width >> 1, 57, STR_9029, w->width - 2);
|
||||
|
||||
DrawRoadVehEngine(w->width >> 1, 88, engine, 0);
|
||||
GfxFillRect(25, 56, w->width - 56, 112, 0x4323);
|
||||
GfxFillRect(25, 56, w->width - 56, 112, 0x323 | USE_COLORTABLE);
|
||||
DrawRoadVehEngineInfo(engine, w->width >> 1, 129, w->width - 52);
|
||||
}
|
||||
|
||||
StringID GetNewsStringNewRoadVehAvail(NewsItem *ni)
|
||||
StringID GetNewsStringNewRoadVehAvail(const NewsItem *ni)
|
||||
{
|
||||
int engine = ni->string_id;
|
||||
SET_DPARAM16(0, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE);
|
||||
SET_DPARAM16(1, GetCustomEngineName(engine));
|
||||
EngineID engine = ni->string_id;
|
||||
SetDParam(0, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE);
|
||||
SetDParam(1, GetCustomEngineName(engine));
|
||||
return STR_02B6;
|
||||
}
|
||||
|
||||
static void DrawShipEngineInfo(EngineID engine, int x, int y, int maxw)
|
||||
{
|
||||
const ShipVehicleInfo *svi = ShipVehInfo(engine);
|
||||
SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5);
|
||||
SetDParam(1, svi->max_speed * 10 >> 5);
|
||||
SetDParam(2, _cargoc.names_long[svi->cargo_type]);
|
||||
SetDParam(3, svi->capacity);
|
||||
SetDParam(4, svi->running_cost * _price.ship_running >> 8);
|
||||
DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw);
|
||||
}
|
||||
|
||||
void DrawNewsNewShipAvail(Window *w)
|
||||
{
|
||||
int engine;
|
||||
EngineID engine;
|
||||
|
||||
DrawNewsBorder(w);
|
||||
|
||||
@@ -207,18 +272,18 @@ void DrawNewsNewShipAvail(Window *w)
|
||||
DrawStringMultiCenter(w->width >> 1, 20, STR_982C_NEW_SHIP_NOW_AVAILABLE, w->width - 2);
|
||||
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
|
||||
|
||||
SET_DPARAM16(0, GetCustomEngineName(engine));
|
||||
SetDParam(0, GetCustomEngineName(engine));
|
||||
DrawStringMultiCenter(w->width >> 1, 57, STR_982D, w->width - 2);
|
||||
|
||||
DrawShipEngine(w->width >> 1, 93, engine, 0);
|
||||
GfxFillRect(25, 56, w->width - 56, 110, 0x4323);
|
||||
GfxFillRect(25, 56, w->width - 56, 110, 0x323 | USE_COLORTABLE);
|
||||
DrawShipEngineInfo(engine, w->width >> 1, 131, w->width - 52);
|
||||
}
|
||||
|
||||
StringID GetNewsStringNewShipAvail(NewsItem *ni)
|
||||
StringID GetNewsStringNewShipAvail(const NewsItem *ni)
|
||||
{
|
||||
int engine = ni->string_id;
|
||||
SET_DPARAM16(0, STR_982C_NEW_SHIP_NOW_AVAILABLE);
|
||||
SET_DPARAM16(1, GetCustomEngineName(engine));
|
||||
EngineID engine = ni->string_id;
|
||||
SetDParam(0, STR_982C_NEW_SHIP_NOW_AVAILABLE);
|
||||
SetDParam(1, GetCustomEngineName(engine));
|
||||
return STR_02B6;
|
||||
}
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
#ifndef __BEOS__
|
||||
#ifndef __MORPHOS__
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "ttd.h"
|
||||
#include "hal.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <sys/stat.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef EXTERNAL_PLAYER
|
||||
#define EXTERNAL_PLAYER "/usr/bin/timidity"
|
||||
#endif
|
||||
|
||||
static pid_t _pid;
|
||||
|
||||
static void extmidi_kill(void) {
|
||||
if(_pid > 0) {
|
||||
kill(_pid, SIGKILL);
|
||||
while(waitpid(_pid, NULL, WNOHANG) != _pid);
|
||||
}
|
||||
_pid = 0;
|
||||
}
|
||||
|
||||
static char *extmidi_start(char **parm) {
|
||||
_pid = 0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void extmidi_stop(void) {
|
||||
extmidi_kill();
|
||||
}
|
||||
|
||||
static void extmidi_play_song(const char *filename) {
|
||||
extmidi_kill();
|
||||
|
||||
_pid = fork();
|
||||
if(_pid < 0) {
|
||||
fprintf(stderr, "extmidi: couldn't fork: %s\n", strerror(errno));
|
||||
_pid = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if(_pid == 0) {
|
||||
#if defined(MIDI_ARG)
|
||||
execl(EXTERNAL_PLAYER, "extmidi", MIDI_ARG, filename, NULL);
|
||||
#else
|
||||
execl(EXTERNAL_PLAYER, "extmidi", filename, NULL);
|
||||
#endif
|
||||
|
||||
fprintf(stderr, "extmidi: couldn't execl: %s\n", strerror(errno));
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
usleep(500);
|
||||
|
||||
|
||||
if(_pid == waitpid(_pid, NULL, WNOHANG)) {
|
||||
fprintf(stderr, "extmidi: play song failed\n");
|
||||
_pid = 0;
|
||||
|
||||
usleep(5000);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void extmidi_stop_song(void) {
|
||||
extmidi_kill();
|
||||
}
|
||||
|
||||
static bool extmidi_is_playing(void) {
|
||||
if(_pid == 0)
|
||||
return 0;
|
||||
|
||||
if(waitpid(_pid, NULL, WNOHANG) == _pid) {
|
||||
_pid = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void extmidi_set_volume(byte vol) {
|
||||
fprintf(stderr, "extmidi: set volume not implemented\n");
|
||||
}
|
||||
|
||||
const HalMusicDriver _extmidi_music_driver = {
|
||||
extmidi_start,
|
||||
extmidi_stop,
|
||||
extmidi_play_song,
|
||||
extmidi_stop_song,
|
||||
extmidi_is_playing,
|
||||
extmidi_set_volume,
|
||||
};
|
||||
#endif /* __MORPHOS__ */
|
||||
#endif /* __BEOS__ */
|
||||
@@ -1,6 +1,12 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#if defined(UNIX)
|
||||
#include "openttd.h"
|
||||
#include "fileio.h"
|
||||
#include "functions.h"
|
||||
#include "macros.h"
|
||||
#include "variables.h"
|
||||
#if defined(UNIX) || defined(__OS2__)
|
||||
#include <ctype.h> // required for tolower()
|
||||
#endif
|
||||
|
||||
@@ -21,7 +27,7 @@ typedef struct {
|
||||
static Fio _fio;
|
||||
|
||||
// Get current position in file
|
||||
uint32 FioGetPos()
|
||||
uint32 FioGetPos(void)
|
||||
{
|
||||
return _fio.pos + (_fio.buffer - _fio.buffer_start) - FIO_BUFFER_SIZE;
|
||||
}
|
||||
@@ -42,7 +48,7 @@ void FioSeekToFile(uint32 pos)
|
||||
FioSeekTo(pos & 0xFFFFFF, SEEK_SET);
|
||||
}
|
||||
|
||||
byte FioReadByte()
|
||||
byte FioReadByte(void)
|
||||
{
|
||||
if (_fio.buffer == _fio.buffer_end) {
|
||||
_fio.pos += FIO_BUFFER_SIZE;
|
||||
@@ -64,13 +70,13 @@ void FioSkipBytes(int n)
|
||||
}
|
||||
|
||||
|
||||
uint16 FioReadWord()
|
||||
uint16 FioReadWord(void)
|
||||
{
|
||||
byte b = FioReadByte();
|
||||
return (FioReadByte() << 8) | b;
|
||||
}
|
||||
|
||||
uint32 FioReadDword()
|
||||
uint32 FioReadDword(void)
|
||||
{
|
||||
uint b = FioReadWord();
|
||||
return (FioReadWord() << 16) | b;
|
||||
@@ -83,16 +89,87 @@ void FioReadBlock(void *ptr, uint size)
|
||||
fread(ptr, 1, size, _fio.cur_fh);
|
||||
}
|
||||
|
||||
void FioCloseAll()
|
||||
static inline void FioCloseFile(int slot)
|
||||
{
|
||||
if (_fio.handles[slot] != NULL) {
|
||||
fclose(_fio.handles[slot]);
|
||||
_fio.handles[slot] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void FioCloseAll(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i!=lengthof(_fio.handles); i++) {
|
||||
if (_fio.handles[i] != NULL) {
|
||||
fclose(_fio.handles[i]);
|
||||
_fio.handles[i] = NULL;
|
||||
for (i = 0; i != lengthof(_fio.handles); i++)
|
||||
FioCloseFile(i);
|
||||
}
|
||||
|
||||
bool FiosCheckFileExists(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
char buf[MAX_PATH];
|
||||
|
||||
sprintf(buf, "%s%s", _path.data_dir, filename);
|
||||
|
||||
f = fopen(buf, "rb");
|
||||
#if !defined(WIN32)
|
||||
if (f == NULL) {
|
||||
char *s;
|
||||
// Make lower case and try again
|
||||
for(s=buf + strlen(_path.data_dir) - 1; *s != 0; s++)
|
||||
*s = tolower(*s);
|
||||
f = fopen(buf, "rb");
|
||||
|
||||
#if defined SECOND_DATA_DIR
|
||||
// tries in the 2nd data directory
|
||||
if (f == NULL) {
|
||||
sprintf(buf, "%s%s", _path.second_data_dir, filename);
|
||||
for(s=buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
|
||||
*s = tolower(*s);
|
||||
f = fopen(buf, "rb");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (f == NULL)
|
||||
return false;
|
||||
else {
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
FILE *FioFOpenFile(const char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
char buf[MAX_PATH];
|
||||
|
||||
sprintf(buf, "%s%s", _path.data_dir, filename);
|
||||
|
||||
f = fopen(buf, "rb");
|
||||
#if !defined(WIN32)
|
||||
if (f == NULL) {
|
||||
char *s;
|
||||
// Make lower case and try again
|
||||
for(s=buf + strlen(_path.data_dir) - 1; *s != 0; s++)
|
||||
*s = tolower(*s);
|
||||
f = fopen(buf, "rb");
|
||||
|
||||
#if defined SECOND_DATA_DIR
|
||||
// tries in the 2nd data directory
|
||||
if (f == NULL) {
|
||||
sprintf(buf, "%s%s", _path.second_data_dir, filename);
|
||||
for(s=buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
|
||||
*s = tolower(*s);
|
||||
f = fopen(buf, "rb");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
void FioOpenFile(int slot, const char *filename)
|
||||
@@ -110,14 +187,27 @@ void FioOpenFile(int slot, const char *filename)
|
||||
for(s=buf + strlen(_path.data_dir) - 1; *s != 0; s++)
|
||||
*s = tolower(*s);
|
||||
f = fopen(buf, "rb");
|
||||
|
||||
#if defined SECOND_DATA_DIR
|
||||
// tries in the 2nd data directory
|
||||
if (f == NULL) {
|
||||
sprintf(buf, "%s%s", _path.second_data_dir, filename);
|
||||
for(s=buf + strlen(_path.second_data_dir) - 1; *s != 0; s++)
|
||||
*s = tolower(*s);
|
||||
f = fopen(buf, "rb");
|
||||
}
|
||||
|
||||
if (f == NULL)
|
||||
sprintf(buf, "%s%s", _path.data_dir, filename); //makes it print the primary datadir path instead of the secundary one
|
||||
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (f == NULL)
|
||||
error("Cannot open file '%s'", buf);
|
||||
|
||||
FioCloseFile(slot); // if file was opened before, close it
|
||||
_fio.handles[slot] = f;
|
||||
FioSeekToFile(slot << 24);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef FILEIO_H
|
||||
#define FILEIO_H
|
||||
|
||||
void FioSeekTo(uint32 pos, int mode);
|
||||
void FioSeekToFile(uint32 pos);
|
||||
uint32 FioGetPos();
|
||||
byte FioReadByte();
|
||||
uint16 FioReadWord();
|
||||
uint32 FioReadDword();
|
||||
void FioCloseAll();
|
||||
uint32 FioGetPos(void);
|
||||
byte FioReadByte(void);
|
||||
uint16 FioReadWord(void);
|
||||
uint32 FioReadDword(void);
|
||||
void FioCloseAll(void);
|
||||
FILE *FioFOpenFile(const char *filename);
|
||||
void FioOpenFile(int slot, const char *filename);
|
||||
void FioReadBlock(void *ptr, uint size);
|
||||
void FioSkipBytes(int n);
|
||||
bool FiosCheckFileExists(const char *filename);
|
||||
|
||||
#endif /* FILEIO_H */
|
||||
|
||||
+153
-172
@@ -1,249 +1,238 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef FUNCTIONS_H
|
||||
#define FUNCTIONS_H
|
||||
|
||||
#include "network.h"
|
||||
|
||||
/* vehicle.c */
|
||||
|
||||
/* window.c */
|
||||
|
||||
|
||||
/* landscape.c */
|
||||
void FindLandscapeHeight(TileInfo *ti, uint x, uint y);
|
||||
void FindLandscapeHeightByTile(TileInfo *ti, uint tile);
|
||||
uint GetTileSlope(uint tile, int *h);
|
||||
int GetTileZ(uint tile);
|
||||
void FindLandscapeHeightByTile(TileInfo *ti, TileIndex tile);
|
||||
|
||||
void DoClearSquare(uint tile);
|
||||
void CDECL ModifyTile(uint tile, uint flags, ...);
|
||||
void SetMapExtraBits(uint tile, byte flags);
|
||||
uint GetMapExtraBits(uint tile);
|
||||
void RunTileLoop();
|
||||
void DoClearSquare(TileIndex tile);
|
||||
void CDECL ModifyTile(TileIndex tile, uint flags, ...);
|
||||
void RunTileLoop(void);
|
||||
|
||||
uint GetPartialZ(int x, int y, int corners);
|
||||
uint GetSlopeZ(int x, int y);
|
||||
uint32 GetTileTrackStatus(uint tile, TransportType mode);
|
||||
void GetAcceptedCargo(uint tile, AcceptedCargo *ac);
|
||||
void ChangeTileOwner(uint tile, byte old_player, byte new_player);
|
||||
void AnimateTile(uint tile);
|
||||
void ClickTile(uint tile);
|
||||
void GetTileDesc(uint tile, TileDesc *td);
|
||||
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode);
|
||||
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
|
||||
void ChangeTileOwner(TileIndex tile, byte old_player, byte new_player);
|
||||
void AnimateTile(TileIndex tile);
|
||||
void ClickTile(TileIndex tile);
|
||||
void GetTileDesc(TileIndex tile, TileDesc *td);
|
||||
void DrawTile(TileInfo *ti);
|
||||
void UpdateTownMaxPass(Town *t);
|
||||
|
||||
uint TileAddWrap(TileIndex tile, int addx, int addy);
|
||||
enum {
|
||||
TILE_WRAPPED = (uint)-1
|
||||
};
|
||||
|
||||
bool IsValidTile(uint tile);
|
||||
bool IsValidTile(TileIndex tile);
|
||||
|
||||
static inline Point RemapCoords(int x, int y, int z)
|
||||
{
|
||||
#if !defined(NEW_ROTATION)
|
||||
static Point FORCEINLINE RemapCoords(int x, int y, int z) { Point pt = { (y-x)*2, y + x -z }; return pt; }
|
||||
Point pt;
|
||||
pt.x = (y - x) * 2;
|
||||
pt.y = y + x - z;
|
||||
#else
|
||||
static Point FORCEINLINE RemapCoords(int x, int y, int z) { Point pt = { (x + y)*2, x - y -z }; return pt; }
|
||||
Point pt;
|
||||
pt.x = (x + y) * 2;
|
||||
pt.y = x - y - z;
|
||||
#endif
|
||||
return pt;
|
||||
}
|
||||
|
||||
static Point FORCEINLINE RemapCoords2(int x, int y) { return RemapCoords(x, y, GetSlopeZ(x, y)); }
|
||||
static inline Point RemapCoords2(int x, int y)
|
||||
{
|
||||
return RemapCoords(x, y, GetSlopeZ(x, y));
|
||||
}
|
||||
|
||||
/* game.c */
|
||||
byte *GetString(byte *buffr, uint16 string);
|
||||
void InjectDparam(int amount);
|
||||
|
||||
int32 GetParamInt32();
|
||||
int GetParamInt16();
|
||||
int GetParamInt8();
|
||||
int GetParamUint16();
|
||||
|
||||
|
||||
/* sound.c */
|
||||
void SndPlayTileFx(int sound, TileIndex tile);
|
||||
void SndPlayVehicleFx(int sound, Vehicle *v);
|
||||
void SndPlayFx(int sound);
|
||||
|
||||
/* clear_land.c */
|
||||
void DrawHillyLandTile(TileInfo *ti);
|
||||
void DrawClearLandTile(TileInfo *ti, byte set);
|
||||
void DrawClearLandFence(TileInfo *ti, byte img);
|
||||
void TileLoopClearHelper(uint tile);
|
||||
|
||||
/* station_land.c */
|
||||
void StationPickerDrawSprite(int x, int y, int railtype, int image);
|
||||
|
||||
/* track_land.c */
|
||||
void DrawTrainDepotSprite(int x, int y, int image, int railtype);
|
||||
void DrawHillyLandTile(const TileInfo *ti);
|
||||
void DrawClearLandTile(const TileInfo *ti, byte set);
|
||||
void DrawClearLandFence(const TileInfo *ti);
|
||||
void TileLoopClearHelper(TileIndex tile);
|
||||
|
||||
/* road_land.c */
|
||||
void DrawRoadDepotSprite(int x, int y, int image);
|
||||
|
||||
/* water_land.c */
|
||||
void DrawShipDepotSprite(int x, int y, int image);
|
||||
void TileLoop_Water(uint tile);
|
||||
void TileLoop_Water(TileIndex tile);
|
||||
|
||||
/* players.c */
|
||||
bool CheckPlayerHasMoney(int32 cost);
|
||||
void SubtractMoneyFromPlayer(int32 cost);
|
||||
void SubtractMoneyFromPlayerFract(byte player, int32 cost);
|
||||
bool CheckOwnership(byte owner);
|
||||
bool CheckTileOwnership(uint tile);
|
||||
StringID GetPlayerNameString(byte player, byte index);
|
||||
void SubtractMoneyFromPlayerFract(PlayerID player, int32 cost);
|
||||
bool CheckOwnership(PlayerID owner);
|
||||
bool CheckTileOwnership(TileIndex tile);
|
||||
StringID GetPlayerNameString(PlayerID player, uint index);
|
||||
|
||||
/* standard */
|
||||
void ShowInfo(const char *str);
|
||||
void CDECL ShowInfoF(const char *str, ...);
|
||||
void NORETURN CDECL error(const char *str, ...);
|
||||
void memswap(void *a, void *b, size_t size);
|
||||
|
||||
/* ttd.c */
|
||||
uint32 Random();
|
||||
uint RandomRange(uint max);
|
||||
/* openttd.c */
|
||||
|
||||
void InitPlayerRandoms();
|
||||
// **************
|
||||
// * Warning: DO NOT enable this unless you understand what it does
|
||||
// *
|
||||
// * If enabled, in a network game all randoms will be dumped to the
|
||||
// * stdout if the first client joins (or if you are a client). This
|
||||
// * is to help finding desync problems.
|
||||
// *
|
||||
// * Warning: DO NOT enable this unless you understand what it does
|
||||
// **************
|
||||
|
||||
uint32 InteractiveRandom(); /* Used for random sequences that are not the same on the other end of the multiplayer link */
|
||||
//#define RANDOM_DEBUG
|
||||
|
||||
|
||||
// Enable this to produce higher quality random numbers.
|
||||
// Doesn't work with network yet.
|
||||
//#define MERSENNE_TWISTER
|
||||
|
||||
// Mersenne twister functions
|
||||
void SeedMT(uint32 seed);
|
||||
uint32 RandomMT(void);
|
||||
|
||||
|
||||
#ifdef MERSENNE_TWISTER
|
||||
static inline uint32 Random(void) { return RandomMT(); }
|
||||
uint RandomRange(uint max);
|
||||
#else
|
||||
|
||||
#ifdef RANDOM_DEBUG
|
||||
#define Random() DoRandom(__LINE__, __FILE__)
|
||||
uint32 DoRandom(int line, const char *file);
|
||||
#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
|
||||
uint DoRandomRange(uint max, int line, const char *file);
|
||||
#else
|
||||
uint32 Random(void);
|
||||
uint RandomRange(uint max);
|
||||
#endif
|
||||
#endif // MERSENNE_TWISTER
|
||||
|
||||
static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
|
||||
static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); }
|
||||
|
||||
|
||||
uint32 InteractiveRandom(void); /* Used for random sequences that are not the same on the other end of the multiplayer link */
|
||||
uint InteractiveRandomRange(uint max);
|
||||
|
||||
|
||||
// Used for profiling
|
||||
#define TIC() { extern uint32 _rdtsc(void); uint32 _xxx_ = _rdtsc(); static float __avg__;
|
||||
#define TOC(s) _xxx_ = _rdtsc() - _xxx_; __avg__=__avg__*0.99+_xxx_*0.01; printf("%s: %8d %f\n", s, _xxx_,__avg__); }
|
||||
|
||||
|
||||
void SetDate(uint date);
|
||||
/* facedraw.c */
|
||||
void DrawPlayerFace(uint32 face, int color, int x, int y);
|
||||
|
||||
/* texteff.c */
|
||||
void MoveAllTextEffects();
|
||||
void MoveAllTextEffects(void);
|
||||
void AddTextEffect(StringID msg, int x, int y, uint16 duration);
|
||||
void InitTextEffects();
|
||||
void InitTextEffects(void);
|
||||
void DrawTextEffects(DrawPixelInfo *dpi);
|
||||
|
||||
bool AddAnimatedTile(uint tile);
|
||||
void DeleteAnimatedTile(uint tile);
|
||||
void AnimateAnimatedTiles();
|
||||
void InitializeAnimatedTiles();
|
||||
void InitTextMessage(void);
|
||||
void DrawTextMessage(void);
|
||||
void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...);
|
||||
void UndrawTextMessage(void);
|
||||
void TextMessageDailyLoop(void);
|
||||
|
||||
bool AddAnimatedTile(TileIndex tile);
|
||||
void DeleteAnimatedTile(TileIndex tile);
|
||||
void AnimateAnimatedTiles(void);
|
||||
void InitializeAnimatedTiles(void);
|
||||
|
||||
/* tunnelbridge_cmd.c */
|
||||
bool CheckTunnelInWay(uint tile, int z);
|
||||
bool CheckBridge_Stuff(byte bridge_type, int bridge_len);
|
||||
bool CheckTunnelInWay(TileIndex tile, int z);
|
||||
bool CheckBridge_Stuff(byte bridge_type, uint bridge_len);
|
||||
uint32 GetBridgeLength(TileIndex begin, TileIndex end);
|
||||
int CalcBridgeLenCostFactor(int x);
|
||||
|
||||
/* network.c */
|
||||
typedef void CommandCallback(bool success, uint tile, uint32 p1, uint32 p2);
|
||||
typedef void CommandCallback(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
||||
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd);
|
||||
|
||||
void NetworkReceive();
|
||||
void NetworkSend();
|
||||
void NetworkProcessCommands();
|
||||
void NetworkListen();
|
||||
void NetworkInitialize();
|
||||
void NetworkShutdown();
|
||||
void NetworkSendCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback);
|
||||
void NetworkSendEvent(uint16 type, uint16 data_len, void * data);
|
||||
void NetworkStartSync(bool fcreset);
|
||||
void NetworkClose(bool client);
|
||||
void NetworkSendReadyPacket();
|
||||
void NetworkSendSyncPackets();
|
||||
void NetworkSendFrameSyncPackets();
|
||||
bool NetworkCheckClientReady();
|
||||
|
||||
void NetworkIPListInit();
|
||||
|
||||
void NetworkCoreInit();
|
||||
void NetworkCoreShutdown();
|
||||
void NetworkCoreDisconnect();
|
||||
void NetworkCoreLoop(bool incomming);
|
||||
bool NetworkCoreConnectGame(const byte* b, unsigned short port);
|
||||
bool NetworkCoreConnectGameStruct(NetworkGameList * item);
|
||||
bool NetworkCoreStartGame();
|
||||
|
||||
void NetworkLobbyShutdown();
|
||||
void NetworkLobbyInit();
|
||||
|
||||
void NetworkGameListClear();
|
||||
NetworkGameList * NetworkGameListAdd();
|
||||
void NetworkGameListFromLAN();
|
||||
void NetworkGameListFromInternet();
|
||||
NetworkGameList * NetworkGameListItem(uint16 index);
|
||||
|
||||
void NetworkGameFillDefaults();
|
||||
void NetworkGameChangeDate(uint16 newdate);
|
||||
/* network.c */
|
||||
void NetworkUDPClose(void);
|
||||
void NetworkStartUp(void);
|
||||
void NetworkShutDown(void);
|
||||
void NetworkGameLoop(void);
|
||||
void NetworkUDPGameLoop(void);
|
||||
bool NetworkServerStart(void);
|
||||
bool NetworkClientConnectGame(const char* host, unsigned short port);
|
||||
void NetworkReboot(void);
|
||||
void NetworkDisconnect(void);
|
||||
void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback);
|
||||
|
||||
/* misc_cmd.c */
|
||||
void PlaceTreesRandomly();
|
||||
|
||||
uint GetTileDist(TileIndex xy1, TileIndex xy2);
|
||||
uint GetTileDist1D(TileIndex xy1, TileIndex xy2);
|
||||
uint GetTileDist1Db(TileIndex xy1, TileIndex xy2);
|
||||
uint GetTileDistAdv(TileIndex xy1, TileIndex xy2);
|
||||
bool CheckDistanceFromEdge(TileIndex tile, uint distance);
|
||||
void PlaceTreesRandomly(void);
|
||||
|
||||
void InitializeLandscapeVariables(bool only_constants);
|
||||
|
||||
/* misc.c */
|
||||
void DeleteName(StringID id);
|
||||
byte *GetName(int id, byte *buff);
|
||||
StringID AllocateName(const byte *name, byte skip);
|
||||
char *GetName(int id, char *buff);
|
||||
|
||||
// AllocateNameUnique also tests if the name used is not used anywere else
|
||||
// and if it is used, it returns an error.
|
||||
#define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
|
||||
#define AllocateName(name, skip) RealAllocateName(name, skip, false)
|
||||
StringID RealAllocateName(const char *name, byte skip, bool check_double);
|
||||
void ConvertDayToYMD(YearMonthDay *ymd, uint16 date);
|
||||
uint ConvertYMDToDay(uint year, uint month, uint day);
|
||||
uint ConvertIntDate(uint date);
|
||||
|
||||
|
||||
|
||||
/* misc functions */
|
||||
void MarkTileDirty(int x, int y);
|
||||
void MarkTileDirtyByTile(TileIndex tile);
|
||||
void InvalidateWindow(byte cls, WindowNumber number);
|
||||
void InvalidateWindowWidget(byte cls, WindowNumber number, byte widget_index);
|
||||
void InvalidateWindowClasses(byte cls);
|
||||
void InvalidateWindow(WindowClass cls, WindowNumber number);
|
||||
void InvalidateWindowWidget(WindowClass cls, WindowNumber number, byte widget_index);
|
||||
void InvalidateWindowClasses(WindowClass cls);
|
||||
void DeleteWindowById(WindowClass cls, WindowNumber number);
|
||||
void DeleteWindowByClass(WindowClass cls);
|
||||
|
||||
void SetObjectToPlaceWnd(int icon, byte mode, Window *w);
|
||||
void SetObjectToPlace(int icon, byte mode, byte window_class, uint16 window_num);
|
||||
void SetObjectToPlaceWnd(CursorID icon, byte mode, Window *w);
|
||||
void SetObjectToPlace(CursorID icon, byte mode, WindowClass window_class, WindowNumber window_num);
|
||||
|
||||
void ResetObjectToPlace();
|
||||
void ResetObjectToPlace(void);
|
||||
|
||||
bool ScrollWindowToTile(TileIndex tile, Window * w);
|
||||
bool ScrollWindowTo(int x, int y, Window * w);
|
||||
|
||||
bool ScrollMainWindowToTile(TileIndex tile);
|
||||
bool ScrollMainWindowTo(int x, int y);
|
||||
void DrawSprite(uint32 img, int x, int y);
|
||||
uint GetCorrectTileHeight(TileIndex tile);
|
||||
bool EnsureNoVehicle(TileIndex tile);
|
||||
bool EnsureNoVehicleZ(TileIndex tile, byte z);
|
||||
void MarkAllViewportsDirty(int left, int top, int right, int bottom);
|
||||
void ShowCostOrIncomeAnimation(int x, int y, int z, int32 cost);
|
||||
void MarkWholeScreenDirty();
|
||||
void ShowFeederIncomeAnimation(int x, int y, int z, int32 cost);
|
||||
|
||||
void DrawFoundation(TileInfo *ti, uint f);
|
||||
|
||||
bool CheckIfAuthorityAllows(uint tile);
|
||||
Town *ClosestTownFromTile(uint tile, uint threshold);
|
||||
bool CheckIfAuthorityAllows(TileIndex tile);
|
||||
Town *ClosestTownFromTile(TileIndex tile, uint threshold);
|
||||
void ChangeTownRating(Town *t, int add, int max);
|
||||
|
||||
uint GetRoadBitsByTile(TileIndex tile);
|
||||
int GetTownRadiusGroup(Town *t, uint tile);
|
||||
int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, byte cargo_type);
|
||||
void ShowRenameSignWindow(SignStruct *ss);
|
||||
void ShowRenameCheckpointWindow(Checkpoint *cp);
|
||||
int GetTownRadiusGroup(const Town *t, TileIndex tile);
|
||||
void ShowNetworkChatQueryWindow(byte desttype, byte dest);
|
||||
void ShowNetworkGiveMoneyWindow(byte player);
|
||||
void ShowNetworkNeedGamePassword(void);
|
||||
void ShowNetworkNeedCompanyPassword(void);
|
||||
int FindFirstBit(uint32 x);
|
||||
void ShowHighscoreTable(int tbl);
|
||||
void ShowHighscoreTable(int difficulty, int8 rank);
|
||||
void ShowEndGameChart(void);
|
||||
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
|
||||
|
||||
enum SaveOrLoadResult {
|
||||
SL_OK = 0, // completed successfully
|
||||
SL_ERROR = 1, // error that was caught before internal structures were modified
|
||||
SL_REINIT = 2, // error that was caught in the middle of updating game state, need to clear it. (can only happen during load)
|
||||
};
|
||||
enum SaveOrLoadMode {
|
||||
SL_INVALID = -1,
|
||||
SL_LOAD = 0,
|
||||
SL_SAVE = 1,
|
||||
SL_OLD_LOAD = 2,
|
||||
};
|
||||
void AfterLoadTown(void);
|
||||
void GenRandomNewGame(uint32 rnd1, uint32 rnd2);
|
||||
void StartScenarioEditor(uint32 rnd1, uint32 rnd2);
|
||||
void AskExitGame(void);
|
||||
void AskExitToGameMenu(void);
|
||||
|
||||
int SaveOrLoad(const char *filename, int mode);
|
||||
|
||||
void AfterLoadTown();
|
||||
void AskExitGame();
|
||||
void AskExitToGameMenu();
|
||||
|
||||
void RedrawAutosave();
|
||||
void RedrawAutosave(void);
|
||||
|
||||
StringID RemapOldStringID(StringID s);
|
||||
|
||||
@@ -258,29 +247,21 @@ enum {
|
||||
};
|
||||
void ShowSaveLoadDialog(int mode);
|
||||
|
||||
void ttd_strlcpy(char *dst, const char *src, size_t len);
|
||||
|
||||
// callback from drivers that is called if the game size changes dynamically
|
||||
void GameSizeChanged();
|
||||
bool MakeScreenshot();
|
||||
bool MakeWorldScreenshot(int left, int top, int width, int height, int zoom);
|
||||
void GameSizeChanged(void);
|
||||
bool FileExists(const char *filename);
|
||||
bool ReadLanguagePack(int index);
|
||||
void InitializeLanguagePacks();
|
||||
byte *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
|
||||
void InitializeLanguagePacks(void);
|
||||
void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
|
||||
int GetLanguageList(char **languages, int max);
|
||||
|
||||
const char *GetScreenshotFormatDesc(int i);
|
||||
void InitializeScreenshotFormats();
|
||||
void SetScreenshotFormat(int i);
|
||||
void CheckSwitchToEuro();
|
||||
|
||||
void LoadFromConfig();
|
||||
void SaveToConfig();
|
||||
void LoadFromConfig(void);
|
||||
void SaveToConfig(void);
|
||||
void CheckConfig(void);
|
||||
int ttd_main(int argc, char* argv[]);
|
||||
byte GetOSVersion();
|
||||
|
||||
void DeterminePaths();
|
||||
char * CDECL str_fmt(const char *str, ...);
|
||||
void DeterminePaths(void);
|
||||
|
||||
void bubblesort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
|
||||
void CSleep(int milliseconds);
|
||||
#endif /* FUNCTIONS_H */
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef GFX_H
|
||||
#define GFX_H
|
||||
|
||||
typedef byte Pixel;
|
||||
|
||||
typedef struct ColorList {
|
||||
byte unk0, unk1, unk2;
|
||||
@@ -10,28 +13,20 @@ typedef struct ColorList {
|
||||
} ColorList;
|
||||
|
||||
struct DrawPixelInfo {
|
||||
byte *dst_ptr;
|
||||
Pixel *dst_ptr;
|
||||
int left, top, width, height;
|
||||
int pitch;
|
||||
uint16 zoom;
|
||||
};
|
||||
|
||||
|
||||
typedef struct SpriteHdr {
|
||||
byte info;
|
||||
byte height;
|
||||
uint16 width;
|
||||
int16 x_offs, y_offs;
|
||||
} SpriteHdr;
|
||||
assert_compile(sizeof(SpriteHdr) == 8);
|
||||
|
||||
typedef struct CursorVars {
|
||||
Point pos, size, offs, delta;
|
||||
Point draw_pos, draw_size;
|
||||
uint32 sprite;
|
||||
CursorID sprite;
|
||||
|
||||
int wheel; // mouse wheel movement
|
||||
const uint16 *animate_list, *animate_cur;
|
||||
const CursorID *animate_list, *animate_cur;
|
||||
uint animate_timeout;
|
||||
|
||||
bool visible;
|
||||
@@ -42,53 +37,69 @@ typedef struct CursorVars {
|
||||
|
||||
void RedrawScreenRect(int left, int top, int right, int bottom);
|
||||
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
|
||||
int DrawStringCentered(int x, int y, uint16 str, byte color);
|
||||
int DrawString(int x, int y, uint16 str, byte color);
|
||||
void DrawStringCenterUnderline(int x, int y, uint16 str, byte color);
|
||||
int DoDrawString(const byte *string, int x, int y, byte color);
|
||||
void DrawStringRightAligned(int x, int y, uint16 str, byte color);
|
||||
|
||||
|
||||
// XXX doesn't really belong here, but the only
|
||||
// consumers always use it in conjunction with DoDrawString()
|
||||
#define UPARROW "\x80"
|
||||
#define DOWNARROW "\xAA"
|
||||
|
||||
|
||||
int DrawStringCentered(int x, int y, StringID str, uint16 color);
|
||||
int DrawStringCenteredTruncated(int xl, int xr, int y, StringID str, uint16 color);
|
||||
int DoDrawStringCentered(int x, int y, const char *str, uint16 color);
|
||||
|
||||
int DrawString(int x, int y, StringID str, uint16 color);
|
||||
int DrawStringTruncated(int x, int y, StringID str, uint16 color, uint maxw);
|
||||
|
||||
int DoDrawString(const char *string, int x, int y, uint16 color);
|
||||
int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw);
|
||||
|
||||
void DrawStringCenterUnderline(int x, int y, StringID str, uint16 color);
|
||||
void DrawStringCenterUnderlineTruncated(int xl, int xr, int y, StringID str, uint16 color);
|
||||
|
||||
void DrawStringRightAligned(int x, int y, StringID str, uint16 color);
|
||||
void DrawStringRightAlignedTruncated(int x, int y, StringID str, uint16 color, uint maxw);
|
||||
|
||||
void GfxFillRect(int left, int top, int right, int bottom, int color);
|
||||
void GfxDrawLine(int left, int top, int right, int bottom, int color);
|
||||
void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags);
|
||||
uint16 GetDrawStringPlayerColor(PlayerID player);
|
||||
|
||||
int GetStringWidth(const byte *str);
|
||||
void LoadStringWidthTable();
|
||||
void DrawStringMultiCenter(int x, int y, uint16 str, int maxw);
|
||||
void DrawStringMultiLine(int x, int y, uint16 str, int maxw);
|
||||
void DrawDirtyBlocks();
|
||||
int GetStringWidth(const char *str);
|
||||
void LoadStringWidthTable(void);
|
||||
void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
|
||||
void DrawStringMultiLine(int x, int y, StringID str, int maxw);
|
||||
void DrawDirtyBlocks(void);
|
||||
void SetDirtyBlocks(int left, int top, int right, int bottom);
|
||||
void MarkWholeScreenDirty();
|
||||
void MarkWholeScreenDirty(void);
|
||||
|
||||
void GfxInitPalettes();
|
||||
void GfxInitPalettes(void);
|
||||
|
||||
bool FillDrawPixelInfo(DrawPixelInfo *n, DrawPixelInfo *o, int left, int top, int width, int height);
|
||||
bool FillDrawPixelInfo(DrawPixelInfo* n, const DrawPixelInfo* o, int left, int top, int width, int height);
|
||||
|
||||
/* window.c */
|
||||
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
|
||||
|
||||
/* spritecache.c */
|
||||
byte *GetSpritePtr(uint sprite);
|
||||
void GfxInitSpriteMem(byte *ptr, uint32 size);
|
||||
void GfxLoadSprites();
|
||||
|
||||
void SetMouseCursor(uint cursor);
|
||||
void SetAnimatedMouseCursor(const uint16 *table);
|
||||
void CursorTick();
|
||||
void DrawMouseCursor();
|
||||
void ScreenSizeChanged();
|
||||
void UndrawMouseCursor();
|
||||
void SetAnimatedMouseCursor(const CursorID *table);
|
||||
void CursorTick(void);
|
||||
void DrawMouseCursor(void);
|
||||
void ScreenSizeChanged(void);
|
||||
void UndrawMouseCursor(void);
|
||||
bool ChangeResInGame(int w, int h);
|
||||
|
||||
typedef struct {
|
||||
int xoffs, yoffs;
|
||||
int xsize, ysize;
|
||||
} SpriteDimension;
|
||||
|
||||
const SpriteDimension *GetSpriteDimension(uint sprite);
|
||||
void SortResolutions(int count);
|
||||
void ToggleFullScreen(bool fs);
|
||||
|
||||
/* gfx.c */
|
||||
#define ASCII_LETTERSTART 32
|
||||
VARDEF int _stringwidth_base;
|
||||
VARDEF byte _stringwidth_table[0x2A0];
|
||||
static inline byte GetCharacterWidth(uint key)
|
||||
{
|
||||
assert(key >= ASCII_LETTERSTART && key - ASCII_LETTERSTART < lengthof(_stringwidth_table));
|
||||
return _stringwidth_table[key - ASCII_LETTERSTART];
|
||||
}
|
||||
|
||||
VARDEF DrawPixelInfo _screen;
|
||||
VARDEF DrawPixelInfo *_cur_dpi;
|
||||
@@ -98,13 +109,23 @@ VARDEF CursorVars _cursor;
|
||||
VARDEF int _pal_first_dirty;
|
||||
VARDEF int _pal_last_dirty;
|
||||
|
||||
/* spritecache.c */
|
||||
//enum { NUM_SPRITES = 0x1320 };
|
||||
//enum { NUM_SPRITES = 0x1500 };
|
||||
enum { NUM_SPRITES = 0x3500 }; // 1500 + space for custom GRF sets
|
||||
VARDEF bool _use_dos_palette;
|
||||
|
||||
/* tables.h */
|
||||
extern byte _palettes[4][256 * 3];
|
||||
VARDEF byte _cur_palette[768];
|
||||
typedef struct Colour {
|
||||
byte r;
|
||||
byte g;
|
||||
byte b;
|
||||
} Colour;
|
||||
|
||||
extern Colour _cur_palette[256];
|
||||
|
||||
|
||||
typedef enum StringColorFlags {
|
||||
IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor
|
||||
} StringColorFlags;
|
||||
|
||||
#ifdef _DEBUG
|
||||
extern bool _dbg_screen_rect;
|
||||
#endif
|
||||
|
||||
#endif /* GFX_H */
|
||||
|
||||
@@ -0,0 +1,376 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "debug.h"
|
||||
#include "functions.h"
|
||||
#include "gfx.h"
|
||||
#include "gfxinit.h"
|
||||
#include "spritecache.h"
|
||||
#include "table/sprites.h"
|
||||
#include "fileio.h"
|
||||
#include "newgrf.h"
|
||||
#include "md5.h"
|
||||
#include "variables.h"
|
||||
#include <ctype.h>
|
||||
|
||||
typedef struct MD5File {
|
||||
const char * const filename; // filename
|
||||
const md5_byte_t hash[16]; // md5 sum of the file
|
||||
} MD5File;
|
||||
|
||||
typedef struct FileList {
|
||||
const MD5File basic[5]; // grf files that always have to be loaded
|
||||
const MD5File landscape[3]; // landscape specific grf files
|
||||
} FileList;
|
||||
|
||||
enum {
|
||||
SKIP = 0xFFFE,
|
||||
END = 0xFFFF
|
||||
};
|
||||
|
||||
#include "table/files.h"
|
||||
#include "table/landscape_sprite.h"
|
||||
|
||||
static const SpriteID * const _landscape_spriteindexes[] = {
|
||||
_landscape_spriteindexes_1,
|
||||
_landscape_spriteindexes_2,
|
||||
_landscape_spriteindexes_3,
|
||||
};
|
||||
|
||||
static const SpriteID * const _slopes_spriteindexes[] = {
|
||||
_slopes_spriteindexes_0,
|
||||
_slopes_spriteindexes_1,
|
||||
_slopes_spriteindexes_2,
|
||||
_slopes_spriteindexes_3,
|
||||
};
|
||||
|
||||
|
||||
static uint LoadGrfFile(const char* filename, uint load_index, int file_index)
|
||||
{
|
||||
uint load_index_org = load_index;
|
||||
|
||||
FioOpenFile(file_index, filename);
|
||||
|
||||
DEBUG(spritecache, 2) ("Reading grf-file ``%s''", filename);
|
||||
|
||||
while (LoadNextSprite(load_index, file_index)) {
|
||||
load_index++;
|
||||
if (load_index >= MAX_SPRITES) {
|
||||
error("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files.");
|
||||
}
|
||||
}
|
||||
DEBUG(spritecache, 2) ("Currently %i sprites are loaded", load_index);
|
||||
|
||||
return load_index - load_index_org;
|
||||
}
|
||||
|
||||
|
||||
static void LoadGrfIndexed(const char* filename, const SpriteID* index_tbl, int file_index)
|
||||
{
|
||||
uint start;
|
||||
|
||||
FioOpenFile(file_index, filename);
|
||||
|
||||
DEBUG(spritecache, 2) ("Reading indexed grf-file ``%s''", filename);
|
||||
|
||||
while ((start = *index_tbl++) != END) {
|
||||
uint end = *index_tbl++;
|
||||
|
||||
if (start == SKIP) { // skip sprites (amount in second var)
|
||||
SkipSprites(end);
|
||||
} else { // load sprites and use indexes from start to end
|
||||
do {
|
||||
#ifdef NDEBUG
|
||||
LoadNextSprite(start, file_index);
|
||||
#else
|
||||
bool b = LoadNextSprite(start, file_index);
|
||||
assert(b);
|
||||
#endif
|
||||
} while (++start <= end);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Check that the supplied MD5 hash matches that stored for the supplied filename */
|
||||
static bool CheckMD5Digest(const MD5File file, md5_byte_t *digest, bool warn)
|
||||
{
|
||||
uint i;
|
||||
|
||||
/* Loop through each byte of the file MD5 and the stored MD5... */
|
||||
for (i = 0; i < 16; i++) if (file.hash[i] != digest[i]) break;
|
||||
|
||||
/* If all bytes of the MD5's match (i.e. the MD5's match)... */
|
||||
if (i == 16) {
|
||||
return true;
|
||||
} else {
|
||||
if (warn) fprintf(stderr, "MD5 of %s is ****INCORRECT**** - File Corrupt.\n", file.filename);
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
/* Calculate and check the MD5 hash of the supplied filename.
|
||||
* returns true if the checksum is correct */
|
||||
static bool FileMD5(const MD5File file, bool warn)
|
||||
{
|
||||
FILE *f;
|
||||
char buf[MAX_PATH];
|
||||
|
||||
// open file
|
||||
sprintf(buf, "%s%s", _path.data_dir, file.filename);
|
||||
f = fopen(buf, "rb");
|
||||
|
||||
#if !defined(WIN32)
|
||||
if (f == NULL) {
|
||||
char *s;
|
||||
// make lower case and check again
|
||||
for (s = buf + strlen(_path.data_dir) - 1; *s != '\0'; s++)
|
||||
*s = tolower(*s);
|
||||
f = fopen(buf, "rb");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (f != NULL) {
|
||||
md5_state_t filemd5state;
|
||||
md5_byte_t buffer[1024];
|
||||
md5_byte_t digest[16];
|
||||
size_t len;
|
||||
|
||||
md5_init(&filemd5state);
|
||||
while ((len = fread(buffer, 1, sizeof(buffer), f)) != 0)
|
||||
md5_append(&filemd5state, buffer, len);
|
||||
|
||||
if (ferror(f) && warn) fprintf(stderr, "Error Reading from %s \n", buf);
|
||||
fclose(f);
|
||||
|
||||
md5_finish(&filemd5state, digest);
|
||||
return CheckMD5Digest(file, digest, warn);
|
||||
} else { // file not found
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Checks, if either the Windows files exist (TRG1R.GRF) or the DOS files (TRG1.GRF)
|
||||
* by comparing the MD5 checksums of the files. _use_dos_palette is set accordingly.
|
||||
* If neither are found, Windows palette is assumed.
|
||||
*
|
||||
* (Note: Also checks sample.cat for corruption) */
|
||||
void CheckExternalFiles(void)
|
||||
{
|
||||
uint i;
|
||||
// count of files from this version
|
||||
uint dos = 0;
|
||||
uint win = 0;
|
||||
|
||||
for (i = 0; i < 2; i++) if (FileMD5(files_dos.basic[i], true)) dos++;
|
||||
for (i = 0; i < 3; i++) if (FileMD5(files_dos.landscape[i], true)) dos++;
|
||||
|
||||
for (i = 0; i < 2; i++) if (FileMD5(files_win.basic[i], true)) win++;
|
||||
for (i = 0; i < 3; i++) if (FileMD5(files_win.landscape[i], true)) win++;
|
||||
|
||||
if (!FileMD5(sample_cat_win, false) && !FileMD5(sample_cat_dos, false))
|
||||
fprintf(stderr, "Your sample.cat file is corrupted or missing!\n");
|
||||
|
||||
/*
|
||||
* forced DOS palette via command line -> leave it that way
|
||||
* all Windows files present -> Windows palette
|
||||
* all DOS files present -> DOS palette
|
||||
* no Windows files present and any DOS file present -> DOS palette
|
||||
* otherwise -> Windows palette
|
||||
*/
|
||||
if (_use_dos_palette) {
|
||||
return;
|
||||
} else if (win == 5) {
|
||||
_use_dos_palette = false;
|
||||
} else if (dos == 5 || (win == 0 && dos > 0)) {
|
||||
_use_dos_palette = true;
|
||||
} else {
|
||||
_use_dos_palette = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static const SpriteID trg1idx[] = {
|
||||
0, 1, // Mouse cursor, ZZZ
|
||||
/* Medium font */
|
||||
2, 92, // ' ' till 'z'
|
||||
SKIP, 36,
|
||||
160, 160, // Move ¾ to the correct position
|
||||
98, 98, // Up arrow
|
||||
131, 133,
|
||||
SKIP, 1, // skip currency sign
|
||||
135, 135,
|
||||
SKIP, 1,
|
||||
137, 137,
|
||||
SKIP, 1,
|
||||
139, 139,
|
||||
140, 140, // TODO Down arrow
|
||||
141, 141,
|
||||
142, 142, // TODO Check mark
|
||||
143, 143, // TODO Cross
|
||||
144, 144,
|
||||
145, 145, // TODO Right arrow
|
||||
146, 149,
|
||||
118, 122, // Transport markers
|
||||
SKIP, 2,
|
||||
157, 157,
|
||||
114, 115, // Small up/down arrows
|
||||
SKIP, 1,
|
||||
161, 225,
|
||||
/* Small font */
|
||||
226, 316, // ' ' till 'z'
|
||||
SKIP, 36,
|
||||
384, 384, // Move ¾ to the correct position
|
||||
322, 322, // Up arrow
|
||||
355, 357,
|
||||
SKIP, 1, // skip currency sign
|
||||
359, 359,
|
||||
SKIP, 1,
|
||||
361, 361,
|
||||
SKIP, 1,
|
||||
363, 363,
|
||||
364, 364, // TODO Down arrow
|
||||
365, 366,
|
||||
SKIP, 1,
|
||||
368, 368,
|
||||
369, 369, // TODO Right arrow
|
||||
370, 373,
|
||||
SKIP, 7,
|
||||
381, 381,
|
||||
SKIP, 3,
|
||||
385, 449,
|
||||
/* Big font */
|
||||
450, 540, // ' ' till 'z'
|
||||
SKIP, 36,
|
||||
608, 608, // Move ¾ to the correct position
|
||||
SKIP, 1,
|
||||
579, 581,
|
||||
SKIP, 1,
|
||||
583, 583,
|
||||
SKIP, 5,
|
||||
589, 589,
|
||||
SKIP, 15,
|
||||
605, 605,
|
||||
SKIP, 3,
|
||||
609, 625,
|
||||
SKIP, 1,
|
||||
627, 632,
|
||||
SKIP, 1,
|
||||
634, 639,
|
||||
SKIP, 1,
|
||||
641, 657,
|
||||
SKIP, 1,
|
||||
659, 664,
|
||||
SKIP, 2,
|
||||
667, 671,
|
||||
SKIP, 1,
|
||||
673, 673,
|
||||
/* Graphics */
|
||||
674, 4792,
|
||||
END
|
||||
};
|
||||
|
||||
/* NOTE: When adding a normal sprite, increase OPENTTD_SPRITES_COUNT with the
|
||||
* amount of sprites and add them to the end of the list, with the index of
|
||||
* the old sprite-count offset from SPR_OPENTTD_BASE. With this there is no
|
||||
* correspondence of any kind with the ID's in the grf file, but results in
|
||||
* a maximum use of sprite slots. */
|
||||
#define OPENTTD_SPRITES_COUNT 95
|
||||
static const SpriteID _openttd_grf_indexes[] = {
|
||||
SPR_IMG_AUTORAIL, SPR_CURSOR_WAYPOINT, // icons etc
|
||||
134, 134, // euro symbol medium size
|
||||
582, 582, // euro symbol large size
|
||||
358, 358, // euro symbol tiny
|
||||
SPR_CURSOR_CANAL, SPR_IMG_FASTFORWARD, // more icons
|
||||
648, 648, // nordic char: æ
|
||||
616, 616, // nordic char: Æ
|
||||
666, 666, // nordic char: ø
|
||||
634, 634, // nordic char: Ø
|
||||
SPR_PIN_UP, SPR_CURSOR_CLONE, // more icons
|
||||
382, 383, // ¼ ½ tiny
|
||||
158, 159, // ¼ ½ medium
|
||||
606, 607, // ¼ ½ large
|
||||
360, 360, // ¦ tiny
|
||||
362, 362, // ¨ tiny
|
||||
136, 136, // ¦ medium
|
||||
138, 138, // ¨ medium
|
||||
584, 584, // ¦ large
|
||||
586, 586, // ¨ large
|
||||
626, 626, // Ð large
|
||||
658, 658, // ð large
|
||||
374, 374, // ´ tiny
|
||||
378, 378, // ¸ tiny
|
||||
150, 150, // ´ medium
|
||||
154, 154, // ¸ medium
|
||||
598, 598, // ´ large
|
||||
602, 602, // ¸ large
|
||||
640, 640, // Þ large
|
||||
672, 672, // þ large
|
||||
380, 380, // º tiny
|
||||
156, 156, // º medium
|
||||
604, 604, // º large
|
||||
317, 320, // { | } ~ tiny
|
||||
93, 96, // { | } ~ medium
|
||||
541, 544, // { | } ~ large
|
||||
SPR_HOUSE_ICON, SPR_HOUSE_ICON,
|
||||
END
|
||||
};
|
||||
|
||||
static byte _sprite_page_to_load = 0xFF;
|
||||
|
||||
static void LoadSpriteTables(void)
|
||||
{
|
||||
const FileList* files = _use_dos_palette ? &files_dos : &files_win;
|
||||
uint load_index;
|
||||
uint i;
|
||||
|
||||
LoadGrfIndexed(files->basic[0].filename, trg1idx, 0);
|
||||
DupSprite( 2, 130); // non-breaking space medium
|
||||
DupSprite(226, 354); // non-breaking space tiny
|
||||
DupSprite(450, 578); // non-breaking space large
|
||||
load_index = 4793;
|
||||
|
||||
for (i = 1; files->basic[i].filename != NULL; i++) {
|
||||
load_index += LoadGrfFile(files->basic[i].filename, load_index, i);
|
||||
}
|
||||
|
||||
if (_sprite_page_to_load != 0) {
|
||||
LoadGrfIndexed(
|
||||
files->landscape[_sprite_page_to_load - 1].filename,
|
||||
_landscape_spriteindexes[_sprite_page_to_load - 1],
|
||||
i++
|
||||
);
|
||||
}
|
||||
|
||||
assert(load_index == SPR_CANALS_BASE);
|
||||
load_index += LoadGrfFile("canalsw.grf", load_index, i++);
|
||||
|
||||
assert(load_index == SPR_SLOPES_BASE);
|
||||
LoadGrfIndexed("trkfoundw.grf", _slopes_spriteindexes[_opt.landscape], i++);
|
||||
|
||||
load_index = SPR_AUTORAIL_BASE;
|
||||
load_index += LoadGrfFile("autorail.grf", load_index, i++);
|
||||
|
||||
assert(load_index == SPR_OPENTTD_BASE);
|
||||
LoadGrfIndexed("openttd.grf", _openttd_grf_indexes, i++);
|
||||
load_index = SPR_OPENTTD_BASE + OPENTTD_SPRITES_COUNT;
|
||||
|
||||
LoadNewGRF(load_index, i);
|
||||
}
|
||||
|
||||
|
||||
void GfxLoadSprites(void)
|
||||
{
|
||||
// Need to reload the sprites only if the landscape changed
|
||||
if (_sprite_page_to_load != _opt.landscape) {
|
||||
_sprite_page_to_load = _opt.landscape;
|
||||
|
||||
// Sprite cache
|
||||
DEBUG(spritecache, 1) ("Loading sprite set %d.", _sprite_page_to_load);
|
||||
|
||||
GfxInitSpriteMem();
|
||||
LoadSpriteTables();
|
||||
GfxInitPalettes();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef GFXINIT_H
|
||||
#define GFXINIT_H
|
||||
|
||||
void CheckExternalFiles(void);
|
||||
void GfxLoadSprites(void);
|
||||
|
||||
#endif /* GFXINIT_H */
|
||||
+579
-441
File diff suppressed because it is too large
Load Diff
-1072
File diff suppressed because it is too large
Load Diff
@@ -1,101 +1,129 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef GUI_H
|
||||
#define GUI_H
|
||||
|
||||
#include "station.h"
|
||||
#include "window.h"
|
||||
|
||||
/* main_gui.c */
|
||||
void SetupColorsAndInitialWindow();
|
||||
void CcPlaySound10(bool success, uint tile, uint32 p1, uint32 p2);
|
||||
void PlaceProc_Sign(uint tile);
|
||||
void SetupColorsAndInitialWindow(void);
|
||||
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
||||
void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
||||
void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2);
|
||||
|
||||
/* settings_gui.c */
|
||||
void ShowGameOptions();
|
||||
void ShowGameDifficulty();
|
||||
void ShowPatchesSelection();
|
||||
void ShowGameOptions(void);
|
||||
void ShowGameDifficulty(void);
|
||||
void ShowPatchesSelection(void);
|
||||
void ShowNewgrf(void);
|
||||
|
||||
/* graph_gui.c */
|
||||
void ShowOperatingProfitGraph();
|
||||
void ShowIncomeGraph();
|
||||
void ShowDeliveredCargoGraph();
|
||||
void ShowPerformanceHistoryGraph();
|
||||
void ShowCompanyValueGraph();
|
||||
void ShowCargoPaymentRates();
|
||||
void ShowCompanyLeagueTable();
|
||||
void ShowPerformanceRatingDetail();
|
||||
void ShowOperatingProfitGraph(void);
|
||||
void ShowIncomeGraph(void);
|
||||
void ShowDeliveredCargoGraph(void);
|
||||
void ShowPerformanceHistoryGraph(void);
|
||||
void ShowCompanyValueGraph(void);
|
||||
void ShowCargoPaymentRates(void);
|
||||
void ShowCompanyLeagueTable(void);
|
||||
void ShowPerformanceRatingDetail(void);
|
||||
|
||||
/* news_gui.c */
|
||||
void ShowLastNewsMessage();
|
||||
void ShowMessageOptions();
|
||||
void ShowMessageHistory();
|
||||
void ShowLastNewsMessage(void);
|
||||
void ShowMessageOptions(void);
|
||||
void ShowMessageHistory(void);
|
||||
|
||||
/* traintoolb_gui.c */
|
||||
void ShowBuildRailToolbar(int index, int button);
|
||||
void PlaceProc_BuyLand(uint tile);
|
||||
void ShowBuildRailToolbar(RailType railtype, int button);
|
||||
void PlaceProc_BuyLand(TileIndex tile);
|
||||
|
||||
/* train_gui.c */
|
||||
void ShowPlayerTrains(int player);
|
||||
void ShowTrainViewWindow(Vehicle *v);
|
||||
void ShowTrainDetailsWindow(Vehicle *v);
|
||||
void ShowOrdersWindow(Vehicle *v);
|
||||
void ShowPlayerTrains(PlayerID player, StationID station);
|
||||
void ShowTrainViewWindow(const Vehicle *v);
|
||||
void ShowOrdersWindow(const Vehicle* v);
|
||||
|
||||
void ShowRoadVehViewWindow(Vehicle *v);
|
||||
void ShowRoadVehViewWindow(const Vehicle* v);
|
||||
|
||||
/* road_gui.c */
|
||||
void ShowBuildRoadToolbar();
|
||||
void ShowBuildRoadScenToolbar();
|
||||
void ShowPlayerRoadVehicles(int player);
|
||||
void ShowBuildRoadToolbar(void);
|
||||
void ShowBuildRoadScenToolbar(void);
|
||||
void ShowPlayerRoadVehicles(PlayerID player, StationID station);
|
||||
|
||||
/* dock_gui.c */
|
||||
void ShowBuildDocksToolbar();
|
||||
void ShowPlayerShips(int player);
|
||||
void ShowBuildDocksToolbar(void);
|
||||
void ShowPlayerShips(PlayerID player, StationID station);
|
||||
|
||||
void ShowShipViewWindow(Vehicle *v);
|
||||
void ShowShipViewWindow(const Vehicle* v);
|
||||
|
||||
/* aircraft_gui.c */
|
||||
void ShowBuildAirToolbar();
|
||||
void ShowPlayerAircraft(int player);
|
||||
void ShowBuildAirToolbar(void);
|
||||
void ShowPlayerAircraft(PlayerID player, StationID station);
|
||||
|
||||
/* terraform_gui.c */
|
||||
void PlaceProc_DemolishArea(uint tile);
|
||||
void PlaceProc_LowerLand(uint tile);
|
||||
void PlaceProc_RaiseLand(uint tile);
|
||||
void PlaceProc_LevelLand(uint tile);
|
||||
void ShowTerraformToolbar();
|
||||
void ShowTerraformToolbar(void);
|
||||
|
||||
void PlaceProc_DemolishArea(TileIndex tile);
|
||||
void PlaceProc_LevelLand(TileIndex tile);
|
||||
bool GUIPlaceProcDragXY(const WindowEvent *we);
|
||||
|
||||
enum { // max 32 - 4 = 28 types
|
||||
GUI_PlaceProc_DemolishArea = 0 << 4,
|
||||
GUI_PlaceProc_LevelArea = 1 << 4,
|
||||
GUI_PlaceProc_DesertArea = 2 << 4,
|
||||
GUI_PlaceProc_WaterArea = 3 << 4,
|
||||
GUI_PlaceProc_ConvertRailArea = 4 << 4,
|
||||
GUI_PlaceProc_RockyArea = 5 << 4,
|
||||
};
|
||||
|
||||
/* misc_gui.c */
|
||||
void PlaceLandBlockInfo();
|
||||
void ShowAboutWindow();
|
||||
void ShowBuildTreesToolbar();
|
||||
void ShowBuildTreesScenToolbar();
|
||||
void ShowTownDirectory();
|
||||
void ShowIndustryDirectory();
|
||||
void ShowSubsidiesList();
|
||||
void ShowPlayerStations(int player);
|
||||
void ShowPlayerFinances(int player);
|
||||
void ShowPlayerCompany(int player);
|
||||
void PlaceLandBlockInfo(void);
|
||||
void ShowAboutWindow(void);
|
||||
void ShowBuildTreesToolbar(void);
|
||||
void ShowBuildTreesScenToolbar(void);
|
||||
void ShowTownDirectory(void);
|
||||
void ShowIndustryDirectory(void);
|
||||
void ShowSubsidiesList(void);
|
||||
void ShowPlayerStations(PlayerID player);
|
||||
void ShowPlayerFinances(PlayerID player);
|
||||
void ShowPlayerCompany(PlayerID player);
|
||||
void ShowSignList(void);
|
||||
|
||||
void ShowEstimatedCostOrIncome(int32 cost, int x, int y);
|
||||
void ShowErrorMessage(StringID msg_1, StringID msg_2, int x, int y);
|
||||
|
||||
void DrawStationCoverageAreaText(int sx, int sy, uint mask);
|
||||
void CheckRedrawStationCoverage(Window *w);
|
||||
void DrawStationCoverageAreaText(int sx, int sy, uint mask,int rad);
|
||||
void CheckRedrawStationCoverage(const Window* w);
|
||||
|
||||
void ShowSmallMap();
|
||||
void ShowExtraViewPortWindow();
|
||||
void ShowSmallMap(void);
|
||||
void ShowExtraViewPortWindow(void);
|
||||
void SetVScrollCount(Window *w, int num);
|
||||
void SetVScroll2Count(Window *w, int num);
|
||||
void SetHScrollCount(Window *w, int num);
|
||||
int HandleEditBoxKey(Window *w, int wid, WindowEvent *we);
|
||||
|
||||
void ShowCheatWindow();
|
||||
void AskForNewGameToStart();
|
||||
void ShowCheatWindow(void);
|
||||
void AskForNewGameToStart(void);
|
||||
|
||||
void DrawEditBox(Window *w, int wid);
|
||||
void HandleEditBox(Window *w, int wid);
|
||||
void DrawEditBox(Window *w, querystr_d *string, int wid);
|
||||
void HandleEditBox(Window *w, querystr_d *string, int wid);
|
||||
int HandleEditBoxKey(Window *w, querystr_d *string, int wid, WindowEvent *we);
|
||||
bool HandleCaret(Textbuf *tb);
|
||||
|
||||
void DeleteTextBufferAll(Textbuf *tb);
|
||||
bool DeleteTextBufferChar(Textbuf *tb, int delmode);
|
||||
bool InsertTextBufferChar(Textbuf *tb, byte key);
|
||||
bool InsertTextBufferClipboard(Textbuf *tb);
|
||||
bool MoveTextBufferPos(Textbuf *tb, int navmode);
|
||||
void UpdateTextBufferSize(Textbuf *tb);
|
||||
|
||||
void BuildFileList(void);
|
||||
void SetFiosType(const byte fiostype);
|
||||
|
||||
/* FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE etc. different colours */
|
||||
extern const byte _fios_colors[];
|
||||
|
||||
/* network gui */
|
||||
void ShowNetworkGameWindow();
|
||||
|
||||
void ShowNetworkGameWindow(void);
|
||||
void ShowChatWindow(StringID str, StringID caption, int maxlen, int maxwidth, WindowClass window_class, WindowNumber window_number);
|
||||
|
||||
/* bridge_gui.c */
|
||||
void ShowBuildBridgeWindow(uint start, uint end, byte type);
|
||||
@@ -107,15 +135,15 @@ enum {
|
||||
};
|
||||
|
||||
bool DoZoomInOutWindow(int how, Window * w);
|
||||
void ShowBuildIndustryWindow();
|
||||
void ShowQueryString(StringID str, StringID caption, int maxlen, int maxwidth, byte window_class, uint16 window_number);
|
||||
void ShowMusicWindow();
|
||||
void ShowBuildIndustryWindow(void);
|
||||
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, WindowClass window_class, WindowNumber window_number);
|
||||
void ShowMusicWindow(void);
|
||||
|
||||
/* main_gui.c */
|
||||
VARDEF byte _newspaper_flag;
|
||||
VARDEF byte _construct_mode;
|
||||
VARDEF byte _station_show_coverage;
|
||||
VARDEF PlaceProc *_place_proc;
|
||||
VARDEF bool _no_button_sound;
|
||||
|
||||
/* vehicle_gui.c */
|
||||
void InitializeGUI(void);
|
||||
|
||||
#endif /* GUI_H */
|
||||
|
||||
@@ -1,114 +1,58 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef HAL_H
|
||||
#define HAL_H
|
||||
|
||||
typedef struct {
|
||||
char *(*start)(char **parm);
|
||||
void (*stop)();
|
||||
const char *(*start)(const char * const *parm);
|
||||
void (*stop)(void);
|
||||
} HalCommonDriver;
|
||||
|
||||
typedef struct {
|
||||
const char *(*start)(char **parm);
|
||||
void (*stop)();
|
||||
const char *(*start)(const char * const *parm);
|
||||
void (*stop)(void);
|
||||
void (*make_dirty)(int left, int top, int width, int height);
|
||||
int (*main_loop)();
|
||||
void (*main_loop)(void);
|
||||
bool (*change_resolution)(int w, int h);
|
||||
void (*toggle_fullscreen)(bool fullscreen);
|
||||
} HalVideoDriver;
|
||||
|
||||
enum {
|
||||
ML_QUIT = 0,
|
||||
ML_SWITCHDRIVER = 1,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *(*start)(char **parm);
|
||||
void (*stop)();
|
||||
const char *(*start)(const char * const *parm);
|
||||
void (*stop)(void);
|
||||
} HalSoundDriver;
|
||||
|
||||
typedef struct {
|
||||
char *(*start)(char **parm);
|
||||
void (*stop)();
|
||||
const char *(*start)(const char * const *parm);
|
||||
void (*stop)(void);
|
||||
|
||||
void (*play_song)(const char *filename);
|
||||
void (*stop_song)();
|
||||
bool (*is_song_playing)();
|
||||
void (*stop_song)(void);
|
||||
bool (*is_song_playing)(void);
|
||||
void (*set_volume)(byte vol);
|
||||
} HalMusicDriver;
|
||||
|
||||
typedef struct {
|
||||
const char *name;
|
||||
const char *longname;
|
||||
const void *drv;
|
||||
uint32 flags;
|
||||
} DriverDesc;
|
||||
|
||||
enum {
|
||||
HALERR_OK = 0,
|
||||
HALERR_ERROR = 1,
|
||||
};
|
||||
|
||||
extern const HalMusicDriver _null_music_driver;
|
||||
extern const HalVideoDriver _null_video_driver;
|
||||
extern const HalSoundDriver _null_sound_driver;
|
||||
|
||||
VARDEF HalMusicDriver *_music_driver;
|
||||
VARDEF HalSoundDriver *_sound_driver;
|
||||
VARDEF HalVideoDriver *_video_driver;
|
||||
|
||||
extern const DriverDesc _video_driver_descs[];
|
||||
extern const DriverDesc _sound_driver_descs[];
|
||||
extern const DriverDesc _music_driver_descs[];
|
||||
|
||||
#if defined(WITH_SDL)
|
||||
extern const HalSoundDriver _sdl_sound_driver;
|
||||
extern const HalVideoDriver _sdl_video_driver;
|
||||
#endif
|
||||
|
||||
#if defined(UNIX)
|
||||
extern const HalMusicDriver _extmidi_music_driver;
|
||||
#endif
|
||||
|
||||
#if defined(__BEOS__)
|
||||
extern const HalMusicDriver _bemidi_music_driver;
|
||||
#endif
|
||||
|
||||
enum DriverType {
|
||||
VIDEO_DRIVER = 0,
|
||||
SOUND_DRIVER = 1,
|
||||
MUSIC_DRIVER = 2,
|
||||
};
|
||||
|
||||
extern void GameLoop();
|
||||
extern bool _dbg_screen_rect;
|
||||
|
||||
void LoadDriver(int driver, const char *name);
|
||||
|
||||
char *GetDriverParam(char **parm, const char *name);
|
||||
bool GetDriverParamBool(char **parm, const char *name);
|
||||
int GetDriverParamInt(char **parm, const char *name, int def);
|
||||
|
||||
extern void GameLoop(void);
|
||||
|
||||
|
||||
// Deals with finding savegames
|
||||
typedef struct {
|
||||
uint16 id;
|
||||
byte type;
|
||||
uint64 mtime;
|
||||
char title[64];
|
||||
char name[256-12-64];
|
||||
int old_extension;
|
||||
} FiosItem;
|
||||
|
||||
// extensions of old savegames, scenarios
|
||||
static const char* const _old_extensions[] = {
|
||||
// old savegame types
|
||||
"ss1", // Transport Tycoon Deluxe preset game
|
||||
"sv1", // Transport Tycoon Deluxe (Patch) saved game
|
||||
"sv2", // Transport Tycoon Deluxe (Patch) saved 2-player game
|
||||
// old scenario game type
|
||||
"sv0", // Transport Tycoon Deluxe (Patch) scenario
|
||||
"ss0", // Transport Tycoon Deluxe preset scenario
|
||||
};
|
||||
|
||||
enum {
|
||||
FIOS_TYPE_DRIVE = 0,
|
||||
FIOS_TYPE_PARENT = 1,
|
||||
@@ -117,8 +61,15 @@ enum {
|
||||
FIOS_TYPE_OLDFILE = 4,
|
||||
FIOS_TYPE_SCENARIO = 5,
|
||||
FIOS_TYPE_OLD_SCENARIO = 6,
|
||||
FIOS_TYPE_DIRECT = 7,
|
||||
};
|
||||
|
||||
|
||||
// Variables to display file lists
|
||||
FiosItem *_fios_list;
|
||||
int _fios_num;
|
||||
int _saveload_mode;
|
||||
|
||||
// get the name of an oldstyle savegame
|
||||
void GetOldSaveGameName(char *title, const char *file);
|
||||
// get the name of an oldstyle scenario
|
||||
@@ -129,18 +80,18 @@ FiosItem *FiosGetSavegameList(int *num, int mode);
|
||||
// Get a list of scenarios
|
||||
FiosItem *FiosGetScenarioList(int *num, int mode);
|
||||
// Free the list of savegames
|
||||
void FiosFreeSavegameList();
|
||||
void FiosFreeSavegameList(void);
|
||||
// Browse to. Returns a filename w/path if we reached a file.
|
||||
char *FiosBrowseTo(const FiosItem *item);
|
||||
// Get descriptive texts.
|
||||
// Returns a path as well as a
|
||||
// string describing the path.
|
||||
StringID FiosGetDescText(const char **path);
|
||||
// Return path, free space and stringID
|
||||
StringID FiosGetDescText(const char **path, uint32 *tot);
|
||||
// Delete a name
|
||||
void FiosDelete(const char *name);
|
||||
bool FiosDelete(const char *name);
|
||||
// Make a filename from a name
|
||||
void FiosMakeSavegameName(char *buf, const char *name);
|
||||
|
||||
void CreateConsole();
|
||||
int CDECL compare_FiosItems(const void *a, const void *b);
|
||||
|
||||
void CreateConsole(void);
|
||||
|
||||
#endif /* HAL_H */
|
||||
|
||||
+40
-4
@@ -1,11 +1,15 @@
|
||||
/* $Id$ */
|
||||
|
||||
#ifndef INDUSTRY_H
|
||||
#define INDUSTRY_H
|
||||
|
||||
#include "pool.h"
|
||||
|
||||
struct Industry {
|
||||
TileIndex xy;
|
||||
byte width; /* swapped order of w/h with town */
|
||||
byte height;
|
||||
Town *town;
|
||||
const Town* town;
|
||||
byte produced_cargo[2];
|
||||
uint16 cargo_waiting[2];
|
||||
byte production_rate[2];
|
||||
@@ -23,12 +27,44 @@ struct Industry {
|
||||
byte color_map;
|
||||
byte last_prod_year;
|
||||
byte was_cargo_delivered;
|
||||
|
||||
uint16 index;
|
||||
};
|
||||
|
||||
extern MemoryPool _industry_pool;
|
||||
|
||||
/**
|
||||
* Check if an Industry really exists.
|
||||
*/
|
||||
static inline bool IsValidIndustry(Industry* industry)
|
||||
{
|
||||
return industry->xy != 0; /* XXX: Replace by INVALID_TILE someday */
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the pointer to the industry with index 'index'
|
||||
*/
|
||||
static inline Industry *GetIndustry(uint index)
|
||||
{
|
||||
return (Industry*)GetItemFromPool(&_industry_pool, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current size of the IndustryPool
|
||||
*/
|
||||
static inline uint16 GetIndustryPoolSize(void)
|
||||
{
|
||||
return _industry_pool.total_items;
|
||||
}
|
||||
|
||||
#define FOR_ALL_INDUSTRIES_FROM(i, start) for (i = GetIndustry(start); i != NULL; i = (i->index + 1 < GetIndustryPoolSize()) ? GetIndustry(i->index + 1) : NULL)
|
||||
#define FOR_ALL_INDUSTRIES(i) FOR_ALL_INDUSTRIES_FROM(i, 0)
|
||||
|
||||
VARDEF int _total_industries; // For the AI: the amount of industries active
|
||||
VARDEF Industry _industries[90];
|
||||
#define DEREF_INDUSTRY(i) (&_industries[i])
|
||||
|
||||
VARDEF uint16 *_industry_sort;
|
||||
VARDEF bool _industry_sort_dirty;
|
||||
|
||||
void DeleteIndustry(Industry *is);
|
||||
|
||||
enum {
|
||||
@@ -71,4 +107,4 @@ enum {
|
||||
IT_SUGAR_MINE = 36,
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif /* INDUSTRY_H */
|
||||
|
||||
+653
-574
File diff suppressed because it is too large
Load Diff
+316
-217
@@ -1,31 +1,38 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
//#include "gui.h"
|
||||
#include "openttd.h"
|
||||
#include "debug.h"
|
||||
#include "functions.h"
|
||||
#include "strings.h"
|
||||
#include "table/strings.h"
|
||||
#include "table/sprites.h"
|
||||
#include "map.h"
|
||||
#include "gui.h"
|
||||
#include "window.h"
|
||||
#include "gfx.h"
|
||||
#include "command.h"
|
||||
#include "viewport.h"
|
||||
#include "industry.h"
|
||||
#include "town.h"
|
||||
#include "variables.h"
|
||||
|
||||
static const byte _build_industry_types[4][12] = {
|
||||
{ 1, 2, 4, 6, 8, 0, 3, 5, 9, 11, 18 },
|
||||
{ 1, 14, 4, 13, 7, 0, 3, 9, 11, 15 },
|
||||
{ 25, 13, 4, 23, 22, 11, 17, 10, 24, 19, 20, 21 },
|
||||
{ 27, 30, 31, 33, 26, 28, 29, 32, 34, 35, 36 },
|
||||
};
|
||||
|
||||
/* Present in table/build_industry.h" */
|
||||
extern const byte _build_industry_types[4][12];
|
||||
extern const byte _industry_type_costs[37];
|
||||
|
||||
static void UpdateIndustryProduction(Industry *i);
|
||||
extern void DrawArrowButtons(int x, int y, int state);
|
||||
|
||||
static void BuildIndustryWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
switch(e->event) {
|
||||
case WE_PAINT:
|
||||
DrawWindowWidgets(w);
|
||||
if (_thd.place_mode == 1 && _thd.window_class == WC_BUILD_INDUSTRY) {
|
||||
int ind_type = _build_industry_types[_opt.landscape][WP(w,def_d).data_1];
|
||||
int ind_type = _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1];
|
||||
|
||||
SET_DPARAM32(0, (_price.build_industry >> 5) * _industry_type_costs[ind_type]);
|
||||
SetDParam(0, (_price.build_industry >> 5) * _industry_type_costs[ind_type]);
|
||||
DrawStringCentered(85, w->height - 21, STR_482F_COST, 0);
|
||||
}
|
||||
break;
|
||||
@@ -33,13 +40,13 @@ static void BuildIndustryWndProc(Window *w, WindowEvent *e)
|
||||
case WE_CLICK: {
|
||||
int wid = e->click.widget;
|
||||
if (wid >= 3) {
|
||||
if (HandlePlacePushButton(w, wid, 0xFF1, 1, NULL))
|
||||
if (HandlePlacePushButton(w, wid, SPR_CURSOR_INDUSTRY, 1, NULL))
|
||||
WP(w,def_d).data_1 = wid - 3;
|
||||
}
|
||||
} break;
|
||||
|
||||
case WE_PLACE_OBJ:
|
||||
if (DoCommandP(e->place.tile, _build_industry_types[_opt.landscape][WP(w,def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)))
|
||||
if (DoCommandP(e->place.tile, _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)))
|
||||
ResetObjectToPlace();
|
||||
break;
|
||||
|
||||
@@ -51,130 +58,130 @@ static void BuildIndustryWndProc(Window *w, WindowEvent *e)
|
||||
}
|
||||
|
||||
static const Widget _build_industry_land0_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 169, 14, 115, 0x0, STR_NULL},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 29, 40, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 68, 79, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 115, 0x0, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const Widget _build_industry_land1_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 169, 14, 115, 0x0, STR_NULL},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 29, 40, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 55, 66, STR_024D_FOOD_PROCESSING_PLANT,STR_026F_CONSTRUCT_FOOD_PROCESSING},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 68, 79, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 115, 0x0, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_024D_FOOD_PROCESSING_PLANT,STR_026F_CONSTRUCT_FOOD_PROCESSING},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const Widget _build_industry_land2_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 169, 14, 115, 0x0, STR_NULL},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 16, 27, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 29, 40, STR_024D_FOOD_PROCESSING_PLANT,STR_026F_CONSTRUCT_FOOD_PROCESSING},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 68, 79, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 115, 0x0, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_024D_FOOD_PROCESSING_PLANT,STR_026F_CONSTRUCT_FOOD_PROCESSING},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const Widget _build_industry_land3_widgets[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 169, 14, 115, 0x0, STR_NULL},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 16, 27, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 29, 40, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 42, 53, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 55, 66, STR_025E_FIZZY_DRINK_FACTORY, STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 115, 0x0, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_025E_FIZZY_DRINK_FACTORY, STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const Widget _build_industry_land0_widgets_extra[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY,STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 169, 14, 187, 0x0, STR_NULL},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY,STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 187, 0x0, STR_NULL},
|
||||
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 16, 27, STR_0241_POWER_STATION,STR_0263_CONSTRUCT_POWER_STATION},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 29, 40, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 68, 79, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0241_POWER_STATION,STR_0263_CONSTRUCT_POWER_STATION},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_0242_SAWMILL, STR_0264_CONSTRUCT_SAWMILL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0247_STEEL_MILL, STR_0269_CONSTRUCT_STEEL_MILL},
|
||||
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 84, 95, STR_0240_COAL_MINE, STR_CONSTRUCT_COAL_MINE_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 97, 108, STR_0243_FOREST, STR_CONSTRUCT_FOREST_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 110, 121, STR_0245_OIL_RIG, STR_CONSTRUCT_OIL_RIG_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 123, 134, STR_0248_FARM, STR_CONSTRUCT_FARM_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 136, 147, STR_024A_OIL_WELLS, STR_CONSTRUCT_OIL_WELLS_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 149, 160, STR_0249_IRON_ORE_MINE, STR_CONSTRUCT_IRON_ORE_MINE_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 84, 95, STR_0240_COAL_MINE, STR_CONSTRUCT_COAL_MINE_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 97, 108, STR_0243_FOREST, STR_CONSTRUCT_FOREST_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 110, 121, STR_0245_OIL_RIG, STR_CONSTRUCT_OIL_RIG_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 123, 134, STR_0248_FARM, STR_CONSTRUCT_FARM_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 136, 147, STR_024A_OIL_WELLS, STR_CONSTRUCT_OIL_WELLS_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 149, 160, STR_0249_IRON_ORE_MINE, STR_CONSTRUCT_IRON_ORE_MINE_TIP},
|
||||
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const Widget _build_industry_land1_widgets_extra[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 169, 14, 174, 0x0, STR_NULL},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 174, 0x0, STR_NULL},
|
||||
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 29, 40, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 55, 66, STR_024D_FOOD_PROCESSING_PLANT,STR_026F_CONSTRUCT_FOOD_PROCESSING},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 68, 79, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0241_POWER_STATION, STR_0263_CONSTRUCT_POWER_STATION},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_024C_PAPER_MILL, STR_026E_CONSTRUCT_PAPER_MILL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_024D_FOOD_PROCESSING_PLANT,STR_026F_CONSTRUCT_FOOD_PROCESSING},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_024E_PRINTING_WORKS, STR_0270_CONSTRUCT_PRINTING_WORKS},
|
||||
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 81+3, 92+3, STR_0240_COAL_MINE, STR_CONSTRUCT_COAL_MINE_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 94+3, 105+3, STR_0243_FOREST, STR_CONSTRUCT_FOREST_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 107+3, 118+3, STR_0248_FARM, STR_CONSTRUCT_FARM_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 120+3, 131+3, STR_024A_OIL_WELLS, STR_CONSTRUCT_OIL_WELLS_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 133+3, 144+3, STR_024F_GOLD_MINE, STR_CONSTRUCT_GOLD_MINE_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81+3, 92+3, STR_0240_COAL_MINE, STR_CONSTRUCT_COAL_MINE_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94+3, 105+3, STR_0243_FOREST, STR_CONSTRUCT_FOREST_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107+3, 118+3, STR_0248_FARM, STR_CONSTRUCT_FARM_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120+3, 131+3, STR_024A_OIL_WELLS, STR_CONSTRUCT_OIL_WELLS_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133+3, 144+3, STR_024F_GOLD_MINE, STR_CONSTRUCT_GOLD_MINE_TIP},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const Widget _build_industry_land2_widgets_extra[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 169, 14, 200, 0x0, STR_NULL},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 200, 0x0, STR_NULL},
|
||||
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 16, 27, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 29, 40, STR_024D_FOOD_PROCESSING_PLANT,STR_026F_CONSTRUCT_FOOD_PROCESSING},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 68, 79, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0250_LUMBER_MILL, STR_0273_CONSTRUCT_LUMBER_MILL_TO},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_024D_FOOD_PROCESSING_PLANT,STR_026F_CONSTRUCT_FOOD_PROCESSING},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_0244_OIL_REFINERY, STR_0266_CONSTRUCT_OIL_REFINERY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_0246_FACTORY, STR_0268_CONSTRUCT_FACTORY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68, 79, STR_0254_WATER_TOWER, STR_0277_CONSTRUCT_WATER_TOWER_CAN},
|
||||
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 81+3, 92+3, STR_024A_OIL_WELLS,STR_CONSTRUCT_OIL_WELLS_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 94+3, 105+3, STR_0255_DIAMOND_MINE, STR_CONSTRUCT_DIAMOND_MINE_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 107+3, 118+3, STR_0256_COPPER_ORE_MINE, STR_CONSTRUCT_COPPER_ORE_MINE_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 120+3, 131+3, STR_0248_FARM, STR_CONSTRUCT_FARM_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 133+3, 144+3, STR_0251_FRUIT_PLANTATION, STR_CONSTRUCT_FRUIT_PLANTATION_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 146+3, 157+3, STR_0252_RUBBER_PLANTATION,STR_CONSTRUCT_RUBBER_PLANTATION_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 159+3, 170+3, STR_0253_WATER_SUPPLY, STR_CONSTRUCT_WATER_SUPPLY_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81+3, 92+3, STR_024A_OIL_WELLS,STR_CONSTRUCT_OIL_WELLS_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94+3, 105+3, STR_0255_DIAMOND_MINE, STR_CONSTRUCT_DIAMOND_MINE_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107+3, 118+3, STR_0256_COPPER_ORE_MINE, STR_CONSTRUCT_COPPER_ORE_MINE_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120+3, 131+3, STR_0248_FARM, STR_CONSTRUCT_FARM_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133+3, 144+3, STR_0251_FRUIT_PLANTATION, STR_CONSTRUCT_FRUIT_PLANTATION_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146+3, 157+3, STR_0252_RUBBER_PLANTATION,STR_CONSTRUCT_RUBBER_PLANTATION_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 159+3, 170+3, STR_0253_WATER_SUPPLY, STR_CONSTRUCT_WATER_SUPPLY_TIP},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const Widget _build_industry_land3_widgets_extra[] = {
|
||||
{ WWT_CLOSEBOX, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, 7, 0, 169, 14, 187, 0x0, STR_NULL},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 7, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 7, 11, 169, 0, 13, STR_0314_FUND_NEW_INDUSTRY, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PANEL, RESIZE_NONE, 7, 0, 169, 14, 187, 0x0, STR_NULL},
|
||||
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 16, 27, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 29, 40, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 42, 53, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 55, 66, STR_025E_FIZZY_DRINK_FACTORY, STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 16, 27, STR_0258_CANDY_FACTORY, STR_027B_CONSTRUCT_CANDY_FACTORY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 29, 40, STR_025B_TOY_SHOP, STR_027E_CONSTRUCT_TOY_SHOP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 42, 53, STR_025C_TOY_FACTORY, STR_027F_CONSTRUCT_TOY_FACTORY},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 55, 66, STR_025E_FIZZY_DRINK_FACTORY, STR_0281_CONSTRUCT_FIZZY_DRINK_FACTORY},
|
||||
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 68+3, 79+3, STR_0257_COTTON_CANDY_FOREST,STR_CONSTRUCT_COTTON_CANDY_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 81+3, 92+3, STR_0259_BATTERY_FARM, STR_CONSTRUCT_BATTERY_FARM_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 94+3, 105+3, STR_025A_COLA_WELLS, STR_CONSTRUCT_COLA_WELLS_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 107+3, 118+3, STR_025D_PLASTIC_FOUNTAINS,STR_CONSTRUCT_PLASTIC_FOUNTAINS_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 120+3, 131+3, STR_025F_BUBBLE_GENERATOR, STR_CONSTRUCT_BUBBLE_GENERATOR_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 133+3, 144+3, STR_0260_TOFFEE_QUARRY, STR_CONSTRUCT_TOFFEE_QUARRY_TIP},
|
||||
{ WWT_CLOSEBOX, 14, 2, 167, 146+3, 157+3, STR_0261_SUGAR_MINE, STR_CONSTRUCT_SUGAR_MINE_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 68+3, 79+3, STR_0257_COTTON_CANDY_FOREST,STR_CONSTRUCT_COTTON_CANDY_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 81+3, 92+3, STR_0259_BATTERY_FARM, STR_CONSTRUCT_BATTERY_FARM_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 94+3, 105+3, STR_025A_COLA_WELLS, STR_CONSTRUCT_COLA_WELLS_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 107+3, 118+3, STR_025D_PLASTIC_FOUNTAINS,STR_CONSTRUCT_PLASTIC_FOUNTAINS_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 120+3, 131+3, STR_025F_BUBBLE_GENERATOR, STR_CONSTRUCT_BUBBLE_GENERATOR_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 133+3, 144+3, STR_0260_TOFFEE_QUARRY, STR_CONSTRUCT_TOFFEE_QUARRY_TIP},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 14, 2, 167, 146+3, 157+3, STR_0261_SUGAR_MINE, STR_CONSTRUCT_SUGAR_MINE_TIP},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
@@ -258,98 +265,176 @@ static const WindowDesc * const _industry_window_desc[2][4] = {
|
||||
},
|
||||
};
|
||||
|
||||
void ShowBuildIndustryWindow()
|
||||
void ShowBuildIndustryWindow(void)
|
||||
{
|
||||
AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt.landscape],0);
|
||||
if (_current_player == OWNER_SPECTATOR) return;
|
||||
AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape],0);
|
||||
}
|
||||
|
||||
#define NEED_ALTERB ((_game_mode == GM_EDITOR || _cheats.setup_prod.value) && (i->accepts_cargo[0] == CT_INVALID || i->accepts_cargo[0] == CT_VALUABLES))
|
||||
static void IndustryViewWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
Industry *i;
|
||||
StringID str;
|
||||
// WP(w,vp2_d).data_1 is for the editbox line
|
||||
// WP(w,vp2_d).data_2 is for the clickline
|
||||
// WP(w,vp2_d).data_3 is for the click pos (left or right)
|
||||
|
||||
switch(e->event) {
|
||||
case WE_PAINT:
|
||||
// in editor, use bulldoze to destroy industry
|
||||
// Destroy Industry button costing money removed per request of dominik
|
||||
//w->disabled_state = (_patches.extra_dynamite && !_networking && _game_mode != GM_EDITOR) ? 0 : (1 << 6);
|
||||
i = DEREF_INDUSTRY(w->window_number);
|
||||
SET_DPARAM16(0, i->town->index);
|
||||
SET_DPARAM16(1, i->type + STR_4802_COAL_MINE);
|
||||
case WE_PAINT: {
|
||||
const Industry *i;
|
||||
StringID str;
|
||||
|
||||
i = GetIndustry(w->window_number);
|
||||
SetDParam(0, w->window_number);
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
if (i->accepts_cargo[0] != 0xFF) {
|
||||
SET_DPARAM16(0, _cargoc.names_s[i->accepts_cargo[0]]);
|
||||
if (i->accepts_cargo[0] != CT_INVALID) {
|
||||
SetDParam(0, _cargoc.names_s[i->accepts_cargo[0]]);
|
||||
str = STR_4827_REQUIRES;
|
||||
if (i->accepts_cargo[1] != 0xFF) {
|
||||
SET_DPARAM16(1, _cargoc.names_s[i->accepts_cargo[1]]);
|
||||
if (i->accepts_cargo[1] != CT_INVALID) {
|
||||
SetDParam(1, _cargoc.names_s[i->accepts_cargo[1]]);
|
||||
str++;
|
||||
if (i->accepts_cargo[2] != 0xFF) {
|
||||
SET_DPARAM16(2, _cargoc.names_s[i->accepts_cargo[2]]);
|
||||
if (i->accepts_cargo[2] != CT_INVALID) {
|
||||
SetDParam(2, _cargoc.names_s[i->accepts_cargo[2]]);
|
||||
str++;
|
||||
}
|
||||
}
|
||||
DrawString(2, 107, str, 0);
|
||||
}
|
||||
|
||||
if (i->produced_cargo[0] != 0xFF) {
|
||||
if (i->produced_cargo[0] != CT_INVALID) {
|
||||
DrawString(2, 117, STR_482A_PRODUCTION_LAST_MONTH, 0);
|
||||
|
||||
SET_DPARAM16(1, i->total_production[0]);
|
||||
SET_DPARAM16(0, _cargoc.names_long_s[i->produced_cargo[0]] + ((i->total_production[0]!=1)<<5));
|
||||
SET_DPARAM16(2, i->pct_transported[0] * 100 >> 8);
|
||||
DrawString(4, 127, STR_482B_TRANSPORTED, 0);
|
||||
SetDParam(0, _cargoc.names_long[i->produced_cargo[0]]);
|
||||
SetDParam(1, i->total_production[0]);
|
||||
|
||||
if (i->produced_cargo[1] != 0xFF) {
|
||||
SET_DPARAM16(1, i->total_production[1]);
|
||||
SET_DPARAM16(0, _cargoc.names_long_s[i->produced_cargo[1]] + ((i->total_production[1]!=1)<<5));
|
||||
SET_DPARAM16(2, i->pct_transported[1] * 100 >> 8);
|
||||
DrawString(4, 137, STR_482B_TRANSPORTED, 0);
|
||||
SetDParam(2, i->pct_transported[0] * 100 >> 8);
|
||||
DrawString(4 + (NEED_ALTERB ? 30 : 0), 127, STR_482B_TRANSPORTED, 0);
|
||||
// Let's put out those buttons..
|
||||
if (NEED_ALTERB)
|
||||
DrawArrowButtons(5, 127, (WP(w,vp2_d).data_2 == 1 ? WP(w,vp2_d).data_3 : 0));
|
||||
|
||||
if (i->produced_cargo[1] != CT_INVALID) {
|
||||
SetDParam(0, _cargoc.names_long[i->produced_cargo[1]]);
|
||||
SetDParam(1, i->total_production[1]);
|
||||
SetDParam(2, i->pct_transported[1] * 100 >> 8);
|
||||
DrawString(4 + (NEED_ALTERB ? 30 : 0), 137, STR_482B_TRANSPORTED, 0);
|
||||
// Let's put out those buttons..
|
||||
if (NEED_ALTERB)
|
||||
DrawArrowButtons(5, 137, (WP(w,vp2_d).data_2 == 2 ? WP(w,vp2_d).data_3 : 0));
|
||||
}
|
||||
}
|
||||
|
||||
DrawWindowViewport(w);
|
||||
break;
|
||||
|
||||
case WE_CLICK:
|
||||
switch(e->click.widget) {
|
||||
case 5:
|
||||
i = DEREF_INDUSTRY(w->window_number);
|
||||
ScrollMainWindowToTile(i->xy + TILE_XY(1,1));
|
||||
break;
|
||||
case 6:
|
||||
// Destroy Industry button costing money removed per request of dominik
|
||||
//i = DEREF_INDUSTRY(w->window_number);
|
||||
/* passing only i->xy is not safe if industry has a weird shape like:
|
||||
_ X X
|
||||
X X X
|
||||
_ <--- grass, no industry, but i->xy points there (first top-left tile)!,
|
||||
so passing i->xy to destroy industry will fail in called procedure
|
||||
*/
|
||||
//DoCommandP(i->xy, w->window_number, 0, CcPlaySound10, CMD_DESTROY_INDUSTRY | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WE_CLICK: {
|
||||
Industry *i;
|
||||
|
||||
switch(e->click.widget) {
|
||||
case 5: {
|
||||
int line;
|
||||
int x;
|
||||
byte b;
|
||||
|
||||
i = GetIndustry(w->window_number);
|
||||
|
||||
// We should work if needed..
|
||||
if (!NEED_ALTERB)
|
||||
return;
|
||||
|
||||
x = e->click.pt.x;
|
||||
line = (e->click.pt.y - 127) / 10;
|
||||
if (e->click.pt.y >= 127 && IS_INT_INSIDE(line, 0, 2) && i->produced_cargo[line]) {
|
||||
if (IS_INT_INSIDE(x, 5, 25) ) {
|
||||
// clicked buttons
|
||||
if (x < 15) {
|
||||
// decrease
|
||||
i->production_rate[line] /= 2;
|
||||
if (i->production_rate[line] < 4)
|
||||
i->production_rate[line] = 4;
|
||||
} else {
|
||||
// increase
|
||||
b = i->production_rate[line] * 2;
|
||||
if (i->production_rate[line] >= 128)
|
||||
b=255;
|
||||
i->production_rate[line] = b;
|
||||
}
|
||||
UpdateIndustryProduction(i);
|
||||
SetWindowDirty(w);
|
||||
w->flags4 |= 5 << WF_TIMEOUT_SHL;
|
||||
WP(w,vp2_d).data_2 = line+1;
|
||||
WP(w,vp2_d).data_3 = (x < 15 ? 1 : 2);
|
||||
} else if (IS_INT_INSIDE(x, 34, 160)) {
|
||||
// clicked the text
|
||||
WP(w,vp2_d).data_1 = line;
|
||||
SetDParam(0, i->production_rate[line] * 8);
|
||||
ShowQueryString(STR_CONFIG_PATCHES_INT32,
|
||||
STR_CONFIG_GAME_PRODUCTION,
|
||||
10, 100, w->window_class,
|
||||
w->window_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
i = GetIndustry(w->window_number);
|
||||
ScrollMainWindowToTile(i->xy + TileDiffXY(1, 1));
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WE_TIMEOUT:
|
||||
WP(w,vp2_d).data_2 = 0;
|
||||
WP(w,vp2_d).data_3 = 0;
|
||||
SetWindowDirty(w);
|
||||
break;
|
||||
|
||||
case WE_ON_EDIT_TEXT:
|
||||
if (*e->edittext.str) {
|
||||
Industry *i;
|
||||
int val;
|
||||
int line;
|
||||
|
||||
i = GetIndustry(w->window_number);
|
||||
line = WP(w,vp2_d).data_1;
|
||||
val = atoi(e->edittext.str);
|
||||
if (!IS_INT_INSIDE(val, 32, 2040)) {
|
||||
if (val < 32) val = 32;
|
||||
else val = 2040;
|
||||
}
|
||||
i->production_rate[line] = (byte)(val / 8);
|
||||
UpdateIndustryProduction(i);
|
||||
SetWindowDirty(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void UpdateIndustryProduction(Industry *i)
|
||||
{
|
||||
if (i->produced_cargo[0] != CT_INVALID)
|
||||
i->total_production[0] = 8 * i->production_rate[0];
|
||||
|
||||
if (i->produced_cargo[1] != CT_INVALID)
|
||||
i->total_production[1] = 8 * i->production_rate[1];
|
||||
}
|
||||
|
||||
static const Widget _industry_view_widgets[] = {
|
||||
{ WWT_TEXTBTN, 9, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 9, 11, 259, 0, 13, STR_4801, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_IMGBTN, 9, 0, 259, 14, 105, 0x0, STR_NULL},
|
||||
{ WWT_6, 9, 2, 257, 16, 103, 0x0, STR_NULL},
|
||||
{ WWT_IMGBTN, 9, 0, 259, 106, 147, 0x0, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, 9, 0, 129, 148, 159, STR_00E4_LOCATION, STR_482C_CENTER_THE_MAIN_VIEW_ON},
|
||||
{ WWT_IMGBTN, 9, 130, 259, 148, 159, 0x0, STR_NULL},
|
||||
// Destroy Industry button costing money removed per request of dominik
|
||||
//{ WWT_PUSHTXTBTN, 9, 130, 259, 148, 159, STR_INDUSTRYDIR_DESTROY, STR_482C_DESTROY_INDUSTRY},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 9, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 9, 11, 247, 0, 13, STR_4801, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, RESIZE_NONE, 9, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON},
|
||||
{ WWT_IMGBTN, RESIZE_NONE, 9, 0, 259, 14, 105, 0x0, STR_NULL},
|
||||
{ WWT_6, RESIZE_NONE, 9, 2, 257, 16, 103, 0x0, STR_NULL},
|
||||
{ WWT_IMGBTN, RESIZE_NONE, 9, 0, 259, 106, 147, 0x0, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 9, 0, 129, 148, 159, STR_00E4_LOCATION, STR_482C_CENTER_THE_MAIN_VIEW_ON},
|
||||
{ WWT_IMGBTN, RESIZE_NONE, 9, 130, 259, 148, 159, 0x0, STR_NULL},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const WindowDesc _industry_view_desc = {
|
||||
-1, -1, 260, 160,
|
||||
WC_INDUSTRY_VIEW,0,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
|
||||
_industry_view_widgets,
|
||||
IndustryViewWndProc
|
||||
};
|
||||
@@ -362,38 +447,42 @@ void ShowIndustryViewWindow(int industry)
|
||||
w = AllocateWindowDescFront(&_industry_view_desc, industry);
|
||||
if (w) {
|
||||
w->flags4 |= WF_DISABLE_VP_SCROLL;
|
||||
i = DEREF_INDUSTRY(w->window_number);
|
||||
AssignWindowViewport(w, 3, 17, 0xFE, 0x56, i->xy + TILE_XY(1,1), 1);
|
||||
WP(w,vp2_d).data_1 = 0;
|
||||
WP(w,vp2_d).data_2 = 0;
|
||||
WP(w,vp2_d).data_3 = 0;
|
||||
i = GetIndustry(w->window_number);
|
||||
AssignWindowViewport(w, 3, 17, 0xFE, 0x56, i->xy + TileDiffXY(1, 1), 1);
|
||||
}
|
||||
}
|
||||
|
||||
static const Widget _industry_directory_widgets[] = {
|
||||
{ WWT_TEXTBTN, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, 13, 11, 507, 0, 13, STR_INDUSTRYDIR_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_PUSHTXTBTN, 13, 0, 100, 14, 25, STR_SORT_BY_NAME, STR_SORT_TIP},
|
||||
{ WWT_PUSHTXTBTN, 13, 101, 200, 14, 25, STR_SORT_BY_TYPE, STR_SORT_TIP},
|
||||
{ WWT_PUSHTXTBTN, 13, 201, 300, 14, 25, STR_SORT_BY_PRODUCTION, STR_SORT_TIP},
|
||||
{ WWT_PUSHTXTBTN, 13, 301, 400, 14, 25, STR_SORT_BY_TRANSPORTED, STR_SORT_TIP},
|
||||
{ WWT_PANEL, 13, 401, 496, 14, 25, 0x0, STR_NULL},
|
||||
{ WWT_IMGBTN, 13, 0, 496, 26, 189, 0x0, STR_200A_TOWN_NAMES_CLICK_ON_NAME},
|
||||
{ WWT_SCROLLBAR, 13, 497, 507, 14, 189, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 13, 11, 495, 0, 13, STR_INDUSTRYDIR_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
|
||||
{ WWT_STICKYBOX, RESIZE_NONE, 13, 496, 507, 0, 13, 0x0, STR_STICKY_BUTTON},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 0, 100, 14, 25, STR_SORT_BY_NAME, STR_SORT_ORDER_TIP},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 101, 200, 14, 25, STR_SORT_BY_TYPE, STR_SORT_ORDER_TIP},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 201, 300, 14, 25, STR_SORT_BY_PRODUCTION, STR_SORT_ORDER_TIP},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 13, 301, 400, 14, 25, STR_SORT_BY_TRANSPORTED, STR_SORT_ORDER_TIP},
|
||||
{ WWT_PANEL, RESIZE_NONE, 13, 401, 495, 14, 25, 0x0, STR_NULL},
|
||||
{ WWT_IMGBTN, RESIZE_BOTTOM, 13, 0, 495, 26, 189, 0x0, STR_200A_TOWN_NAMES_CLICK_ON_NAME},
|
||||
{ WWT_SCROLLBAR, RESIZE_BOTTOM, 13, 496, 507, 14, 177, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
|
||||
{ WWT_RESIZEBOX, RESIZE_TB, 13, 496, 507, 178, 189, 0x0, STR_RESIZE_BUTTON},
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static byte _industry_sort[lengthof(_industries)];
|
||||
static uint _num_industry_sort;
|
||||
|
||||
static char _bufcache[96];
|
||||
static byte _last_industry_idx;
|
||||
static uint16 _last_industry_idx;
|
||||
|
||||
static byte _industry_sort_order;
|
||||
|
||||
static int CDECL GeneralIndustrySorter(const void *a, const void *b)
|
||||
{
|
||||
char buf1[96];
|
||||
byte val;
|
||||
Industry *i = DEREF_INDUSTRY(*(const byte*)a);
|
||||
Industry *j = DEREF_INDUSTRY(*(const byte*)b);
|
||||
uint16 val;
|
||||
Industry *i = GetIndustry(*(const uint16*)a);
|
||||
Industry *j = GetIndustry(*(const uint16*)b);
|
||||
int r = 0;
|
||||
|
||||
switch (_industry_sort_order >> 1) {
|
||||
@@ -404,28 +493,28 @@ static int CDECL GeneralIndustrySorter(const void *a, const void *b)
|
||||
// FIXME - Production & Transported sort need to be inversed...but, WTF it does not wanna!
|
||||
// FIXME - And no simple --> "if (!(_industry_sort_order & 1)) r = -r;" hack at the bottom!!
|
||||
case 2: { /* Sort by Production */
|
||||
if (i->produced_cargo[0] != 0xFF && j->produced_cargo[0] != 0xFF) { // both industries produce cargo?
|
||||
if (i->produced_cargo[1] == 0xFF) // producing one or two things?
|
||||
if (i->produced_cargo[0] != CT_INVALID && j->produced_cargo[0] != CT_INVALID) { // both industries produce cargo?
|
||||
if (i->produced_cargo[1] == CT_INVALID) // producing one or two things?
|
||||
r = j->total_production[0] - i->total_production[0];
|
||||
else
|
||||
r = (j->total_production[0] + j->total_production[1]) / 2 - (i->total_production[0] + i->total_production[1]) / 2;
|
||||
} else if (i->produced_cargo[0] == 0xFF && j->produced_cargo[0] == 0xFF) // none of them producing anything, let them go to the name-sorting
|
||||
} else if (i->produced_cargo[0] == CT_INVALID && j->produced_cargo[0] == CT_INVALID) // none of them producing anything, let them go to the name-sorting
|
||||
r = 0;
|
||||
else if (i->produced_cargo[0] == 0xFF) // end up the non-producer industry first/last in list
|
||||
else if (i->produced_cargo[0] == CT_INVALID) // end up the non-producer industry first/last in list
|
||||
r = 1;
|
||||
else
|
||||
r = -1;
|
||||
break;
|
||||
}
|
||||
case 3: /* Sort by Transported amount */
|
||||
if (i->produced_cargo[0] != 0xFF && j->produced_cargo[0] != 0xFF) { // both industries produce cargo?
|
||||
if (i->produced_cargo[1] == 0xFF) // producing one or two things?
|
||||
if (i->produced_cargo[0] != CT_INVALID && j->produced_cargo[0] != CT_INVALID) { // both industries produce cargo?
|
||||
if (i->produced_cargo[1] == CT_INVALID) // producing one or two things?
|
||||
r = (j->pct_transported[0] * 100 >> 8) - (i->pct_transported[0] * 100 >> 8);
|
||||
else
|
||||
r = ((j->pct_transported[0] * 100 >> 8) + (j->pct_transported[1] * 100 >> 8)) / 2 - ((i->pct_transported[0] * 100 >> 8) + (i->pct_transported[1] * 100 >> 8)) / 2;
|
||||
} else if (i->produced_cargo[0] == 0xFF && j->produced_cargo[0] == 0xFF) // none of them producing anything, let them go to the name-sorting
|
||||
} else if (i->produced_cargo[0] == CT_INVALID && j->produced_cargo[0] == CT_INVALID) // none of them producing anything, let them go to the name-sorting
|
||||
r = 0;
|
||||
else if (i->produced_cargo[0] == 0xFF) // end up the non-producer industry first/last in list
|
||||
else if (i->produced_cargo[0] == CT_INVALID) // end up the non-producer industry first/last in list
|
||||
r = 1;
|
||||
else
|
||||
r = -1;
|
||||
@@ -434,13 +523,13 @@ static int CDECL GeneralIndustrySorter(const void *a, const void *b)
|
||||
|
||||
// default to string sorting if they are otherwise equal
|
||||
if (r == 0) {
|
||||
SET_DPARAM32(0, i->town->townnameparts);
|
||||
GetString(buf1, i->town->townnametype);
|
||||
SetDParam(0, i->town->index);
|
||||
GetString(buf1, STR_TOWN);
|
||||
|
||||
if ( (val=*(const byte*)b) != _last_industry_idx) {
|
||||
if ( (val=*(const uint16*)b) != _last_industry_idx) {
|
||||
_last_industry_idx = val;
|
||||
SET_DPARAM32(0, j->town->townnameparts);
|
||||
GetString(_bufcache, j->town->townnametype);
|
||||
SetDParam(0, j->town->index);
|
||||
GetString(_bufcache, STR_TOWN);
|
||||
}
|
||||
r = strcmp(buf1, _bufcache);
|
||||
}
|
||||
@@ -449,19 +538,24 @@ static int CDECL GeneralIndustrySorter(const void *a, const void *b)
|
||||
return r;
|
||||
}
|
||||
|
||||
static void MakeSortedIndustryList()
|
||||
static void MakeSortedIndustryList(void)
|
||||
{
|
||||
Industry *i;
|
||||
int n = 0, index = 0;
|
||||
int n = 0;
|
||||
|
||||
for(i=_industries; i != endof(_industries); i++) {
|
||||
if(i->xy) _industry_sort[n++] = index;
|
||||
index++;
|
||||
/* Create array for sorting */
|
||||
_industry_sort = realloc(_industry_sort, GetIndustryPoolSize() * sizeof(_industry_sort[0]));
|
||||
if (_industry_sort == NULL)
|
||||
error("Could not allocate memory for the industry-sorting-list");
|
||||
|
||||
FOR_ALL_INDUSTRIES(i) {
|
||||
if(i->xy)
|
||||
_industry_sort[n++] = i->index;
|
||||
}
|
||||
_num_industry_sort = n;
|
||||
_last_industry_idx = 255; // used for "cache"
|
||||
_last_industry_idx = 0xFFFF; // used for "cache"
|
||||
|
||||
qsort(_industry_sort, n, 1, GeneralIndustrySorter);
|
||||
qsort(_industry_sort, n, sizeof(_industry_sort[0]), GeneralIndustrySorter);
|
||||
|
||||
DEBUG(misc, 1) ("Resorting Industries list...");
|
||||
}
|
||||
@@ -481,77 +575,76 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
|
||||
MakeSortedIndustryList();
|
||||
}
|
||||
|
||||
w->vscroll.count = _num_industry_sort;
|
||||
SetVScrollCount(w, _num_industry_sort);
|
||||
|
||||
DrawWindowWidgets(w);
|
||||
DoDrawString(_industry_sort_order & 1 ? "\xAA" : "\xA0", _indicator_positions[_industry_sort_order>>1], 15, 0x10);
|
||||
DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order>>1], 15, 0x10);
|
||||
|
||||
p = w->vscroll.pos;
|
||||
n = 0;
|
||||
|
||||
while (p < _num_industry_sort) {
|
||||
i = DEREF_INDUSTRY(_industry_sort[p]);
|
||||
SET_DPARAM16(0, i->town->index);
|
||||
SET_DPARAM16(1, i->type + STR_4802_COAL_MINE);
|
||||
if (i->produced_cargo[0] != 0xFF) {
|
||||
SET_DPARAM16(3, i->total_production[0]);
|
||||
SET_DPARAM16(2, _cargoc.names_long_s[i->produced_cargo[0]] + ((i->total_production[0]!=1)<<5));
|
||||
i = GetIndustry(_industry_sort[p]);
|
||||
SetDParam(0, i->index);
|
||||
if (i->produced_cargo[0] != CT_INVALID) {
|
||||
SetDParam(1, _cargoc.names_long[i->produced_cargo[0]]);
|
||||
SetDParam(2, i->total_production[0]);
|
||||
|
||||
if (i->produced_cargo[1] != 0xFF) {
|
||||
SET_DPARAM16(5, i->total_production[1]);
|
||||
SET_DPARAM16(4, _cargoc.names_long_s[i->produced_cargo[1]] + ((i->total_production[1]!=1)<<5));
|
||||
SET_DPARAM16(6, i->pct_transported[0] * 100 >> 8);
|
||||
SET_DPARAM16(7, i->pct_transported[1] * 100 >> 8);
|
||||
if (i->produced_cargo[1] != CT_INVALID) {
|
||||
SetDParam(3, _cargoc.names_long[i->produced_cargo[1]]);
|
||||
SetDParam(4, i->total_production[1]);
|
||||
SetDParam(5, i->pct_transported[0] * 100 >> 8);
|
||||
SetDParam(6, i->pct_transported[1] * 100 >> 8);
|
||||
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_TWO, 0);
|
||||
} else {
|
||||
SET_DPARAM16(4, i->pct_transported[0] * 100 >> 8);
|
||||
SetDParam(3, i->pct_transported[0] * 100 >> 8);
|
||||
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM, 0);
|
||||
}
|
||||
} else {
|
||||
DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_NOPROD, 0);
|
||||
}
|
||||
p++;
|
||||
if (++n == 16)
|
||||
if (++n == w->vscroll.cap)
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
|
||||
case WE_CLICK:
|
||||
switch(e->click.widget) {
|
||||
case 2: {
|
||||
case 3: {
|
||||
_industry_sort_order = _industry_sort_order==0 ? 1 : 0;
|
||||
_industry_sort_dirty = true;
|
||||
SetWindowDirty(w);
|
||||
} break;
|
||||
|
||||
case 3: {
|
||||
case 4: {
|
||||
_industry_sort_order = _industry_sort_order==2 ? 3 : 2;
|
||||
_industry_sort_dirty = true;
|
||||
SetWindowDirty(w);
|
||||
} break;
|
||||
|
||||
case 4: {
|
||||
case 5: {
|
||||
_industry_sort_order = _industry_sort_order==4 ? 5 : 4;
|
||||
_industry_sort_dirty = true;
|
||||
SetWindowDirty(w);
|
||||
} break;
|
||||
|
||||
case 5: {
|
||||
case 6: {
|
||||
_industry_sort_order = _industry_sort_order==6 ? 7 : 6;
|
||||
_industry_sort_dirty = true;
|
||||
SetWindowDirty(w);
|
||||
} break;
|
||||
|
||||
case 7: {
|
||||
case 8: {
|
||||
int y = (e->click.pt.y - 28) / 10;
|
||||
byte p;
|
||||
uint16 p;
|
||||
Industry *c;
|
||||
|
||||
if (!IS_INT_INSIDE(y, 0, 16))
|
||||
if (!IS_INT_INSIDE(y, 0, w->vscroll.cap))
|
||||
return;
|
||||
p = y + w->vscroll.pos;
|
||||
if (p < _num_industry_sort) {
|
||||
c = DEREF_INDUSTRY(_industry_sort[p]);
|
||||
c = GetIndustry(_industry_sort[p]);
|
||||
ScrollMainWindowToTile(c->xy);
|
||||
}
|
||||
} break;
|
||||
@@ -561,6 +654,10 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
|
||||
case WE_4:
|
||||
SetWindowDirty(w);
|
||||
break;
|
||||
|
||||
case WE_RESIZE:
|
||||
w->vscroll.cap += e->sizing.diff.y / 10;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -569,14 +666,14 @@ static void IndustryDirectoryWndProc(Window *w, WindowEvent *e)
|
||||
static const WindowDesc _industry_directory_desc = {
|
||||
-1, -1, 508, 190,
|
||||
WC_INDUSTRY_DIRECTORY,0,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
|
||||
_industry_directory_widgets,
|
||||
IndustryDirectoryWndProc
|
||||
};
|
||||
|
||||
|
||||
|
||||
void ShowIndustryDirectory()
|
||||
void ShowIndustryDirectory(void)
|
||||
{
|
||||
/* Industry List */
|
||||
Window *w;
|
||||
@@ -584,6 +681,8 @@ void ShowIndustryDirectory()
|
||||
w = AllocateWindowDescFront(&_industry_directory_desc, 0);
|
||||
if (w) {
|
||||
w->vscroll.cap = 16;
|
||||
w->resize.height = w->height - 6 * 10; // minimum 10 items
|
||||
w->resize.step_height = 10;
|
||||
SetWindowDirty(w);
|
||||
}
|
||||
}
|
||||
|
||||
+156
-191
@@ -1,85 +1,116 @@
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "table/strings.h"
|
||||
#include "functions.h"
|
||||
#include "window.h"
|
||||
#include "gui.h"
|
||||
#include "viewport.h"
|
||||
#include "gfx.h"
|
||||
#include "player.h"
|
||||
#include "command.h"
|
||||
#include "console.h"
|
||||
#include "network.h"
|
||||
#include "variables.h"
|
||||
|
||||
extern void MakeNewGame();
|
||||
extern void StartScenario();
|
||||
|
||||
/*
|
||||
static void ShowSelectTutorialWindow()
|
||||
{
|
||||
}
|
||||
*/
|
||||
extern void SwitchMode(int new_mode);
|
||||
|
||||
static const Widget _select_game_widgets[] = {
|
||||
{ WWT_CAPTION, 13, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL},
|
||||
{ WWT_IMGBTN, 13, 0, 335, 14, 196, 0x0, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, 12, 10, 167, 22, 33, STR_0140_NEW_GAME, STR_02FB_START_A_NEW_GAME},
|
||||
{ WWT_PUSHTXTBTN, 12, 168, 325, 22, 33, STR_0141_LOAD_GAME, STR_02FC_LOAD_A_SAVED_GAME_FROM},
|
||||
//{ WWT_PUSHTXTBTN, 12, 10, 167, 177, 188, STR_0142_TUTORIAL_DEMONSTRATION, STR_02FD_VIEW_DEMONSTRATIONS_TUTORIALS},
|
||||
{ WWT_PUSHTXTBTN, 12, 10, 167, 177, 188, STR_CONFIG_PATCHES, STR_CONFIG_PATCHES_TIP},
|
||||
{ WWT_PUSHTXTBTN, 12, 10, 167, 40, 51, STR_0220_CREATE_SCENARIO,STR_02FE_CREATE_A_CUSTOMIZED_GAME},
|
||||
{ WWT_PUSHTXTBTN, 12, 10, 167, 136, 147, STR_SINGLE_PLAYER, STR_02FF_SELECT_SINGLE_PLAYER_GAME},
|
||||
{ WWT_PUSHTXTBTN, 12, 168, 325, 136, 147, STR_MULTIPLAYER, STR_0300_SELECT_TWO_PLAYER_GAME},
|
||||
{ WWT_PUSHTXTBTN, 12, 10, 167, 159, 170, STR_0148_GAME_OPTIONS, STR_0301_DISPLAY_GAME_OPTIONS},
|
||||
{ WWT_PUSHTXTBTN, 12, 168, 325, 159, 170, STR_01FE_DIFFICULTY, STR_0302_DISPLAY_DIFFICULTY_OPTIONS},
|
||||
{ WWT_PUSHTXTBTN, 12, 168, 325, 40, 51, STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING},
|
||||
{ WWT_PUSHTXTBTN, 12, 168, 325, 177, 188, STR_0304_QUIT, STR_0305_LEAVE_OPENTTD},
|
||||
{ WWT_PANEL_2, 12, 10, 85, 69, 122, 0x1312, STR_030E_SELECT_TEMPERATE_LANDSCAPE},
|
||||
{ WWT_PANEL_2, 12, 90, 165, 69, 122, 0x1314, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
|
||||
{ WWT_PANEL_2, 12, 170, 245, 69, 122, 0x1316, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
|
||||
{ WWT_PANEL_2, 12, 250, 325, 69, 122, 0x1318, STR_0311_SELECT_TOYLAND_LANDSCAPE},
|
||||
{ WIDGETS_END},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 13, 0, 335, 0, 13, STR_0307_OPENTTD, STR_NULL},
|
||||
{ WWT_IMGBTN, RESIZE_NONE, 13, 0, 335, 14, 196, STR_NULL, STR_NULL},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 22, 33, STR_0140_NEW_GAME, STR_02FB_START_A_NEW_GAME},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 22, 33, STR_0141_LOAD_GAME, STR_02FC_LOAD_A_SAVED_GAME},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 40, 51, STR_0220_CREATE_SCENARIO,STR_02FE_CREATE_A_CUSTOMIZED_GAME},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 40, 51, STR_029A_PLAY_SCENARIO, STR_0303_START_A_NEW_GAME_USING},
|
||||
{ WWT_PANEL_2, RESIZE_NONE, 12, 10, 86, 59, 113, 0x1312, STR_030E_SELECT_TEMPERATE_LANDSCAPE},
|
||||
{ WWT_PANEL_2, RESIZE_NONE, 12, 90, 166, 59, 113, 0x1314, STR_030F_SELECT_SUB_ARCTIC_LANDSCAPE},
|
||||
{ WWT_PANEL_2, RESIZE_NONE, 12, 170, 246, 59, 113, 0x1316, STR_0310_SELECT_SUB_TROPICAL_LANDSCAPE},
|
||||
{ WWT_PANEL_2, RESIZE_NONE, 12, 250, 326, 59, 113, 0x1318, STR_0311_SELECT_TOYLAND_LANDSCAPE},
|
||||
|
||||
{ WWT_PANEL, RESIZE_NONE, 12, 219, 254, 120, 131, STR_NULL, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 12, 255, 266, 120, 131, STR_0225, STR_NULL},
|
||||
{ WWT_PANEL, RESIZE_NONE, 12, 279, 314, 120, 131, STR_NULL, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 12, 315, 326, 120, 131, STR_0225, STR_NULL},
|
||||
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 138, 149, STR_SINGLE_PLAYER, STR_02FF_SELECT_SINGLE_PLAYER_GAME},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 138, 149, STR_MULTIPLAYER, STR_0300_SELECT_MULTIPLAYER_GAME},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 159, 170, STR_0148_GAME_OPTIONS, STR_0301_DISPLAY_GAME_OPTIONS},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 159, 170, STR_01FE_DIFFICULTY, STR_0302_DISPLAY_DIFFICULTY_OPTIONS},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 10, 167, 177, 188, STR_CONFIG_PATCHES, STR_CONFIG_PATCHES_TIP},
|
||||
{ WWT_PUSHTXTBTN, RESIZE_NONE, 12, 168, 325, 177, 188, STR_0304_QUIT, STR_0305_QUIT_OPENTTD},
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
static void SelectGameWndProc(Window *w, WindowEvent *e) {
|
||||
switch(e->event) {
|
||||
extern void HandleOnEditText(WindowEvent *e);
|
||||
extern void HandleOnEditTextCancel(void);
|
||||
|
||||
static inline void CreateScenario(void) {_switch_mode = SM_EDITOR;}
|
||||
|
||||
static inline void SetNewLandscapeType(byte landscape)
|
||||
{
|
||||
_opt_newgame.landscape = landscape;
|
||||
InvalidateWindowClasses(WC_SELECT_GAME);
|
||||
}
|
||||
|
||||
static void SelectGameWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
/* We do +/- 6 for the map_xy because 64 is 2^6, but it is the lowest available element */
|
||||
static const StringID mapsizes[] = {STR_64, STR_128, STR_256, STR_512, STR_1024, STR_2048, INVALID_STRING_ID};
|
||||
|
||||
switch (e->event) {
|
||||
case WE_PAINT:
|
||||
w->click_state = (w->click_state & ~(0xC0) & ~(0xF << 12)) | (1 << (_new_opt.landscape+12)) | (!_networking?(1<<6):(1<<7));
|
||||
w->disabled_state = _networking ? 0x30 : 0;
|
||||
SET_DPARAM16(0, STR_6801_EASY + _new_opt.diff_level);
|
||||
w->click_state = (w->click_state & ~(1 << 14) & ~(0xF << 6)) | (1 << (_opt_newgame.landscape + 6)) | (1 << 14);
|
||||
SetDParam(0, STR_6801_EASY + _opt_newgame.diff_level);
|
||||
DrawWindowWidgets(w);
|
||||
|
||||
DrawStringRightAligned(216, 121, STR_MAPSIZE, 0);
|
||||
DrawString(223, 121, mapsizes[_patches.map_x - 6], 0x10);
|
||||
DrawString(270, 121, STR_BY, 0);
|
||||
DrawString(283, 121, mapsizes[_patches.map_y - 6], 0x10);
|
||||
break;
|
||||
|
||||
case WE_CLICK:
|
||||
switch(e->click.widget) {
|
||||
case 2: DoCommandP(0, 0, 0, NULL, CMD_START_NEW_GAME); break;
|
||||
switch (e->click.widget) {
|
||||
case 2: AskForNewGameToStart(); break;
|
||||
case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
|
||||
case 4: ShowPatchesSelection(); break;
|
||||
case 5: DoCommandP(0, InteractiveRandom(), 0, NULL, CMD_CREATE_SCENARIO); break;
|
||||
case 6:
|
||||
if (_networking)
|
||||
DoCommandP(0, 0, 0, NULL, CMD_SET_SINGLE_PLAYER);
|
||||
case 4: CreateScenario(); break;
|
||||
case 5: ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
|
||||
case 6: case 7: case 8: case 9:
|
||||
SetNewLandscapeType(e->click.widget - 6);
|
||||
break;
|
||||
case 7:
|
||||
case 10: case 11: /* Mapsize X */
|
||||
ShowDropDownMenu(w, mapsizes, _patches.map_x - 6, 11, 0, 0);
|
||||
break;
|
||||
case 12: case 13: /* Mapsize Y */
|
||||
ShowDropDownMenu(w, mapsizes, _patches.map_y - 6, 13, 0, 0);
|
||||
break;
|
||||
case 15:
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (!_network_available) {
|
||||
ShowErrorMessage(-1,STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
|
||||
} else {
|
||||
ShowErrorMessage(INVALID_STRING_ID, STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
|
||||
} else
|
||||
ShowNetworkGameWindow();
|
||||
ShowErrorMessage(-1, TEMP_STRING_NO_NETWORK, 0, 0);
|
||||
}
|
||||
#else
|
||||
ShowErrorMessage(INVALID_STRING_ID ,STR_NETWORK_ERR_NOTAVAILABLE, 0, 0);
|
||||
#endif
|
||||
break;
|
||||
case 8: ShowGameOptions(); break;
|
||||
case 9: ShowGameDifficulty(); break;
|
||||
case 10:ShowSaveLoadDialog(SLD_LOAD_SCENARIO); break;
|
||||
case 11:AskExitGame(); break;
|
||||
case 12: case 13: case 14: case 15:
|
||||
DoCommandP(0, e->click.widget - 12, 0, NULL, CMD_SET_NEW_LANDSCAPE_TYPE);
|
||||
break;
|
||||
}
|
||||
case WE_KEYPRESS:
|
||||
switch(e->keypress.keycode) {
|
||||
case WKC_BACKQUOTE: IConsoleSwitch(); break;
|
||||
case 16: ShowGameOptions(); break;
|
||||
case 17: ShowGameDifficulty(); break;
|
||||
case 18: ShowPatchesSelection(); break;
|
||||
case 19: AskExitGame(); break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
|
||||
case WE_ON_EDIT_TEXT_CANCEL: HandleOnEditTextCancel(); break;
|
||||
|
||||
case WE_DROPDOWN_SELECT: /* Mapsize selection */
|
||||
switch (e->dropdown.button) {
|
||||
case 11: _patches.map_x = e->dropdown.index + 6; break;
|
||||
case 13: _patches.map_y = e->dropdown.index + 6; break;
|
||||
}
|
||||
SetWindowDirty(w);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static const WindowDesc _select_game_desc = {
|
||||
@@ -90,132 +121,73 @@ static const WindowDesc _select_game_desc = {
|
||||
SelectGameWndProc
|
||||
};
|
||||
|
||||
void ShowSelectGameWindow()
|
||||
void ShowSelectGameWindow(void)
|
||||
{
|
||||
AllocateWindowDesc(&_select_game_desc);
|
||||
}
|
||||
|
||||
|
||||
// p1 = mode
|
||||
// 0 - start new game
|
||||
// 1 - close new game dialog
|
||||
|
||||
int32 CmdStartNewGame(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
void GenRandomNewGame(uint32 rnd1, uint32 rnd2)
|
||||
{
|
||||
if (!(flags & DC_EXEC))
|
||||
return 0;
|
||||
_random_seeds[0][0] = rnd1;
|
||||
_random_seeds[0][1] = rnd2;
|
||||
|
||||
switch(p1) {
|
||||
case 0: // show select game window
|
||||
AskForNewGameToStart();
|
||||
break;
|
||||
case 1: // close select game window
|
||||
DeleteWindowById(WC_SAVELOAD, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
SwitchMode(SM_NEWGAME);
|
||||
}
|
||||
|
||||
int32 CmdGenRandomNewGame(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
void StartScenarioEditor(uint32 rnd1, uint32 rnd2)
|
||||
{
|
||||
if (!(flags & DC_EXEC))
|
||||
return 0;
|
||||
_random_seeds[0][0] = rnd1;
|
||||
_random_seeds[0][1] = rnd2;
|
||||
|
||||
// this forces stuff into test mode.
|
||||
_docommand_recursive = 0;
|
||||
|
||||
_random_seeds[0][0] = p1;
|
||||
_random_seeds[0][1] = p2;
|
||||
|
||||
if (_networking) { NetworkStartSync(true); }
|
||||
|
||||
MakeNewGame();
|
||||
return 0;
|
||||
SwitchMode(SM_START_SCENARIO);
|
||||
}
|
||||
|
||||
int32 CmdLoadGame(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (!(flags & DC_EXEC))
|
||||
return 0;
|
||||
|
||||
// ShowSaveLoadDialog(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 CmdCreateScenario(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (!(flags & DC_EXEC))
|
||||
return 0;
|
||||
|
||||
_switch_mode = SM_EDITOR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 CmdSetSinglePlayer(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
printf("CmdSetSinglePlayer\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 CmdStartScenario(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (!(flags & DC_EXEC))
|
||||
return 0;
|
||||
|
||||
// this forces stuff into test mode.
|
||||
_docommand_recursive = 0;
|
||||
|
||||
_random_seeds[0][0] = p1;
|
||||
_random_seeds[0][1] = p2;
|
||||
|
||||
if (_networking) { NetworkStartSync(true); }
|
||||
|
||||
StartScenario();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static const Widget _ask_abandon_game_widgets[] = {
|
||||
{ WWT_TEXTBTN, 4, 0, 10, 0, 13, STR_00C5, STR_NULL},
|
||||
{ WWT_CAPTION, 4, 11, 179, 0, 13, STR_00C7_QUIT, STR_NULL},
|
||||
{ WWT_IMGBTN, 4, 0, 179, 14, 91, 0x0, STR_NULL},
|
||||
{ WWT_TEXTBTN, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL},
|
||||
{ WWT_TEXTBTN, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL},
|
||||
{ WIDGETS_END},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_00C7_QUIT, STR_NULL},
|
||||
{ WWT_IMGBTN, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL},
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
static void AskAbandonGameWndProc(Window *w, WindowEvent *e) {
|
||||
switch(e->event) {
|
||||
static void AskAbandonGameWndProc(Window* w, WindowEvent* e)
|
||||
{
|
||||
switch (e->event) {
|
||||
case WE_PAINT:
|
||||
DrawWindowWidgets(w);
|
||||
#if defined(_WIN32)
|
||||
SET_DPARAM16(0, STR_0133_WINDOWS);
|
||||
SetDParam(0, STR_0133_WINDOWS);
|
||||
#elif defined(__APPLE__)
|
||||
SET_DPARAM16(0, STR_0135_OSX);
|
||||
SetDParam(0, STR_0135_OSX);
|
||||
#elif defined(__BEOS__)
|
||||
SET_DPARAM16(0, STR_OSNAME_BEOS);
|
||||
SetDParam(0, STR_OSNAME_BEOS);
|
||||
#elif defined(__MORPHOS__)
|
||||
SET_DPARAM16(0, STR_OSNAME_MORPHOS);
|
||||
SetDParam(0, STR_OSNAME_MORPHOS);
|
||||
#elif defined(__AMIGA__)
|
||||
SetDParam(0, STR_OSNAME_AMIGAOS);
|
||||
#elif defined(__OS2__)
|
||||
SetDParam(0, STR_OSNAME_OS2);
|
||||
#else
|
||||
SET_DPARAM16(0, STR_0134_UNIX);
|
||||
SetDParam(0, STR_0134_UNIX);
|
||||
#endif
|
||||
DrawStringMultiCenter(0x5A, 0x26, STR_00CA_ARE_YOU_SURE_YOU_WANT_TO, 178);
|
||||
DrawStringMultiCenter(90, 38, STR_00CA_ARE_YOU_SURE_YOU_WANT_TO, 178);
|
||||
return;
|
||||
|
||||
case WE_CLICK:
|
||||
switch(e->click.widget) {
|
||||
case 3:
|
||||
DeleteWindow(w);
|
||||
break;
|
||||
case 4:
|
||||
_exit_game = true;
|
||||
break;
|
||||
switch (e->click.widget) {
|
||||
case 3: DeleteWindow(w); break;
|
||||
case 4: _exit_game = true; break;
|
||||
}
|
||||
break;
|
||||
|
||||
case WE_KEYPRESS: /* Exit game on pressing 'Enter' */
|
||||
if (e->keypress.keycode == WKC_RETURN)
|
||||
_exit_game = true;
|
||||
switch (e->keypress.keycode) {
|
||||
case WKC_RETURN:
|
||||
case WKC_NUM_ENTER:
|
||||
_exit_game = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -228,41 +200,44 @@ static const WindowDesc _ask_abandon_game_desc = {
|
||||
AskAbandonGameWndProc
|
||||
};
|
||||
|
||||
void AskExitGame()
|
||||
void AskExitGame(void)
|
||||
{
|
||||
AllocateWindowDescFront(&_ask_abandon_game_desc, 0);
|
||||
}
|
||||
|
||||
|
||||
static const Widget _ask_quit_game_widgets[] = {
|
||||
{ WWT_TEXTBTN, 4, 0, 10, 0, 13, STR_00C5, STR_NULL},
|
||||
{ WWT_CAPTION, 4, 11, 179, 0, 13, STR_0161_QUIT_GAME, STR_NULL},
|
||||
{ WWT_IMGBTN, 4, 0, 179, 14, 91, 0x0, STR_NULL},
|
||||
{ WWT_TEXTBTN, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL},
|
||||
{ WWT_TEXTBTN, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL},
|
||||
{ WIDGETS_END},
|
||||
{ WWT_CLOSEBOX, RESIZE_NONE, 4, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
|
||||
{ WWT_CAPTION, RESIZE_NONE, 4, 11, 179, 0, 13, STR_0161_QUIT_GAME, STR_NULL},
|
||||
{ WWT_IMGBTN, RESIZE_NONE, 4, 0, 179, 14, 91, 0x0, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 12, 25, 84, 72, 83, STR_00C9_NO, STR_NULL},
|
||||
{ WWT_TEXTBTN, RESIZE_NONE, 12, 95, 154, 72, 83, STR_00C8_YES, STR_NULL},
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
static void AskQuitGameWndProc(Window *w, WindowEvent *e) {
|
||||
switch(e->event) {
|
||||
case WE_PAINT:
|
||||
DrawWindowWidgets(w);
|
||||
DrawStringMultiCenter(0x5A, 0x26,
|
||||
_game_mode != GM_EDITOR ? STR_0160_ARE_YOU_SURE_YOU_WANT_TO :
|
||||
STR_029B_ARE_YOU_SURE_YOU_WANT_TO,
|
||||
178);
|
||||
return;
|
||||
static void AskQuitGameWndProc(Window* w, WindowEvent* e)
|
||||
{
|
||||
switch (e->event) {
|
||||
case WE_PAINT:
|
||||
DrawWindowWidgets(w);
|
||||
DrawStringMultiCenter(
|
||||
90, 38,
|
||||
_game_mode != GM_EDITOR ?
|
||||
STR_0160_ARE_YOU_SURE_YOU_WANT_TO : STR_029B_ARE_YOU_SURE_YOU_WANT_TO,
|
||||
178
|
||||
);
|
||||
break;
|
||||
|
||||
case WE_CLICK:
|
||||
switch(e->click.widget) {
|
||||
case 3:
|
||||
DeleteWindow(w);
|
||||
case WE_CLICK:
|
||||
switch (e->click.widget) {
|
||||
case 3: DeleteWindow(w); break;
|
||||
case 4: _switch_mode = SM_MENU; break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
_switch_mode = SM_MENU;
|
||||
|
||||
case WE_KEYPRESS: /* Return to main menu on pressing 'Enter' */
|
||||
if (e->keypress.keycode == WKC_RETURN) _switch_mode = SM_MENU;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,17 +250,7 @@ static const WindowDesc _ask_quit_game_desc = {
|
||||
};
|
||||
|
||||
|
||||
void AskExitToGameMenu()
|
||||
void AskExitToGameMenu(void)
|
||||
{
|
||||
AllocateWindowDescFront(&_ask_quit_game_desc, 0);
|
||||
}
|
||||
|
||||
int32 CmdSetNewLandscapeType(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
if (flags & DC_EXEC) {
|
||||
// XXX: some stuff
|
||||
_new_opt.landscape = p1;
|
||||
InvalidateWindowClasses(WC_SELECT_GAME);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
README
|
||||
------------------------------------------------------------------------
|
||||
All bugs listed below are marked as known. Please do not submit any bugs
|
||||
that are the same as these. If you do, don't act surprised, because
|
||||
we WILL flame you!!
|
||||
|
||||
There is an experimental AI included in the game which you can enable
|
||||
from the "Configure Patches" window. All bugs related to this AI should
|
||||
go to: http://www.tt-forums.net/viewtopic.php?t=9576
|
||||
|
||||
Of course if you have more knowledge about any of these bugs, have more
|
||||
specifics, we welcome you to report them. React to the given bug indicated
|
||||
by the number below on http://sourceforge.net/tracker/?group_id=103924&atid=636365
|
||||
or http://bugs.openttd.org.
|
||||
If the the bug report is closed, it has been fixed, which then can be verified
|
||||
in the latest SVN version.
|
||||
|
||||
Bugs for 0.4.5
|
||||
------------------------------------------------------------------------
|
||||
URL: http://bugs.openttd.org
|
||||
|
||||
-20 Saving files when run from gdb
|
||||
-45 NORETURN wrongly declared for gcc
|
||||
-46 Some if, for, switch and while have no space before (
|
||||
-47 rating calculation and cargo loading priority
|
||||
-9 [MorphOS] write to NULL when going to device root in filerequester
|
||||
-8 [MorphOS] game crashes if no TCP/IP stack is loaded
|
||||
|
||||
------------------------------------------------------------------------
|
||||
URL: http://sourceforge.net/tracker/?atid=636365&group_id=103924&func=browse
|
||||
|
||||
-1417453 Makefile and Variables issue
|
||||
-1415782 crash in string code with openbsd/zaurus
|
||||
-1397638 Economics bug?
|
||||
-1395628 Trackpad panning/scrolling broken
|
||||
-1394799 Dual headed engines disagreement
|
||||
-1393415 NPF & one-way sigs
|
||||
-1393411 "Void Order" reporting.
|
||||
-1390260 Mis-reporting of Plane Crash
|
||||
-1389999 Child windows not sticking
|
||||
-1389986 Shares problem (nightly 3330)
|
||||
-1380497 problems with competitors during multiplayer
|
||||
-1372772 Train gets lost between two stations
|
||||
-1366446 different names for patches
|
||||
-1362784 Incorrect vehicule profit calcul with inflation on
|
||||
-1299162 Music volume too low
|
||||
-1288024 Strange string on OTTD initial screen
|
||||
-1250094 Towns Shrink when center tile is built on
|
||||
-1244842 Multiplayer interface bug (0.4.0.1)
|
||||
-1212267 station visited twice when servicing
|
||||
-1211764 AI companies behave weird on the stock market
|
||||
-1208170 Duplicate station names can be created
|
||||
-1197116 Some stations are cargo-less
|
||||
-1188897 Station with cargo enroute_from INVALID_STATION
|
||||
-1181888 Invaild Station Order => Crash
|
||||
-1174829 Waypoint / Orders Bug
|
||||
-1168820 Some mouse and keyboard events are lost
|
||||
-1167810 Cargo payment after deleting stations (st->xy = 0)
|
||||
-1157244 Can't save game if name contains german umlauts
|
||||
-1116638 "More, but smaller changes" deficiency
|
||||
-1106356 re-offered prototypes
|
||||
-1085486 Subsidies: Only count when station is in right suburb
|
||||
|
||||
Minor Bugs for 0.4.5
|
||||
------------------------------------------------------------------------
|
||||
URL: http://sourceforge.net/tracker/?atid=669662&group_id=103924&func=browse
|
||||
|
||||
-1412033 autoreplace not possible on monorail/maglev trains
|
||||
-1412031 fast forward scrolling is also fast forward :)
|
||||
-1395489 Nightly 3358 Linux Driver warnings
|
||||
-1394316 Multistop traffic jam
|
||||
-1394231 Autorenew glitch on helicopters
|
||||
-1387424 overtake insolvent company is to cheap
|
||||
-1382782 Loan interest calculated 'wrong'
|
||||
-1372891 Performance loss with NTP & NPF
|
||||
-1342383 Last built rail type not cleared when starting new game
|
||||
-1296259 Autosave override for multiplayer games
|
||||
-1254226 giant screenshot crashes multiplayer
|
||||
-1242753 Town population minus 10
|
||||
-1236320 Bug in main menu allows moving screen
|
||||
-1201284 permanent hilight in a depot
|
||||
-1193870 keep the date counter running
|
||||
-1185852 Scrollbars get arbitrarily small
|
||||
-1184634 Replace vehicles window bug
|
||||
-1183253 Incorrect Load vs Loading Sprites
|
||||
-1183251 Hangar sprite does not update when refit.
|
||||
-1160732 little bug with transparency
|
||||
-1153937 Game wont run from a start menu shortcut
|
||||
-1117731 Editor-StartingDate
|
||||
-1114237 Wrong autoreplace hint
|
||||
-1108046 game freezes
|
||||
-1106889 Chat Interface enhancements
|
||||
-1104358 train lost message - history
|
||||
-1102174 Bug if 3 people buy 25% shares in one company
|
||||
-1087407 wrong message in history
|
||||
-1084620 Minor bug considering buses/trucks
|
||||
-1034310 color mauve in diagrams
|
||||
-1030661 It's possible to build a tunnel under oil wells
|
||||
-1009171 Canals and locks at sea level cause flooding
|
||||
-0993516 Canal + bouy -> wrong graphics.
|
||||
-0987891 Large UFO destruction bug
|
||||
-0987883 Aircraft landing/taking off
|
||||
-0987880 company league table updating
|
||||
-0985924 aircraft taxi speed
|
||||
-0941694 Clipping problems stations/vehicles on slopes
|
||||
+265
-331
@@ -1,18 +1,18 @@
|
||||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "ttd.h"
|
||||
#include "openttd.h"
|
||||
#include "functions.h"
|
||||
#include "map.h"
|
||||
#include "player.h"
|
||||
#include "spritecache.h"
|
||||
#include "table/sprites.h"
|
||||
#include "tile.h"
|
||||
#include <stdarg.h>
|
||||
#include "gfx.h"
|
||||
#include "viewport.h"
|
||||
#include "command.h"
|
||||
#include "vehicle.h"
|
||||
|
||||
byte _map_type_and_height[TILES_X * TILES_Y];
|
||||
byte _map5[TILES_X * TILES_Y];
|
||||
byte _map3_lo[TILES_X * TILES_Y];
|
||||
byte _map3_hi[TILES_X * TILES_Y];
|
||||
byte _map_owner[TILES_X * TILES_Y];
|
||||
byte _map2[TILES_X * TILES_Y];
|
||||
byte _map_extra_bits[TILES_X * TILES_Y/4];
|
||||
#include "variables.h"
|
||||
|
||||
extern const TileTypeProcs
|
||||
_tile_type_clear_procs,
|
||||
@@ -47,84 +47,37 @@ const byte _tileh_to_sprite[32] = {
|
||||
0,0,0,0,0,0,0,16,0,0,0,17,0,15,18,0,
|
||||
};
|
||||
|
||||
uint GetTileSlope(uint tile, int *h)
|
||||
const byte _inclined_tileh[] = {
|
||||
3, 9, 3, 6, 12, 6, 12, 9
|
||||
};
|
||||
|
||||
|
||||
void FindLandscapeHeightByTile(TileInfo *ti, TileIndex tile)
|
||||
{
|
||||
uint a,b,c,d,min;
|
||||
int r;
|
||||
|
||||
if (GET_TILE_X(tile) == TILE_X_MAX || GET_TILE_Y(tile) == TILE_Y_MAX) {
|
||||
if (h)
|
||||
*h = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(tile < TILES_X * TILES_Y && GET_TILE_X(tile) != TILE_X_MAX && GET_TILE_Y(tile) != TILE_Y_MAX);
|
||||
|
||||
min = a = _map_type_and_height[tile] & 0xF;
|
||||
b = _map_type_and_height[tile+TILE_XY(1,0)] & 0xF;
|
||||
if (min >= b) min = b;
|
||||
c = _map_type_and_height[tile+TILE_XY(0,1)] & 0xF;
|
||||
if (min >= c) min = c;
|
||||
d = _map_type_and_height[tile+TILE_XY(1,1)] & 0xF;
|
||||
if (min >= d) min = d;
|
||||
|
||||
r = 0;
|
||||
if ((a-=min)!=0) { r += (--a << 4) + 8; }
|
||||
if ((c-=min)!=0) { r += (--c << 4) + 4; }
|
||||
if ((d-=min)!=0) { r += (--d << 4) + 2; }
|
||||
if ((b-=min)!=0) { r += (--b << 4) + 1; }
|
||||
|
||||
if (h != 0)
|
||||
*h = min * 8;
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
int GetTileZ(uint tile)
|
||||
{
|
||||
int h;
|
||||
GetTileSlope(tile, &h);
|
||||
return h;
|
||||
}
|
||||
|
||||
void FindLandscapeHeightByTile(TileInfo *ti, uint tile)
|
||||
{
|
||||
if (GET_TILE_X(tile) == TILE_X_MAX ||
|
||||
GET_TILE_Y(tile) == TILE_Y_MAX) {
|
||||
ti->tileh = 0;
|
||||
ti->type = MP_STRANGE;
|
||||
ti->tile = 0;
|
||||
ti->map5 = 0;
|
||||
ti->z = 0;
|
||||
return;
|
||||
}
|
||||
assert(tile < MapSize());
|
||||
|
||||
ti->tile = tile;
|
||||
ti->map5 = _map5[tile];
|
||||
ti->type = GET_TILETYPE(tile);
|
||||
ti->map5 = _m[tile].m5;
|
||||
ti->type = GetTileType(tile);
|
||||
ti->tileh = GetTileSlope(tile, &ti->z);
|
||||
// ti->z = min * 8;
|
||||
}
|
||||
|
||||
/* find the landscape height for the coordinates x y */
|
||||
void FindLandscapeHeight(TileInfo *ti, uint x, uint y)
|
||||
{
|
||||
int tile;
|
||||
|
||||
ti->x = x;
|
||||
ti->y = y;
|
||||
|
||||
if (x >= TILE_X_MAX*16-1 || y >= TILE_Y_MAX*16-1) {
|
||||
if (x >= MapMaxX() * 16 - 1 || y >= MapMaxY() * 16 - 1) {
|
||||
ti->tileh = 0;
|
||||
ti->type = MP_STRANGE;
|
||||
ti->type = MP_VOID;
|
||||
ti->tile = 0;
|
||||
ti->map5 = 0;
|
||||
ti->z = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
tile = TILE_FROM_XY(x,y);
|
||||
FindLandscapeHeightByTile(ti, tile);
|
||||
FindLandscapeHeightByTile(ti, TileVirtXY(x, y));
|
||||
}
|
||||
|
||||
uint GetPartialZ(int x, int y, int corners)
|
||||
@@ -225,38 +178,29 @@ uint GetPartialZ(int x, int y, int corners)
|
||||
uint GetSlopeZ(int x, int y)
|
||||
{
|
||||
TileInfo ti;
|
||||
// int z;
|
||||
|
||||
FindLandscapeHeight(&ti, x, y);
|
||||
|
||||
/*
|
||||
z = ti.z;
|
||||
x &= 0xF;
|
||||
y &= 0xF;
|
||||
|
||||
|
||||
assert(z < 256);
|
||||
*/
|
||||
return _tile_type_procs[ti.type]->get_slope_z_proc(&ti);
|
||||
}
|
||||
|
||||
// direction=true: check for foundation in east and south corner
|
||||
// direction=false: check for foundation in west and south corner
|
||||
bool hasFoundation(TileInfo *ti, bool direction)
|
||||
static bool hasFoundation(const TileInfo* ti, bool direction)
|
||||
{
|
||||
bool south, other; // southern corner and east/west corner
|
||||
uint slope = _tile_type_procs[ti->type]->get_slope_tileh_proc(ti);
|
||||
uint tileh = ti->tileh;
|
||||
|
||||
if(slope==0 && slope!=tileh) tileh=15;
|
||||
if (slope == 0 && slope != tileh) tileh = 15;
|
||||
south = (tileh & 2) != (slope & 2);
|
||||
|
||||
if(direction)
|
||||
if (direction) {
|
||||
other = (tileh & 4) != (slope & 4);
|
||||
else
|
||||
} else {
|
||||
other = (tileh & 1) != (slope & 1);
|
||||
}
|
||||
return south || other;
|
||||
|
||||
}
|
||||
|
||||
void DrawFoundation(TileInfo *ti, uint f)
|
||||
@@ -264,16 +208,16 @@ void DrawFoundation(TileInfo *ti, uint f)
|
||||
uint32 sprite_base = SPR_SLOPES_BASE-14;
|
||||
|
||||
TileInfo ti2;
|
||||
FindLandscapeHeight(&ti2, ti->x, ti->y-1);
|
||||
if(hasFoundation( &ti2, true )) sprite_base += 22; // foundation in NW direction
|
||||
FindLandscapeHeight(&ti2, ti->x-1, ti->y);
|
||||
if(hasFoundation( &ti2, false )) sprite_base += 22*2; // foundation in NE direction
|
||||
FindLandscapeHeight(&ti2, ti->x, ti->y - 1);
|
||||
if (hasFoundation(&ti2, true)) sprite_base += 22; // foundation in NW direction
|
||||
FindLandscapeHeight(&ti2, ti->x - 1, ti->y);
|
||||
if (hasFoundation(&ti2, false)) sprite_base += 22 * 2; // foundation in NE direction
|
||||
|
||||
if (f < 15) {
|
||||
// leveled foundation
|
||||
if( sprite_base < SPR_SLOPES_BASE ) sprite_base = 990; // use original slope sprites
|
||||
if (sprite_base < SPR_SLOPES_BASE) sprite_base = SPR_FOUNDATION_BASE + 1; // use original slope sprites
|
||||
|
||||
AddSortableSpriteToDraw(f-1 + sprite_base, ti->x, ti->y, 16, 16, 7, ti->z);
|
||||
AddSortableSpriteToDraw(f - 1 + sprite_base, ti->x, ti->y, 16, 16, 7, ti->z);
|
||||
ti->z += 8;
|
||||
ti->tileh = 0;
|
||||
OffsetGroundSprite(31, 1);
|
||||
@@ -282,7 +226,7 @@ void DrawFoundation(TileInfo *ti, uint f)
|
||||
sprite_base += 14;
|
||||
|
||||
AddSortableSpriteToDraw(
|
||||
HASBIT( (1<<1) | (1<<2) | (1<<4) | (1<<8), ti->tileh) ? sprite_base + (f - 15) : ti->tileh + 0x3DE - 1,
|
||||
HASBIT((1<<1) | (1<<2) | (1<<4) | (1<<8), ti->tileh) ? sprite_base + (f - 15) : SPR_FOUNDATION_BASE + ti->tileh,
|
||||
ti->x, ti->y, 1, 1, 1, ti->z
|
||||
);
|
||||
|
||||
@@ -291,7 +235,7 @@ void DrawFoundation(TileInfo *ti, uint f)
|
||||
}
|
||||
}
|
||||
|
||||
void DoClearSquare(uint tile)
|
||||
void DoClearSquare(TileIndex tile)
|
||||
{
|
||||
ModifyTile(tile,
|
||||
MP_SETTYPE(MP_CLEAR) |
|
||||
@@ -301,30 +245,30 @@ void DoClearSquare(uint tile)
|
||||
);
|
||||
}
|
||||
|
||||
uint32 GetTileTrackStatus(uint tile, TransportType mode)
|
||||
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode)
|
||||
{
|
||||
return _tile_type_procs[GET_TILETYPE(tile)]->get_tile_track_status_proc(tile, mode);
|
||||
return _tile_type_procs[GetTileType(tile)]->get_tile_track_status_proc(tile, mode);
|
||||
}
|
||||
|
||||
void ChangeTileOwner(uint tile, byte old_player, byte new_player)
|
||||
void ChangeTileOwner(TileIndex tile, byte old_player, byte new_player)
|
||||
{
|
||||
_tile_type_procs[GET_TILETYPE(tile)]->change_tile_owner_proc(tile, old_player, new_player);
|
||||
_tile_type_procs[GetTileType(tile)]->change_tile_owner_proc(tile, old_player, new_player);
|
||||
}
|
||||
|
||||
void GetAcceptedCargo(uint tile, AcceptedCargo *ac)
|
||||
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac)
|
||||
{
|
||||
memset(ac, 0, sizeof(AcceptedCargo));
|
||||
_tile_type_procs[GET_TILETYPE(tile)]->get_accepted_cargo_proc(tile, ac);
|
||||
_tile_type_procs[GetTileType(tile)]->get_accepted_cargo_proc(tile, ac);
|
||||
}
|
||||
|
||||
void AnimateTile(uint tile)
|
||||
void AnimateTile(TileIndex tile)
|
||||
{
|
||||
_tile_type_procs[GET_TILETYPE(tile)]->animate_tile_proc(tile);
|
||||
_tile_type_procs[GetTileType(tile)]->animate_tile_proc(tile);
|
||||
}
|
||||
|
||||
void ClickTile(uint tile)
|
||||
void ClickTile(TileIndex tile)
|
||||
{
|
||||
_tile_type_procs[GET_TILETYPE(tile)]->click_tile_proc(tile);
|
||||
_tile_type_procs[GetTileType(tile)]->click_tile_proc(tile);
|
||||
}
|
||||
|
||||
void DrawTile(TileInfo *ti)
|
||||
@@ -332,109 +276,117 @@ void DrawTile(TileInfo *ti)
|
||||
_tile_type_procs[ti->type]->draw_tile_proc(ti);
|
||||
}
|
||||
|
||||
void GetTileDesc(uint tile, TileDesc *td)
|
||||
void GetTileDesc(TileIndex tile, TileDesc *td)
|
||||
{
|
||||
_tile_type_procs[GET_TILETYPE(tile)]->get_tile_desc_proc(tile, td);
|
||||
_tile_type_procs[GetTileType(tile)]->get_tile_desc_proc(tile, td);
|
||||
}
|
||||
|
||||
/* Clear a piece of landscape
|
||||
* p1 = 0,
|
||||
* p2 = 0
|
||||
/** Clear a piece of landscape
|
||||
* @param x,y coordinates of clearance
|
||||
* @param p1 unused
|
||||
* @param p2 unused
|
||||
*/
|
||||
|
||||
int32 CmdLandscapeClear(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
uint tile;
|
||||
TileIndex tile = TileVirtXY(x, y);
|
||||
|
||||
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
||||
|
||||
tile = TILE_FROM_XY(x,y);
|
||||
return _tile_type_procs[GET_TILETYPE(tile)]->clear_tile_proc(tile, flags);
|
||||
return _tile_type_procs[GetTileType(tile)]->clear_tile_proc(tile, flags);
|
||||
}
|
||||
|
||||
// p1 = end tile
|
||||
/** Clear a big piece of landscape
|
||||
* @param x,y end coordinates of area dragging
|
||||
* @param p1 start tile of area dragging
|
||||
* @param p2 unused
|
||||
*/
|
||||
int32 CmdClearArea(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
|
||||
{
|
||||
int32 cost,ret, money;
|
||||
int32 cost, ret, money;
|
||||
int sx,sy;
|
||||
int x,y;
|
||||
bool success = false;
|
||||
|
||||
if (p1 >= MapSize()) return CMD_ERROR;
|
||||
|
||||
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
|
||||
|
||||
// make sure sx,sy are smaller than ex,ey
|
||||
sx = GET_TILE_X(p1)*16;
|
||||
sy = GET_TILE_Y(p1)*16;
|
||||
sx = TileX(p1) * 16;
|
||||
sy = TileY(p1) * 16;
|
||||
if (ex < sx) intswap(ex, sx);
|
||||
if (ey < sy) intswap(ey, sy);
|
||||
|
||||
money = GetAvailableMoneyForCommand();
|
||||
cost = 0;
|
||||
|
||||
for(x=sx; x<=ex; x+=16) {
|
||||
for(y=sy; y<=ey; y+=16) {
|
||||
ret = DoCommandByTile(TILE_FROM_XY(x,y), 0, 0, flags &~DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
if (ret == CMD_ERROR) continue;
|
||||
for (x = sx; x <= ex; x += 16) {
|
||||
for (y = sy; y <= ey; y += 16) {
|
||||
ret = DoCommandByTile(TileVirtXY(x, y), 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
if (CmdFailed(ret)) continue;
|
||||
cost += ret;
|
||||
success = true;
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
if ( ret>0 && (money -= ret) < 0) {
|
||||
if (ret > 0 && (money -= ret) < 0) {
|
||||
_additional_cash_required = ret;
|
||||
return cost - ret;
|
||||
}
|
||||
DoCommandByTile(TILE_FROM_XY(x,y), 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||
DoCommandByTile(TileVirtXY(x, y), 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||
|
||||
// draw explosion animation...
|
||||
if ((x==sx || x==ex) && (y==sy || y==ey)) {
|
||||
if ((x == sx || x == ex) && (y == sy || y == ey)) {
|
||||
// big explosion in each corner, or small explosion for single tiles
|
||||
CreateEffectVehicleAbove(x + 8,y + 8, 2, sy==ey && sx==ex ? EV_DEMOLISH : EV_CRASHED_SMOKE);
|
||||
CreateEffectVehicleAbove(x + 8, y + 8, 2,
|
||||
sy == ey && sx == ex ? EV_EXPLOSION_SMALL : EV_EXPLOSION_LARGE
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!success)
|
||||
cost = CMD_ERROR;
|
||||
return cost;
|
||||
return (success) ? cost : CMD_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* utility function used to modify a tile */
|
||||
void CDECL ModifyTile(uint tile, uint flags, ...)
|
||||
void CDECL ModifyTile(TileIndex tile, uint flags, ...)
|
||||
{
|
||||
va_list va;
|
||||
int i;
|
||||
|
||||
va_start(va, flags);
|
||||
|
||||
if ((i = (flags >> 8) & 0xF) != 0) {
|
||||
_map_type_and_height[tile] = (_map_type_and_height[tile]&~0xF0)|((i-1) << 4);
|
||||
if ((i = GB(flags, 8, 4)) != 0) {
|
||||
SetTileType(tile, i - 1);
|
||||
}
|
||||
|
||||
if (flags & (MP_MAP2_CLEAR | MP_MAP2)) {
|
||||
int x = 0;
|
||||
if (flags & MP_MAP2) x = va_arg(va, int);
|
||||
_map2[tile] = x;
|
||||
_m[tile].m2 = x;
|
||||
}
|
||||
|
||||
if (flags & (MP_MAP3LO_CLEAR | MP_MAP3LO)) {
|
||||
int x = 0;
|
||||
if (flags & MP_MAP3LO) x = va_arg(va, int);
|
||||
_map3_lo[tile] = x;
|
||||
_m[tile].m3 = x;
|
||||
}
|
||||
|
||||
if (flags & (MP_MAP3HI_CLEAR | MP_MAP3HI)) {
|
||||
int x = 0;
|
||||
if (flags & MP_MAP3HI) x = va_arg(va, int);
|
||||
_map3_hi[tile] = x;
|
||||
_m[tile].m4 = x;
|
||||
}
|
||||
|
||||
if (flags & (MP_MAPOWNER|MP_MAPOWNER_CURRENT)) {
|
||||
byte x = _current_player;
|
||||
PlayerID x = _current_player;
|
||||
if (flags & MP_MAPOWNER) x = va_arg(va, int);
|
||||
_map_owner[tile] = x;
|
||||
_m[tile].m1 = x;
|
||||
}
|
||||
|
||||
if (flags & MP_MAP5) {
|
||||
_map5[tile] = va_arg(va, int);
|
||||
_m[tile].m5 = va_arg(va, int);
|
||||
}
|
||||
|
||||
va_end(va);
|
||||
@@ -443,81 +395,72 @@ void CDECL ModifyTile(uint tile, uint flags, ...)
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
|
||||
void SetMapExtraBits(uint tile, byte bits)
|
||||
{
|
||||
_map_extra_bits[tile >> 2] &= ~(3 << ((tile&3)*2));
|
||||
_map_extra_bits[tile >> 2] |= (bits&3) << ((tile&3)*2);
|
||||
}
|
||||
|
||||
uint GetMapExtraBits(uint tile)
|
||||
{
|
||||
return (_map_extra_bits[tile >> 2] >> (tile&3)*2)&3;
|
||||
}
|
||||
|
||||
#define TILELOOP_BITS 4
|
||||
#define TILELOOP_SIZE (1 << TILELOOP_BITS)
|
||||
#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << TILE_X_BITS))
|
||||
#define TILELOOP_CHKMASK (((1 << (TILE_X_BITS - TILELOOP_BITS))-1) << TILELOOP_BITS)
|
||||
#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
|
||||
#define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
|
||||
|
||||
void RunTileLoop()
|
||||
void RunTileLoop(void)
|
||||
{
|
||||
uint tile;
|
||||
TileIndex tile;
|
||||
uint count;
|
||||
|
||||
tile = _cur_tileloop_tile;
|
||||
|
||||
assert( (tile & ~TILELOOP_ASSERTMASK) == 0);
|
||||
count = (TILES_X/TILELOOP_SIZE) * (TILES_Y/TILELOOP_SIZE);
|
||||
count = (MapSizeX() / TILELOOP_SIZE) * (MapSizeY() / TILELOOP_SIZE);
|
||||
do {
|
||||
_tile_type_procs[GET_TILETYPE(tile)]->tile_loop_proc(tile);
|
||||
_tile_type_procs[GetTileType(tile)]->tile_loop_proc(tile);
|
||||
|
||||
if ( GET_TILE_X(tile) < TILES_X - TILELOOP_SIZE) {
|
||||
if (TileX(tile) < MapSizeX() - TILELOOP_SIZE) {
|
||||
tile += TILELOOP_SIZE; /* no overflow */
|
||||
} else {
|
||||
tile = TILE_MASK(tile - TILELOOP_SIZE * (TILES_X/TILELOOP_SIZE-1) + TILE_XY(0, TILELOOP_SIZE)); /* x would overflow, also increase y */
|
||||
tile = TILE_MASK(tile - TILELOOP_SIZE * (MapSizeX() / TILELOOP_SIZE - 1) + TileDiffXY(0, TILELOOP_SIZE)); /* x would overflow, also increase y */
|
||||
}
|
||||
} while (--count);
|
||||
assert( (tile & ~TILELOOP_ASSERTMASK) == 0);
|
||||
|
||||
tile += 9;
|
||||
if (tile & TILELOOP_CHKMASK)
|
||||
tile = (tile + TILES_X) & TILELOOP_ASSERTMASK;
|
||||
tile = (tile + MapSizeX()) & TILELOOP_ASSERTMASK;
|
||||
_cur_tileloop_tile = tile;
|
||||
}
|
||||
|
||||
void InitializeLandscape()
|
||||
void InitializeLandscape(void)
|
||||
{
|
||||
int i;
|
||||
uint map_size;
|
||||
uint i;
|
||||
|
||||
memset(_map_owner, OWNER_NONE, sizeof(_map_owner));
|
||||
memset(_map2, 0, sizeof(_map2));
|
||||
memset(_map3_lo, 0, sizeof(_map3_lo));
|
||||
memset(_map3_hi, 0, sizeof(_map3_hi));
|
||||
memset(_map_extra_bits, 0, sizeof(_map_extra_bits));
|
||||
memset(_map_type_and_height, MP_WATER << 4, sizeof(_map_type_and_height));
|
||||
|
||||
for(i=0; i!=TILES_Y-1; i++)
|
||||
memset(_map_type_and_height + i*TILES_X, 0, TILES_X-1);
|
||||
map_size = MapSize();
|
||||
for (i = 0; i < map_size; i++) {
|
||||
_m[i].type_height = MP_CLEAR << 4;
|
||||
_m[i].m1 = OWNER_NONE;
|
||||
_m[i].m2 = 0;
|
||||
_m[i].m3 = 0;
|
||||
_m[i].m4 = 0;
|
||||
_m[i].m5 = 3;
|
||||
_m[i].extra = 0;
|
||||
}
|
||||
|
||||
memset(_map5, 3, sizeof(_map5));
|
||||
// create void tiles at the border
|
||||
for (i = 0; i < MapMaxY(); ++i)
|
||||
SetTileType(i * MapSizeX() + MapMaxX(), MP_VOID);
|
||||
for (i = 0; i < MapSizeX(); ++i)
|
||||
SetTileType(MapSizeX() * MapMaxY() + i, MP_VOID);
|
||||
}
|
||||
|
||||
void ConvertGroundTilesIntoWaterTiles()
|
||||
void ConvertGroundTilesIntoWaterTiles(void)
|
||||
{
|
||||
uint tile = 0;
|
||||
int h;
|
||||
TileIndex tile = 0;
|
||||
uint h;
|
||||
|
||||
while(true) {
|
||||
if (IS_TILETYPE(tile, MP_CLEAR) && GetTileSlope(tile, &h) == 0 && h == 0) {
|
||||
_map_type_and_height[tile] = MP_WATER << 4;
|
||||
_map5[tile] = 0;
|
||||
_map_owner[tile] = OWNER_WATER;
|
||||
}
|
||||
tile++;
|
||||
if (GET_TILE_X(tile) == TILE_X_MAX) {
|
||||
tile += TILE_XY(-TILE_X_MAX, 1);
|
||||
if (GET_TILE_Y(tile) == TILE_Y_MAX)
|
||||
break;
|
||||
for (tile = 0; tile < MapSize(); ++tile) {
|
||||
if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == 0 && h == 0) {
|
||||
SetTileType(tile, MP_WATER);
|
||||
_m[tile].m5 = 0;
|
||||
SetTileOwner(tile, OWNER_WATER);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -528,182 +471,192 @@ static const byte _genterrain_tbl_2[5] = { 0, 0, 0, 0, 33 };
|
||||
static void GenerateTerrain(int type, int flag)
|
||||
{
|
||||
uint32 r;
|
||||
int x,y;
|
||||
int w,h;
|
||||
byte *p,*tile;
|
||||
uint x;
|
||||
uint y;
|
||||
uint w;
|
||||
uint h;
|
||||
const Sprite* template;
|
||||
const byte *p;
|
||||
Tile* tile;
|
||||
byte direction;
|
||||
|
||||
r = Random();
|
||||
p = GetSpritePtr((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845);
|
||||
template = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845);
|
||||
|
||||
x = r & TILE_X_MAX;
|
||||
y = (r >> TILE_X_BITS) & TILE_Y_MAX;
|
||||
x = r & MapMaxX();
|
||||
y = (r >> MapLogX()) & MapMaxY();
|
||||
|
||||
|
||||
if (x < 2 || y < 2)
|
||||
return;
|
||||
|
||||
direction = (byte)(r >> 22) & 3;
|
||||
w = p[2];
|
||||
h = p[1];
|
||||
if (direction & 1) { w = p[1]; h = p[2]; }
|
||||
p += 8;
|
||||
direction = GB(r, 22, 2);
|
||||
if (direction & 1) {
|
||||
w = template->height;
|
||||
h = template->width;
|
||||
} else {
|
||||
w = template->width;
|
||||
h = template->height;
|
||||
}
|
||||
p = template->data;
|
||||
|
||||
if (flag & 4) {
|
||||
if (!(flag & 2)) {
|
||||
if (!(flag & 1)) {
|
||||
if (x + y > 190)
|
||||
return;
|
||||
} else {
|
||||
if (y < 30 + x)
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (!(flag & 1)) {
|
||||
if (x + y < 256)
|
||||
return;
|
||||
} else {
|
||||
if (x < 30 + y)
|
||||
return;
|
||||
}
|
||||
uint xw = x * MapSizeY();
|
||||
uint yw = y * MapSizeX();
|
||||
uint bias = (MapSizeX() + MapSizeY()) * 16;
|
||||
|
||||
switch (flag & 3) {
|
||||
case 0:
|
||||
if (xw + yw > MapSize() - bias) return;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (yw < xw + bias) return;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (xw + yw < MapSize() + bias) return;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if (xw < yw + bias) return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (x + w >= TILE_X_MAX-1)
|
||||
if (x + w >= MapMaxX() - 1)
|
||||
return;
|
||||
|
||||
if (y + h >= TILE_Y_MAX-1)
|
||||
if (y + h >= MapMaxY() - 1)
|
||||
return;
|
||||
|
||||
tile = &_map_type_and_height[TILE_XY(x,y)];
|
||||
tile = &_m[TileXY(x, y)];
|
||||
|
||||
if (direction == 0) {
|
||||
do {
|
||||
int w_cur = w;
|
||||
byte *tile_cur = tile;
|
||||
switch (direction) {
|
||||
case 0:
|
||||
do {
|
||||
if (*p >= *tile_cur) *tile_cur = *p;
|
||||
p++;
|
||||
tile_cur++;
|
||||
} while (--w_cur != 0);
|
||||
tile += TILE_XY(0,1);
|
||||
} while (--h != 0);
|
||||
} else if (direction == 1) {
|
||||
do {
|
||||
int h_cur = h;
|
||||
byte *tile_cur = tile;
|
||||
Tile* tile_cur = tile;
|
||||
uint w_cur;
|
||||
|
||||
for (w_cur = w; w_cur != 0; --w_cur) {
|
||||
if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
|
||||
p++;
|
||||
tile_cur++;
|
||||
}
|
||||
tile += TileDiffXY(0, 1);
|
||||
} while (--h != 0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
do {
|
||||
if (*p >= *tile_cur) *tile_cur = *p;
|
||||
p++;
|
||||
tile_cur+=TILE_XY(0,1);
|
||||
} while (--h_cur != 0);
|
||||
tile++;
|
||||
} while (--w != 0);
|
||||
} else if (direction == 2) {
|
||||
tile += w - 1;
|
||||
do {
|
||||
int w_cur = w;
|
||||
byte *tile_cur = tile;
|
||||
Tile* tile_cur = tile;
|
||||
uint h_cur;
|
||||
|
||||
for (h_cur = h; h_cur != 0; --h_cur) {
|
||||
if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
|
||||
p++;
|
||||
tile_cur += TileDiffXY(0, 1);
|
||||
}
|
||||
tile++;
|
||||
} while (--w != 0);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
tile += TileDiffXY(w - 1, 0);
|
||||
do {
|
||||
if (*p >= *tile_cur) *tile_cur = *p;
|
||||
p++;
|
||||
tile_cur--;
|
||||
} while (--w_cur != 0);
|
||||
tile += TILE_XY(0,1);
|
||||
} while (--h != 0);
|
||||
} else {
|
||||
tile += (h - 1) * TILE_XY(0,1);
|
||||
do {
|
||||
int h_cur = h;
|
||||
byte *tile_cur = tile;
|
||||
Tile* tile_cur = tile;
|
||||
uint w_cur;
|
||||
|
||||
for (w_cur = w; w_cur != 0; --w_cur) {
|
||||
if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
|
||||
p++;
|
||||
tile_cur--;
|
||||
}
|
||||
tile += TileDiffXY(0, 1);
|
||||
} while (--h != 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
tile += TileDiffXY(0, h - 1);
|
||||
do {
|
||||
if (*p >= *tile_cur) *tile_cur = *p;
|
||||
p++;
|
||||
tile_cur-=TILE_XY(0,1);
|
||||
} while (--h_cur != 0);
|
||||
tile++;
|
||||
} while (--w != 0);
|
||||
Tile* tile_cur = tile;
|
||||
uint h_cur;
|
||||
|
||||
for (h_cur = h; h_cur != 0; --h_cur) {
|
||||
if (*p >= tile_cur->type_height) tile_cur->type_height = *p;
|
||||
p++;
|
||||
tile_cur -= TileDiffXY(0, 1);
|
||||
}
|
||||
tile++;
|
||||
} while (--w != 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "table/genland.h"
|
||||
|
||||
static void CreateDesertOrRainForest()
|
||||
static void CreateDesertOrRainForest(void)
|
||||
{
|
||||
uint tile;
|
||||
const TileIndexDiff *data;
|
||||
byte mt;
|
||||
int i;
|
||||
TileIndex tile;
|
||||
const TileIndexDiffC *data;
|
||||
uint i;
|
||||
|
||||
tile = 0;
|
||||
do {
|
||||
data = _make_desert_or_rainforest_data;
|
||||
do {
|
||||
if ((i = *data++) == MDORD_LAST) {
|
||||
SetMapExtraBits(tile, 1);
|
||||
break;
|
||||
}
|
||||
mt = _map_type_and_height[TILE_MASK(tile + i)];
|
||||
} while ((mt & 0xC) == 0 && (mt >> 4) != MP_WATER);
|
||||
} while (++tile != TILES_X*TILES_Y);
|
||||
for (tile = 0; tile != MapSize(); ++tile) {
|
||||
for (data = _make_desert_or_rainforest_data;
|
||||
data != endof(_make_desert_or_rainforest_data); ++data) {
|
||||
TileIndex t = TILE_MASK(tile + ToTileIndexDiff(*data));
|
||||
if (TileHeight(t) >= 4 || IsTileType(t, MP_WATER)) break;
|
||||
}
|
||||
if (data == endof(_make_desert_or_rainforest_data))
|
||||
SetMapExtraBits(tile, 1);
|
||||
}
|
||||
|
||||
for(i=0; i!=256; i++)
|
||||
for (i = 0; i != 256; i++)
|
||||
RunTileLoop();
|
||||
|
||||
tile = 0;
|
||||
do {
|
||||
data = _make_desert_or_rainforest_data;
|
||||
do {
|
||||
if ((i = *data++) == MDORD_LAST) {
|
||||
SetMapExtraBits(tile, 2);
|
||||
break;
|
||||
}
|
||||
} while ( !IS_TILETYPE(TILE_MASK(tile+i), MP_CLEAR) || (_map5[TILE_MASK(tile + i)]&0x1C) != 0x14);
|
||||
} while (++tile != TILES_X*TILES_Y);
|
||||
for (tile = 0; tile != MapSize(); ++tile) {
|
||||
for (data = _make_desert_or_rainforest_data;
|
||||
data != endof(_make_desert_or_rainforest_data); ++data) {
|
||||
TileIndex t = TILE_MASK(tile + ToTileIndexDiff(*data));
|
||||
if (IsTileType(t, MP_CLEAR) && (_m[t].m5 & 0x1c) == 0x14) break;
|
||||
}
|
||||
if (data == endof(_make_desert_or_rainforest_data))
|
||||
SetMapExtraBits(tile, 2);
|
||||
}
|
||||
}
|
||||
|
||||
void GenerateLandscape()
|
||||
void GenerateLandscape(void)
|
||||
{
|
||||
int i,flag;
|
||||
uint i;
|
||||
uint flag;
|
||||
uint32 r;
|
||||
|
||||
if (_opt.landscape == LT_HILLY) {
|
||||
i = ((Random() & 0x7F) + 950) * LANDSCAPE_SIZE_FACTOR;
|
||||
do {
|
||||
for (i = ScaleByMapSize((Random() & 0x7F) + 950); i != 0; --i)
|
||||
GenerateTerrain(2, 0);
|
||||
} while (--i);
|
||||
|
||||
r = Random();
|
||||
flag = (r & 3) | 4;
|
||||
i = (((r >> 16) & 0x7F) + 450) * LANDSCAPE_SIZE_FACTOR;
|
||||
do {
|
||||
flag = GB(r, 0, 2) | 4;
|
||||
for (i = ScaleByMapSize(GB(r, 16, 7) + 450); i != 0; --i)
|
||||
GenerateTerrain(4, flag);
|
||||
} while (--i);
|
||||
} else if (_opt.landscape == LT_DESERT) {
|
||||
i = ((Random()&0x7F) + 170) * LANDSCAPE_SIZE_FACTOR;
|
||||
do {
|
||||
for (i = ScaleByMapSize((Random()&0x7F) + 170); i != 0; --i)
|
||||
GenerateTerrain(0, 0);
|
||||
} while (--i);
|
||||
|
||||
r = Random();
|
||||
flag = (r & 3) | 4;
|
||||
i = (((r >> 16) & 0xFF) + 1700) * LANDSCAPE_SIZE_FACTOR;
|
||||
do {
|
||||
flag = GB(r, 0, 2) | 4;
|
||||
for (i = ScaleByMapSize(GB(r, 16, 8) + 1700); i != 0; --i)
|
||||
GenerateTerrain(0, flag);
|
||||
} while (--i);
|
||||
|
||||
flag ^= 2;
|
||||
|
||||
i = ((Random() & 0x7F) + 410) * LANDSCAPE_SIZE_FACTOR;
|
||||
do {
|
||||
for (i = ScaleByMapSize((Random() & 0x7F) + 410); i != 0; --i)
|
||||
GenerateTerrain(3, flag);
|
||||
} while (--i);
|
||||
} else {
|
||||
i = ((Random() & 0x7F) + (3 - _opt.diff.quantity_sea_lakes)*256 + 100) * LANDSCAPE_SIZE_FACTOR;
|
||||
do {
|
||||
i = ScaleByMapSize((Random() & 0x7F) + (3 - _opt.diff.quantity_sea_lakes) * 256 + 100);
|
||||
for (; i != 0; --i)
|
||||
GenerateTerrain(_opt.diff.terrain_type, 0);
|
||||
} while (--i);
|
||||
}
|
||||
|
||||
ConvertGroundTilesIntoWaterTiles();
|
||||
@@ -712,15 +665,15 @@ void GenerateLandscape()
|
||||
CreateDesertOrRainForest();
|
||||
}
|
||||
|
||||
void OnTick_Town();
|
||||
void OnTick_Trees();
|
||||
void OnTick_Station();
|
||||
void OnTick_Industry();
|
||||
void OnTick_Town(void);
|
||||
void OnTick_Trees(void);
|
||||
void OnTick_Station(void);
|
||||
void OnTick_Industry(void);
|
||||
|
||||
void OnTick_Players();
|
||||
void OnTick_Train();
|
||||
void OnTick_Players(void);
|
||||
void OnTick_Train(void);
|
||||
|
||||
void CallLandscapeTick()
|
||||
void CallLandscapeTick(void)
|
||||
{
|
||||
OnTick_Town();
|
||||
OnTick_Trees();
|
||||
@@ -736,32 +689,13 @@ TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng)
|
||||
int rn = rng;
|
||||
uint32 r = Random();
|
||||
|
||||
return TILE_XY(
|
||||
GET_TILE_X(a) + ((byte)r * rn * 2 >> 8) - rn,
|
||||
GET_TILE_Y(a) + ((byte)(r>>8) * rn * 2 >> 8) - rn
|
||||
);
|
||||
return TILE_MASK(TileXY(
|
||||
TileX(a) + (GB(r, 0, 8) * rn * 2 >> 8) - rn,
|
||||
TileY(a) + (GB(r, 8, 8) * rn * 2 >> 8) - rn
|
||||
));
|
||||
}
|
||||
|
||||
// This function checks if we add addx/addy to tile, if we
|
||||
// do wrap around the edges. For example, tile = (10,2) and
|
||||
// addx = +3 and addy = -4. This function will now return
|
||||
// TILE_WRAPPED, because the y is wrapped. This is needed in
|
||||
// for example, farmland. When the tile is not wrapped,
|
||||
// the result will be tile + TILE_XY(addx, addy)
|
||||
uint TileAddWrap(TileIndex tile, int addx, int addy)
|
||||
bool IsValidTile(TileIndex tile)
|
||||
{
|
||||
int x, y;
|
||||
x = GET_TILE_X(tile) + addx;
|
||||
y = GET_TILE_Y(tile) + addy;
|
||||
|
||||
// Are we about to wrap?
|
||||
if (x > 0 && x < TILE_X_MAX && y > 0 && y < TILE_Y_MAX)
|
||||
return tile + TILE_XY(addx, addy);
|
||||
|
||||
return TILE_WRAPPED;
|
||||
}
|
||||
|
||||
bool IsValidTile(uint tile)
|
||||
{
|
||||
return (tile < TILES_X * TILE_Y_MAX && GET_TILE_X(tile) != TILE_X_MAX);
|
||||
return (tile < MapSizeX() * MapMaxY() && TileX(tile) != MapMaxX());
|
||||
}
|
||||
|
||||
+2601
-2397
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+2776
File diff suppressed because it is too large
Load Diff
+2641
-2397
File diff suppressed because it is too large
Load Diff
+2623
-2255
File diff suppressed because it is too large
Load Diff
+2613
-1927
File diff suppressed because it is too large
Load Diff
+2601
-2397
File diff suppressed because it is too large
Load Diff
+2773
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user