Page 46 of 59

Re: More height levels

Posted: 08 Oct 2012 20:40
by SwissFan91
Ben_Robbins_ wrote:lots
I share your enthusiasm for this patch! :D
Ben_Robbins_ wrote:...The inclusion of the snow tipped peaks once developed, or the multi scenario patch, would be complimentary leaps forward also...
Could you elaborate on this?

I really enjoy playing with this as obviously it is great for the types of games I like and the things I draw. It will allow for 100-tile long pistes instead of just ~10 tiles with the current, restrictive height levels. I haven't got any clue whatsoever about the coding involved, and I'm not going to start shouting about GET THIS IN TRUNK RIGHT NOW, but if/when it does it will be a brilliant addition.

Until then, let us hope Chill keeps his patchpack/new patchpack with this in! :P

Re: More height levels

Posted: 08 Oct 2012 21:00
by Eddi
Ben_Robbins_ wrote:Nothing nicer than being reminded of the glowing hospitality of a socially reclusive introvert, with such perfectly flawed logic.
dear sir. i think your irony detector is broken.

Re: More height levels

Posted: 11 Oct 2012 22:22
by KeithM
I hope I'm posting this in the right place. I think the issue is related to this patch, even if it is part of Chill's Patchpack.

I recently compiled the patchpack, but immediately ran into trouble when attempting to start the game.
Cannot open file "flat_blacktiles.grf"
At first hand it seems all I need to do is find this grf file somewhere, but I can't. To be honest I'm not really sure where to look, I'm the kind of nostalgic idiot who still uses a set of original TTD graphics copied from computer to computer over the past decade.

Re: More height levels

Posted: 11 Oct 2012 22:47
by Ben_Robbins_
The grf needs to go in the in the data folder rather than the newgrf folder, and Chrill posted it some way back in this forum. Here is the file: http://www.tt-forums.net/download/file.php?id=111058

Re: More height levels

Posted: 12 Oct 2012 13:23
by KeithM
Thank you for the quick reply. I hope that's all that's missing, otherwise I might have to pester you again.

Re: More height levels

