I have checked out the ZB code from SVN and am currently trying to get it to run (and do some modifications)
There is a bug in TerrainData.cpp:
- Code: Select all
for (int i=0; i<4; ++i)
{
for (int j=0; j<4; ++j)
{
x_interpol [i] += h_base[j-1 + (i-1)*width_]*cx[j];
xd_interpol[i] += h_base[j-1 + (i-1)*width_]*cxd[j];
}
}
which is obviousely wrong (for i=0 and j=0, this yields a negative index into the h_base array).
However, I'm not very familiar with the code. So could you point me into the right direction to fix this? I'd really like to do some development on that code

EDIT: Okay, looking at the code a bit more, it actually seems correct (but maybe not the most command semantic).
Anyway, the game crashes for me at that code.
I tried to replace it with this:
- Code: Select all
x_interpol[i] = height_data_[hbase_loc + (j-1 + (i-1)*width_)];
xd_interpol[i] = height_data_[hbase_loc + (j-1 + (i-1)*width_)];
where hbase_loc is int hbase_loc = x_int + z_int * width_;.
It doesn't crash any more, however, it still doesn't work correctly. The heightmap seems to be messed up resulting in the tank either not driving at all or jumping through the map :/
edit 2: nvm.. I forgot the * cx[j]. It seems to work correctly with that now.