Trouble coding new parameters for pak ****ets
Thanks to VS's help, I have now managed to make makeobj compile. However, I have had considerable difficulty in adding a new parameter for it to read. The problem seems to be that the writer always writes 0 to the pak file instead of the number actually present in the .dat file, even if the default is specified as 1. I am trying to add an "is_tilting" line to the vehicle definitions to go with the new cornering algorithm, and have added this to vehicle_writer.cc:
uint8 tilting = (obj.get_int("is_tilting", 1));
node.write_uint8(fp, tilting, 33);
I have also changed the line:
int total_len = 31;
to
int total_len = 34;
to take account of the additional size of the new 8-bit integer that I am using to store the is_tilting value (I have set a bool "get_tilting" function to return true if is_tilting is 1, or otherwise return false).
I have added the following line to the test .dat file:
is_tilting=1
However, whenever the program reads the tilting variable on a file compiled with the version of makeobj that I have compiled, is_tilting always comes out at 0, rather than 1. I am having great difficulty in understanding why this is (especially since I copied exactly the code for reading and writing other variables), and should greatly appreciate any ****istance.