Page 2 of 3
Re: Probably the most stupid question about patching (widgets)
Posted: 22 Jul 2010 21:01
by pavel1269
On first look, I miss one number ....
Code: Select all
... <flags>, <guiflags>, <init val>, <min>, <max>, <step> ...
Re: The most stupid question about patching (\src\table\setting)
Posted: 22 Jul 2010 21:14
by Kogut
Code: Select all
SDT_VAR(GameSettings, economy.town_demanded_food_divisor, SLE_UINT8, 0, MS, 1, 10000, 1, 1,STR_CONFIG_SETTING_TOWN_DEMANDED_FOOD_DIVISOR, NULL),
Code: Select all
<settings group> = GameSettings
<varname> = economy.town_demanded_food_divisor
<vardef> = SLE_UINT8
<savewhereflags> = 0
<gui flags> = MS
<initial value> = 1
<max value> = 10000
<min value> = 1
<step> = 1
<display string> = STR_CONFIG_SETTING_TOWN_DEMANDED_FOOD_DIVISOR
<onchange callback proc> = NULL
in result:
Code: Select all
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(378) : warning C4003: not enough actual parameters for macro 'SDT_VAR'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(378) : error C2143: syntax error : missing '}' before ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(378) : error C2440: 'initializing' : cannot convert from 'SaveLoadTypes' to 'const void *'
3> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(378) : error C2440: 'initializing' : cannot convert from 'void *' to 'int32'
3> There is no context in which this conversion is possible
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(380) : error C2059: syntax error : '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(380) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(380) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(380) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(381) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(381) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(381) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(382) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(382) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(382) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(383) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(383) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(383) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(384) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(384) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(384) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(385) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(385) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(385) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(386) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(386) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(386) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(387) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(387) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(387) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(389) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(389) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(389) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(390) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(390) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(390) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(391) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(391) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(391) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(392) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(392) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(392) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(394) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(394) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(394) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(395) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(395) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(395) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(396) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(396) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(396) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(398) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(398) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(398) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(399) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(399) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(399) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(400) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(400) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(400) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(401) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(401) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(401) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(402) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(402) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(402) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(403) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(403) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(403) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(404) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(404) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(404) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(405) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(405) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(405) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(406) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(406) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(406) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(407) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(407) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(407) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(408) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(408) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(408) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(409) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(409) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(409) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(410) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(410) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(410) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(411) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(411) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(411) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(412) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(412) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(412) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(413) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(413) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(413) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(414) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(414) : error C2447: '{' : missing function header (old-style formal list?)
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(414) : error C2059: syntax error : ','
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(415) : error C2143: syntax error : missing ';' before '{'
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(415) : fatal error C1003: error count exceeds 100; stopping compilation
Re: The most stupid question about patching (\src\table\setting)
Posted: 22 Jul 2010 21:22
by pavel1269
Hmm. I don't see any problem with this line of code, except use of STD_VAR, which is not causing the error (I think).
Can you create a patch file, with just this one file to see, any other modifications? You know, by accident removed some parentheses, comma or something.
Re: The most stupid question about patching (\src\table\setting)
Posted: 22 Jul 2010 21:26
by Kogut
Thank for your answer
Re: The most stupid question about patching (\src\table\setting)
Posted: 22 Jul 2010 21:45
by pavel1269
Oh... Have you actually modified the code as I said? I have not noticed the warning saying you the problem, because I see very bad those wide lines. You are missing there the <interval> number. Also, you have there as a <guiflag> SL_MAX_VERSION, so you mixed SDT_VAR and SDT_CONDVAR. You can see everywhere around use of those two
To compile replace
Code: Select all
SDT_VAR(GameSettings, economy.town_demanded_food_divisor, SLE_UINT8, 0, SL_MAX_VERSION, 1, 10000, 1, STR_CONFIG_SETTING_TOWN_DEMANDED_FOOD_DIVISOR, NULL),
With
Code: Select all
SDT_VAR(GameSettings, economy.town_demanded_food_divisor, SLE_UINT8, 0, SL_MAX_VERSION, 1, 10000, 1, 0, STR_CONFIG_SETTING_TOWN_DEMANDED_FOOD_DIVISOR, NULL),
Re: The most stupid question about patching (\src\table\setting)
Posted: 23 Jul 2010 00:21
by Eddi
only the first error is usually relevant, the the other ones are only following from the first error, you don't need to post every single one of them...
Re: The most stupid question about patching (\src\table\setting)
Posted: 23 Jul 2010 07:00
by Kogut
Code: Select all
SDT_VAR(GameSettings, economy.town_demanded_food_divisor, SLE_UINT8, 0, SL_MAX_VERSION, 1, 10000, 1, 0,STR_CONFIG_SETTING_TOWN_DEMANDED_FOOD_DIVISOR, NULL),
And the same error
Re: The most stupid question about patching (\src\table\setting)
Posted: 23 Jul 2010 07:53
by Alberth
Randomly trying suggestions from others is not going to get you anywhere.
With programming, it *helps* *a* *lot* if you have at least a basic understanding of what you are doing, and can resolve simple problems like for example syntax errors, by yourself.
To speed up your development, I'd like to suggest you take the time to read a book about C/C++ programming, and do a few simpler excercises first, to make you familiar with the syntax of the language, and the basic development process.
Re: The most stupid question about patching (\src\table\setting)
Posted: 23 Jul 2010 08:10
by Kogut
Alberth wrote:With programming, it *helps* *a* *lot* if you have at least a basic understanding of what you are doing, and can resolve simple problems like for example syntax errors, by yourself.
The problem is that wiki page have incorrect information about parameters that should be inserted. In case of syntax problem in my code I would like to get hint what is wrong, but according to
Code: Select all
3>c:\openttd_folder_kompilacyjny\openttdnewfolder\src\table\settings.h(378) : warning C4003: not enough actual parameters for macro 'SDT_VAR'
Problem is that information about 'SDT_VAR' on wiki are outdated, and macro is failing to create correct code.
Alberth wrote:Randomly trying suggestions from others is not going to get you anywhere.
I assume that replies in the topic are from people with basic understanding of what is happening in settings.h.
To speed up your development, I'd like to suggest you take the time to read a book about C/C++ programming, and do a few simpler excercises first, to make you familiar with the syntax of the language, and the basic development process.
It is done.
Re: The most stupid question about patching (\src\table\setting)
Posted: 23 Jul 2010 08:15
by Kogut
Whatmore example from wiki is failing with the same error message
Code: Select all
SDT_VAR(GameSettings, my_var_opt,SLE_UINT8,S, 0, 4, 1, 20, STR_CONFIG_SETTING_MY_VAR_OPT,NULL),
Re: The most stupid question about patching (\src\table\setting)
Posted: 23 Jul 2010 08:52
by Alberth
You may have noticed it already, but the wiki is outdated. In fact, it is so by definition.
The reason for the wiki being out of date, is that the wiki is not the authorative source of information. The actual source code used at the moment is the one and only authorative source.
For large parts of the source code, the comments in the code may also have some meaning to help you understand what is happening. However, I have seen places where the code and the comments contradict each other, so they may be wrong.
In other words, you should read the source code rather than the wiki to understand what to enter in the code, and set the parameters according to what the code says.
As for the actual error, a syntax error usually means that a seperator (a comma or a semi colon) is missing at the line, or the line above it, or that the number of parameters is not correct.
Unfortunately, my understanding of settings.h is so basic that I cannot tell you the correct magic line. I'd have to study the code as well first.
Edit: fixed typo
Re: The most stupid question about patching (\src\table\setting)
Posted: 23 Jul 2010 08:59
by Kogut
OK, I see that I should try to convert one of existing settings to new setting.
Re: The most stupid question about patching (\src\table\setting)
Posted: 23 Jul 2010 11:54
by Michi_cc
The source code says:
Code: Select all
#define SDT_VAR(base, var, type, flags, guiflags, def, min, max, interval, str, proc) ...stuff...
Comparing leads to the conclusion that the example misses one of the parameters. It's not exactly clear which one, but from the values I'd guess interval is the missing one.
Your initial patch has a much bigger problem though, which is that you very likely don't want a no-save (S) setting, which means you have to use SDT_CONDVAR to not break savegames (and bump the savegame version).
-- Michael Lutz
Re: Probably the most stupid question about compiling
Posted: 23 Jul 2010 20:29
by petert
Kogut wrote:1) Yes I know, but why not name that folder "openttd_source" or sth similar?
Because ottdsrc is the same thing.
Re: The most stupid question about patching (\src\table\setting)
Posted: 25 Jul 2010 10:31
by Kogut
Thanks for help, I finally completed my little patch!
Re: The most stupid question about patching (\src\table\sett
Posted: 02 Nov 2010 19:42
by Kogut
Where I can find information what does it mean? [result of compiling of patched openttd]
Re: The most stupid question about patching (\src\table\sett
Posted: 02 Nov 2010 21:07
by Alberth
Kogut wrote:Where I can find information what does it mean? [result of compiling of patched openttd]
At line 53 of src/core/pool_type.hpp
Seriously, you should build a debug version of openttd, and run the program in the debugger. When the error occurs, you get a stack-dump of function-calls, that show you how that line was reached. That usually gives very good hints where to look.
Since "index < this->first_unused" fails, you are trying to do "index >= this->first_unused". That sounds like you trying to get an entry from a pool that is not used.
Re: The most stupid question about patching (\src\table\sett
Posted: 02 Nov 2010 21:10
by Kogut
Thanks!
Is it possible to stop generation of all that language files? It is really impresive that there are so many translations, but it takes time to generate...
Re: Stupid questions about patching
Posted: 02 Nov 2010 21:15
by Kogut
I discovered problem - my patch is unable to load savegames (except that generated with patched openttd) and crashed on welcome screen...
Re: Stupid questions about patching
Posted: 07 Nov 2010 10:27
by Kogut
One more (I am using tortoiseSVN)
- I applied patchpack to trunk
- I patched patch - how to create diff from patchpack (I want to have diff only with my modifications, not whole patchpack + my modifications)?