Compare commits

...
160 Commits
Author SHA1 Message Date
rubidium b995ecc47e (svn r23833) -Release: 1.2.0-beta3 2012-01-21 14:36:56 +00:00
translators aa674e6450 (svn r23832) -Update from WebTranslator v3.0:
belarusian - 7 changes by Wowanxm
english_US - 3 changes by Rubidium
frisian - 49 changes by Flexo
german - 7 changes by Jogio, planetmaker
spanish - 3 changes by Terkhen
tamil - 13 changes by aswn
vietnamese - 35 changes by myquartz
2012-01-21 14:29:18 +00:00
rubidium 2583b977c2 (svn r23831) -Prepare: 1.2.0-beta3 2012-01-21 14:28:53 +00:00
yexo f917ac0a0f (svn r23830) -Revert (r23804) [FS#4986]: while the idea was good, it causes too much trouble 2012-01-21 13:57:24 +00:00
frosch d5e0be7d7f (svn r23829) -Fix [FS#4996]: Loading empty GS strings/translations failed. 2012-01-21 13:21:33 +00:00
frosch 5fa15c563c (svn r23828) -Fix: Return early from SlString() for empty strings, before doing invalid things which surprisingly do not break everything. 2012-01-21 13:21:23 +00:00
rubidium 9f162e7115 (svn r23827) -Feature [FS#4992]: [NoGo] Allow to chose the goal question window's title from a (small) set of options 2012-01-21 12:03:55 +00:00
rubidium 70c7fbd90e (svn r23826) -Fix [FS#4972]: the detailed performance rating window showed the cargo count of the current quarter instead of the last quarter like the tooltip says 2012-01-20 20:18:19 +00:00
translators 15331fa03c (svn r23825) -Update from WebTranslator v3.0:
belarusian - 2 changes by KorneySan
german - 49 changes by planetmaker
russian - 2 changes by Lone_Wolf
welsh - 17 changes by kazzie
2012-01-20 18:45:22 +00:00
translators 26a1d1385f (svn r23824) -Update from WebTranslator v3.0:
french - 22 changes by OliTTD
german - 82 changes by NG
latvian - 24 changes by Parastais
spanish - 1 changes by Terkhen
tamil - 83 changes by aswn
2012-01-19 18:45:22 +00:00
translators cbb008bc3e (svn r23823) -Update from WebTranslator v3.0:
simplified_chinese - 46 changes by chenwt0315
dutch - 2 changes by Parody
french - 56 changes by OliTTD
german - 38 changes by Jogio
latvian - 23 changes by Parastais
polish - 5 changes by wojteks86
russian - 17 changes by akasoft
tamil - 13 changes by aswn
2012-01-18 18:45:40 +00:00
rubidium a66debfadd (svn r23822) -Fix-ish: when replaying make sure companies get created even if their creating client doesn't exist during the replay 2012-01-17 21:13:02 +00:00
rubidium ede8c86f77 (svn r23821) -Fix-ish: when replaying a command log, ignore the command limit 2012-01-17 21:12:19 +00:00
rubidium 8a1ac5a128 (svn r23820) -Fix (r23818): WT3 validation failure 2012-01-17 18:48:25 +00:00
frosch 2458a29fd0 (svn r23819) -Fix [FS#4951]: Removal of towns with 0 population failed during map generation. 2012-01-17 18:46:09 +00:00
translators 3dcf19fd07 (svn r23818) -Update from WebTranslator v3.0:
belarusian - 1 changes by KorneySan
finnish - 7 changes by jpx_
french - 110 changes by OliTTD
german - 1 changes by NG
italian - 7 changes by lorenzodv
latvian - 69 changes by Parastais
polish - 38 changes by wojteks86
romanian - 10 changes by kkmic
russian - 1 changes by akasoft
slovenian - 140 changes by Necrolyte
welsh - 4 changes by kazzie
2012-01-17 18:46:04 +00:00
rubidium 4f62472fd9 (svn r23817) -Fix [FS#4962]: desync due to different NewGRF version. So reduce the chance that it happens significantly with betas/RCs/nightlies by doing the same as is done for stable releases: check the NewGRF version of server vs client.
Previously this check was not done for nightlies/betas/RCs due to missing versioning information in the source tarballs, but they have that for a while now. So just force the NewGRF version check for all versions, and remove the broken --revision configure option
2012-01-17 17:27:38 +00:00
yexo 2c99805117 (svn r23816) -Fix (r23635, r23805): make SCC_ENCODED the first entry in the StringControlCode enum since it's value is not allowed to change 2012-01-16 22:29:25 +00:00
translators 358b3e41b2 (svn r23815) -Update from WebTranslator v3.0:
belarusian - 13 changes by KorneySan
dutch - 7 changes by habell
english_AU - 7 changes by tomas4g
english_US - 1 changes by Rubidium
french - 13 changes by ElNounch
latvian - 14 changes by Parastais
norwegian_bokmal - 9 changes by mantaray
persian - 10 changes by Peymanpn
russian - 7 changes by Lone_Wolf, akasoft
serbian - 7 changes by etran
tamil - 81 changes by aswn
ukrainian - 4 changes by Fixer
2012-01-16 18:46:02 +00:00
rubidium 2a0754b678 (svn r23814) -Codechange: write the random-debug output directly to a file 2012-01-15 21:15:38 +00:00
yexo 44ddde6fa1 (svn r23813) -Codechange: fix other language files 2012-01-15 19:30:27 +00:00
yexo fab78a7bf2 (svn r23812) -Fix [FS#4977] (r23804): custom ActionB messages were broken 2012-01-15 19:29:49 +00:00
translators c42e30927d (svn r23810) -Update from WebTranslator v3.0:
dutch - 3 changes by Bennievv
english_US - 7 changes by Rubidium
german - 12 changes by NG, planetmaker
korean - 3 changes by telk5093
latvian - 54 changes by Parastais
persian - 107 changes by Peymanpn
spanish - 7 changes by Terkhen
tamil - 71 changes by aswn
2012-01-15 18:45:41 +00:00
frosch 64b6d03cd3 (svn r23809) -Feature: Enhance some fatal NewGRF errors with the spritenumber that caused the problem. 2012-01-15 18:18:44 +00:00
frosch dfb5c78dc6 (svn r23808) -Codechange: Remove various translations which will be invalid with the next commit. 2012-01-15 18:17:45 +00:00
frosch 92700c1262 (svn r23807) -Codechange: GRFError::num_params is not needed, remove it. 2012-01-15 17:33:35 +00:00
frosch 1dc8de17e0 (svn r23806) -Fix: [NewGRF] Integer parameters in ActionB did not quite work anymore. 2012-01-15 15:50:00 +00:00
frosch 0011f9ce45 (svn r23805) -Add: {STRING6} and {STRING7}. 2012-01-15 15:49:01 +00:00
yexo 15292fa080 (svn r23804) -Fix: [NewGRF] Make string code 80 more secure by not crashing when it's used in strings where it's not supposed to be used 2012-01-15 13:17:02 +00:00
yexo 8e68a442b9 (svn r23803) -Fix [FS#4969]: newgrf textstack was not properly used when storing parameters for the error message window 2012-01-15 13:06:11 +00:00
yexo 5535261e13 (svn r23802) -Fix [FS#4968] (r23601): game lobby gui not updated when new company information becomes available 2012-01-15 12:56:13 +00:00
yexo f5b6a9db5c (svn r23801) -Fix: reading the utf-8 BOM from AI/GS files on big-endian machines failed 2012-01-15 11:31:34 +00:00
rubidium 48717ade9c (svn r23800) -Codechange: also desync log failed commands 2012-01-14 19:44:25 +00:00
translators 4870192823 (svn r23799) -Update from WebTranslator v3.0:
german - 7 changes by planetmaker
latvian - 3 changes by 
spanish - 1 changes by Terkhen
tamil - 49 changes by aswn
2012-01-14 18:45:21 +00:00
translators fc009697b0 (svn r23794) -Update from WebTranslator v3.0:
latvian - 5 changes by Tranzistors
2012-01-13 18:45:09 +00:00
yexo 710d44dec3 (svn r23793) -Fix (r23791): height computation was missing a few pixels so the last line was still missing 2012-01-12 20:03:35 +00:00
yexo 21c2f9377d (svn r23792) -Feature [FS#4958]: move 'refitable to' text above custom newgrf text in build vehicle gui 2012-01-12 19:23:00 +00:00
yexo b1a830491a (svn r23791) -Fix [FS#4960]: resize text panel for parameter description if it doesn't fit in 4 lines.
If you resize the window so it's smaller than default the text might still not fit
2012-01-12 19:11:51 +00:00
translators 1ea634fcba (svn r23790) -Update from WebTranslator v3.0:
belarusian - 7 changes by Wowanxm
simplified_chinese - 62 changes by Gavin
italian - 2 changes by Snail_
latvian - 3 changes by 
serbian - 8 changes by etran
2012-01-12 18:45:31 +00:00
frosch 7b0ea17f00 (svn r23789) -Fix: [NewGRF] While we can only show one error per NewGRF, fatal errors should always disable the GRF. Also give those errors precedence over other information. 2012-01-12 17:46:42 +00:00
yexo ec54f39db5 (svn r23788) -Fix: failure to load newgrf files that use action 0 general prop 15 with a missing language file 2012-01-12 17:44:20 +00:00
rubidium 89ab59f0cb (svn r23787) -Fix: add some missing spaces 2012-01-11 18:47:32 +00:00
translators 20b3fd8ccd (svn r23786) -Update from WebTranslator v3.0:
catalan - 14 changes by arnau
english_AU - 6 changes by tomas4g
hungarian - 32 changes by IPG
italian - 10 changes by Snail_, lorenzodv
latvian - 29 changes by Parastais
norwegian_bokmal - 6 changes by mantaray
spanish - 15 changes by Terkhen
welsh - 6 changes by kazzie
2012-01-11 18:45:41 +00:00
translators f619a1a5a7 (svn r23785) -Update from WebTranslator v3.0:
croatian - 6 changes by VoyagerOne
czech - 12 changes by TheLamer
dutch - 6 changes by habell
english_US - 6 changes by Rubidium
finnish - 7 changes by jpx_
latvian - 17 changes by Parastais, Tranzistors
romanian - 6 changes by tonny
russian - 6 changes by Lone_Wolf
spanish - 6 changes by Terkhen
2012-01-10 18:45:51 +00:00
truebrain e2fea99ba9 (svn r23784) -Revert (r23740): compiling without libpng failed to include a correct header 2012-01-09 23:04:03 +00:00
rubidium 1a0fe0e8c6 (svn r23783) -Cleanup: remove ancient but not needed command flag 2012-01-09 22:21:45 +00:00
rubidium f33f9b3920 (svn r23782) -Fix [FS#4965]: crash due to genders used for station name in hangar string of Italian translation 2012-01-09 22:20:44 +00:00
rubidium 2728cb21a9 (svn r23781) -Fix [FS#4964]: under certain circumstances, e.g. a single invalid order, trying to determine the next order state could end up in an infinite loop 2012-01-09 22:19:53 +00:00
truebrain 6c7c02eb14 (svn r23780) -Fix [FS#4963] (r23764): also name the two new errors server-side. As extra, split up one of the errors in 3 errors, to be more specific what goes wrong. As cherry on top, make sure on all sides we can never again forget to add such entries on both sides, by introducing an assert_compile() 2012-01-09 21:22:48 +00:00
translators 64605a253e (svn r23779) -Update from WebTranslator v3.0:
bulgarian - 12 changes by kokobongo
croatian - 4 changes by VoyagerOne
dutch - 2 changes by habell
english_AU - 2 changes by tomas4g
latvian - 25 changes by Parastais, Tranzistors
lithuanian - 4 changes by simas068
norwegian_bokmal - 2 changes by mantaray
tamil - 34 changes by aswn
turkish - 76 changes by niw3
2012-01-09 18:45:39 +00:00
rubidium df963509f6 (svn r23778) -Fix [FS#4957]: trim all control codes and the likes from strings being passed into the AI. If the AI would be displaying them later we would be showing those control codes as question marks. 2012-01-08 21:51:08 +00:00
rubidium 4479f90843 (svn r23777) -Codechange: refactor allocating memory and fetching strings into a single function for scripts 2012-01-08 21:48:05 +00:00
translators ab38e3227d (svn r23776) -Update from WebTranslator v3.0:
basque - 18 changes by rosie2999
italian - 2 changes by lorenzodv
latvian - 35 changes by Tranzistors
tamil - 117 changes by aswn
ukrainian - 24 changes by Fixer
welsh - 5 changes by kazzie
2012-01-08 18:45:25 +00:00
frosch 45df862fb0 (svn r23775) -Change: Hide the PCX screenshot format from the options window, if a 32bpp blitter is used. 2012-01-08 16:58:10 +00:00
frosch ed46420ca0 (svn r23774) -Fix: Wrong path in readme.txt 2012-01-08 14:46:41 +00:00
michi_cc 9232a2ef0c (svn r23773) -Change: [NewGRF] Update all cached train properties if a train vehicle enters a new railtype. 2012-01-08 12:47:54 +00:00
rubidium 7e78d15e58 (svn r23772) -Fix (r23771): validation failure 2012-01-08 08:41:30 +00:00
translators a56540ad3a (svn r23771) -Update from WebTranslator v3.0:
belarusian - 2 changes by Wowanxm
catalan - 23 changes by arnau
finnish - 2 changes by jpx_
latvian - 65 changes by Tranzistors
romanian - 3 changes by tonny
russian - 2 changes by Lone_Wolf
spanish - 9 changes by Terkhen
tamil - 72 changes by aswn
2012-01-07 18:45:39 +00:00
smatz 24bf6ea495 (svn r23770) -Fix: compilation with GCC 4.7 2012-01-07 18:37:22 +00:00
rubidium 182969f531 (svn r23769) -Codechange: make the lag/join start timeouts configurable as well 2012-01-07 14:43:45 +00:00
rubidium 98b27a2b5b (svn r23768) -Fix: inconsistent stye in changelog 2012-01-07 06:34:14 +00:00
rubidium 8711395682 (svn r23766) -Update: some documentation 2012-01-06 22:22:17 +00:00
translators 23204aa404 (svn r23765) -Update from WebTranslator v3.0:
dutch - 7 changes by Yexo
english_US - 5 changes by Rubidium
french - 8 changes by glx
german - 2 changes by planetmaker
italian - 1 changes by lorenzodv
latvian - 123 changes by Tranzistors
slovenian - 36 changes by ntadej
urdu - 48 changes by haider
2012-01-06 22:19:25 +00:00
rubidium bddfcaef95 (svn r23764) -Fix [FS#4955]: make default timeouts for certain states lower and configurable 2012-01-06 21:49:06 +00:00
rubidium 9d958ff581 (svn r23763) -Fix [FS#4956]: check whether a water tile is really empty when overbuilding it with an object 2012-01-06 19:49:44 +00:00
alberth c19d7bfdae (svn r23762) -Fix [FS#4954]: Removed double words in three strings, and one change 'cost' to 'income' in english.txt (thanks Tranzistors) 2012-01-06 19:42:41 +00:00
translators 1b4e13bd49 (svn r23761) -Update from WebTranslator v3.0:
belarusian - 1 changes by Wowanxm
bulgarian - 50 changes by kokobongo
english_AU - 6 changes by tomas4g
english_US - 1 changes by Rubidium
finnish - 1 changes by jpx_
french - 1 changes by ElNounch
german - 20 changes by planetmaker
italian - 1 changes by lorenzodv
latvian - 202 changes by Tranzistors
norwegian_bokmal - 17 changes by mantaray
norwegian_nynorsk - 1 changes by mantaray
romanian - 1 changes by kkmic
russian - 1 changes by Lone_Wolf
serbian - 25 changes by etran
spanish - 20 changes by Terkhen
welsh - 1 changes by kazzie
2012-01-06 18:46:26 +00:00
frosch fa0949577e (svn r23760) -Feature: Allow readonly display of NewGRF parameters, if GRF list may not be edited. 2012-01-05 20:03:15 +00:00
smatz 597ef4e7b1 (svn r23759) -Fix (r17612)[FS#4951]: the check for duplicate town names wasn't really working 2012-01-05 19:56:48 +00:00
michi_cc ee0fcb2567 (svn r23758) -Feature: [NewGRF] Alternate rail type label list. 2012-01-05 19:40:34 +00:00
frosch 69e197c87f (svn r23757) -Codechange: Unify the drawing of toggle buttons for boolean settings. 2012-01-05 19:32:51 +00:00
rubidium 2fb393fcd0 (svn r23756) -Fix (r23755): ... and WT3 likes some strings that strgen doesn't like ;) 2012-01-05 19:28:42 +00:00
translators b476537d29 (svn r23755) -Update from WebTranslator v3.0:
croatian - 3 changes by VoyagerOne
english_US - 5 changes by Rubidium
finnish - 5 changes by jpx_
lithuanian - 32 changes by Devastator
norwegian_bokmal - 8 changes by eloekset
norwegian_nynorsk - 299 changes by eloekset
romanian - 20 changes by kkmic
russian - 21 changes by akasoft
swedish - 8 changes by tobjork
2012-01-05 18:45:42 +00:00
rubidium d2c643df63 (svn r23754) -Fix (r23752): the locks aren't reentrant 2012-01-05 17:08:49 +00:00
rubidium d0770c8319 (svn r23753) -Fix [FS#4952]: use plurals for the infrastructure stats 2012-01-05 06:14:08 +00:00
rubidium c530450193 (svn r23752) -Fix [FS#4938]: missing locking causing crash is extreme case when being in the MP lobby 2012-01-04 22:11:26 +00:00
rubidium 531e501b5a (svn r23751) -Codechange: rename NetworkUDPGameLoop to a more descriptive name, and move the UDP specific bits to network_udp 2012-01-04 22:08:43 +00:00
translators b80fb93b1b (svn r23750) -Update from WebTranslator v3.0:
belarusian - 19 changes by Wowanxm
croatian - 19 changes by VoyagerOne
english_AU - 20 changes by tomas4g
italian - 20 changes by lorenzodv
lithuanian - 161 changes by BlinK_
norwegian_bokmal - 22 changes by eloekset, mantaray
norwegian_nynorsk - 32 changes by eloekset
vietnamese - 5 changes by nglekhoi
welsh - 19 changes by kazzie
2012-01-04 18:45:54 +00:00
michi_cc 52175a4260 (svn r23749) -Fix: [Win32] Work around a possible deadlock when initialising threaded drawing. 2012-01-04 00:45:36 +00:00
frosch bc9c8db287 (svn r23748) -Fix: Make vehicle variables A8 and A9 always return 0. Returning cur_image is a potential desyncer due to Action1 in static NewGRFs. 2012-01-03 23:53:53 +00:00
truebrain 3c355da531 (svn r23747) -Fix (r23746): forgot one more case 2012-01-03 23:13:53 +00:00
truebrain 251687f795 (svn r23746) -Fix: also set 'info' to NULL if 'instance' dies (for both AI and GS); avoids invalid memory reads 2012-01-03 23:09:48 +00:00
frosch 00ec5da361 (svn r23745) -Fix (r23087): If autorefit fails, count the vehicle capacity nevertheless, if it is already carrying the right thing. 2012-01-03 23:08:15 +00:00
frosch 7ff95b9e97 (svn r23744) -Fix (r23142) [FS#4923]: Check the version of the right GRF. 2012-01-03 22:36:35 +00:00
frosch f5ebbc96e9 (svn r23743) -Fix [FS#4906]: Call CB 15E for all vehicles before actually executing any refit. 2012-01-03 22:04:12 +00:00
rubidium d906c6865a (svn r23742) -Revert (r23735): for some reason gcc-trunk is more picky than basically everything else :( 2012-01-03 21:58:26 +00:00
rubidium d8d2f74559 (svn r23741) -Revert (r23740): the few parts that the Windows / non-network compiles stumble on 2012-01-03 21:47:01 +00:00
rubidium 6d6be50ae0 (svn r23740) -Codechange: remove some 300 unneeded includes from the .cpp files 2012-01-03 21:32:51 +00:00
truebrain d880056415 (svn r23739) -Fix (r23738): owh vim, when can you learn to copy/paste tabs correctly? 2012-01-03 20:41:38 +00:00
truebrain ecb725b34b (svn r23738) -Fix (r23731): forgot to sync the new window with the script API 2012-01-03 20:38:41 +00:00
truebrain a32154eaa0 (svn r23737) -Fix: fix the svn:properties of a few files that got added lately 2012-01-03 20:37:56 +00:00
truebrain f4770d0b0a (svn r23736) -Document: document correctly that WC_GOAL_QUESTION has a WindowNumber which is identical to the uniqueid given by the GameScript 2012-01-03 20:28:28 +00:00
rubidium e40eb8177a (svn r23735) -Codechange: remove ~50 includes from headers that weren't needed 2012-01-03 20:26:05 +00:00
rubidium 9856282d0b (svn r23734) -Cleanup: remove the translated strings as well 2012-01-03 19:22:33 +00:00
rubidium abbc0f052b (svn r23733) -Fix-ish [FS#4939]: cheating to different climates messes things even more up than changing NewGRFs in-game... so guess what happened 2012-01-03 19:21:32 +00:00
translators aa482051ed (svn r23732) -Update from WebTranslator v3.0:
bulgarian - 7 changes by kokobongo
croatian - 3 changes by VoyagerOne
dutch - 20 changes by Yexo
english_US - 20 changes by Rubidium
finnish - 22 changes by jpx_
french - 20 changes by glx
german - 1 changes by planetmaker
lithuanian - 1 changes by BlinK_
norwegian_nynorsk - 1 changes by mantaray
portuguese - 1 changes by JayCity
russian - 1 changes by akasoft
serbian - 1 changes by etran
ukrainian - 27 changes by Fixer
2012-01-03 18:46:13 +00:00
truebrain 34d90da509 (svn r23731) -Add: add GSGoal::Question(), to ask a question to a(ll) company(ies). It can contain random text, and at most 3 buttons from a collection of 17 2012-01-03 16:36:24 +00:00
rubidium 18ac3f2bd8 (svn r23730) -Add: Australian translation 2012-01-03 16:04:58 +00:00
truebrain 2aa6086256 (svn r23729) -Fix (r23670) [FS#4941]: if you increase the buffer size, also increase the bytes per pixel 2012-01-03 10:50:06 +00:00
truebrain 9a05d03e2c (svn r23728) -Fix [#FS4942-ish]: when cheating into another company, the SignList was not updated 2012-01-03 10:27:14 +00:00
truebrain 8dbb654e39 (svn r23727) -Codechange: speedup the 32bpp palette animation by reducing the amount of compares. This is possible because the function is called with only 2 possible conditions: from 0 to 255 (full palette update, 8bpp only) or from PALETTE_ANIM_START to 255 2012-01-03 09:46:37 +00:00
peter1138 4da7f2b723 (svn r23726) -Fix (r23670): Remove debugging code added accidentally 2012-01-03 02:38:35 +00:00
yexo f5caf142c0 (svn r23725) -Fix (r23723): compile before commit 2012-01-03 00:47:56 +00:00
yexo 5f79b4c5d1 (svn r23724) -Codechange: split of the check to see if ambient sounds are enabled to a header file allowing compilers to inline that check 2012-01-03 00:45:22 +00:00
yexo b9e19cc6c1 (svn r23723) -Codechange: speedup flood checks a bit 2012-01-03 00:44:23 +00:00
frosch 4027e58ba3 (svn r23722) -Change: Give the chat query window the same Z priority as the normal text query window. 2012-01-03 00:22:14 +00:00
yexo c4e2dfdd89 (svn r23721) -Fix (r23070): reading memory of a temporary (already deconstructed) object is invalid 2012-01-02 22:58:15 +00:00
rubidium d2f776ef3e (svn r23720) -Fix/Feature [FS#4935]: show the script debug window also when the game script crashes 2012-01-02 22:44:28 +00:00
rubidium 8371ecc922 (svn r23719) -Fix [FS#4930]: extraction of music packs failed 2012-01-02 21:57:29 +00:00
rubidium 37b136576d (svn r23718) -Fix [FS#4936]: rescanai caused crash when the AI settings of an AI was opened 2012-01-02 20:39:50 +00:00
rubidium caa5762636 (svn r23717) -Fix [FS#4927]: ships going to wrong dock location when moving the dock while the game is paused 2012-01-02 20:39:18 +00:00
smatz 3655d5105b (svn r23716) -Revert (r23705)[FS#4937]: unforeseen consequences 2012-01-02 19:47:52 +00:00
translators 2d368a37b9 (svn r23715) -Update from WebTranslator v3.0:
luxembourgish - 48 changes by Phreeze
portuguese - 7 changes by SupSuper
turkish - 100 changes by niw3
ukrainian - 11 changes by Fixer
welsh - 1 changes by kazzie
2012-01-02 18:45:26 +00:00
truebrain 091bc25a90 (svn r23714) -Codechange: don't mix Viewport with non-viewport code 2012-01-02 13:44:37 +00:00
truebrain 0d929e877f (svn r23713) -Codechange: split VehicleMove() into two functions, to minimalize the work done where possible 2012-01-02 13:44:30 +00:00
truebrain 19004a77f8 (svn r23712) -Codechange: rename the two vehicle hashes we have to names that make clear where they differ in 2012-01-02 12:07:50 +00:00
truebrain 0e9a98619d (svn r23711) -Codechange: don't chain the two vehicle hashes, but call them one by one 2012-01-02 12:07:42 +00:00
rubidium 6ed84aff8d (svn r23710) -Change: make the default secondary sort method for the server list the number of clients instead of the name 2012-01-01 22:35:19 +00:00
rubidium 9a921fd0ae (svn r23709) -Feature-ish: try harder to sort text instead of fancy characters in the server names 2012-01-01 22:32:26 +00:00
truebrain cb414b09d2 (svn r23708) -Codechange: apply the same trick as r23701 to GetTileSlope(), gaining similar benefits 2012-01-01 19:20:08 +00:00
translators 62b00c1da8 (svn r23707) -Update from WebTranslator v3.0:
catalan - 22 changes by arnau
indonesian - 19 changes by rusydan
italian - 2 changes by lorenzodv
russian - 2 changes by Lone_Wolf
serbian - 2 changes by etran
2012-01-01 18:45:38 +00:00
smatz bcd3f2bb59 (svn r23706) -Codechange: prevent 'unknown command' doxygen errors 2012-01-01 17:36:19 +00:00
smatz a90b767995 (svn r23705) -Codechange: cache the last processed station in FindStationsAroundTiles() in order to make the code a bit faster 2012-01-01 17:32:45 +00:00
alberth 4af8c2d5e1 (svn r23704) -Doc: Doxygen comment fixes and additions. 2012-01-01 17:22:32 +00:00
truebrain da460f6928 (svn r23703) -Codechange: allow a compiler to inline a wrapper function, avoiding creation of a function stack, massively increasing its speed, for a function that is called often 2012-01-01 16:38:38 +00:00
truebrain 3b2ecfab01 (svn r23702) -Codechange: avoid using TileAddWrap() in FindStationsAroundTiles() by finding out where the border is in advance, speeding up the function with a factor 3 (you got to love random statistics which has no real meaning in the grand scheme of it all :D) 2012-01-01 16:23:05 +00:00
truebrain 6f6035ce0b (svn r23701) -Codechange: give TileAddWrap() a 27% speed-up, by swapping entries in an if() statement, and reusing already calculated values (tnx to SmatZ for the ideas) 2012-01-01 16:01:51 +00:00
truebrain 39f2d75e03 (svn r23700) -Fix: the size of the Subsidies pool used a random macro, which didn't really make sense in the grand scheme of things 2012-01-01 10:50:46 +00:00
truebrain a057b8c634 (svn r23699) -Fix [FS#4928] (r23630): too much copy/pasting only allowed a silly low amount of goals to be created. 2012-01-01 10:50:38 +00:00
rubidium b111813d0b (svn r23698) -Fix (r21685): small, apparantly yearly reoccuring, typo 2012-01-01 00:05:02 +00:00
translators 6d0cf1d2ea (svn r23697) -Update from WebTranslator v3.0:
belarusian - 1 changes by Wowanxm
czech - 2 changes by SmatZ
dutch - 1 changes by Yexo
english_US - 13 changes by Rubidium
french - 2 changes by glx
german - 1 changes by planetmaker
hebrew - 1 changes by rril
indonesian - 85 changes by rusydan
norwegian_bokmal - 116 changes by mantaray
romanian - 1 changes by tonny
spanish - 2 changes by Terkhen
2011-12-31 18:45:53 +00:00
rubidium 167813aded (svn r23696) -Fix (r23695): 5 <-> 6... today is not my day 2011-12-31 15:02:14 +00:00
rubidium 8b223f0274 (svn r23695) -Fix/Feature [FS#4916]: make a distinction between fully zoomed in and default zoomed in screenshots 2011-12-31 14:56:39 +00:00
rubidium 20931c5af8 (svn r23694) -Fix (rprev): somehow compilers didn't understand what I meant... 2011-12-31 13:57:09 +00:00
rubidium a137c838f9 (svn r23693) -Fix [FS#4859]: hardcode the original defaults for loading old savegames if they could totally mess with the game's behaviour 2011-12-31 13:52:54 +00:00
rubidium 1a6d352b92 (svn r23692) -Fix: use smallest_x of your children only when you let the children update it 2011-12-31 11:14:03 +00:00
truebrain f27b7e2a78 (svn r23691) -Fix: signed/unsigned issues, causing asserts for some languages in relation to the serverlist 2011-12-31 10:55:00 +00:00
rubidium 440b63da33 (svn r23690) -Fix: massive typo ;) 2011-12-31 10:08:18 +00:00
translators 4d71d3868d (svn r23689) -Update from WebTranslator v3.0:
simplified_chinese - 23 changes by chenwt0315
norwegian_bokmal - 236 changes by mantaray
swedish - 9 changes by tobjork
2011-12-30 18:45:18 +00:00
michi_cc 977c1fa68a (svn r23688) -Codechange: No need to check if a train needs servicing if we only extend a train's path without actually calling the pathfinder. The path extension will stop when hitting a junction tile, so it is impossible to miss a depot this way. 2011-12-30 17:56:37 +00:00
rubidium 433af5215a (svn r23687) -Fix [FS#4922]: document where the game script directory is 2011-12-30 12:07:28 +00:00
michi_cc 24d530b55d (svn r23686) -Fix [FS#4921] (r23413): Infrastructure count of canals/locks/ship depots wasn't updated properly when a company went into bankruptcy or was taken over. 2011-12-29 20:10:06 +00:00
translators 35b76bc8a9 (svn r23685) -Update from WebTranslator v3.0:
norwegian_bokmal - 67 changes by mantaray
swedish - 25 changes by tobjork
vietnamese - 1 changes by nglekhoi
welsh - 50 changes by kazzie
2011-12-29 18:45:21 +00:00
rubidium fbbfaac819 (svn r23684) -Cleanup: let the highway take the highway 2011-12-28 20:06:51 +00:00
rubidium 8d125a60ce (svn r23683) -Fix [FS#4912]-ish: when fitting another engine the cargo capacity of wagons could become lower, causing them to contain more than they should. This caused the cargo transfer from the replaced parts to put even more stuff in the already full wagon. Prevent this from happening by reducing the amount of cargo in the vehicle to the capacity when moving vehicles/wagons around, or when autoreplacing 2011-12-28 19:48:04 +00:00
translators 660e5b286f (svn r23682) -Update from WebTranslator v3.0:
catalan - 2 changes by arnau
serbian - 11 changes by etran
2011-12-28 18:45:12 +00:00
rubidium 7d2061516a (svn r23681) -Fix [FS#4914]: vehicle numbers got misaccounted when autoreplacing failed due to length checks 2011-12-28 17:34:44 +00:00
rubidium 98fdf81320 (svn r23680) -Fix [FS#4915]: prevent removal of the (AI) company the local player is in 2011-12-28 17:33:12 +00:00
translators 156e25d375 (svn r23679) -Update from WebTranslator v3.0:
swedish - 48 changes by tobjork
tamil - 26 changes by aswn
2011-12-27 18:45:10 +00:00
truebrain 96e1f0a8f0 (svn r23678) -Fix: close the editbox of settings when changing an AI, to avoid invalid memory read/write (reported by SmatZ) 2011-12-27 15:35:47 +00:00
truebrain 0e6ca77e1a (svn r23677) -Fix [FS#4909]: invalidate AI Parameters window when changing AI 2011-12-27 15:17:42 +00:00
rubidium 2c09939bd3 (svn r23676) -Fix [FS#4913] (r23412): when removing road stops the wrong tile was checked for updating the infrastructure cache 2011-12-27 13:45:30 +00:00
translators 3f7b812891 (svn r23675) -Update from WebTranslator v3.0:
belarusian - 3 changes by Wowanxm
indonesian - 18 changes by fanioz
persian - 47 changes by Peymanpn
urdu - 19 changes by haider
2011-12-26 18:45:19 +00:00
michi_cc 47171c7829 (svn r23674) -Fix (r23670): Don't read invalid memory in the 32bpp simple blitter. 2011-12-26 14:53:19 +00:00
rubidium f7c7271ecf (svn r23673) -Codechange: prepare the installers for some (future) massive changes in OpenGFX w.r.t. compatability with earlier versions 2011-12-26 13:21:37 +00:00
rubidium 1143f0451a (svn r23672) -Fix: WT3 validation failure 2011-12-25 18:47:48 +00:00
translators cf4f7399a1 (svn r23671) -Update from WebTranslator v3.0:
hebrew - 1 changes by rril
indonesian - 10 changes by fanioz
korean - 123 changes by telk5093
russian - 2 changes by Lone_Wolf
vietnamese - 32 changes by nglekhoi
2011-12-25 18:45:29 +00:00
peter1138 3ef77e55c5 (svn r23670) -Feature: Add ability to adjust brightness of colour after remapping for 32bpp sprites 2011-12-24 23:33:45 +00:00
translators dc497258d6 (svn r23669) -Update from WebTranslator v3.0:
estonian - 112 changes by notAbot
hebrew - 2 changes by rril
slovenian - 33 changes by ntadej
swedish - 7 changes by Zuu
2011-12-24 18:45:21 +00:00
smatz 2fb22e8214 (svn r23668) -Fix: the 'Configure' button in the 'AI / Game Configuration' window didn't get enabled when activating a GameScript 2011-12-24 13:08:11 +00:00
373 changed files with 12012 additions and 3720 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ FILE_PATTERNS = *.c \
RECURSIVE = YES
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = */3rdparty */.svn
EXCLUDE_PATTERNS = */3rdparty */.svn */script/api
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
-7
View File
@@ -37,7 +37,6 @@ STAGE = !!STAGE!!
MAKEDEPEND = !!MAKEDEPEND!!
CFLAGS_MAKEDEP = !!CFLAGS_MAKEDEP!!
SORT = !!SORT!!
REVISION = !!REVISION!!
AWK = !!AWK!!
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
@@ -94,15 +93,9 @@ $(LANG_OBJS_DIR)/table/strings.h: $(LANG_DIR)/english.txt $(LANG_OBJS_DIR)/$(STR
VERSIONS := $(shell AWK="$(AWK)" "$(ROOT_DIR)/findversion.sh")
MODIFIED := $(shell echo "$(VERSIONS)" | cut -f 3 -d' ')
ifdef REVISION
# Use specified revision (which should be of the form "r000").
REV := $(REVISION)
REV_NR := $(shell echo $(REVISION) | sed "s@[^0-9]@@g")
else
# Use autodetected revisions
REV := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ')
REV_NR := $(shell echo "$(VERSIONS)" | cut -f 2 -d' ')
endif
# Make sure we have something in REV and REV_NR
ifeq ($(REV),)
+72
View File
@@ -1,3 +1,66 @@
1.2.0-beta3 (2012-01-21)
------------------------------------------------------------------------
- Feature: [NoGo] Allow to chose the goal question window's title from a (small) set of options [FS#4992] (r23827)
- Feature: [NewGRF] Enhance some fatal NewGRF errors with the spritenumber that caused the problem (r23809)
- Fix: Loading empty GS strings/translations failed [FS#4996] (r23829)
- Fix: Return early from SlString() for empty strings, before doing invalid things which surprisingly do not break everything. (r23828)
- Fix: The detailed performance rating window showed the cargo count of the current quarter instead of the last quarter like the tooltip says [FS#4972] (r23826)
- Fix: Removal of towns with 0 population failed during map generation [FS#4951] (r23819)
- Fix: [Network] Desync due to different NewGRF version at client and server [FS#4962] (r23817)
- Fix: [NewGRF] Textstack was not properly used when storing parameters for the error message window [FS#4969] (r23803)
- Fix: Game lobby gui not updated when new company information becomes available [FS#4968] (r23802)
- Fix: Reading the UTF-8 BOM from AI/GS files on big-endian machines failed (r23801)
- Fix: Move 'refitable to' text above custom newgrf text in build vehicle gui [FS#4958] (r23792)
- Fix: [NewGRF] Resize text panel for parameter description if it does not fit in 4 lines [FS#4960] (r23791)
- Fix: [NewGRF] While we can only show one error per NewGRF, fatal errors should always disable the GRF. Also give those errors precedence over other information (r23789)
- Fix: [NewGRF] Failure to load newgrf files that use action 0 general prop 15 with a missing language file (r23788)
- Fix: Crash due to genders used for station name in hangar string of Italian translation [FS#4965] (r23782)
- Fix: Under certain circumstances, e.g. a single invalid order, trying to determine the next order state could end up in an infinite loop [FS#4964] (r23781)
- Fix: [Network] Missing naming of some errors[FS#4963] (r23780)
- Fix: Trim all control codes and the likes from strings being passed into the AI. If the AI would be displaying them later we would be showing those control codes as question marks [FS#4957] (r23778)
- Fix: Hide the PCX screenshot format from the options window, if a 32bpp blitter is used (r23775)
- Fix: [NewGRF] Update all cached train properties if a train vehicle enters a new railtype (r23773)
1.2.0-beta2 (2012-01-07)
------------------------------------------------------------------------
- Feature: [NewGRF] Allow read-only display of NewGRF parameters, if GRF list may not be edited (r23760)
- Feature: [NewGRF] Alternate rail type label list (r23758)
- Feature: Make the default secondary sort method for the server list the number of clients instead of the name (r23710)
- Feature: Try harder to sort text instead of fancy characters in the server names (r23709)
- Feature: Make a distinction between fully zoomed in and default zoomed in screenshots [FS#4916] (r23695)
- Feature: Add ability to adjust brightness of colour after remapping for 32bpp sprites (r23670)
- Feature: [GS] GSGoal::Question(), to ask a question to a(ll) company(ies). It can contain random text, and at most 3 buttons from a collection of 17 (r23731)
- Feature: Australian translation (r23730)
- Fix: Make default timeouts for certain network states lower and configurable [CVE-2012-0049] [FS#4955] (r23764)
- Fix: Check whether a water tile is really empty when overbuilding it with an object [FS#4956] (r23763)
- Fix: The check for duplicate town names was not really working [FS#4951] (r23759)
- Fix: Missing locking causing crash is extreme case when being in the MP lobby [FS#4938] (r23752)
- Fix: [Win32] Work around a possible deadlock when initialising threaded drawing (r23749)
- Fix: Make vehicle variables A8 and A9 always return 0. Returning cur_image is a potential desyncer due to Action1 in static NewGRFs (r23748)
- Fix: Also set 'info' to NULL if 'instance' dies (for both AI and GS); avoids invalid memory reads (r23746)
- Fix: If autorefit fails, count the vehicle capacity nevertheless, if it is already carrying the right thing (r23745)
- Fix: [NewGRF] Check the version of the right GRF [FS#4923] (r23744)
- Fix: [NewGRF] Call CB 15E for all vehicles before actually executing any refit [FS#4906] (r23743)
- Fix: Cheating to different climates messes things even more up than changing NewGRFs in-game so it was removed [FS#4939] (r23733)
- Fix: When cheating into another company, the SignList was not updated [FS#4942] (r23728)
- Fix: Reading memory of a temporary (already deconstructed) object is invalid (r23721)
- Fix: [Script] Show the script debug window also when the game script crashes [FS#4935] (r23720)
- Fix: Extraction of music packs failed [FS#4930] (r23719)
- Fix: [AI] Rescanai caused crash when the AI settings of an AI was opened [FS#4936] (r23718)
- Fix: Ships going to wrong dock location when moving the dock while the game is paused [FS#4927] (r23717)
- Fix: The amount of goals was too low [FS#4928] (r23699)
- Fix: Hardcode the original defaults for loading old savegames if they could totally mess with the game's behaviour [FS#4859] (r23693)
- Fix: Infrastructure count of canals/locks/ship depots was not updated properly when a company went into bankruptcy or was taken over [FS#4921] (r23686)
- Fix: When fitting another engine the cargo capacity of wagons could become lower, causing them to contain more than they should. This caused the cargo transfer from the replaced parts to put even more stuff in the already full wagon. Prevent this from happening by reducing the amount of cargo in the vehicle to the capacity when moving vehicles/wagons around, or when autoreplacing [FS#4912] (r23683)
- Fix: Vehicle numbers got misaccounted when autoreplacing failed due to length checks [FS#4914] (r23681)
- Fix: [AI] Prevent removal of the (AI) company the local player is in [FS#4915] (r23680)
- Fix: [Script] Close the editbox of settings when changing an AI, to avoid invalid memory read/write (r23678)
- Fix: [Script] Invalidate AI Parameters window when changing AI [FS#4909] (r23677)
- Fix: When removing road stops the wrong tile was checked for updating the infrastructure cache [FS#4913] (r23676)
- Fix: [Script] The 'Configure' button in the 'AI / Game Configuration' window did not get enabled when activating a GameScript (r23668)
1.2.0-beta1 (2011-12-24)
------------------------------------------------------------------------
- Feature: Ability to run a game script; a script that controls some of the logic of the game, e.g. to implement goals or tutorials (r23637)
@@ -148,6 +211,15 @@
- Fix: Change the centre of train vehicles to depend on the vehicle length instead of being fixed at 4/8th of the original vehicle length to make sure shortened vehicles do not block tiles they should not block [FS#2379,FS#3569] (r23290)
1.1.5 (2012-01-14)
------------------------------------------------------------------------
- Fix: Make default timeouts for certain network states lower and configurable [CVE-2012-0049] [FS#4955] (r23764)
- Fix: Check whether a water tile is really empty when overbuilding it with an object [FS#4956] (r23763)
- Fix: Missing locking causing crash in extreme case when being in the MP lobby [FS#4938] (r23752)
- Fix: Clear the backed up orders of a removed station as well, otherwise one could create orders to a station that was never in the original backupped orders. For example a road vehicle trying to go to a buoy [FS#4876] (r23464)
- Fix: Do not assume all industries that cut trees have tile (0,0) and wait until all tiles of an industry are completed before starting to cut trees (r23458)
1.1.4 (2011-12-05)
------------------------------------------------------------------------
- Fix: Savegames made with the Catalan town name generator would trigger a 'savegame corrupt' exception [FS#4866] (r23418)
+1 -24
View File
@@ -32,7 +32,6 @@ set_default() {
os="DETECT"
endian="AUTO"
cpu_type="DETECT"
revision=""
config_log="config.log"
prefix_dir="/usr/local"
binary_dir="games"
@@ -107,7 +106,6 @@ set_default() {
os
endian
cpu_type
revision
config_log
prefix_dir
binary_dir
@@ -199,8 +197,6 @@ detect_params() {
--cpu-type) prev_p="cpu_type";;
--cpu-type=*) cpu_type="$optarg";;
--revision=*) revision="$optarg";;
--cc-build) prevp_p="cc_build";;
--cc-build=*) cc_build="$optarg";;
--cc-host) prevp_p="cc_host";;
@@ -1010,31 +1006,15 @@ check_params() {
fi
fi
if [ -n "$revision" ]; then
log 1 "checking revision... $revision"
log 1 "WARNING: we do not advise you to use this setting"
log 1 "WARNING: in most cases it is not safe for network use"
log 1 "WARNING: USE WITH CAUTION!"
sleep 5
elif [ -f "$ROOT_DIR/version" ]; then
revision="`cat $ROOT_DIR/version`"
log 1 "checking revision... $revision"
elif [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
revision=""
if [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
log 1 "checking revision... svn detection"
elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
revision=""
log 1 "checking revision... git detection"
elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`hg help 2>/dev/null`" ]; then
revision=""
log 1 "checking revision... hg detection"
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
revision=""
log 1 "checking revision... source tarball"
else
revision=""
log 1 "checking revision... no detection"
log 1 "WARNING: there is no means to determine the version."
log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
@@ -3245,7 +3225,6 @@ make_sed() {
s@!!SRCS!!@$SRCS@g;
s@!!OS!!@$os@g;
s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
s@!!REVISION!!@$revision@g;
s@!!AWK!!@$awk@g;
s@!!DISTCC!!@$distcc@g;
s@!!NFORENUM!!@$nforenum@g;
@@ -3468,8 +3447,6 @@ showhelp() {
echo " MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/"
echo " DOS/WINCE/PSP/HAIKU"
echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
echo " --revision=rXXXX overwrite the revision detection."
echo " Use with care!"
echo ""
echo "Paths:"
echo " --prefix-dir=dir specifies the prefix for all installed"
+2 -2
View File
@@ -1,6 +1,6 @@
OpenTTD's known bugs
Last updated: 2011-12-24
Release version: 1.2.0-beta1
Last updated: 2012-01-07
Release version: 1.2.0-beta2
------------------------------------------------------------------------
+13 -1
View File
@@ -1,8 +1,20 @@
openttd (1.2.0~beta3) unstable; urgency=low
* New upstream release 1.2.0-beta3
-- Matthijs Kooijman <matthijs@stdin.nl> Sat, 21 Jan 2012 16:00:00 +0100
openttd (1.2.0~beta2) unstable; urgency=low
* New upstream release 1.2.0-beta2
-- Matthijs Kooijman <matthijs@stdin.nl> Sat, 07 Jan 2012 00:00:00 +0100
openttd (1.2.0~beta1) unstable; urgency=low
* New upstream release 1.2.0-beta1
-- Matthijs Kooijman <matthijs@stdin.nl> Fri, 24 Dec 2011 00:00:00 +0100
-- Matthijs Kooijman <matthijs@stdin.nl> Sat, 24 Dec 2011 00:00:00 +0100
openttd (1.1.4) unstable; urgency=low
+2 -2
View File
@@ -1,9 +1,9 @@
@echo off
set OPENTTD_VERSION=1.2.0-beta1
set OPENTTD_VERSION=1.2.0-beta3
set OPENSFX_VERSION=0.8.0
set NOSOUND_VERSION=0.8.0
set OPENGFX_VERSION=0.7.0
set OPENGFX_VERSION=1.2.0
echo To make the installer, you must have the WarpIN compiler (wic) installed and in
echo your path, as well as wget and unzip. This file will download the various DLLs
+3 -3
View File
@@ -2,8 +2,8 @@
!define APPV_MAJOR 1
!define APPV_MINOR 2
!define APPV_MAINT 0
!define APPV_BUILD 0
!define APPV_EXTRA "-beta1"
!define APPV_BUILD 2
!define APPV_EXTRA "-beta3"
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version
@@ -14,7 +14,7 @@
!define APPURLLINK "http://www.openttd.org"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
!define OPENGFX_BASE_VERSION "0.7.0"
!define OPENGFX_BASE_VERSION "1.2.0"
!define OPENSFX_BASE_VERSION "0.8.0"
!define OPENMSX_BASE_VERSION "1.0.0"
+6
View File
@@ -107,6 +107,12 @@
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\src\lang\english.txt;..\objs\strgen\strgen.exe;%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\bin\lang\dutch.lng;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="..\src\lang\english_AU.txt">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating english_AU language file</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "%(FullPath)"</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\src\lang\english.txt;..\objs\strgen\strgen.exe;%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\bin\lang\english_AU.lng;%(Outputs)</Outputs>
</CustomBuild>
<CustomBuild Include="..\src\lang\english_US.txt">
<Message Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating english_US language file</Message>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "%(FullPath)"</Command>
+3
View File
@@ -37,6 +37,9 @@
<CustomBuild Include="..\src\lang\dutch.txt">
<Filter>Translations</Filter>
</CustomBuild>
<CustomBuild Include="..\src\lang\english_AU.txt">
<Filter>Translations</Filter>
</CustomBuild>
<CustomBuild Include="..\src\lang\english_US.txt">
<Filter>Translations</Filter>
</CustomBuild>
+15
View File
@@ -213,6 +213,21 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\english_AU.txt"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Generating english_AU language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;exit 0&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt;..\objs\strgen\strgen.exe"
Outputs="..\bin\lang\english_AU.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\english_US.txt"
>
+15
View File
@@ -214,6 +214,21 @@
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\english_AU.txt"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Generating english_AU language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;exit 0&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt;..\objs\strgen\strgen.exe"
Outputs="..\bin\lang\english_AU.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\english_US.txt"
>
+5 -3
View File
@@ -1,6 +1,6 @@
OpenTTD readme
Last updated: 2011-12-24
Release version: 1.2.0-beta1
Last updated: 2012-01-21
Release version: 1.2.0-beta3
------------------------------------------------------------------------
@@ -262,7 +262,7 @@ system:
directory if it is your personal directory, i.e. "~/", or when it is the
root directory, i.e. "/".
2. Your personal directory
Windows: C:\My Documents (95, 98, ME)
Windows: C:\My Documents\OpenTTD (95, 98, ME)
C:\Documents and Settings\<username>\My Documents\OpenTTD (2000, XP)
C:\Users\<username>\Documents\OpenTTD (Vista, 7)
Mac OSX: ~/Documents/OpenTTD
@@ -292,6 +292,8 @@ OpenTTD directory:
Music Sets: baseset (or a subdirectory thereof)
AIs: ai (or a subdirectory thereof)
AI Libraries: ai/libraries (or a subdirectory thereof)
Game Scripts (GS): game (or a subdirectory thereof)
GS Libraries: game/libraries (or a subdirectory thereof)
Savegames: save
Automatic Savegames: save/autosave
Scenarios: scenario
+1 -1
View File
@@ -183,7 +183,7 @@ typedef char SQChar;
#define scstrdup strdup
#define scstrrchr strrchr
#define scstrcat strcat
#define MAX_CHAR 0xFF
#define MAX_CHAR 0xFFFF
#endif
#define SQUIRREL_VERSION _SC("Squirrel 2.2.5 stable - With custom OpenTTD modifications")
+1 -5
View File
@@ -2,11 +2,7 @@
#ifndef _SQLEXER_H_
#define _SQLEXER_H_
#ifdef SQUNICODE
typedef SQChar LexChar;
#else
typedef unsigned char LexChar;
#endif
typedef unsigned short LexChar;
struct SQLexer
{
-1
View File
@@ -13,7 +13,6 @@
#define AI_HPP
#include "../script/api/script_event_types.hpp"
#include "../date_type.h"
#include "../core/string_compare_type.hpp"
#include <map>
-1
View File
@@ -11,7 +11,6 @@
#include "../stdafx.h"
#include "../settings_type.h"
#include "../core/random_func.hpp"
#include "ai.hpp"
#include "ai_config.hpp"
#include "ai_info.hpp"
+1
View File
@@ -13,6 +13,7 @@
#define AI_CONFIG_HPP
#include "../script/script_config.hpp"
#include "../company_type.h"
class AIConfig : public ScriptConfig {
public:
+2 -5
View File
@@ -16,15 +16,11 @@
#include "../company_func.h"
#include "../network/network.h"
#include "../window_func.h"
#include "../command_func.h"
#include "../fileio_func.h"
#include "ai_scanner.hpp"
#include "ai_instance.hpp"
#include "ai_config.hpp"
#include "ai_info.hpp"
#include "ai.hpp"
#include "../script/script_storage.hpp"
#include "../script/api/script_error.hpp"
/* static */ uint AI::frame_counter = 0;
/* static */ AIScannerInfo *AI::scanner_info = NULL;
@@ -108,6 +104,7 @@
delete c->ai_instance;
c->ai_instance = NULL;
c->ai_info = NULL;
cur_company.Restore();
@@ -333,7 +330,7 @@
InvalidateWindowData(WC_AI_LIST, 0, 1);
SetWindowClassesDirty(WC_AI_DEBUG);
SetWindowDirty(WC_AI_SETTINGS, 0);
InvalidateWindowClassesData(WC_AI_SETTINGS);
}
#if defined(ENABLE_NETWORK)
+10 -6
View File
@@ -7,14 +7,13 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file ai_gui.cpp Window for configuring the AIs */
/** @file ai_gui.cpp %Window for configuring the AIs */
#include "../stdafx.h"
#include "../table/sprites.h"
#include "../error.h"
#include "../gui.h"
#include "../querystring_gui.h"
#include "../company_func.h"
#include "../company_base.h"
#include "../company_gui.h"
#include "../strings_func.h"
@@ -24,7 +23,6 @@
#include "../network/network.h"
#include "../settings_func.h"
#include "../network/network_content.h"
#include "../core/backup_type.hpp"
#include "ai.hpp"
#include "../script/api/script_log.hpp"
@@ -36,7 +34,6 @@
#include "../game/game_info.hpp"
#include "../game/game_instance.hpp"
#include "../widgets/ai_widget.h"
#include "table/strings.h"
@@ -172,7 +169,9 @@ struct AIListWindow : public Window {
for (int i = 0; i < this->selected; i++) it++;
GetConfig(slot)->Change((*it).second->GetName(), (*it).second->GetVersion());
}
SetWindowDirty(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
InvalidateWindowData(WC_GAME_OPTIONS, WN_GAME_OPTIONS_AI);
InvalidateWindowClassesData(WC_AI_SETTINGS);
DeleteWindowByClass(WC_QUERY_STRING);
}
virtual void OnClick(Point pt, int widget, int click_count)
@@ -385,7 +384,7 @@ struct AISettingsWindow : public Window {
}
if ((config_item.flags & SCRIPTCONFIG_BOOLEAN) != 0) {
DrawFrameRect(buttons_left, y + 2, buttons_left + 19, y + 10, (current_value != 0) ? COLOUR_GREEN : COLOUR_RED, (current_value != 0) ? FR_LOWERED : FR_NONE);
DrawBoolButton(buttons_left, y + 2, current_value != 0, editable);
SetDParam(idx++, current_value == 0 ? STR_CONFIG_SETTING_OFF : STR_CONFIG_SETTING_ON);
} else {
DrawArrowButtons(buttons_left, y + 2, COLOUR_YELLOW, (this->clicked_button == i) ? 1 + (this->clicked_increase != rtl) : 0, editable && current_value > config_item.min_value, editable && current_value < config_item.max_value);
@@ -1319,4 +1318,9 @@ void ShowAIDebugWindowIfAIError()
break;
}
}
GameInstance *g = Game::GetGameInstance();
if (g != NULL && g->IsDead()) {
ShowAIDebugWindow(OWNER_DEITY);
}
}
+1 -1
View File
@@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file ai_gui.hpp Window for configuring the AIs */
/** @file ai_gui.hpp %Window for configuring the AIs */
#ifndef AI_GUI_HPP
#define AI_GUI_HPP
-3
View File
@@ -11,14 +11,11 @@
#include "../stdafx.h"
#include "../script/squirrel_helper.hpp"
#include "../script/squirrel_class.hpp"
#include "ai_info.hpp"
#include "ai_scanner.hpp"
#include "../settings_type.h"
#include "../debug.h"
#include "../rev.h"
#include "ai.hpp"
/**
* Check if the API version provided by the AI is supported.
-1
View File
@@ -13,7 +13,6 @@
#define AI_INFO_HPP
#include "../script/script_info.hpp"
#include "../script/script_config.hpp"
/** All static information from an AI like name, version, etc. */
class AIInfo : public ScriptInfo {
-3
View File
@@ -11,7 +11,6 @@
#include "../stdafx.h"
#include "../debug.h"
#include "../saveload/saveload.h"
#include "../error.h"
#include "../script/squirrel_class.hpp"
@@ -20,8 +19,6 @@
#include "ai_gui.hpp"
#include "ai.hpp"
#include "../script/script_fatalerror.hpp"
#include "../script/script_suspend.hpp"
#include "../script/script_storage.hpp"
#include "ai_info.hpp"
#include "ai_instance.hpp"
-1
View File
@@ -12,7 +12,6 @@
#ifndef AI_INSTANCE_HPP
#define AI_INSTANCE_HPP
#include <squirrel.h>
#include "../script/script_instance.hpp"
/** Runtime information about an AI like a pointer to the squirrel vm and the current state. */
-2
View File
@@ -11,14 +11,12 @@
#include "../stdafx.h"
#include "../debug.h"
#include "../fileio_func.h"
#include "../network/network.h"
#include "../core/random_func.hpp"
#include "../script/squirrel_class.hpp"
#include "ai_info.hpp"
#include "ai_scanner.hpp"
#include "../script/api/script_controller.hpp"
AIScannerInfo::AIScannerInfo() :
+7 -7
View File
@@ -16,7 +16,6 @@
#include "aircraft.h"
#include "landscape.h"
#include "news_func.h"
#include "vehicle_gui.h"
#include "newgrf_engine.h"
#include "newgrf_sound.h"
#include "spritecache.h"
@@ -314,8 +313,8 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
UpdateAircraftCache(v, true);
VehicleMove(v, false);
VehicleMove(u, false);
VehicleUpdatePosition(v);
VehicleUpdatePosition(u);
/* Aircraft with 3 vehicles (chopper)? */
if (v->subtype == AIR_HELICOPTER) {
@@ -336,7 +335,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
w->UpdateDeltaXY(INVALID_DIR);
u->SetNext(w);
VehicleMove(w, false);
VehicleUpdatePosition(w);
}
}
@@ -464,7 +463,7 @@ static void HelicopterTickHandler(Aircraft *v)
u->cur_image = img;
VehicleMove(u, true);
VehicleUpdatePositionAndViewport(u);
}
/**
@@ -480,6 +479,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
v->y_pos = y;
v->z_pos = z;
VehicleUpdatePosition(v);
v->UpdateViewport(true, false);
if (v->subtype == AIR_HELICOPTER) v->Next()->Next()->cur_image = GetRotorImage(v, EIT_ON_MAP);
@@ -494,7 +494,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
u->z_pos = GetSlopePixelZ(safe_x, safe_y);
u->cur_image = v->cur_image;
VehicleMove(u, true);
VehicleUpdatePositionAndViewport(u);
u = u->Next();
if (u != NULL) {
@@ -502,7 +502,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
u->y_pos = y;
u->z_pos = z + ROTOR_Z_OFFSET;
VehicleMove(u, true);
VehicleUpdatePositionAndViewport(u);
}
}
+1 -1
View File
@@ -201,7 +201,7 @@ static AirportFTA *AirportBuildAutomata(uint nofelements, const AirportFTAbuildu
/**
* Get the finite state machine of an airport type.
* @param airport_type Airport type to query FTA from. @see AirportTypes
* @param airport_type %Airport type to query FTA from. @see AirportTypes
* @return Finite state machine of the airport.
*/
const AirportFTAClass *GetAirport(const byte airport_type)
+2 -2
View File
@@ -71,7 +71,7 @@ enum AirportMovementStates {
STARTTAKEOFF = 11, ///< Airplane has arrived at a runway for take-off.
ENDTAKEOFF = 12, ///< Airplane has reached end-point of the take-off runway.
HELITAKEOFF = 13, ///< Helicopter wants to leave the airport.
FLYING = 14, ///< Vehicle is flying in the air.
FLYING = 14, ///< %Vehicle is flying in the air.
LANDING = 15, ///< Airplane wants to land.
ENDLANDING = 16, ///< Airplane wants to finish landing.
HELILANDING = 17, ///< Helicopter wants to land.
@@ -172,7 +172,7 @@ public:
const AirportMovingData *moving_data; ///< Movement data.
struct AirportFTA *layout; ///< state machine for airport
const byte *terminals; ///< Array with the number of terminal groups, followed by the number of terminals in each group.
const byte *terminals; ///< %Array with the number of terminal groups, followed by the number of terminals in each group.
const byte num_helipads; ///< Number of helipads on this airport. When 0 helicopters will go to normal terminals.
Flags flags; ///< Flags for this airport type.
byte nofelements; ///< number of positions the airport consists of
-2
View File
@@ -27,11 +27,9 @@
#include "core/geometry_func.hpp"
#include "hotkeys.h"
#include "vehicle_func.h"
#include "sprite.h"
#include "widgets/airport_widget.h"
#include "table/strings.h"
static AirportClassID _selected_airport_class; ///< the currently visible airport class
static int _selected_airport_index; ///< the index of the selected airport in the current class or -1
+1 -1
View File
@@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file animated_tile_func.h Tile animation! */
/** @file animated_tile_func.h %Tile animation! */
#ifndef ANIMATED_TILE_FUNC_H
#define ANIMATED_TILE_FUNC_H
+1 -2
View File
@@ -18,7 +18,6 @@
#include "newgrf.h"
#include "table/strings.h"
#include "table/sprites.h"
static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts per vehicle, i.e. when to abort calling the articulated vehicle callback.
@@ -397,6 +396,6 @@ void AddArticulatedParts(Vehicle *first)
if (flip_image) v->spritenum++;
VehicleMove(v, false);
VehicleUpdatePosition(v);
}
}
+30 -2
View File
@@ -17,7 +17,6 @@
#include "vehicle_func.h"
#include "autoreplace_func.h"
#include "autoreplace_gui.h"
#include "group.h"
#include "articulated_vehicles.h"
#include "core/random_func.hpp"
@@ -89,6 +88,33 @@ bool CheckAutoreplaceValidity(EngineID from, EngineID to, CompanyID company)
return EnginesHaveCargoInCommon(from, to);
}
/**
* Check the capacity of all vehicles in a chain and spread cargo if needed.
* @param v The vehicle to check.
*/
void CheckCargoCapacity(Vehicle *v)
{
assert(v == NULL || v->First() == v);
for (Vehicle *src = v; src != NULL; src = src->Next()) {
/* Do we need to more cargo away? */
if (src->cargo.Count() <= src->cargo_cap) continue;
/* We need to move a particular amount. Try that on the other vehicles. */
uint to_spread = src->cargo.Count() - src->cargo_cap;
for (Vehicle *dest = v; dest != NULL && to_spread != 0; dest = dest->Next()) {
if (dest->cargo.Count() >= dest->cargo_cap || dest->cargo_type != src->cargo_type) continue;
uint amount = min(to_spread, dest->cargo_cap - dest->cargo.Count());
src->cargo.MoveTo(&dest->cargo, amount, VehicleCargoList::MTA_UNLOAD, NULL);
to_spread -= amount;
}
/* Any left-overs will be thrown away, but not their feeder share. */
src->cargo.Truncate(src->cargo_cap);
}
}
/**
* Transfer cargo from a single (articulated )old vehicle to the new vehicle chain
* @param old_veh Old vehicle that will be sold
@@ -297,7 +323,7 @@ static inline CommandCost CmdStartStopVehicle(const Vehicle *v, bool evaluate_ca
*/
static inline CommandCost CmdMoveVehicle(const Vehicle *v, const Vehicle *after, DoCommandFlag flags, bool whole_chain)
{
return DoCommand(0, v->index | (whole_chain ? 1 : 0) << 20, after != NULL ? after->index : INVALID_VEHICLE, flags, CMD_MOVE_RAIL_VEHICLE);
return DoCommand(0, v->index | (whole_chain ? 1 : 0) << 20, after != NULL ? after->index : INVALID_VEHICLE, flags | DC_NO_CARGO_CAP_CHECK, CMD_MOVE_RAIL_VEHICLE);
}
/**
@@ -551,6 +577,8 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
if (i == 0) old_head = NULL;
}
}
if ((flags & DC_EXEC) != 0) CheckCargoCapacity(new_head);
}
/* If we are not in DC_EXEC undo everything, i.e. rearrange old vehicles.
-2
View File
@@ -14,8 +14,6 @@
#include "command_type.h"
#include "company_base.h"
#include "engine_type.h"
#include "group_type.h"
void RemoveAllEngineReplacement(EngineRenewList *erl);
EngineID EngineReplacement(EngineRenewList erl, EngineID engine, GroupID group);
-2
View File
@@ -13,7 +13,6 @@
#include "command_func.h"
#include "vehicle_gui.h"
#include "newgrf_engine.h"
#include "group.h"
#include "rail.h"
#include "strings_func.h"
#include "window_func.h"
@@ -28,7 +27,6 @@
#include "widgets/autoreplace_widget.h"
#include "table/strings.h"
uint GetEngineListHeight(VehicleType type);
void DrawEngineList(VehicleType type, int x, int r, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, bool show_count, GroupID selected_group);
-1
View File
@@ -14,7 +14,6 @@
#include "company_func.h"
#include "depot_func.h"
#include "slope_func.h"
#include "tile_map.h"
/**
+49 -48
View File
@@ -10,7 +10,6 @@
/** @file 32bpp_anim.cpp Implementation of the optimized 32 bpp blitter with animation support. */
#include "../stdafx.h"
#include "../core/math_func.hpp"
#include "../video/video_driver.hpp"
#include "32bpp_anim.hpp"
@@ -25,27 +24,27 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
const SpriteData *src = (const SpriteData *)bp->sprite;
const Colour *src_px = (const Colour *)(src->data + src->offset[zoom][0]);
const uint8 *src_n = (const uint8 *)(src->data + src->offset[zoom][1]);
const uint16 *src_n = (const uint16 *)(src->data + src->offset[zoom][1]);
for (uint i = bp->skip_top; i != 0; i--) {
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
src_n += *(const uint32 *)src_n;
src_n = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
}
uint32 *dst = (uint32 *)bp->dst + bp->top * bp->pitch + bp->left;
uint8 *anim = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
uint16 *anim = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
const byte *remap = bp->remap; // store so we don't have to access it via bp everytime
for (int y = 0; y < bp->height; y++) {
uint32 *dst_ln = dst + bp->pitch;
uint8 *anim_ln = anim + this->anim_buf_width;
uint16 *anim_ln = anim + this->anim_buf_width;
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
src_px++;
const uint8 *src_n_ln = src_n + *(const uint32 *)src_n;
src_n += 4;
const uint16 *src_n_ln = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
src_n += 2;
uint32 *dst_end = dst + bp->skip_left;
@@ -106,9 +105,9 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
*dst = src_px->data;
*anim = 0;
} else {
uint r = remap[m];
*anim = r;
if (r != 0) *dst = this->LookupColourInPalette(r);
uint r = remap[GB(m, 0, 8)];
*anim = r | (m & 0xFF00);
if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
}
anim++;
dst++;
@@ -122,9 +121,9 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
*anim = 0;
} else {
uint r = remap[m];
uint r = remap[GB(m, 0, 8)];
*anim = 0;
if (r != 0) *dst = ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, *dst);
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
}
anim++;
dst++;
@@ -145,14 +144,14 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
src_px += n;
do {
*dst = MakeTransparent(*dst, 3, 4);
*anim = remap[*anim];
*anim = 0;
anim++;
dst++;
} while (--n != 0);
} else {
do {
*dst = MakeTransparent(*dst, (256 * 4 - src_px->a), 256 * 4);
*anim = remap[*anim];
*anim = 0;
anim++;
dst++;
src_px++;
@@ -164,23 +163,25 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
if (src_px->a == 255) {
do {
/* Compiler assumes pointer aliasing, can't optimise this on its own */
uint m = *src_n++;
uint m = GB(*src_n, 0, 8);
/* Above PALETTE_ANIM_START is palette animation */
*anim++ = m;
*dst++ = (m >= PALETTE_ANIM_START) ? this->LookupColourInPalette(m) : src_px->data;
*anim++ = *src_n;
*dst++ = (m >= PALETTE_ANIM_START) ? this->AdjustBrightness(this->LookupColourInPalette(m), GB(*src_n, 8, 8)) : src_px->data;
src_px++;
src_n++;
} while (--n != 0);
} else {
do {
uint m = *src_n++;
uint m = GB(*src_n, 0, 8);
*anim++ = 0;
if (m >= PALETTE_ANIM_START) {
*dst = ComposeColourPANoCheck(this->LookupColourInPalette(m), src_px->a, *dst);
*dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(m), GB(*src_n, 8, 8)), src_px->a, *dst);
} else {
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
}
dst++;
src_px++;
src_n++;
} while (--n != 0);
}
break;
@@ -219,7 +220,7 @@ void Blitter_32bppAnim::DrawColourMappingRect(void *dst, int width, int height,
}
uint32 *udst = (uint32 *)dst;
uint8 *anim;
uint16 *anim;
anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
@@ -259,7 +260,7 @@ void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
/* Set the colour in the anim-buffer too, if we are rendering to the screen */
if (_screen_disable_anim) return;
this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = colour;
this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = colour | (DEFAULT_BRIGHTNESS << 8);
}
void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colour)
@@ -271,18 +272,18 @@ void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colou
}
uint32 colour32 = LookupColourInPalette(colour);
uint8 *anim_line;
uint16 *anim_line;
anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
do {
uint32 *dst = (uint32 *)video;
uint8 *anim = anim_line;
uint16 *anim = anim_line;
for (int i = width; i > 0; i--) {
*dst = colour32;
/* Set the colour in the anim-buffer too */
*anim = colour;
*anim = colour | (DEFAULT_BRIGHTNESS << 8);
dst++;
anim++;
}
@@ -297,19 +298,19 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
uint32 *dst = (uint32 *)video;
const uint32 *usrc = (const uint32 *)src;
uint8 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
uint16 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
for (; height > 0; height--) {
/* We need to keep those for palette animation. */
uint32 *dst_pal = dst;
uint8 *anim_pal = anim_line;
uint16 *anim_pal = anim_line;
memcpy(dst, usrc, width * sizeof(uint32));
usrc += width;
dst += _screen.pitch;
/* Copy back the anim-buffer */
memcpy(anim_line, usrc, width * sizeof(uint8));
usrc = (const uint32 *)((const uint8 *)usrc + width);
memcpy(anim_line, usrc, width * sizeof(uint16));
usrc = (const uint32 *)((const uint16 *)usrc + width);
anim_line += this->anim_buf_width;
/* Okay, it is *very* likely that the image we stored is using
@@ -320,10 +321,10 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
* for just the cursor. This just copies the implementation of
* palette animation, much cheaper though slightly nastier. */
for (int i = 0; i < width; i++) {
uint colour = *anim_pal;
if (IsInsideBS(colour, PALETTE_ANIM_START, PALETTE_ANIM_SIZE)) {
uint colour = GB(*anim_pal, 0, 8);
if (colour >= PALETTE_ANIM_START) {
/* Update this pixel */
*dst_pal = LookupColourInPalette(colour);
*dst_pal = this->AdjustBrightness(LookupColourInPalette(colour), GB(*anim_pal, 8, 8));
}
dst_pal++;
anim_pal++;
@@ -337,7 +338,7 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
uint32 *udst = (uint32 *)dst;
const uint32 *src = (const uint32 *)video;
const uint8 *anim_line;
const uint16 *anim_line;
if (this->anim_buf == NULL) return;
@@ -348,8 +349,8 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
src += _screen.pitch;
udst += width;
/* Copy the anim-buffer */
memcpy(udst, anim_line, width * sizeof(uint8));
udst = (uint32 *)((uint8 *)udst + width);
memcpy(udst, anim_line, width * sizeof(uint16));
udst = (uint32 *)((uint16 *)udst + width);
anim_line += this->anim_buf_width;
}
}
@@ -358,7 +359,7 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
{
assert(!_screen_disable_anim);
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
uint8 *dst, *src;
uint16 *dst, *src;
/* We need to scroll the anim-buffer too */
if (scroll_y > 0) {
@@ -375,7 +376,7 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
uint th = height - scroll_y;
for (; th > 0; th--) {
memcpy(dst, src, tw * sizeof(uint8));
memcpy(dst, src, tw * sizeof(uint16));
src -= this->anim_buf_width;
dst -= this->anim_buf_width;
}
@@ -396,7 +397,7 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
uint tw = width + (scroll_x >= 0 ? -scroll_x : scroll_x);
uint th = height + scroll_y;
for (; th > 0; th--) {
memmove(dst, src, tw * sizeof(uint8));
memmove(dst, src, tw * sizeof(uint16));
src += this->anim_buf_width;
dst += this->anim_buf_width;
}
@@ -407,7 +408,7 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
int Blitter_32bppAnim::BufferSize(int width, int height)
{
return width * height * (sizeof(uint32) + sizeof(uint8));
return width * height * (sizeof(uint32) + sizeof(uint16));
}
void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
@@ -415,22 +416,22 @@ void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
assert(!_screen_disable_anim);
this->palette = palette;
/* Never repaint the transparency pixel */
if (this->palette.first_dirty == 0) {
this->palette.first_dirty++;
this->palette.count_dirty--;
}
/* If first_dirty is 0, it is for 8bpp indication to send the new
* palette. As we dont do that for 32bpp, ignore that request
* completely */
if (this->palette.first_dirty == 0) return;
assert(this->palette.first_dirty == PALETTE_ANIM_START);
const uint8 *anim = this->anim_buf;
const uint16 *anim = this->anim_buf;
uint32 *dst = (uint32 *)_screen.dst_ptr;
/* Let's walk the anim buffer and try to find the pixels */
for (int y = this->anim_buf_height; y != 0 ; y--) {
for (int x = this->anim_buf_width; x != 0 ; x--) {
uint colour = *anim;
if (IsInsideBS(colour, this->palette.first_dirty, this->palette.count_dirty)) {
uint colour = GB(*anim, 0, 8);
if (colour >= PALETTE_ANIM_START) {
/* Update this pixel */
*dst = LookupColourInPalette(colour);
*dst = this->AdjustBrightness(LookupColourInPalette(colour), GB(*anim, 8, 8));
}
dst++;
anim++;
@@ -452,7 +453,7 @@ void Blitter_32bppAnim::PostResize()
if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height) {
/* The size of the screen changed; we can assume we can wipe all data from our buffer */
free(this->anim_buf);
this->anim_buf = CallocT<uint8>(_screen.width * _screen.height);
this->anim_buf = CallocT<uint16>(_screen.width * _screen.height);
this->anim_buf_width = _screen.width;
this->anim_buf_height = _screen.height;
}
+2 -2
View File
@@ -17,7 +17,7 @@
/** The optimised 32 bpp blitter with palette animation. */
class Blitter_32bppAnim FINAL : public Blitter_32bppOptimized {
private:
uint8 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
uint16 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
int anim_buf_width; ///< The width of the animation buffer.
int anim_buf_height; ///< The height of the animation buffer.
Palette palette; ///< The current palette.
@@ -41,7 +41,7 @@ public:
/* virtual */ Blitter::PaletteAnimation UsePaletteAnimation();
/* virtual */ const char *GetName() { return "32bpp-anim"; }
/* virtual */ int GetBytesPerPixel() { return 5; }
/* virtual */ int GetBytesPerPixel() { return 6; }
/* virtual */ void PostResize();
/**
+28
View File
@@ -14,6 +14,7 @@
#include "base.hpp"
#include "../core/bitmath_func.hpp"
#include "../core/math_func.hpp"
#include "../gfx_func.h"
/** Base for all 32bpp blitters. */
@@ -134,6 +135,33 @@ public:
return ComposeColour(0xFF, colour, colour, colour);
}
static const int DEFAULT_BRIGHTNESS = 64;
static inline uint32 AdjustBrightness(uint32 colour, uint8 brightness)
{
/* Shortcut for normal brightness */
if (brightness == DEFAULT_BRIGHTNESS) return colour;
uint16 ob = 0;
uint16 r = GB(colour, 16, 8) * brightness / DEFAULT_BRIGHTNESS;
uint16 g = GB(colour, 8, 8) * brightness / DEFAULT_BRIGHTNESS;
uint16 b = GB(colour, 0, 8) * brightness / DEFAULT_BRIGHTNESS;
/* Sum overbright */
if (r > 255) ob += r - 255;
if (g > 255) ob += g - 255;
if (b > 255) ob += b - 255;
if (ob == 0) return ComposeColour(GB(colour, 24, 8), r, g, b);
/* Reduce overbright strength */
ob /= 2;
return ComposeColour(GB(colour, 24, 8),
r >= 255 ? 255 : min(r + ob * (255 - r) / 256, 255),
g >= 255 ? 255 : min(g + ob * (255 - g) / 256, 255),
b >= 255 ? 255 : min(b + ob * (255 - b) / 256, 255));
}
};
#endif /* BLITTER_32BPP_BASE_HPP */
+22 -16
View File
@@ -12,7 +12,6 @@
#include "../stdafx.h"
#include "../zoom_func.h"
#include "../settings_type.h"
#include "../core/math_func.hpp"
#include "32bpp_optimized.hpp"
/** Instantiation of the optimized 32bpp blitter factory. */
@@ -36,12 +35,12 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
/* src_n : each line begins with uint32 n = 'number of bytes in this line',
* then interleaved stream of 'm' and 'n' channels. 'm' is remap,
* 'n' is number of bytes with the same alpha channel class */
const uint8 *src_n = (const uint8 *)(src->data + src->offset[zoom][1]);
const uint16 *src_n = (const uint16 *)(src->data + src->offset[zoom][1]);
/* skip upper lines in src_px and src_n */
for (uint i = bp->skip_top; i != 0; i--) {
src_px = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
src_n += *(const uint32 *)src_n;
src_n = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
}
/* skip lines in dst */
@@ -59,8 +58,8 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
src_px++;
/* next src_n line begins here */
const uint8 *src_n_ln = src_n + *(const uint32 *)src_n;
src_n += 4;
const uint16 *src_n_ln = (const uint16 *)((const byte *)src_n + *(const uint32 *)src_n);
src_n += 2;
/* we will end this line when we reach this point */
uint32 *dst_end = dst + bp->skip_left;
@@ -119,8 +118,8 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
if (m == 0) {
*dst = src_px->data;
} else {
uint r = remap[m];
if (r != 0) *dst = this->LookupColourInPalette(r);
uint r = remap[GB(m, 0, 8)];
if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
}
dst++;
src_px++;
@@ -132,8 +131,8 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
if (m == 0) {
*dst = ComposeColourRGBANoCheck(src_px->r, src_px->g, src_px->b, src_px->a, *dst);
} else {
uint r = remap[m];
if (r != 0) *dst = ComposeColourPANoCheck(this->LookupColourInPalette(r), src_px->a, *dst);
uint r = remap[GB(m, 0, 8)];
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
}
dst++;
src_px++;
@@ -270,7 +269,7 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
*
* it has to be stored in one stream so fewer registers are used -
* x86 has problems with register allocation even with this solution */
uint8 *dst_n_orig[ZOOM_LVL_COUNT];
uint16 *dst_n_orig[ZOOM_LVL_COUNT];
/* lengths of streams */
uint32 lengths[ZOOM_LVL_COUNT][2];
@@ -293,7 +292,7 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
uint size = src_orig->height * src_orig->width;
dst_px_orig[z] = CallocT<Colour>(size + src_orig->height * 2);
dst_n_orig[z] = CallocT<uint8>(size * 2 + src_orig->height * 4 * 2);
dst_n_orig[z] = CallocT<uint16>(size * 2 + src_orig->height * 4 * 2);
uint32 *dst_px_ln = (uint32 *)dst_px_orig[z];
uint32 *dst_n_ln = (uint32 *)dst_n_orig[z];
@@ -302,9 +301,9 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
for (uint y = src_orig->height; y > 0; y--) {
Colour *dst_px = (Colour *)(dst_px_ln + 1);
uint8 *dst_n = (uint8 *)(dst_n_ln + 1);
uint16 *dst_n = (uint16 *)(dst_n_ln + 1);
uint8 *dst_len = dst_n++;
uint16 *dst_len = dst_n++;
uint last = 3;
int len = 0;
@@ -313,7 +312,7 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
uint8 a = src->a;
uint t = a > 0 && a < 255 ? 1 : a;
if (last != t || len == 255) {
if (last != t || len == 65535) {
if (last != 3) {
*dst_len = len;
dst_len = dst_n++;
@@ -328,8 +327,15 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
dst_px->a = a;
*dst_n = src->m;
if (src->m != 0) {
/* Get brightest value */
uint8 rgb_max = max(src->r, max(src->g, src->b));
/* Black pixel (8bpp or old 32bpp image), so use default value */
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
*dst_n |= rgb_max << 8;
/* Pre-convert the mapping channel to a RGB value */
uint32 colour = this->LookupColourInPalette(src->m);
uint32 colour = this->AdjustBrightness(this->LookupColourInPalette(src->m), rgb_max);
dst_px->r = GB(colour, 16, 8);
dst_px->g = GB(colour, 8, 8);
dst_px->b = GB(colour, 0, 8);
@@ -354,7 +360,7 @@ Sprite *Blitter_32bppOptimized::Encode(SpriteLoader::Sprite *sprite, AllocatorPr
}
dst_px = (Colour *)AlignPtr(dst_px, 4);
dst_n = (uint8 *)AlignPtr(dst_n, 4);
dst_n = (uint16 *)AlignPtr(dst_n, 4);
*dst_px_ln = (uint8 *)dst_px - (uint8 *)dst_px_ln;
*dst_n_ln = (uint8 *)dst_n - (uint8 *)dst_n_ln;
+26 -10
View File
@@ -20,11 +20,11 @@ static FBlitter_32bppSimple iFBlitter_32bppSimple;
void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
{
const SpriteLoader::CommonPixel *src, *src_line;
const Blitter_32bppSimple::Pixel *src, *src_line;
uint32 *dst, *dst_line;
/* Find where to start reading in the source sprite */
src_line = (const SpriteLoader::CommonPixel *)bp->sprite + (bp->skip_top * bp->sprite_width + bp->skip_left) * ScaleByZoom(1, zoom);
src_line = (const Blitter_32bppSimple::Pixel *)bp->sprite + (bp->skip_top * bp->sprite_width + bp->skip_left) * ScaleByZoom(1, zoom);
dst_line = (uint32 *)bp->dst + bp->top * bp->pitch + bp->left;
for (int y = 0; y < bp->height; y++) {
@@ -41,7 +41,7 @@ void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoo
if (src->m == 0) {
if (src->a != 0) *dst = ComposeColourRGBA(src->r, src->g, src->b, src->a, *dst);
} else {
if (bp->remap[src->m] != 0) *dst = ComposeColourPA(this->LookupColourInPalette(bp->remap[src->m]), src->a, *dst);
if (bp->remap[src->m] != 0) *dst = ComposeColourPA(this->AdjustBrightness(this->LookupColourInPalette(bp->remap[src->m]), src->v), src->a, *dst);
}
break;
@@ -94,26 +94,42 @@ void Blitter_32bppSimple::DrawColourMappingRect(void *dst, int width, int height
Sprite *Blitter_32bppSimple::Encode(SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
{
Sprite *dest_sprite;
SpriteLoader::CommonPixel *dst;
dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width * sizeof(SpriteLoader::CommonPixel));
Blitter_32bppSimple::Pixel *dst;
Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + sprite->height * sprite->width * sizeof(*dst));
dest_sprite->height = sprite->height;
dest_sprite->width = sprite->width;
dest_sprite->x_offs = sprite->x_offs;
dest_sprite->y_offs = sprite->y_offs;
dst = (SpriteLoader::CommonPixel *)dest_sprite->data;
dst = (Blitter_32bppSimple::Pixel *)dest_sprite->data;
SpriteLoader::CommonPixel *src = (SpriteLoader::CommonPixel *)sprite->data;
memcpy(dst, sprite->data, sprite->height * sprite->width * sizeof(SpriteLoader::CommonPixel));
for (int i = 0; i < sprite->height * sprite->width; i++) {
if (dst[i].m != 0) {
if (src->m == 0) {
dst[i].r = src->r;
dst[i].g = src->g;
dst[i].b = src->b;
dst[i].a = src->a;
dst[i].m = 0;
dst[i].v = 0;
} else {
/* Get brightest value */
uint8 rgb_max = max(src->r, max(src->g, src->b));
/* Black pixel (8bpp or old 32bpp image), so use default value */
if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
dst[i].v = rgb_max;
/* Pre-convert the mapping channel to a RGB value */
uint colour = this->LookupColourInPalette(dst[i].m);
uint colour = this->AdjustBrightness(this->LookupColourInPalette(src->m), dst[i].v);
dst[i].r = GB(colour, 16, 8);
dst[i].g = GB(colour, 8, 8);
dst[i].b = GB(colour, 0, 8);
dst[i].a = src->a;
dst[i].m = src->m;
}
src++;
}
return dest_sprite;
+8
View File
@@ -17,6 +17,14 @@
/** The most trivial 32 bpp blitter (without palette animation). */
class Blitter_32bppSimple : public Blitter_32bppBase {
struct Pixel {
uint8 r; ///< Red-channel
uint8 g; ///< Green-channel
uint8 b; ///< Blue-channel
uint8 a; ///< Alpha-channel
uint8 m; ///< Remap-channel
uint8 v; ///< Brightness-channel
};
public:
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
/* virtual */ void DrawColourMappingRect(void *dst, int width, int height, PaletteID pal);
-2
View File
@@ -16,7 +16,6 @@
#if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE)
#include "core/geometry_func.hpp"
#include "fileio_func.h"
#include "fontcache.h"
#include "gfx_func.h"
#include "network/network.h"
@@ -25,7 +24,6 @@
#include "strings_func.h"
#include "video/video_driver.hpp"
#include "window_func.h"
#include "window_gui.h"
#include "widgets/bootstrap_widget.h"
+2 -1
View File
@@ -847,9 +847,10 @@ int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number)
y += FONT_HEIGHT_NORMAL;
}
if (refittable) y = ShowRefitOptionsList(left, right, y, engine_number);
/* Additional text from NewGRF */
y = ShowAdditionalText(left, right, y, engine_number);
if (refittable) y = ShowRefitOptionsList(left, right, y, engine_number);
return y;
}
+27
View File
@@ -105,6 +105,33 @@ public:
{
return this->amount[cargo];
}
/**
* Get the sum of all cargo amounts.
* @return The sum.
*/
template <typename T>
inline const T GetSum() const
{
T ret = 0;
for (size_t i = 0; i < lengthof(this->amount); i++) {
ret += this->amount[i];
}
return ret;
}
/**
* Get the amount of cargos that have an amount.
* @return The amount.
*/
inline byte GetCount() const
{
byte count = 0;
for (size_t i = 0; i < lengthof(this->amount); i++) {
if (this->amount[i] != 0) count++;
}
return count;
}
};
-1
View File
@@ -11,7 +11,6 @@
#include "stdafx.h"
#include "cargotype.h"
#include "core/bitmath_func.hpp"
#include "newgrf_cargo.h"
#include "string_func.h"
#include "strings_func.h"
+1 -38
View File
@@ -18,18 +18,15 @@
#include "saveload/saveload.h"
#include "textbuf_gui.h"
#include "window_gui.h"
#include "newgrf.h"
#include "string_func.h"
#include "strings_func.h"
#include "window_func.h"
#include "rail_gui.h"
#include "gui.h"
#include "company_gui.h"
#include "gamelog.h"
#include "widgets/cheat_widget.h"
#include "table/strings.h"
#include "table/sprites.h"
@@ -87,26 +84,6 @@ static int32 ClickSetProdCheat(int32 p1, int32 p2)
return _cheats.setup_prod.value;
}
/**
* Handle changing of climate.
* @param p1 New climate.
* @param p2 Unused.
* @return New climate.
*/
static int32 ClickChangeClimateCheat(int32 p1, int32 p2)
{
if (p1 == -1) p1 = 3;
if (p1 == 4) p1 = 0;
_settings_game.game_creation.landscape = p1;
GamelogStartAction(GLAT_CHEAT);
GamelogTestMode();
ReloadNewGRFData();
GamelogStopAction();
return _settings_game.game_creation.landscape;
}
extern void EnginesMonthlyLoop();
/**
@@ -140,7 +117,6 @@ enum CheatNumbers {
CHT_CROSSINGTUNNELS, ///< Allow tunnels to cross each other.
CHT_NO_JETCRASH, ///< Disable jet-airplane crashes.
CHT_SETUP_PROD, ///< Allow manually editing of industry production.
CHT_SWITCH_CLIMATE, ///< Switch climate.
CHT_CHANGE_DATE, ///< Do time traveling.
CHT_NUM_CHEATS, ///< Number of cheats.
@@ -173,7 +149,6 @@ static const CheatEntry _cheats_ui[] = {
{SLE_BOOL, STR_CHEAT_CROSSINGTUNNELS, &_cheats.crossing_tunnels.value, &_cheats.crossing_tunnels.been_used, NULL },
{SLE_BOOL, STR_CHEAT_NO_JETCRASH, &_cheats.no_jetcrash.value, &_cheats.no_jetcrash.been_used, NULL },
{SLE_BOOL, STR_CHEAT_SETUP_PROD, &_cheats.setup_prod.value, &_cheats.setup_prod.been_used, &ClickSetProdCheat },
{SLE_UINT8, STR_CHEAT_SWITCH_CLIMATE, &_settings_game.game_creation.landscape, &_cheats.switch_climate.been_used, &ClickChangeClimateCheat },
{SLE_INT32, STR_CHEAT_CHANGE_DATE, &_cur_year, &_cheats.change_date.been_used, &ClickChangeDateCheat },
};
@@ -222,7 +197,7 @@ struct CheatWindow : Window {
case SLE_BOOL: {
bool on = (*(bool*)ce->variable);
DrawFrameRect(button_left, y + 1, button_left + 20 - 1, y + FONT_HEIGHT_NORMAL - 1, on ? COLOUR_GREEN : COLOUR_RED, on ? FR_LOWERED : FR_NONE);
DrawBoolButton(button_left, y, on, true);
SetDParam(0, on ? STR_CONFIG_SETTING_ON : STR_CONFIG_SETTING_OFF);
break;
}
@@ -247,10 +222,6 @@ struct CheatWindow : Window {
break;
}
/* Set correct string for switch climate cheat */
case STR_CHEAT_SWITCH_CLIMATE: val += STR_CHEAT_SWITCH_CLIMATE_TEMPERATE_LANDSCAPE;
/* FALL THROUGH */
default: SetDParam(0, val);
}
break;
@@ -292,14 +263,6 @@ struct CheatWindow : Window {
width = max(width, GetStringBoundingBox(ce->str).width + 10 + 10);
break;
/* Set correct string for switch climate cheat */
case STR_CHEAT_SWITCH_CLIMATE:
for (StringID i = STR_CHEAT_SWITCH_CLIMATE_TEMPERATE_LANDSCAPE; i <= STR_CHEAT_SWITCH_CLIMATE_TOYLAND_LANDSCAPE; i++) {
SetDParam(0, i);
width = max(width, GetStringBoundingBox(ce->str).width);
}
break;
default:
SetDParam(0, INT64_MAX);
width = max(width, GetStringBoundingBox(ce->str).width);
+2 -2
View File
@@ -32,10 +32,10 @@ struct Cheats {
Cheat crossing_tunnels; ///< allow tunnels that cross each other
Cheat dummy1; ///< empty cheat (build while in pause mode)
Cheat no_jetcrash; ///< no jet will crash on small airports anymore
Cheat switch_climate; ///< change the climate of the map
Cheat dummy2; ///< empty cheat (change the climate of the map)
Cheat change_date; ///< changes date ingame
Cheat setup_prod; ///< setup raw-material production in game
Cheat dummy2; ///< empty cheat (enable running el-engines on normal rail)
Cheat dummy3; ///< empty cheat (enable running el-engines on normal rail)
};
extern Cheats _cheats;
+1 -4
View File
@@ -14,9 +14,6 @@
#include "command_func.h"
#include "landscape.h"
#include "genworld.h"
#include "landscape_type.h"
#include "clear_func.h"
#include "economy_func.h"
#include "viewport_func.h"
#include "water.h"
#include "core/random_func.hpp"
@@ -259,7 +256,7 @@ static void TileLoop_Clear(TileIndex tile)
return;
}
}
AmbientSoundEffectCallback(tile);
AmbientSoundEffect(tile);
switch (_settings_game.game_creation.landscape) {
case LT_TROPIC: TileLoopClearDesert(tile); break;
+30 -37
View File
@@ -17,9 +17,7 @@
#include "network/network_type.h"
#include "network/network.h"
#include "genworld.h"
#include "newgrf_storage.h"
#include "strings_func.h"
#include "gfx_func.h"
#include "texteff.hpp"
#include "town.h"
#include "date_func.h"
@@ -152,6 +150,8 @@ CommandProc CmdCompanyCtrl;
CommandProc CmdCustomNewsItem;
CommandProc CmdCreateGoal;
CommandProc CmdRemoveGoal;
CommandProc CmdGoalQuestion;
CommandProc CmdGoalQuestionAnswer;
CommandProc CmdLevelLand;
@@ -290,6 +290,8 @@ static const Command _command_proc_table[] = {
DEF_CMD(CmdCustomNewsItem, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CUSTOM_NEWS_ITEM
DEF_CMD(CmdCreateGoal, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CREATE_GOAL
DEF_CMD(CmdRemoveGoal, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_REMOVE_GOAL
DEF_CMD(CmdGoalQuestion, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_GOAL_QUESTION
DEF_CMD(CmdGoalQuestionAnswer, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_GOAL_QUESTION_ANSWER
DEF_CMD(CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once
@@ -631,40 +633,31 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
if (exec_as_spectator) cur_company.Change(COMPANY_SPECTATOR);
bool test_and_exec_can_differ = (cmd_flags & CMD_NO_TEST) != 0;
bool skip_test = _networking && (cmd & CMD_NO_TEST_IF_IN_NETWORK) != 0;
/* Do we need to do a test run?
* Basically we need to always do this, except when
* the no-test-in-network flag is giving and we're
* in a network game (e.g. restoring orders would
* fail this test because the first order does not
* exist yet when inserting the second, giving that
* a wrong insert location and ignoring the command
* and thus breaking restoring). However, when we
* just want to do cost estimation we don't care
* because it's only done once anyway. */
CommandCost res;
if (estimate_only || !skip_test) {
/* Test the command. */
_cleared_object_areas.Clear();
SetTownRatingTestMode(true);
ClearStorageChanges(false);
res = proc(tile, flags, p1, p2, text);
SetTownRatingTestMode(false);
/* Test the command. */
_cleared_object_areas.Clear();
SetTownRatingTestMode(true);
ClearStorageChanges(false);
CommandCost res = proc(tile, flags, p1, p2, text);
SetTownRatingTestMode(false);
/* Make sure we're not messing things up here. */
assert(exec_as_spectator ? _current_company == COMPANY_SPECTATOR : cur_company.Verify());
/* Make sure we're not messing things up here. */
assert(exec_as_spectator ? _current_company == COMPANY_SPECTATOR : cur_company.Verify());
/* If the command fails, we're doing an estimate
* or the player does not have enough money
* (unless it's a command where the test and
* execution phase might return different costs)
* we bail out here. */
if (res.Failed() || estimate_only ||
(!test_and_exec_can_differ && !CheckCompanyHasMoney(res))) {
cur_company.Restore();
return_dcpi(res, false);
/* If the command fails, we're doing an estimate
* or the player does not have enough money
* (unless it's a command where the test and
* execution phase might return different costs)
* we bail out here. */
if (res.Failed() || estimate_only ||
(!test_and_exec_can_differ && !CheckCompanyHasMoney(res))) {
if (!_networking || _generating_world || (cmd & CMD_NETWORK_COMMAND) != 0) {
/* Log the failed command as well. Just to be able to be find
* causes of desyncs due to bad command test implementations. */
DEBUG(desync, 1, "cmdf: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text, GetCommandName(cmd));
}
cur_company.Restore();
return_dcpi(res, false);
}
#ifdef ENABLE_NETWORK
@@ -703,11 +696,11 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
cur_company.Restore();
}
/* If the test and execution can differ, or we skipped the test
* we have to check the return of the command. Otherwise we can
* check whether the test and execution have yielded the same
* result, i.e. cost and error state are the same. */
if (!test_and_exec_can_differ && !skip_test) {
/* If the test and execution can differ we have to check the
* return of the command. Otherwise we can check whether the
* test and execution have yielded the same result,
* i.e. cost and error state are the same. */
if (!test_and_exec_can_differ) {
assert(res.GetCost() == res2.GetCost() && res.Failed() == res2.Failed()); // sanity check
} else if (res2.Failed()) {
return_dcpi(res2, false);
+6 -4
View File
@@ -266,6 +266,8 @@ enum Commands {
CMD_CUSTOM_NEWS_ITEM, ///< create a custom news message
CMD_CREATE_GOAL, ///< create a new goal
CMD_REMOVE_GOAL, ///< remove a goal
CMD_GOAL_QUESTION, ///< ask a goal related question
CMD_GOAL_QUESTION_ANSWER, ///< answer(s) to CMD_GOAL_QUESTION
CMD_LEVEL_LAND, ///< level land
CMD_BUILD_LOCK, ///< build a lock
@@ -318,9 +320,10 @@ enum DoCommandFlag {
DC_NO_TEST_TOWN_RATING = 0x020, ///< town rating does not disallow you from building
DC_BANKRUPT = 0x040, ///< company bankrupts, skip money check, skip vehicle on tile check in some cases
DC_AUTOREPLACE = 0x080, ///< autoreplace/autorenew is in progress, this shall disable vehicle limits when building, and ignore certain restrictions when undoing things (like vehicle attach callback)
DC_ALL_TILES = 0x100, ///< allow this command also on MP_VOID tiles
DC_NO_MODIFY_TOWN_RATING = 0x200, ///< do not change town rating
DC_FORCE_CLEAR_TILE = 0x400, ///< do not only remove the object on the tile, but also clear any water left on it
DC_NO_CARGO_CAP_CHECK = 0x100, ///< when autoreplace/autorenew is in progress, this shall prevent truncating the amount of cargo in the vehicle to prevent testing the command to remove cargo
DC_ALL_TILES = 0x200, ///< allow this command also on MP_VOID tiles
DC_NO_MODIFY_TOWN_RATING = 0x400, ///< do not change town rating
DC_FORCE_CLEAR_TILE = 0x800, ///< do not only remove the object on the tile, but also clear any water left on it
};
DECLARE_ENUM_AS_BIT_SET(DoCommandFlag)
@@ -342,7 +345,6 @@ DECLARE_ENUM_AS_BIT_SET(DoCommandFlag)
*/
enum FlaggedCommands {
CMD_NETWORK_COMMAND = 0x0100, ///< execute the command without sending it on the network
CMD_NO_TEST_IF_IN_NETWORK = 0x0200, ///< When enabled, the command will bypass the no-DC_EXEC round if in network
CMD_FLAGS_MASK = 0xFF00, ///< mask for all command flags
CMD_ID_MASK = 0x00FF, ///< mask for the command ID
};
+6 -10
View File
@@ -12,22 +12,20 @@
#ifndef COMPANY_BASE_H
#define COMPANY_BASE_H
#include "core/pool_type.hpp"
#include "road_type.h"
#include "rail_type.h"
#include "livery.h"
#include "autoreplace_type.h"
#include "economy_type.h"
#include "tile_type.h"
#include "settings_type.h"
#include "group.h"
/** Statistics about the economy. */
struct CompanyEconomyEntry {
Money income;
Money expenses;
int32 delivered_cargo;
int32 performance_history; ///< company score (scale 0-1000)
Money company_value;
Money income; ///< The amount of income.
Money expenses; ///< The amount of expenses.
CargoArray delivered_cargo; ///< The amount of delivered cargo.
int32 performance_history; ///< Company score (scale 0-1000)
Money company_value; ///< The value of the company.
};
struct CompanyInfrastructure {
@@ -65,8 +63,6 @@ struct CompanyProperties {
byte block_preview; ///< Number of quarters that the company is not allowed to get new exclusive engine previews (see CompaniesGenStatistics).
uint32 cargo_types; ///< Which cargo types were transported the last year.
TileIndex location_of_HQ; ///< Northern tile of HQ; #INVALID_TILE when there is none.
TileIndex last_build_coordinate; ///< Coordinate of the last build thing by this company.
+29 -8
View File
@@ -10,7 +10,6 @@
/** @file company_cmd.cpp Handling of companies. */
#include "stdafx.h"
#include "engine_base.h"
#include "company_base.h"
#include "company_func.h"
#include "company_gui.h"
@@ -33,7 +32,6 @@
#include "settings_func.h"
#include "vehicle_base.h"
#include "vehicle_func.h"
#include "sprite.h"
#include "smallmap_gui.h"
#include "game/game.hpp"
@@ -112,6 +110,7 @@ void SetLocalCompany(CompanyID new_company)
/* ... and redraw the whole screen. */
MarkWholeScreenDirty();
InvalidateWindowClassesData(WC_SIGN_LIST, -1);
}
/**
@@ -811,7 +810,13 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
/* Has the network client a correct ClientIndex? */
if (!(flags & DC_EXEC)) return CommandCost();
NetworkClientInfo *ci = NetworkClientInfo::GetByClientID(client_id);
#ifndef DEBUG_DUMP_COMMANDS
/* When replaying the client ID is not a valid client; there
* are actually no clients at all. However, the company has to
* be created, otherwise we cannot rerun the game properly.
* So only allow a NULL client info in that case. */
if (ci == NULL) return CommandCost();
#endif /* NOT DEBUG_DUMP_COMMANDS */
/* Delete multiplayer progress bar */
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, WN_NETWORK_STATUS_WINDOW_JOIN);
@@ -843,13 +848,17 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
}
if (_network_server) {
ci->client_playas = c->index;
NetworkUpdateClientInfo(ci->client_id);
if (ci != NULL) {
/* ci is only NULL when replaying.
* When replaying no client is actually in need of an update. */
ci->client_playas = c->index;
NetworkUpdateClientInfo(ci->client_id);
}
if (Company::IsValidID(ci->client_playas)) {
if (Company::IsValidID(c->index)) {
_network_company_states[c->index].months_empty = 0;
_network_company_states[c->index].password[0] = '\0';
NetworkServerUpdateCompanyPassworded(ci->client_playas, false);
NetworkServerUpdateCompanyPassworded(c->index, false);
/* XXX - When a client joins, we automatically set its name to the
* client's name (for some reason). As it stands now only the server
@@ -862,12 +871,24 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
* TODO: Perhaps this could be improved by when the client is ready
* with joining to let it send itself the command, and not the server?
* For example in network_client.c:534? */
NetworkSendCommand(0, 0, 0, CMD_RENAME_PRESIDENT, NULL, ci->client_name, ci->client_playas);
if (ci != NULL) {
/* ci is only NULL when replaying.
* When replaying, the command to rename the president will
* automatically be ran, so this is not even needed to get
* the exact same state. */
NetworkSendCommand(0, 0, 0, CMD_RENAME_PRESIDENT, NULL, ci->client_name, c->index);
}
}
/* Announce new company on network. */
NetworkAdminCompanyInfo(c, true);
NetworkServerSendChat(NETWORK_ACTION_COMPANY_NEW, DESTTYPE_BROADCAST, 0, "", ci->client_id, ci->client_playas + 1);
if (ci != NULL) {
/* ci is only NULL when replaying.
* When replaying, the message that someone started a new company
* is not interesting at all. */
NetworkServerSendChat(NETWORK_ACTION_COMPANY_NEW, DESTTYPE_BROADCAST, 0, "", ci->client_id, c->index + 1);
}
}
#endif /* ENABLE_NETWORK */
break;
-1
View File
@@ -14,7 +14,6 @@
#include "command_type.h"
#include "company_type.h"
#include "tile_type.h"
#include "gfx_type.h"
bool MayCompanyTakeOver(CompanyID cbig, CompanyID small);
+1 -5
View File
@@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file company_gui.cpp Company related GUIs. */
/** @file company_gui.cpp %Company related GUIs. */
#include "stdafx.h"
#include "error.h"
@@ -20,17 +20,14 @@
#include "network/network.h"
#include "network/network_gui.h"
#include "network/network_func.h"
#include "vehicle_func.h"
#include "newgrf.h"
#include "company_manager_face.h"
#include "strings_func.h"
#include "date_func.h"
#include "widgets/dropdown_type.h"
#include "tilehighlight_func.h"
#include "sprite.h"
#include "company_base.h"
#include "core/geometry_func.hpp"
#include "economy_func.h"
#include "object_type.h"
#include "rail.h"
#include "engine_base.h"
@@ -41,7 +38,6 @@
#include "widgets/company_widget.h"
#include "table/strings.h"
/** Company GUI constants. */
static const uint EXP_LINESPACE = 2; ///< Amount of vertical space for a horizontal (sub-)total line.
+1 -1
View File
@@ -1245,7 +1245,7 @@ DEF_CONSOLE_CMD(ConStopAI)
return true;
}
if (Company::IsHumanID(company_id)) {
if (Company::IsHumanID(company_id) || company_id == _local_company) {
IConsoleWarning("Company is not controlled by an AI.");
return true;
}
+7 -1
View File
@@ -63,11 +63,17 @@ void SetRandomSeed(uint32 seed)
#include "../network/network_server.h"
#include "../network/network_internal.h"
#include "../company_func.h"
#include "../fileio_func.h"
#include "../date_func.h"
uint32 DoRandom(int line, const char *file)
{
if (_networking && (!_network_server || (NetworkClientSocket::IsValidID(0) && NetworkClientSocket::Get(0)->status != NetworkClientSocket::STATUS_INACTIVE))) {
printf("Random [%d/%d] %s:%d\n", _frame_counter, (byte)_current_company, file, line);
static FILE *f = FioFOpenFile("random-out.log", "wb", AUTOSAVE_DIR);
if (f != NULL) {
fprintf(f, "%08x; %02x; %04x; %02x; %s:%d\n", _date, _date_fract, _frame_counter, (byte)_current_company, file, line);
fflush(f);
}
}
return _random.Next();
+5 -5
View File
@@ -17,8 +17,8 @@
/**
* Simple pair of data. Both types have to be POD ("Plain Old Data")!
* @tvar T Key type.
* @tvar U Value type.
* @tparam T Key type.
* @tparam U Value type.
*/
template <typename T, typename U>
struct SmallPair {
@@ -32,9 +32,9 @@ struct SmallPair {
/**
* Implementation of simple mapping class. Both types have to be POD ("Plain Old Data")!
* It has inherited accessors from SmallVector().
* @tvar T Key type.
* @tvar U Value type.
* @tvar S Unit of allocation.
* @tparam T Key type.
* @tparam U Value type.
* @tparam S Unit of allocation.
*
* @see SmallVector
*/
+8 -7
View File
@@ -15,25 +15,26 @@
#include "date_type.h"
#include "strings_type.h"
static const int CF_NOEURO = 0;
static const int CF_ISEURO = 1;
static const uint NUM_CURRENCY = 29;
static const int CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1;
static const int CF_NOEURO = 0; ///< Currency never switches to the Euro (as far as known).
static const int CF_ISEURO = 1; ///< Currency _is_ the Euro.
static const uint NUM_CURRENCY = 29; ///< Number of currencies.
static const int CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1; ///< Index of the custom currency.
/** Specification of a currency. */
struct CurrencySpec {
uint16 rate;
char separator[8];
Year to_euro;
Year to_euro; ///< %Year of switching to the Euro. May also be #CF_NOEURO or #CF_ISEURO.
char prefix[16];
char suffix[16];
/**
* The currency symbol is represented by two possible values, prefix and suffix
* Usage of one or the other is determined by symbol_pos.
* Usage of one or the other is determined by #symbol_pos.
* 0 = prefix
* 1 = suffix
* 2 = both : Special case only for custom currency.
* It is not a spec from Newgrf,
* rather a way to let users do what they want with custom curency
* rather a way to let users do what they want with custom currency
*/
byte symbol_pos;
StringID name;
-1
View File
@@ -20,7 +20,6 @@
#include "widgets/dropdown_type.h"
#include "widgets/date_widget.h"
#include "table/strings.h"
/** Window to select a date graphically by using dropdowns */
struct SetDateWindow : Window {
+7 -7
View File
@@ -149,13 +149,13 @@ enum Token {
TOKEN_ELSE, ///< (#)else in code
TOKEN_ENDIF, ///< (#)endif in code
TOKEN_UNDEF, ///< (#)undef in code
TOKEN_OR, ///< '||' within #if expression
TOKEN_AND, ///< '&&' within #if expression
TOKEN_DEFINED, ///< 'defined' within #if expression
TOKEN_OPEN, ///< '(' within #if expression
TOKEN_CLOSE, ///< ')' within #if expression
TOKEN_NOT, ///< '!' within #if expression
TOKEN_ZERO, ///< '0' within #if expression
TOKEN_OR, ///< '||' within <tt>#if</tt> expression
TOKEN_AND, ///< '&&' within <tt>#if</tt> expression
TOKEN_DEFINED, ///< 'defined' within <tt>#if</tt> expression
TOKEN_OPEN, ///< '(' within <tt>#if</tt> expression
TOKEN_CLOSE, ///< ')' within <tt>#if</tt> expression
TOKEN_NOT, ///< '!' within <tt>#if</tt> expression
TOKEN_ZERO, ///< '0' within <tt>#if</tt> expression
TOKEN_INCLUDE, ///< (#)include in code
};
+1 -1
View File
@@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file depot_cmd.cpp Command Handling for depots. */
/** @file depot_cmd.cpp %Command Handling for depots. */
#include "stdafx.h"
#include "command_func.h"
+1 -3
View File
@@ -12,10 +12,8 @@
#ifndef DEPOT_FUNC_H
#define DEPOT_FUNC_H
#include "tile_type.h"
#include "vehicle_type.h"
#include "direction_type.h"
#include "slope_type.h"
#include "slope_func.h"
void ShowDepotWindow(TileIndex tile, VehicleType type);
-2
View File
@@ -18,10 +18,8 @@
#include "viewport_func.h"
#include "command_func.h"
#include "depot_base.h"
#include "vehicle_gui.h"
#include "spritecache.h"
#include "strings_func.h"
#include "window_func.h"
#include "vehicle_func.h"
#include "company_func.h"
#include "tilehighlight_func.h"
+5 -6
View File
@@ -149,8 +149,7 @@ static void InitializeDisasterVehicle(DisasterVehicle *v, int x, int y, int z, D
v->current_order.Free();
DisasterVehicleUpdateImage(v);
VehicleMove(v, false);
MarkSingleVehicleDirty(v);
VehicleUpdatePositionAndViewport(v);
}
static void SetDisasterVehiclePos(DisasterVehicle *v, int x, int y, int z)
@@ -161,7 +160,7 @@ static void SetDisasterVehiclePos(DisasterVehicle *v, int x, int y, int z)
v->tile = TileVirtXY(x, y);
DisasterVehicleUpdateImage(v);
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
DisasterVehicle *u = v->Next();
if (u != NULL) {
@@ -175,13 +174,13 @@ static void SetDisasterVehiclePos(DisasterVehicle *v, int x, int y, int z)
u->direction = v->direction;
DisasterVehicleUpdateImage(u);
VehicleMove(u, true);
VehicleUpdatePositionAndViewport(u);
if ((u = u->Next()) != NULL) {
u->x_pos = x;
u->y_pos = y;
u->z_pos = z + 5;
VehicleMove(u, true);
VehicleUpdatePositionAndViewport(u);
}
}
}
@@ -479,7 +478,7 @@ static bool DisasterTick_Helicopter_Rotors(DisasterVehicle *v)
if (++v->cur_image > SPR_ROTOR_MOVING_3) v->cur_image = SPR_ROTOR_MOVING_1;
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
return true;
}
-3
View File
@@ -15,7 +15,6 @@
#include "station_gui.h"
#include "command_func.h"
#include "water.h"
#include "water_map.h"
#include "window_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
@@ -25,9 +24,7 @@
#include "slope_func.h"
#include "tilehighlight_func.h"
#include "company_base.h"
#include "station_type.h"
#include "hotkeys.h"
#include "bridge.h"
#include "widgets/dock_widget.h"
+7 -18
View File
@@ -17,7 +17,6 @@
#include "news_func.h"
#include "network/network.h"
#include "network/network_func.h"
#include "vehicle_gui.h"
#include "ai/ai.hpp"
#include "aircraft.h"
#include "newgrf_engine.h"
@@ -29,9 +28,7 @@
#include "newgrf_station.h"
#include "newgrf_airporttiles.h"
#include "object.h"
#include "group.h"
#include "strings_func.h"
#include "window_func.h"
#include "date_func.h"
#include "vehicle_func.h"
#include "sound_func.h"
@@ -44,7 +41,6 @@
#include "waypoint_base.h"
#include "economy_base.h"
#include "core/pool_func.hpp"
#include "newgrf.h"
#include "core/backup_type.hpp"
#include "water.h"
#include "game/game.hpp"
@@ -218,27 +214,21 @@ int UpdateCompanyRatingAndValue(Company *c, bool update)
/* Generate score depending on amount of transported cargo */
{
const CompanyEconomyEntry *cee;
int numec;
uint32 total_delivered;
numec = min(c->num_valid_stat_ent, 4);
int numec = min(c->num_valid_stat_ent, 4);
if (numec != 0) {
cee = c->old_economy;
total_delivered = 0;
const CompanyEconomyEntry *cee = c->old_economy;
OverflowSafeInt64 total_delivered = 0;
do {
total_delivered += cee->delivered_cargo;
total_delivered += cee->delivered_cargo.GetSum<OverflowSafeInt64>();
} while (++cee, --numec);
_score_part[owner][SCORE_DELIVERED] = total_delivered;
_score_part[owner][SCORE_DELIVERED] = ClampToI32(total_delivered);
}
}
/* Generate score for variety of cargo */
{
uint num = CountBits(c->cargo_types);
_score_part[owner][SCORE_CARGO] = num;
if (update) c->cargo_types = 0;
_score_part[owner][SCORE_CARGO] = c->old_economy->delivered_cargo.GetCount();
}
/* Generate score for company's money */
@@ -1011,8 +1001,7 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, Ti
}
/* Update company statistics */
company->cur_economy.delivered_cargo += accepted;
if (accepted > 0) SetBit(company->cargo_types, cargo_type);
company->cur_economy.delivered_cargo[cargo_type] += accepted;
/* Increase town's counter for town effects */
const CargoSpec *cs = CargoSpec::Get(cargo_type);
+13 -15
View File
@@ -19,7 +19,6 @@
#include "effectvehicle_func.h"
#include "effectvehicle_base.h"
#include "table/sprites.h"
static void ChimneySmokeInit(EffectVehicle *v)
{
@@ -45,7 +44,7 @@ static bool ChimneySmokeTick(EffectVehicle *v)
v->cur_image = SPR_CHIMNEY_SMOKE_0;
}
v->progress = 7;
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
}
return true;
@@ -78,7 +77,7 @@ static bool SteamSmokeTick(EffectVehicle *v)
moved = true;
}
if (moved) VehicleMove(v, true);
if (moved) VehicleUpdatePositionAndViewport(v);
return true;
}
@@ -95,11 +94,11 @@ static bool DieselSmokeTick(EffectVehicle *v)
if ((v->progress & 3) == 0) {
v->z_pos++;
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
} else if ((v->progress & 7) == 1) {
if (v->cur_image != SPR_DIESEL_SMOKE_5) {
v->cur_image++;
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
} else {
delete v;
return false;
@@ -123,7 +122,7 @@ static bool ElectricSparkTick(EffectVehicle *v)
v->progress = 0;
if (v->cur_image != SPR_ELECTRIC_SPARK_5) {
v->cur_image++;
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
} else {
delete v;
return false;
@@ -160,7 +159,7 @@ static bool SmokeTick(EffectVehicle *v)
moved = true;
}
if (moved) VehicleMove(v, true);
if (moved) VehicleUpdatePositionAndViewport(v);
return true;
}
@@ -177,7 +176,7 @@ static bool ExplosionLargeTick(EffectVehicle *v)
if ((v->progress & 3) == 0) {
if (v->cur_image != SPR_EXPLOSION_LARGE_F) {
v->cur_image++;
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
} else {
delete v;
return false;
@@ -202,7 +201,7 @@ static bool BreakdownSmokeTick(EffectVehicle *v)
} else {
v->cur_image = SPR_BREAKDOWN_SMOKE_0;
}
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
}
v->animation_state--;
@@ -226,7 +225,7 @@ static bool ExplosionSmallTick(EffectVehicle *v)
if ((v->progress & 3) == 0) {
if (v->cur_image != SPR_EXPLOSION_SMALL_B) {
v->cur_image++;
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
} else {
delete v;
return false;
@@ -303,7 +302,7 @@ static bool BulldozerTick(EffectVehicle *v)
return false;
}
}
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
}
return true;
@@ -476,7 +475,7 @@ static bool BubbleTick(EffectVehicle *v)
if (v->spritenum == 0) {
v->cur_image++;
if (v->cur_image < SPR_BUBBLE_GENERATE_3) {
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
return true;
}
if (v->animation_substate != 0) {
@@ -522,7 +521,7 @@ static bool BubbleTick(EffectVehicle *v)
v->z_pos += b->z;
v->cur_image = SPR_BUBBLE_0 + b->image;
VehicleMove(v, true);
VehicleUpdatePositionAndViewport(v);
return true;
}
@@ -606,8 +605,7 @@ EffectVehicle *CreateEffectVehicle(int x, int y, int z, EffectVehicleType type)
_effect_init_procs[type](v);
VehicleMove(v, false);
MarkSingleVehicleDirty(v);
VehicleUpdatePositionAndViewport(v);
return v;
}
+1
View File
@@ -13,6 +13,7 @@
#define EFFECTVEHICLE_BASE_H
#include "vehicle_base.h"
#include "transparency.h"
/**
* A special vehicle is one of the following:
-1
View File
@@ -16,7 +16,6 @@
#include "aircraft.h"
#include "newgrf.h"
#include "newgrf_engine.h"
#include "group.h"
#include "strings_func.h"
#include "core/random_func.hpp"
#include "window_func.h"
-2
View File
@@ -12,11 +12,9 @@
#ifndef ENGINE_BASE_H
#define ENGINE_BASE_H
#include "company_type.h"
#include "engine_type.h"
#include "vehicle_type.h"
#include "core/pool_type.hpp"
#include "core/smallvec_type.hpp"
#include "newgrf_commons.h"
typedef Pool<Engine, EngineID, 64, 64000> EnginePool;
-1
View File
@@ -11,7 +11,6 @@
#include "stdafx.h"
#include "window_gui.h"
#include "gfx_func.h"
#include "engine_base.h"
#include "command_func.h"
#include "strings_func.h"
+5 -4
View File
@@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file engine_gui.h Engine GUI functions, used by build_vehicle_gui and autoreplace_gui */
/** @file engine_gui.h %Engine GUI functions, used by build_vehicle_gui and autoreplace_gui */
#ifndef ENGINE_GUI_H
#define ENGINE_GUI_H
@@ -15,12 +15,13 @@
#include "engine_type.h"
#include "sortlist_type.h"
#include "gfx_type.h"
#include "vehicle_type.h"
typedef GUIList<EngineID, CargoID> GUIEngineList;
typedef int CDECL EngList_SortTypeFunction(const EngineID*, const EngineID*); ///< argument type for EngList_Sort()
void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare); ///< sort of the engine list
void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items); ///< sort of specified portion of the engine list
typedef int CDECL EngList_SortTypeFunction(const EngineID*, const EngineID*); ///< argument type for #EngList_Sort.
void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare);
void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items);
StringID GetEngineCategoryName(EngineID engine);
StringID GetEngineInfoString(EngineID engine);
+2
View File
@@ -119,8 +119,10 @@ public:
{
this->position.x = x;
this->position.y = y;
if (textref_stack_size > 0) StartTextRefStackUsage(textref_stack_size, textref_stack);
CopyOutDParam(this->decode_params, this->strings, detailed_msg == INVALID_STRING_ID ? summary_msg : detailed_msg, lengthof(this->decode_params));
if (textref_stack_size > 0) {
StopTextRefStackUsage();
MemCpyT(this->textref_stack, textref_stack, textref_stack_size);
}
+2 -2
View File
@@ -28,8 +28,8 @@ enum Subdirectory {
BASESET_DIR, ///< Subdirectory for all base data (base sets, intro game)
NEWGRF_DIR, ///< Subdirectory for all NewGRFs
LANG_DIR, ///< Subdirectory for all translation files
AI_DIR, ///< Subdirectory for all AI files
AI_LIBRARY_DIR,///< Subdirectory for all AI libraries
AI_DIR, ///< Subdirectory for all %AI files
AI_LIBRARY_DIR,///< Subdirectory for all %AI libraries
GAME_DIR, ///< Subdirectory for all game scripts
GAME_LIBRARY_DIR, ///< Subdirectory for all GS libraries
NUM_SUBDIRS, ///< Number of subdirectories
-1
View File
@@ -11,7 +11,6 @@
#include "../stdafx.h"
#include "../settings_type.h"
#include "../core/random_func.hpp"
#include "game.hpp"
#include "game_config.hpp"
#include "game_info.hpp"
+3 -4
View File
@@ -10,14 +10,11 @@
/** @file game_core.cpp Implementation of Game. */
#include "../stdafx.h"
#include "../command_func.h"
#include "../core/backup_type.hpp"
#include "../core/bitmath_func.hpp"
#include "../company_base.h"
#include "../company_func.h"
#include "../network/network.h"
#include "../window_func.h"
#include "../fileio_func.h"
#include "game.hpp"
#include "game_scanner.hpp"
#include "game_config.hpp"
@@ -97,6 +94,7 @@
delete Game::instance;
Game::instance = NULL;
Game::info = NULL;
cur_company.Restore();
@@ -155,6 +153,7 @@
if (Game::instance != NULL) {
delete Game::instance;
Game::instance = NULL;
Game::info = NULL;
}
} else if (Game::instance != NULL) {
Game::info = _settings_game.game_config->GetInfo();
@@ -178,7 +177,7 @@
InvalidateWindowData(WC_AI_LIST, 0, 1);
SetWindowClassesDirty(WC_AI_DEBUG);
SetWindowDirty(WC_AI_SETTINGS, 0);
InvalidateWindowClassesData(WC_AI_SETTINGS);
}
-4
View File
@@ -11,14 +11,10 @@
#include "../stdafx.h"
#include "../script/squirrel_helper.hpp"
#include "../script/squirrel_class.hpp"
#include "game_info.hpp"
#include "game_scanner.hpp"
#include "../settings_type.h"
#include "../debug.h"
#include "../rev.h"
#include "game.hpp"
/**
* Check if the API version provided by the Game is supported.
-1
View File
@@ -13,7 +13,6 @@
#define GAME_INFO_HPP
#include "../script/script_info.hpp"
#include "../script/script_config.hpp"
/** All static information from an Game like name, version, etc. */
class GameInfo : public ScriptInfo {
+20 -2
View File
@@ -10,12 +10,12 @@
/** @file game_instance.cpp Implementation of GameInstance. */
#include "../stdafx.h"
#include "../debug.h"
#include "../saveload/saveload.h"
#include "../error.h"
#include "../script/squirrel_class.hpp"
#include "../script/script_storage.hpp"
#include "../ai/ai_gui.hpp"
#include "game_config.hpp"
#include "game_info.hpp"
#include "game_instance.hpp"
@@ -126,6 +126,7 @@ void GameInstance::RegisterAPI()
SQGSEventCompanyMerger_Register(this->engine);
SQGSEventCompanyNew_Register(this->engine);
SQGSEventController_Register(this->engine);
SQGSEventGoalQuestionAnswer_Register(this->engine);
SQGSEventIndustryClose_Register(this->engine);
SQGSEventIndustryOpen_Register(this->engine);
SQGSEventStationFirstVehicle_Register(this->engine);
@@ -196,6 +197,23 @@ ScriptInfo *GameInstance::FindLibrary(const char *library, int version)
return (ScriptInfo *)Game::FindLibrary(library, version);
}
void GameInstance::Died()
{
ScriptInstance::Died();
ShowAIDebugWindow(OWNER_DEITY);
const GameInfo *info = Game::GetInfo();
if (info != NULL) {
ShowErrorMessage(STR_ERROR_AI_PLEASE_REPORT_CRASH, INVALID_STRING_ID, WL_WARNING);
if (info->GetURL() != NULL) {
ScriptLog::Info("Please report the error to the following URL:");
ScriptLog::Info(info->GetURL());
}
}
}
/**
* DoCommand callback function for all commands executed by Game Scripts.
* @param result The result of the command.
+1
View File
@@ -30,6 +30,7 @@ public:
private:
/* virtual */ void RegisterAPI();
/* virtual */ void Died();
/* virtual */ CommandCallback *GetDoCommandCallback();
/* virtual */ void LoadDummyScript() {}
};
-5
View File
@@ -10,15 +10,10 @@
/** @file game_scanner.cpp allows scanning Game scripts */
#include "../stdafx.h"
#include "../debug.h"
#include "../fileio_func.h"
#include "../network/network.h"
#include "../core/random_func.hpp"
#include "../script/squirrel_class.hpp"
#include "game_info.hpp"
#include "game_scanner.hpp"
#include "../script/api/script_controller.hpp"
void GameScannerInfo::Initialize()
-2
View File
@@ -10,7 +10,6 @@
/** @file game_text.cpp Implementation of handling translated strings. */
#include "../stdafx.h"
#include "../language.h"
#include "../strgen/strgen.h"
#include "../debug.h"
#include "../fileio_func.h"
@@ -21,7 +20,6 @@
#include "table/strings.h"
#include <exception>
#include <stdarg.h>
void CDECL strgen_warning(const char *s, ...)
-3
View File
@@ -18,10 +18,8 @@
#include "network/network.h"
#include "heightmap.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "date_func.h"
#include "engine_func.h"
#include "newgrf_storage.h"
#include "water.h"
#include "video/video_driver.hpp"
#include "tilehighlight_func.h"
@@ -36,7 +34,6 @@
#include "game/game.hpp"
#include "game/game_instance.hpp"
#include "table/sprites.h"
void GenerateClearTile();
void GenerateIndustries();
-3
View File
@@ -22,7 +22,6 @@
#include "string_func.h"
#include "widgets/dropdown_type.h"
#include "widgets/dropdown_func.h"
#include "landscape_type.h"
#include "querystring_gui.h"
#include "town.h"
#include "settings_func.h"
@@ -33,8 +32,6 @@
#include "widgets/genworld_widget.h"
#include "table/strings.h"
#include "table/sprites.h"
extern void MakeNewgameSettingsLive();
+30 -1
View File
@@ -20,7 +20,6 @@
#include "settings_type.h"
#include "network/network.h"
#include "network/network_func.h"
#include "thread/thread.h"
#include "window_func.h"
#include "newgrf_debug.h"
@@ -822,6 +821,36 @@ Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestio
return box;
}
/**
* Calculates height of string (in pixels). The string is changed to a multiline string if needed.
* @param str string to check
* @param maxw maximum string width
* @return height of pixels of string when it is drawn
*/
int GetStringHeight(const char *str, int maxw)
{
char buffer[DRAW_STRING_BUFFER];
strecpy(buffer, str, lastof(buffer));
uint32 tmp = FormatStringLinebreaks(buffer, lastof(buffer), maxw);
return GetMultilineStringHeight(buffer, GB(tmp, 0, 16), FS_NORMAL);
}
/**
* Calculate string bounding box for multi-line strings.
* @param str String to check.
* @param suggestion Suggested bounding box.
* @return Bounding box for the multi-line string, may be bigger than \a suggestion.
*/
Dimension GetStringMultiLineBoundingBox(const char *str, const Dimension &suggestion)
{
Dimension box = {suggestion.width, GetStringHeight(str, suggestion.width)};
return box;
}
/**
* Draw string, possibly over multiple lines.
*
+1
View File
@@ -125,6 +125,7 @@ Dimension GetStringBoundingBox(StringID strid);
uint32 FormatStringLinebreaks(char *str, const char *last, int maxw, FontSize start_fontsize = FS_NORMAL);
int GetStringHeight(StringID str, int maxw);
Dimension GetStringMultiLineBoundingBox(StringID str, const Dimension &suggestion);
Dimension GetStringMultiLineBoundingBox(const char *str, const Dimension &suggestion);
void LoadStringWidthTable(bool monospace = false);
void DrawDirtyBlocks();
-1
View File
@@ -23,7 +23,6 @@
#include "base_media_func.h"
#include "table/sprites.h"
#include "table/strings.h"
/** Whether the given NewGRFs must get a palette remap from windows to DOS or not. */
bool _palette_remap_grf[MAX_FILE_SLOTS];
+67 -7
View File
@@ -13,21 +13,16 @@
#include "company_func.h"
#include "industry.h"
#include "town.h"
#include "news_func.h"
#include "ai/ai.hpp"
#include "station_base.h"
#include "cargotype.h"
#include "strings_func.h"
#include "window_func.h"
#include "goal_base.h"
#include "core/pool_func.hpp"
#include "core/random_func.hpp"
#include "game/game.hpp"
#include "command_func.h"
#include "company_base.h"
#include "string_func.h"
#include "gui.h"
#include "network/network.h"
#include "table/strings.h"
GoalID _new_goal_id;
@@ -118,3 +113,68 @@ CommandCost CmdRemoveGoal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
return CommandCost();
}
/**
* Ask a goal related question
* @param tile unused.
* @param flags type of operation
* @param p1 various bitstuffed elements
* - p1 = (bit 0 - 15) - Unique ID to use for this question.
* - p1 = (bit 16 - 23) - Company for which this question is.
* @param p2 Buttons of the question.
* @param text Text of the question.
* @return the cost of this operation or an error
*/
CommandCost CmdGoalQuestion(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
uint16 uniqueid = (GoalType)GB(p1, 0, 16);
CompanyID company = (CompanyID)GB(p1, 16, 8);
byte type = GB(p1, 24, 8);
if (_current_company != OWNER_DEITY) return CMD_ERROR;
if (StrEmpty(text)) return CMD_ERROR;
if (company != INVALID_COMPANY && !Company::IsValidID(company)) return CMD_ERROR;
if (CountBits(p2) < 1 || CountBits(p2) > 3) return CMD_ERROR;
if (p2 >= (1 << GOAL_QUESTION_BUTTON_COUNT)) return CMD_ERROR;
if (type >= GOAL_QUESTION_TYPE_COUNT) return CMD_ERROR;
if (flags & DC_EXEC) {
if (company == _local_company || (company == INVALID_COMPANY && Company::IsValidID(_local_company))) ShowGoalQuestion(uniqueid, type, p2, text);
}
return CommandCost();
}
/**
* Reply to a goal question.
* @param tile unused.
* @param flags type of operation
* @param p1 Unique ID to use for this question.
* @param p2 Button the company pressed
* @param text Text of the question.
* @return the cost of this operation or an error
*/
CommandCost CmdGoalQuestionAnswer(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (p1 > UINT16_MAX) return CMD_ERROR;
if (p2 >= GOAL_QUESTION_BUTTON_COUNT) return CMD_ERROR;
if (_current_company == OWNER_DEITY) {
/* It has been requested to close this specific question on all clients */
if (flags & DC_EXEC) DeleteWindowById(WC_GOAL_QUESTION, p1);
return CommandCost();
}
if (_networking && _local_company == _current_company) {
/* Somebody in the same company answered the question. Close the window */
if (flags & DC_EXEC) DeleteWindowById(WC_GOAL_QUESTION, p1);
if (!_network_server) return CommandCost();
}
if (flags & DC_EXEC) {
Game::NewEvent(new ScriptEventGoalQuestionAnswer(p1, (ScriptCompany::CompanyID)(byte)_current_company, (ScriptGoal::QuestionButton)(1 << p2)));
}
return CommandCost();
}
+2 -3
View File
@@ -7,17 +7,16 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file goal_base.h Goal base class. */
/** @file goal_base.h %Goal base class. */
#ifndef GOAL_BASE_H
#define GOAL_BASE_H
#include "cargo_type.h"
#include "company_type.h"
#include "goal_type.h"
#include "core/pool_type.hpp"
typedef Pool<Goal, GoalID, 1, MAX_COMPANIES> GoalPool;
typedef Pool<Goal, GoalID, 1, 256> GoalPool;
extern GoalPool _goal_pool;
/** Struct about subsidies, offered and awarded */
+131 -2
View File
@@ -16,11 +16,11 @@
#include "strings_func.h"
#include "date_func.h"
#include "viewport_func.h"
#include "gfx_func.h"
#include "gui.h"
#include "goal_base.h"
#include "core/geometry_func.hpp"
#include "company_func.h"
#include "command_func.h"
#include "widgets/goal_widget.h"
@@ -247,8 +247,137 @@ static const WindowDesc _goals_list_desc(
_nested_goals_list_widgets, lengthof(_nested_goals_list_widgets)
);
void ShowGoalsList()
{
AllocateWindowDescFront<GoalListWindow>(&_goals_list_desc, 0);
}
struct GoalQuestionWindow : Window {
char *question;
int buttons;
int button[3];
byte type;
GoalQuestionWindow(const WindowDesc *desc, WindowNumber window_number, byte type, uint32 button_mask, const char *question) : Window(), type(type)
{
assert(type < GOAL_QUESTION_TYPE_COUNT);
this->question = strdup(question);
/* Figure out which buttons we have to enable */
uint bit;
int n = 0;
FOR_EACH_SET_BIT(bit, button_mask) {
if (bit >= GOAL_QUESTION_BUTTON_COUNT) break;
this->button[n++] = bit;
if (n == 3) break;
}
this->buttons = n;
assert(this->buttons > 0 && this->buttons < 4);
this->CreateNestedTree(desc);
this->GetWidget<NWidgetStacked>(WID_GQ_BUTTONS)->SetDisplayedPlane(this->buttons - 1);
this->FinishInitNested(desc, window_number);
}
~GoalQuestionWindow()
{
free(this->question);
}
virtual void SetStringParameters(int widget) const
{
switch (widget) {
case WID_GQ_CAPTION:
SetDParam(0, STR_GOAL_QUESTION_CAPTION_QUESTION + this->type);
break;
case WID_GQ_BUTTON_1:
SetDParam(0, STR_GOAL_QUESTION_BUTTON_CANCEL + this->button[0]);
break;
case WID_GQ_BUTTON_2:
SetDParam(0, STR_GOAL_QUESTION_BUTTON_CANCEL + this->button[1]);
break;
case WID_GQ_BUTTON_3:
SetDParam(0, STR_GOAL_QUESTION_BUTTON_CANCEL + this->button[2]);
break;
}
}
virtual void OnClick(Point pt, int widget, int click_count)
{
switch (widget) {
case WID_GQ_BUTTON_1:
DoCommandP(0, this->window_number, this->button[0], CMD_GOAL_QUESTION_ANSWER);
delete this;
break;
case WID_GQ_BUTTON_2:
DoCommandP(0, this->window_number, this->button[1], CMD_GOAL_QUESTION_ANSWER);
delete this;
break;
case WID_GQ_BUTTON_3:
DoCommandP(0, this->window_number, this->button[2], CMD_GOAL_QUESTION_ANSWER);
delete this;
break;
}
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
{
if (widget != WID_GQ_QUESTION) return;
SetDParamStr(0, this->question);
size->height = GetStringHeight(STR_JUST_RAW_STRING, size->width) + WD_PAR_VSEP_WIDE;
}
virtual void DrawWidget(const Rect &r, int widget) const
{
if (widget != WID_GQ_QUESTION) return;
SetDParamStr(0, this->question);
DrawStringMultiLine(r.left, r.right, r.top, UINT16_MAX, STR_JUST_RAW_STRING, TC_BLACK, SA_TOP | SA_HOR_CENTER);
}
};
static const NWidgetPart _nested_goal_question_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE),
NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, WID_GQ_CAPTION), SetDataTip(STR_WHITE_STRING, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
EndContainer(),
NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE),
NWidget(WWT_EMPTY, INVALID_COLOUR, WID_GQ_QUESTION), SetMinimalSize(300, 0), SetPadding(8, 8, 8, 8), SetFill(1, 0),
NWidget(NWID_SELECTION, INVALID_COLOUR, WID_GQ_BUTTONS),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(85, 10, 85),
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_1), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(65, 10, 65),
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_1), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_2), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(25, 10, 25),
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_1), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_2), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, WID_GQ_BUTTON_3), SetDataTip(STR_BLACK_STRING, STR_NULL), SetFill(1, 0),
EndContainer(),
EndContainer(),
NWidget(NWID_SPACER), SetMinimalSize(0, 8),
EndContainer(),
};
static const WindowDesc _goal_question_list_desc(
WDP_CENTER, 0, 0,
WC_GOAL_QUESTION, WC_NONE,
WDF_CONSTRUCTION,
_nested_goal_question_widgets, lengthof(_nested_goal_question_widgets)
);
void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const char *question)
{
new GoalQuestionWindow(&_goal_question_list_desc, id, type, button_mask, question);
}
+5
View File
@@ -12,6 +12,11 @@
#ifndef GOAL_TYPE_H
#define GOAL_TYPE_H
#include "core/enum_type.hpp"
static const uint32 GOAL_QUESTION_BUTTON_COUNT = 18; ///< Amount of buttons available.
static const byte GOAL_QUESTION_TYPE_COUNT = 4; ///< Amount of question types.
/** Types of goal destinations */
enum GoalType {
GT_NONE, ///< Destination is not linked
+2 -2
View File
@@ -22,13 +22,13 @@
#include "gfx_func.h"
#include "sortlist_type.h"
#include "core/geometry_func.hpp"
#include "math.h"
#include "currency.h"
#include "widgets/graph_widget.h"
#include "table/strings.h"
#include "table/sprites.h"
#include <math.h>
/* Bitmasks of company and cargo indices that shouldn't be drawn. */
static uint _legend_excluded_companies;
@@ -717,7 +717,7 @@ struct DeliveredCargoGraphWindow : BaseGraphWindow {
virtual OverflowSafeInt64 GetGraphData(const Company *c, int j)
{
return c->old_economy[j].delivered_cargo;
return c->old_economy[j].delivered_cargo.GetSum<OverflowSafeInt64>();
}
};
-2
View File
@@ -12,8 +12,6 @@
#include "stdafx.h"
#include "train.h"
#include "roadveh.h"
#include "vehicle_gui.h"
#include "window_func.h"
/**
* Recalculates the cached total power of a vehicle. Should be called when the consist is changed.
+4 -3
View File
@@ -16,6 +16,7 @@
#include "vehicle_gui.h"
#include "landscape.h"
#include "window_func.h"
#include "widgets/vehicle_widget.h"
/** What is the status of our acceleration? */
enum AccelStatus {
@@ -226,10 +227,10 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
/**
* Checks if the vehicle is in a slope and sets the required flags in that case.
* @param new_tile True if the vehicle reached a new tile.
* @param turned Indicates if the vehicle has turned.
* @param update_delta Indicates to also update the delta.
* @return Old height of the vehicle.
*/
inline byte UpdateInclination(bool new_tile, bool turned)
inline byte UpdateInclination(bool new_tile, bool update_delta)
{
byte old_z = this->z_pos;
@@ -239,7 +240,7 @@ struct GroundVehicle : public SpecializedVehicle<T, Type> {
this->UpdateZPosition();
}
this->UpdateViewport(true, turned);
this->UpdateViewport(true, update_delta);
return old_z;
}
-3
View File
@@ -12,11 +12,8 @@
#include "stdafx.h"
#include "cmd_helper.h"
#include "command_func.h"
#include "group.h"
#include "train.h"
#include "vehicle_gui.h"
#include "vehiclelist.h"
#include "window_func.h"
#include "vehicle_func.h"
#include "autoreplace_base.h"
#include "autoreplace_func.h"
-2
View File
@@ -14,7 +14,6 @@
#include "command_func.h"
#include "vehicle_gui.h"
#include "vehicle_base.h"
#include "group.h"
#include "string_func.h"
#include "strings_func.h"
#include "window_func.h"
@@ -29,7 +28,6 @@
#include "widgets/group_widget.h"
#include "table/strings.h"
#include "table/sprites.h"
typedef GUIList<const Group*> GUIGroupList;
+2 -1
View File
@@ -16,7 +16,6 @@
#include "gfx_type.h"
#include "economy_type.h"
#include "tile_type.h"
#include "strings_type.h"
#include "transport_type.h"
struct Window;
@@ -30,6 +29,7 @@ void ShowGameOptions();
void ShowGameDifficulty();
void ShowGameSettings();
void DrawArrowButtons(int x, int y, Colours button_colour, byte state, bool clickable_left, bool clickable_right);
void DrawBoolButton(int x, int y, bool state, bool clickable);
/* train_gui.cpp */
void ShowOrdersWindow(const Vehicle *v);
@@ -53,6 +53,7 @@ void ShowTownDirectory();
void ShowIndustryDirectory();
void ShowSubsidiesList();
void ShowGoalsList();
void ShowGoalQuestion(uint16 id, byte type, uint32 button_mask, const char *question);
void ShowEstimatedCostOrIncome(Money cost, int x, int y);
+1 -1
View File
@@ -28,7 +28,7 @@
*/
static inline byte RGBToGrayscale(byte red, byte green, byte blue)
{
/* To avoid doubles and stuff, multiple it with a total of 65536 (16bits), then
/* To avoid doubles and stuff, multiply it with a total of 65536 (16bits), then
* divide by it to normalize the value to a byte again. */
return ((red * 19595) + (green * 38470) + (blue * 7471)) / 65536;
}
+1 -1
View File
@@ -7,7 +7,7 @@
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file hotkeys.h Hotkey related functions. */
/** @file hotkeys.h %Hotkey related functions. */
#ifndef HOTKEYS_H
#define HOTKEYS_H

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