Integrated Version ChrisIN-Final-1 [2008/03/12] *r11485*

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

chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Integrated Version ChrisIN-r11204 [05/10/2007]

Post by chrissicom »

Ok, I have a weird problem, look at this code, which is correct in my opinion (no comments about style, I talk about working or not working here):

Code: Select all

/** Checks if the savegame is between these versions (for ChrisIN savegame compatibility checks).
 */
static inline bool CheckChrisInVersion(uint16 from, uint16 to)
{
	extern uint16 _sl_version;
	if (_sl_version > from && _sl_version < to) return true;

	return false;
}
and

Code: Select all

/* Before version 80 we did NOT have a variable length animated tile table */
	if (CheckChrisInVersion(0,80)) { ///< this was CheckSavegameVersion(80) originally
		/* In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) */
		SlArray(_animated_tile_list, 256, CheckSavegameVersion(6) ? (SLE_FILE_U16 | SLE_VAR_U32) : SLE_UINT32);

		for (_animated_tile_count = 0; _animated_tile_count < 256; _animated_tile_count++) {
			if (_animated_tile_list[_animated_tile_count] == 0) break;
		}
		return;
	}
	/* This is duplicate code from above for ChrisIN until Trunk reaches savegame version 85 */
	if (CheckChrisInVersion(80,85)) {
		/* In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) */
		SlArray(_animated_tile_list, 256, CheckSavegameVersion(6) ? (SLE_FILE_U16 | SLE_VAR_U32) : SLE_UINT32);

		for (_animated_tile_count = 0; _animated_tile_count < 256; _animated_tile_count++) {
			if (_animated_tile_list[_animated_tile_count] == 0) break;
		}
		return;
	}
The first if works, when the savegame version is below 80 the if is true and that portition of code is executed. What doesn't work is that the if is false when loading a savegame with version 81-84 (otherwise I wouldn't get invalid chunk size, because nothing else was changed with version 80 afaik) but in my opinion it should be true?!? I know this isn't the nicest solution yet, I just need to do something like this because some code was added in trunk version 80 which is in ChrisIN only since version 85 so I need to do some special handling of savegame versions 81-84. The way I do it above isn't exactly nice but I don't see what's wrong with the code in a functional sense :cry:
boekabart
Transport Coordinator
Transport Coordinator
Posts: 333
Joined: 25 Aug 2005 09:44
Location: Eindhoven, Netherlands

Re: Integrated Version ChrisIN-r11204 [05/10/2007]

Post by boekabart »

crissicom: At least in my configuration, rev.cpp is re-created every build by the projects\determineversion.vbs script - using the data from rev.cpp.in . Apparently this doesn't happen on your system, any idea why? Did you remove cscript.exe or so?
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Integrated Version ChrisIN-r11204 [05/10/2007]

Post by chrissicom »

Hmmm no csript is there and I use it sometimes as well, so it should work. Maybe it's a file system security problem that Visual Studio can't overwrite the file? Although I doubt that (as the file is owned by me and not by the default admin group) I will try to delete the rev.cpp file and then see if the file is re-created. So actually when compilation works as intended my changes to rev.cpp will be overwritten when compiling? Did I understand that correctly?
Lukeno1
Engineer
Engineer
Posts: 86
Joined: 22 Sep 2007 19:35

Re: Integrated Version ChrisIN-r11204 [05/10/2007]

Post by Lukeno1 »

Hows the development going? Seeing as this is 5 days old, r11235 is the latest release, can you do that please? And please, don't say 'you can compile yourself' as that isn't helpful...
Edit: Small problem, r11235 (which I just put in) thinks of ChrisIN r11204 savegames as newer than itself, so I have to stick with the ChrisIN r11204 until the new version :S
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Integrated Version ChrisIN-r11204 [05/10/2007]

Post by chrissicom »

See this post http://www.tt-forums.net/viewtopic.php?p=632002#p632002 which is actually on top of this page and you know why I haven't released the new build yet :)
Lukeno1
Engineer
Engineer
Posts: 86
Joined: 22 Sep 2007 19:35

Re: Integrated Version ChrisIN-r11204 [05/10/2007]

Post by Lukeno1 »

Sorry Chris, that means nothing to me, that post at the top :oops:
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Integrated Version ChrisIN-r11204 [05/10/2007]

Post by chrissicom »

Lukeno1 wrote:Sorry Chris, that means nothing to me, that post at the top :oops:
The problem is that in trunk a check was introduced wether savegame version is already 80 and then some code is not used anymore which is reqired for older versions. But since ChrisIN has a newer savegame version than trunk, in ChrisIN this old code is required up to version 84. Therefore I need to implement the code so it is used for versions up to 84 except 80 so any trunk game +ChrisIN savegames from at least the last version can be loaded :)
User avatar
ukdmbfan
Engineer
Engineer
Posts: 31
Joined: 11 Sep 2007 22:01
Location: Surrey, UK
Contact:

Re: Integrated Version ChrisIN-r11204 [05/10/2007]

Post by ukdmbfan »

From a logic standpoint the code looks correct, but my OpenTTD source knowledge is pretty poor so I can't tell whether it could be a variable problem. Have you tried outputting the values of everything you're using in the function when it's called?

