Maniaplanet 4.1 has changed the way script types and values are written. The code now does the following:
+
+
* First write the list of all types (all types appear only once).
+
* For each value, write the index of the type in the list, and then write the value.
+
+
Writing the types and values has not changed except for the addition of structures which are a plain list of members.
+
+
Also note that the indices are written in the following form:
+
+
* If the index is < 128, it is written directly into one byte (because this covers 99% of the cases).
+
* Otherwise, it is written in the first 7 bits of the first byte and in the following 2 bytes, a total of 23 bits (7+8+8). The 8th bit of the first byte is set to 1.
+
+
Note that this scheme is also used to write string lengths.