Posted: 16 Oct 2012 16:55
by pavel1269
I am having a problem with the flat_blacktiles.grf. At first, I was not even aware of its existence, but trying to run OTTD told me so. After I finally found some:
(#1: http://www.tt-forums.net/viewtopic.php?p=789494#p789494
#2: http://www.tt-forums.net/viewtopic.php?p=864368#p864368
#3: http://ipv4.tt-forums.net/viewtopic.php ... 82#p834982)

But now, I have the "void" purple. Any idea of solution?

Compiling with MSVC 2010, win 7, 32bit.

Re: More height levels

Posted: 16 Oct 2012 17:12
by planetmaker
pavel1269 wrote:I am having a problem with the flat_blacktiles.grf. At first, I was not even aware of its existence, but trying to run OTTD told me so. After I finally found some:
(#1: http://www.tt-forums.net/viewtopic.php?p=789494#p789494
#2: http://www.tt-forums.net/viewtopic.php?p=864368#p864368
#3: http://ipv4.tt-forums.net/viewtopic.php ... 82#p834982)

But now, I have the "void" purple. Any idea of solution?

Compiling with MSVC 2010, win 7, 32bit.
Probably the patch supplied a windows-paletted grf, but OpenTTD assumes a DOS-paletted one. Or your build process assumes the wrong one. openttd.grf uses the DOS palette exclusively.

Re: More height levels

Posted: 16 Oct 2012 17:39
by pavel1269
I found some problem, which might cause this. I found, that the grf is in "30_PaintingVoidTiles.patch", but I don't have it in the appropriate directory. I tryed to apply patch again and it immediately goes to the "/src/gfxinit.cpp", skiping the grf. Now, what makes me wonder, does OTTD build system handle .grf files in media/extra_grf/? I think, that those .nfo and .png files are included into some base set. Does this mean, that .grf files placed there would get merged too? IE, I am missing that grf in some base set?

EDIT:
1) Why ask, when I can try ... no, it does not.
2) I tryed to set value of "newgrf_default_palette" to 0, but it creates even more problems with other new grfs :( .

Re: More height levels

Posted: 16 Oct 2012 19:33
by Eddi
flat_blacktiles is not a newgrf, it should go in the bin/baseset directory (alongside openttd.grf)

Re: More height levels

Posted: 17 Oct 2012 13:23
by pavel1269

Code: Select all

-	DrawGroundSprite(SPR_FLAT_BLACKTILES + SlopeToSpriteOffset(ti->tileh), PAL_NONE); 
+	DrawGroundSprite(SPR_FLAT_BLACKTILES + SlopeToSpriteOffset(ti->tileh), PAL_WINDOWS);
Did the job.

EDIT: So putting there something like "_settings_client.gui.newgrf_default_palette" there might be better.

Re: More height levels

Posted: 17 Oct 2012 14:13
by planetmaker
And the even better solution might be to provide the sprite in the native palette... the DOS palette.

Re: More height levels

Posted: 17 Oct 2012 14:25
by ChillCore
planetmaker wrote: And the even better solution might be to provide the sprite in the native palette... the DOS palette.
Indeed, find it here ... http://www.tt-forums.net/viewtopic.php? ... &start=744
The sources are available too if needed/wanted ... there is a link in the second post of my patchpack thread (dos palleted sprites needed for v 13_5 and later)


I would attach it to the first post of this thread for it to be found easier but I do not have access to it as it is ic111 who started the topic.

Re: More height levels

Posted: 17 Oct 2012 14:27
by Yexo
ChillCore wrote:I would attach it to the first post of this thread for it to be found easier but I do not have access to it as it is ic111 who started the topic.
Please try to reach ic111 by pm first, if he doesn't respond after a few days make a topic report on the first post. Include a link to the attachment or edits you want and a moderator can edit it for you.

Re: More height levels

Posted: 17 Oct 2012 15:36
by ChillCore
PM sent to ic111, thank you for the offer Yexo.

Basically I asked for the attachment below to be added to the first post.

This zip includes everything needed: the sprites, the nfo, the compiled grf, the GPL lisense and a readme with credits and instructions on usage.
As for edits to the first post ... not sure what could be added, except maybe the fact that you really need the "GRF" to be able to start the patch at all (although this is already made clear by the error message you get when trying to start the patch without it).

Re: More height levels

Posted: 17 Oct 2012 19:19
by ic111
I added the file in the first post, together with a link to this discussion here.

Re: More height levels

Posted: 18 Oct 2012 13:25
by ChillCore
Thank you ic111, hopefully people will find/use the correct GRF more easily now.


Also I hope to find some time soon to resume hacking OpenTTD. ;)

Re: More height levels

Posted: 18 Oct 2012 17:46
by pavel1269
I have one more problem with the patch. Does it restrict some slope actions? I tried to search for that, but seems like no one had that problem. I can't modify slope under object now (house, road, etc.).

EDIT: Problem found, although I have no idea how it started.
EDIT2: I found the problem. On the game start, settings of "build_on_slopes" and "autoslope" is getting turned off. I have no idea why, fortunately saved games are not reversing these values.

Re: More height levels

Posted: 25 Dec 2012 10:55
by ic111
Just a small update, some minor adjustments to changes in trunk.

Re: More height levels

Posted: 25 Dec 2012 15:08
by ic111
Seems that there is some problem with the max. allowed heightlevel setting.

In the settings.ini it used to be

Code: Select all

[SDT_VAR]
base     = GameSettings
var      = construction.max_heightlevel
type     = SLE_UINT8
from     = MORE_HEIGHTLEVEL_SAVEGAME_VERSION
guiflags = SGF_NEWGAME_ONLY | SGF_NO_NETWORK
def      = DEF_MAX_HEIGHTLEVEL
min      = MIN_MAX_HEIGHTLEVEL
max      = MAX_MAX_HEIGHTLEVEL
str      = STR_CONFIG_SETTING_MAX_HEIGHTLEVEL
proc     = AfterChangeOfMaxHeightlevel
with def/min/max being set to constants defined in tile_type.h

Code: Select all

STR_CONFIG_SETTING_MAX_HEIGHTLEVEL                              :{LTBLUE}Maximal allowed heightlevel: {ORANGE}{STRING1}
This lead to the following assertion when opening the Construction node in the settings tree.

Code: Select all