Also, regarding the version numbers issue you were having, on recompiling the r11204-ChrisIN recently I removed rev.cpp and altered rev.cpp.in and ottdres.rc.in and it compiled correctly (I'd always have r<rev>M come up in OpenTTD before then) and shows "r11204-ChrisIN" (what I changed it to) as the version on the main screen. I'd say try removing rev.cpp and altering rev.cpp.in, because for some reason it's not doing it correctly with rev.cpp there.
Matt
- "If you do things right, people won't be sure you've done anything at all"
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Integrated Version ChrisIN-r11204 [05/10/2007]

Post by chrissicom »

Hmmm then maybe the vscript mentioned earlier should also remove rev.cpp on rebuilding as otherwise it seems that changes to rev.cpp.in don't make their way to rev.cpp :)
Draakon
Director
Director
Posts: 542
Joined: 11 Mar 2007 16:50

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by Draakon »

after upgrade my games tells these things: your language pack is invalid and your openttd.grf is missin or corrupted, any help?
User avatar
AntBUK
Transport Coordinator
Transport Coordinator
Posts: 319
Joined: 02 May 2007 12:29
Location: Sheffield, England
Contact:

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by AntBUK »

Same problem. Original game files are present and the language pack is there.

Using Win32.
Rasing Awareness: Aspergers Syndrome 1 (NAS UK)2 (BBC)3 (YaleDDC)


Something is driving you insane... It is me.
MJS
Director
Director
Posts: 540
Joined: 28 Jul 2005 09:31

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by MJS »

Which is the last version compatible with the current one? You listed that for earlier versions, and it was quite handy.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by chrissicom »

Hmm somehow I compressed an old .exe dunno how that happened but now I uploaded the .zip again with the correct .exe in it :) Sorry for the inconvinience. Savegame compatibility was always and is still on top of the first post of this thread. The current version loads savegames from r11192-ChrisIN and newer :))
The Zero
Engineer
Engineer
Posts: 5
Joined: 26 Aug 2007 16:12

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by The Zero »

There's a problem with Copy & Paste patch. I don't know if it's ChrisIN related, but in previous build (11204) it was ok. Now when I click Paste, I get this error:

Code: Select all

NOT_REACHED triggered at line 765 of ..\src\viewport.cpp
I use prebuilt version of ChrisIN with a bunch of newgrf, most of them are from ChrisIN and #openttdcoop NewGRF pack.
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by chrissicom »

The Zero wrote:There's a problem with Copy & Paste patch. I don't know if it's ChrisIN related, but in previous build (11204) it was ok. Now when I click Paste, I get this error:

Code: Select all

NOT_REACHED triggered at line 765 of ..\src\viewport.cpp
I use prebuilt version of ChrisIN with a bunch of newgrf, most of them are from ChrisIN and #openttdcoop NewGRF pack.
Thanks for reporting this problem :) Copy & Paste is broken in r11245-ChrisIN because viewport.cpp got messed up on the last merge. I have fixed it now and will release an update shortly. This bug has no influence on other parts of the game and also does not influence savegames :)

Edit:
I try to fix the can't copy road bridge problem as well before releasing the bugfixed version.


Edit 2:
Ok after doing some research in the code I know what the matter is I think, I just don't know the solution. Maybe somebody else does when I show the direction.

The problem we have in ChrisIN right now is that copy&paste will paste a road bridge as a rail type as well. This means that bit p2 is not properly set to 15 which would mean that the transport type is road and not rail. Although the copy paste patch should set this bit here:

Code: Select all

static void CP_Build_Bridge(TileIndex start_tile, TileIndex end_tile, uint8 bridgetype, uint8 railtype, uint8 transport_type)
{
	CP_DoCommand(start_tile, end_tile,
		bridgetype | (railtype << 8) | (transport_type << 15), NULL, CMD_BUILD_BRIDGE | CMD_MSG(STR_5015_CAN_T_BUILD_BRIDGE_HERE));
}
Maybe this code doesn't work anymore because of some trunk change but even after searching the changelog many times I don't see what would affect this and why the road bit isn't set anymore. It worked in previous versions but unfortunately I don't know exactly in which version it started to stop working.
Starbud
Traffic Manager
Traffic Manager
Posts: 211
Joined: 05 Mar 2007 00:48
Location: Sweden
Contact:

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by Starbud »

I noticed yesterday om ChrisIN r11192 when i was trying to learn something that there was something messing up the graphics on copied bridges, just the roadbridges i think.
I hope it can help alittle.

Btw, any chance that the cooperation tracks in MiniIN will show up in ChrisIN?
I found it to be useful to let others use my networks since i like building the networks but not the stations :)
http://openttd.org - i love building stuff :)
Someones play with pics http://dimalimsliv.blogg.se
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by chrissicom »

There is a new version of the shared tracks in development and I talked to the author already, but it still has bugs. When it is in a satisfying working state without too many bugs I will include it :)
Draakon
Director
Director
Posts: 542
Joined: 11 Mar 2007 16:50

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by Draakon »

chriss, how do you plan doing that manual?
chrissicom
Route Supervisor
Route Supervisor
Posts: 415
Joined: 07 Oct 2004 10:05

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by chrissicom »

Probably as a seperate file as including a manual directly in the game would be hard to do for me as I don't have a MAC or Linux box to test it there, so a .html like landscape.html in the docs dir of the source will probably be the manual. It's primary purpose is to give a short overview of how to use the patches so people don't have to search through all the links in the first post.

Probably by monday I will have a new version ready with copy & paste completely fixed (i.e. copying road bridges will be available too then). For the time being when playing with the latest ChrisIN don't use copy & paste until the next release, it will crash your game! You've been warned :P
Starbud
Traffic Manager
Traffic Manager
Posts: 211
Joined: 05 Mar 2007 00:48
Location: Sweden
Contact:

Re: Integrated Version ChrisIN-r11245 [2007/10/11]

Post by Starbud »

I have a mac and can test on that one.
But i need someone to compile it because the compilation give some errors on this machine and i have not figured out why yet.
http://openttd.org - i love building stuff :)
Someones play with pics http://dimalimsliv.blogg.se
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 16 guests