Daylength Patch [12/09/2008] Compatibility: r14293

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply

Which daylength are you playing at?

1-5
53
41%
6-15
27
21%
15+
50
38%
 
Total votes: 130

andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by andrewas »

Didn't I post a fixed patch? I know I meant to. Anyway, the crash is indeed due to the game attempting to save a value, part of the date description, into a variable which is too small for it. (Why the OTTD developers allow a variable to be 32 bit in memory but 16 in the save file is beyond me, its just asking for trouble. But no doubt theres a sound reason for it). Also, it doesn't adjust the savegame structure to account for the new patch which breaks savegame compatibility with all prior versions.

Ill merge my version against something more recent and post it.
Forked
Engineer
Engineer
Posts: 43
Joined: 13 Jan 2008 20:36

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Forked »

sweet :) thank you.
andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by andrewas »

Here it is then - not the cleanest code, but it should work.

EDIT] And now, a version with actual savegame compatibility.
Attachments
daylength_r11934.patch
(13.01 KiB) Downloaded 117 times
dante
Engineer
Engineer
Posts: 75
Joined: 17 Dec 2007 16:56

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by dante »

hi, i would like to apply this patch but already have a no random industry patch installed.

is it posseble also to install this patch? so i have both? and how should i do this?
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Bilbo »

dante wrote:hi, i would like to apply this patch but already have a no random industry patch installed.

is it posseble also to install this patch? so i have both? and how should i do this?
Yes, easily.

Apply first patch, then apply second one.

patch -p0 <first.patch
patch -p0 <second.patch

if you are lucky, there won't be any patch conflicts for you to resolve.

Then recompile
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by DaleStan »

Or, cat first.patch second.patch | patch -p0

The latter works really well for applying lots of known non-conflicting patches, and it's even better when you need to zcat instead.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Bilbo »

DaleStan wrote:Or, cat first.patch second.patch | patch -p0

The latter works really well for applying lots of known non-conflicting patches, and it's even better when you need to zcat instead.
Or, stuff all patches in the root of the source tree and do:
cat *.patch | patch -p0

Applies them all :)

Though I've not seed gzipped patches floating around on the forums, so I doubt zcat would be necessary in this case.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by andrewas »

The above replies are correct, but wont work under BuildOTTD, and windows doesnt provide a cat command. Simplest solution is to use any text editor, and add all the patch files to one big patch which BuildOTTD will accept. (If the patches dont have linebreaks, then use a better text editor. notepad may have problems).

Failing that, get build tools which werent explicitly designed to apply one and only one patch with no technical knowledge needed. Check the wiki for options.
Gonozal_VIII
Traffic Manager
Traffic Manager
Posts: 165
Joined: 03 Dec 2007 15:06

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Gonozal_VIII »

i noticed a bug in the patch, the running cost in the vehicle details window gets multiplied with the daylength twice (daylength 30 --> 900 times the value) it's correct in the purchase list and gets substracted correctly, it's only the display there that's wrong
edit: only for trains
andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by andrewas »

Fixed.
Gonozal_VIII
Traffic Manager
Traffic Manager
Posts: 165
Joined: 03 Dec 2007 15:06

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Gonozal_VIII »

---------------------------
TortoiseMerge
---------------------------
An unknown line type was found in line 184 !
---------------------------
OK
---------------------------

line 184 of the patch is empty... if i remove it, i get the same error with line 183
andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by andrewas »

Odd. Works for me, but I did modify that section of the patch by hand, perhaps this is confusing your patch program.

Regardless, this version is exactly as SVN spit it out, so it should work.
Attachments
daylength_11952.patch
(13.11 KiB) Downloaded 156 times
Gonozal_VIII
Traffic Manager
Traffic Manager
Posts: 165
Joined: 03 Dec 2007 15:06

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Gonozal_VIII »

yes, now it works fine, thanks :-)
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by DaleStan »

andrewas wrote:Odd. Works for me, but I did modify that section of the patch by hand, perhaps this is confusing your patch program.
The only reliable hand modifications of a patch are to remove a complete patch band and to remove a complete file. Anything else should be done by rediffing.

Especially when you're handing files to TortoiseMerge. It's at least as fragile as WinME.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
dante
Engineer
Engineer
Posts: 75
Joined: 17 Dec 2007 16:56

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by dante »

ok but i'm a noob in patches still :)

i use buildttd to apply a patch. so is there some explenation on how to apply a second patch (for dummies) ? :oops:
Yexo
Tycoon
Tycoon
Posts: 3663
Joined: 20 Dec 2007 12:49

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Yexo »

dante wrote:ok but i'm a noob in patches still :)

i use buildttd to apply a patch. so is there some explenation on how to apply a second patch (for dummies) ? :oops:
Open both patches in wordpad (not notepad, as that might not work) and copy-past one after the other. Then save as combined.patch (or something else) and use that as the patch file for buildottd. If both patches change the same lines of code however, it won't work (and there's no way to fix that except by hand).
User avatar
Wolf01
Tycoon
Tycoon
Posts: 2016
Joined: 24 Apr 2004 10:43
Location: Venezia - Italia
Contact:

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Wolf01 »

yes why not...
did you ever try that?
maybe with patches which modify different files "might" work, but if both patches want to modify the same file i'm not so sure it works

and both windows notepad (which doesn't support unix EOL style) and wordpad (the best way to destroy a source file if not done in the right way) aren't the right programs to do that
try with notepad++, editpad lite, programmer's notepad etc
Forked
Engineer
Engineer
Posts: 43
Joined: 13 Jan 2008 20:36

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Forked »

Add both patches to the source with TortoiseSVN (edited) .. then create one combined patch from it.. Apply that patch in BuildOTTD. :) of course make sure there are no errors... and if one or both patches adds new files make sure tortoiseSVN add them to the .diff file as well (I'm not sure thats default behavior)

edit: corrected windows app name (sorry, I usually just use svn and patch myself)
Last edited by Forked on 23 Jan 2008 20:04, edited 1 time in total.
User avatar
Bilbo
Tycoon
Tycoon
Posts: 1710
Joined: 06 Jun 2007 21:07
Location: Czech Republic

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by Bilbo »

Forked wrote:Add both patches to the source with TurtleSVN (tortoise?)
Yes. Tortoise, not turtle. TortoiseSVN.
If you need something, do it yourself or it will be never done.

My patches: Extra large maps (1048576 high, 1048576 wide) (FS#1059), Vehicle + Town + Industry console commands (FS#1060), few minor patches (FS#2820, FS#1521, FS#2837, FS#2843), AI debugging facility

Other: Very large ships NewGRF, Bilbo's multiplayer patch pack v5 (for OpenTTD 0.7.3)
andrewas
Engineer
Engineer
Posts: 115
Joined: 03 Oct 2005 19:14

Re: Daylength Patch [03/09/2007] Compatibility: r11060

Post by andrewas »

dante wrote:ok but i'm a noob in patches still :)

i use buildttd to apply a patch. so is there some explenation on how to apply a second patch (for dummies) ? :oops:
Unfortunately, you're getting into 'dummies need not apply' territory, there are very likely going to be problems that no software can solve, and BuildOTTD is not going to do anything to make life easier. If you want to continue with BuildOTTD, then follow the advice above and add all the patches to one file. Otherwise, go to this page:
http://wiki.openttd.org/index.php/Categ ... ng_OpenTTD

Of those options, I use cygwin most of the time, and use BuildOTTD to test that a patch is going to work on a clean environment.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 20 guests