openttd: /home/wol/openttd/_trunk_comb/src/strings_func.h:59: StringParameters::StringParameters(StringParameters&, uint): Assertion `size <= parent.num_param - parent.offset' failed.

Program received signal SIGABRT, Aborted.
0xb7fe1424 in __kernel_vsyscall ()
(gdb) bt
#0  0xb7fe1424 in __kernel_vsyscall ()
#1  0xb7b5a941 in *__GI_raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0xb7b5dd72 in *__GI_abort () at abort.c:92
#3  0xb7b53b58 in *__GI___assert_fail (assertion=0x855dd6c "size <= parent.num_param - parent.offset", file=0x84bdc00 "/home/wol/openttd/_trunk_comb/src/strings_func.h", line=59, 
    function=0x855e5e0 "StringParameters::StringParameters(StringParameters&, uint)") at assert.c:81
#4  0x0842d136 in StringParameters (size=<optimized out>, parent=..., this=<optimized out>) at /home/wol/openttd/_trunk_comb/src/strings_func.h:59
#5  FormatString (buff=0xbfffc886 "\377\277", str_arg=str_arg@entry=0xb7fdd964 "", args=args@entry=0xbfffc320, last=last@entry=0xbfffd05f "\b\200}c\b#", case_index=case_index@entry=0, game_script=game_script@entry=false, 
    dry_run=dry_run@entry=true) at /home/wol/openttd/_trunk_comb/src/strings.cpp:1175
#6  0x0842c1cc in FormatString (buff=buff@entry=0xbfffc883 "\377\277", str_arg=0xb7fdd964 "", args=args@entry=0xbfffc320, last=last@entry=0xbfffd05f "\b\200}c\b#", case_index=case_index@entry=0, 
    game_script=game_script@entry=false, dry_run=dry_run@entry=false) at /home/wol/openttd/_trunk_comb/src/strings.cpp:905
#7  0x0842d6b6 in GetStringWithArgs (buffr=0xbfffc883 "\377\277", string=34916, args=args@entry=0xbfffc320, last=last@entry=0xbfffd05f "\b\200}c\b#", case_index=case_index@entry=0, game_script=game_script@entry=false)
    at /home/wol/openttd/_trunk_comb/src/strings.cpp:269
#8  0x0842b032 in FormatString (buff=0x0, str_arg=str_arg@entry=0xb7fbfc93 "Maximal allowed heightlevel: ", args=args@entry=0x86f01e0, last=last@entry=0xbfffd05f "\b\200}c\b#", case_index=case_index@entry=0, 
    game_script=game_script@entry=false, dry_run=dry_run@entry=true) at /home/wol/openttd/_trunk_comb/src/strings.cpp:1176
#9  0x0842c1cc in FormatString (buff=buff@entry=0xbfffc860 "Maximal allowed heightlevel: \377\277", str_arg=0xb7fbfc93 "Maximal allowed heightlevel: ", args=args@entry=0x86f01e0, 
    last=last@entry=0xbfffd05f "\b\200}c\b#", case_index=case_index@entry=0, game_script=game_script@entry=false, dry_run=dry_run@entry=false) at /home/wol/openttd/_trunk_comb/src/strings.cpp:905
#10 0x0842d6b6 in GetStringWithArgs (buffr=buffr@entry=0xbfffc860 "Maximal allowed heightlevel: \377\277", string=string@entry=892, args=args@entry=0x86f01e0, last=last@entry=0xbfffd05f "\b\200}c\b#", 
    case_index=case_index@entry=0, game_script=game_script@entry=false) at /home/wol/openttd/_trunk_comb/src/strings.cpp:269
#11 0x0842dbef in GetString (buffr=0xbfffc860 "Maximal allowed heightlevel: \377\277", string=892, last=0xbfffd05f "\b\200}c\b#") at /home/wol/openttd/_trunk_comb/src/strings.cpp:276
#12 0x0827bc0d in DrawString (left=60, right=493, top=94, str=892, colour=TC_LIGHT_BLUE, align=SA_LEFT, underline=false, fontsize=FS_NORMAL) at /home/wol/openttd/_trunk_comb/src/gfx.cpp:653
#13 0x083f4cdd in SettingEntry::DrawSetting (this=this@entry=0x86ec3b0, settings_ptr=settings_ptr@entry=0x86eb060, left=60, left@entry=35, right=right@entry=493, y=94, state=0, highlight=false)
    at /home/wol/openttd/_trunk_comb/src/settings_gui.cpp:1268
#14 0x083f5001 in SettingEntry::Draw (this=0x86ec3b0, settings_ptr=0x86eb060, left=5, right=493, base_y=61, first_row=0, max_row=26, cur_row=3, parent_last=0, selected=0x0) at /home/wol/openttd/_trunk_comb/src/settings_gui.cpp:1169
#15 0x083f524e in Draw (parent_last=<optimized out>, cur_row=<optimized out>, selected=<optimized out>, max_row=<optimized out>, first_row=<optimized out>, base_y=<optimized out>, right=<optimized out>, left=<optimized out>, 
    settings_ptr=<optimized out>, this=<optimized out>) at /home/wol/openttd/_trunk_comb/src/settings_gui.cpp:1413
#16 SettingsPage::Draw (this=0x863d5ec, settings_ptr=0x86eb060, left=5, right=493, base_y=61, first_row=0, max_row=26, selected=0x0, cur_row=2, parent_last=0) at /home/wol/openttd/_trunk_comb/src/settings_gui.cpp:1408
#17 0x083f524e in Draw (parent_last=<optimized out>, cur_row=<optimized out>, selected=<optimized out>, max_row=<optimized out>, first_row=<optimized out>, base_y=<optimized out>, right=<optimized out>, left=<optimized out>, 
    settings_ptr=<optimized out>, this=<optimized out>) at /home/wol/openttd/_trunk_comb/src/settings_gui.cpp:1413
#18 SettingsPage::Draw (this=0x863d574, settings_ptr=0x86eb060, left=5, right=493, base_y=61, first_row=0, max_row=26, selected=0x0, cur_row=0, parent_last=0) at /home/wol/openttd/_trunk_comb/src/settings_gui.cpp:1408
#19 0x083f7ff4 in GameSettingsWindow::DrawWidget (this=0xa8b4b2d0, r=..., widget=1) at /home/wol/openttd/_trunk_comb/src/settings_gui.cpp:1854
#20 0x084a8b87 in NWidgetBackground::Draw (this=0xa8b4b880, w=0xa8b4b2d0) at /home/wol/openttd/_trunk_comb/src/widget.cpp:1808
#21 0x084a6374 in NWidgetPIPContainer::Draw (this=0xa8b4b830, w=0xa8b4b2d0) at /home/wol/openttd/_trunk_comb/src/widget.cpp:1068
#22 0x084a6374 in NWidgetPIPContainer::Draw (this=0xa8b4b508, w=0xa8b4b2d0) at /home/wol/openttd/_trunk_comb/src/widget.cpp:1068
#23 0x084a9c6a in Window::DrawWidgets (this=0xa8b4b2d0) at /home/wol/openttd/_trunk_comb/src/widget.cpp:572
#24 0x084b0193 in DrawOverlappedWindowForAll (left=584, top=256, right=1095, bottom=704) at /home/wol/openttd/_trunk_comb/src/window.cpp:704
#25 0x0827970a in RedrawScreenRect (left=584, top=top@entry=256, right=right@entry=1095, bottom=704) at /home/wol/openttd/_trunk_comb/src/gfx.cpp:1726
#26 0x08279950 in DrawDirtyBlocks () at /home/wol/openttd/_trunk_comb/src/gfx.cpp:1818
#27 0x084b1d8c in UpdateWindows () at /home/wol/openttd/_trunk_comb/src/window.cpp:2754
#28 0x08494b77 in VideoDriver_SDL::MainLoop (this=0x8733890) at /home/wol/openttd/_trunk_comb/src/video/sdl_v.cpp:631
#29 0x0832f19d in ttd_main (argc=1, argv=0xbffff644) at /home/wol/openttd/_trunk_comb/src/openttd.cpp:847
#30 0x08165498 in main (argc=1, argv=0xbffff644) at /home/wol/openttd/_trunk_comb/src/os/unix/unix.cpp:275
I noticed that I used STRING1 (which worked in the past as far as I remember), but all other strings defined there use STRING2. As this looked like it might be the cause for the assertion, I replaced it with STRING2 (I admit that I not fully understand the magic behind consuming the string parameters of those settings strings...). This fixed the assertion, but nevertheless it prints out "undefined string" in the construction settings. I also replaced the constants from tile_type.h by simple int literals in settings.ini, no change.

I noticed that some there was some refactoring concerning settings during the last months, but currently I have no clue what might be wrong with that settings.ini entry.

Can anyone help? If you know the solution, feel free to post an updated version of the patch as I will not have the time for such things during the next two weeks...

Re: More height levels

Posted: 28 Dec 2012 07:56
by ChillCore
Hello ic111,

This will fix your advanced setting, while adding a helptext at the bottom of the gui and setting an interval too for when we click the little arrows.

Code: Select all

lang/english.txt:
---------------------
-STR_CONFIG_SETTING_MAX_HEIGHTLEVEL                              :{LTBLUE}Maximal allowed heightlevel: {ORANGE}{STRING1}
+STR_CONFIG_SETTING_MAX_HEIGHTLEVEL                              :Maximal allowed heightlevel: {STRING2}
+STR_CONFIG_SETTING_MAX_HEIGHTLEVEL_HELPTEXT                     :Set the maximal allowed heightlevel


table/settings.ini
-----------------------
 [SDT_VAR]
 base     = GameSettings
 var      = construction.max_heightlevel
 type     = SLE_UINT8
 from     = MORE_HEIGHTLEVEL_SAVEGAME_VERSION
 guiflags = SGF_NEWGAME_ONLY | SGF_NO_NETWORK
 def      = DEF_MAX_HEIGHTLEVEL
 min      = MIN_MAX_HEIGHTLEVEL
 max      = MAX_MAX_HEIGHTLEVEL
+interval = 1
 str      = STR_CONFIG_SETTING_MAX_HEIGHTLEVEL
+strhelp  = STR_CONFIG_SETTING_MAX_HEIGHTLEVEL_HELPTEXT
+strval   = STR_JUST_INT
+cat      = SC_BASIC
 proc     = AfterChangeOfMaxHeightlevel
I did not post patches because I am having a quick look at the rest of the code too.
So far I have fixed the alignment issue in the worldgeneration and play heightmap guis (just removing two spacers).
In the smallmap there is/was a problem with the road icon showing purple.
I am now going to have a quick look at the cheat gui querybox problem you mention in the code.

Also the coding style, mostly in the documentation department, will need a once over soon-ish. ;)


----------------------------
Edit:

Another one bites the dust. :mrgreen:

Code: Select all

@@ -211,6 +211,7 @@ static const NWidgetPart _nested_cheat_w
 struct CheatWindow : Window {
 	int clicked;
 	int header_height;
+	int clicked_widget;
 
 	CheatWindow(const WindowDesc *desc) : Window()
 	{
@@ -335,15 +336,16 @@ struct CheatWindow : Window {
 
 		if (btn == CHT_CHANGE_DATE && x >= 20 + SETTING_BUTTON_WIDTH) {
 			/* Click at the date text directly. */
+			clicked_widget = CHT_CHANGE_DATE;
 			SetDParam(0, value);
 			ShowQueryString(STR_JUST_INT, STR_CHEAT_CHANGE_DATE_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED);
 			return;
-		} else if (btn == CHT_EDIT_MAX_HL && x >= 40) {
+		} else if (btn == CHT_EDIT_MAX_HL && x >= 20 + SETTING_BUTTON_WIDTH) {
 			/* Click at the max. heightlevel text directly. */
-// TODO: How to process the result in OnQueryTextFinished / how to find out that we want to change max. heightlevel, not date
-//			SetDParam(0, value);
-//			ShowQueryString(STR_JUST_INT, STR_CHEAT_EDIT_MAX_HL_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED);
-//			return;
+			clicked_widget = CHT_EDIT_MAX_HL;
+			SetDParam(0, value);
+			ShowQueryString(STR_JUST_INT, STR_CHEAT_EDIT_MAX_HL_QUERY_CAPT, 8, this, CS_NUMERAL, QSF_ACCEPT_UNCHANGED);
+			return;
 		}
 
 		/* Not clicking a button? */
@@ -384,7 +386,7 @@ struct CheatWindow : Window {
 		/* Was 'cancel' pressed or nothing entered? */
 		if (str == NULL || StrEmpty(str)) return;
 
-		const CheatEntry *ce = &_cheats_ui[CHT_CHANGE_DATE];
+		const CheatEntry *ce = &_cheats_ui[clicked_widget];
 		int oldvalue = (int32)ReadValue(ce->variable, ce->type);
 		int value = atoi(str);
 		*ce->been_used = true;
^^^ cheat_gui.cpp ... just in case the context did not give it away.