wolfc wrote:I dont' see the harm here. According to the 'Howto apply a patch/diff file' thread a patch is allowed to have leadings dirs.
I know that, the problem is not for Linux (Unix) users but for Windows users. It's not so easy to use a git patch under Windows and "svn diff > ..." don't make more work

.
wolfc wrote:Yes, I was already pondering this when I put that piece of code in. Maybe with some smart directives the Tile struct can be made a union with bit fields. Although that needs to be coded/verified against each compiler (even gcc differs with arch/version combinations). It would make the code more readable though. Besides 4MiB on a desktop machine is peanuts (not on the handhelds though).
Wrong way: every waste byte must be removed! And if you put your variable into
TileExtended and not into
Tile you have removed this 4MiBs.
But then you have still (addicted to the amount of rail tiles on your map) up to 4MiBs waste, because these tiles don't need this extra byte. And you can see in e.g. docs/landscape_grid.html that a rail tile have 22 free/unused bits and you should use them before extended the whole map array.
wolfc wrote:Anyway my guess is this patch won't make trunk, because first routing needs to be finished, [...]
The routing is finished since a long time (something around r3000 ? ). I don't know why people mention this everytime...
wolfc wrote:Yes, I noticed so I have forced the yelsig2.grf in the old way and bumped the load_index. It doesn't crash without extra grfs, I still have to try with.
Do it the right way, use svn://svn.openttd.org/extra/ottd_grf (IIRC) and do
a) (maybe only for testing) extended the openttdgui stuff
or b) define a new action 05 and include it
and then load these new openttd(w/d).grfs (copied them into the data folder) for your working copy.
Edit: I had a very quick look on your new version:
3 times you have this:
Code: Select all
- SetSignalStates(t, GB(_m[t].m2, 4, 4));
+ // FIXME: what is this?
+ //SetSignalStates(t, GB(_m[t].m2, 4, 4));
in rail_map.h you can read:
Code: Select all
/** These are states in which a signal can be. Currently these are only two, so
* simple boolean logic will do. But do try to compare to this enum instead of
* normal boolean evaluation, since that will make future additions easier.
*/
Don't remove (comment out) code which isn' needed especial if the reason is you don't understand how this work (a good search program can help you to find and solve a lot).
Line 481 and 689 into your patch file are unneeded.
Your way how you change GetSignalStates() and the whole save of signal states aren't good. Current it use a single bit because it has only two states * 4 depended on the code. Why you don't do something like this? :
Code: Select all
static inline uint GetSignalStates(TileIndex tile)
{
- return GB(_m[tile].m4, 4, 4);
+ return GB(_me[tile].m7, 0, 8);
}
So you have two bits, up to 4 different states.
You removed the whole SetSignalStates() and replaced it whith SetSignalStateByTrackdir() which doing nearly the same (and if you follow my last hint very nearly). And if I see it right, this change need a few other changes which aren't needed.
Line 545, a tabulator to much, have a look on cooding style, in line 689 was a similar problem.
Oh, that's really really bad:
Code: Select all
+ SPR_YELSIG_BASE = SPR_NEWGRFS_BASE, // The sprites used for yellow (three-state) signals
Two lines above can you read:
/* From where can we start putting NewGRFs? */ why do you do that?
Okay, a very short and fast look.
-BigBB