r6280 - in packages/trunk/simutrans/debian: . patches

Ansgar Burchardt ansgar-guest at alioth.debian.org
Sun Mar 23 20:27:19 UTC 2008


Author: ansgar-guest
Date: 2008-03-23 20:27:19 +0000 (Sun, 23 Mar 2008)
New Revision: 6280

Added:
   packages/trunk/simutrans/debian/patches/makeobj-endianness
Modified:
   packages/trunk/simutrans/debian/changelog
   packages/trunk/simutrans/debian/patches/series
   packages/trunk/simutrans/debian/rules
Log:
began work on endianness patch

Modified: packages/trunk/simutrans/debian/changelog
===================================================================
--- packages/trunk/simutrans/debian/changelog	2008-03-23 13:10:44 UTC (rev 6279)
+++ packages/trunk/simutrans/debian/changelog	2008-03-23 20:27:19 UTC (rev 6280)
@@ -1,3 +1,11 @@
+simutrans (99.18~0.svn1664-3) UNRELEASED; urgency=low
+
+  * makeobj should work on big-endian archs (Closes: #472326)
+    + new patch: makeobj-endianness
+    + NOT FINISHED YET
+
+ -- Ansgar Burchardt <ansgar at 43-1.org>  Sun, 23 Mar 2008 21:15:39 +0100
+
 simutrans (99.18~0.svn1664-2) unstable; urgency=low
 
   * Fix segfault on startup (Closes: #471244)

Added: packages/trunk/simutrans/debian/patches/makeobj-endianness
===================================================================
--- packages/trunk/simutrans/debian/patches/makeobj-endianness	                        (rev 0)
+++ packages/trunk/simutrans/debian/patches/makeobj-endianness	2008-03-23 20:27:19 UTC (rev 6280)
@@ -0,0 +1,1025 @@
+fix makeobj on big-endian architectures
+
+makeobj assumes a little-endian architecture, the files it generates on
+big-endian architectures are unusable.
+
+While at it, remove the following warnings:
+../besch/writer/way_obj_writer.cc:21:
+    warning: deprecated conversion from string constant to ‘char*’
+../besch/writer/way_writer.cc:21:
+    warning: deprecated conversion from string constant to ‘char*’
+
+
+TODO:
+ * image nodes still broken
+ * make patch less ugly
+ * copy, uncopy (see calls to fwrite in root_writer.cc)
+
+Index: simutrans-99.18~0.svn1664/besch/writer/bridge_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/bridge_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/bridge_writer.cc
+@@ -20,7 +20,7 @@
+ 	uint32 maintenance   = obj.get_int("maintenance", 1000);
+ 	uint8  pillars_every = obj.get_int("pillar_distance",0); // distance==0 is off
+ 	uint8  pillar_asymmetric = obj.get_int("pillar_asymmetric",0); // middle of tile
+-	uint8  max_lenght    = obj.get_int("max_lenght",0); // max_lenght==0: unlimited
++	uint8  max_length    = obj.get_int("max_lenght",0); // max_lenght==0: unlimited
+ 	uint8  max_height    = obj.get_int("max_height",0); // max_height==0: unlimited
+ 
+ 	// prissi: timeline
+@@ -35,17 +35,17 @@
+ 	// Hajo: Version needs high bit set as trigger -> this is required
+ 	//       as marker because formerly nodes were unversionend
+ 	uint16 version = 0x8007;
+-	node.write_data_at(outfp, &version,        0, 2);
+-	node.write_data_at(outfp, &topspeed,       2, 2);
+-	node.write_data_at(outfp, &preis,          4, 4);
+-	node.write_data_at(outfp, &maintenance,    8, 4);
+-	node.write_data_at(outfp, &wegtyp,        12, 1);
+-	node.write_data_at(outfp, &pillars_every, 13, 1);
+-	node.write_data_at(outfp, &max_lenght,    14, 1);
+-	node.write_data_at(outfp, &intro_date,    15, sizeof(uint16));
+-	node.write_data_at(outfp, &obsolete_date, 17, sizeof(uint16));
+-	node.write_data_at(outfp, &pillar_asymmetric, 19, 1);
+-	node.write_data_at(outfp, &max_height,    20, 1);
++	node.write_uint16(outfp, version,            0);
++	node.write_uint16(outfp, topspeed,           2);
++	node.write_uint32(outfp, preis,              4);
++	node.write_uint32(outfp, maintenance,        8);
++	node.write_uint8 (outfp, wegtyp,            12);
++	node.write_uint8 (outfp, pillars_every,     13);
++	node.write_uint8 (outfp, max_length,        14);
++	node.write_uint16(outfp, intro_date,        15);
++	node.write_uint16(outfp, obsolete_date,     17);
++	node.write_uint8 (outfp, pillar_asymmetric, 19);
++	node.write_uint8 (outfp, max_height,        20);
+ 
+ 	static const char* const names[] = {
+ 		"image",
+Index: simutrans-99.18~0.svn1664/besch/writer/building_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/building_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/building_writer.cc
+@@ -48,16 +48,16 @@
+ 
+ 	// Hajo: write version data
+ 	v16 = 0x8002;
+-	node.write_data_at(fp, &v16, 0, sizeof(uint16));
++	node.write_uint16(fp, v16, 0);
+ 
+ 	v16 = besch.phasen;
+-	node.write_data_at(fp, &v16, 2, sizeof(uint16));
++	node.write_uint16(fp, v16, 2);
+ 
+ 	v16 = besch.index;
+-	node.write_data_at(fp, &v16, 4, sizeof(uint16));
++	node.write_uint16(fp, v16, 4);
+ 
+ 	uint8 uv8 = besch.seasons;
+-	node.write_data_at(fp, &uv8, 6, sizeof(uint8));
++	node.write_uint8(fp, uv8, 6);
+ 
+ 	node.write(fp);
+ }
+@@ -272,61 +272,24 @@
+ 		}
+ 	}
+ 
+-	// Hajo: old code
+-	// node.write_data(fp, &besch);
+-
+-	// Hajo: temp vars of appropriate size
+-	uint32 v32;
+-	uint16 v16;
+-	uint8  v8;
+-
+ 	// Hajo: write version data
+-	v16 = 0x8005;
+-	node.write_data_at(fp, &v16, 0, sizeof(uint16));
++	node.write_uint16(fp, 0x8005,                           0);
+ 
+ 	// Hajo: write besch data
+-
+-	v8 = (uint8) besch.gtyp;
+-	node.write_data_at(fp, &v8, 2, sizeof(uint8));
+-
+-	v8 = (uint8)besch.utype;
+-	node.write_data_at(fp, &v8, 3, sizeof(uint8));
+-
+-	v16 = (uint16)besch.level;
+-	node.write_data_at(fp, &v16, 4, sizeof(uint16));
+-
+-	v32 = (uint32)besch.bauzeit;
+-	node.write_data_at(fp, &v32, 6, sizeof(uint32));
+-
+-	v16 = besch.groesse.x;
+-	node.write_data_at(fp, &v16, 10, sizeof(uint16));
+-
+-	v16 = besch.groesse.y;
+-	node.write_data_at(fp, &v16, 12, sizeof(uint16));
+-
+-	v8 = (uint8)besch.layouts;
+-	node.write_data_at(fp, &v8, 14, sizeof(uint8));
+-
+-	v16 = (uint16)besch.allowed_climates;
+-	node.write_data_at(fp, &v16, 15, sizeof(uint16));
+-
+-	v8 = (uint8)besch.enables;
+-	node.write_data_at(fp, &v8, 17, sizeof(uint8));
+-
+-	v8 = (uint8)besch.flags;
+-	node.write_data_at(fp, &v8, 18, sizeof(uint8));
+-
+-	v8 = (uint8)besch.chance;
+-	node.write_data_at(fp, &v8, 19, sizeof(uint8));
+-
+-	v16 = besch.intro_date;
+-	node.write_data_at(fp, &v16, 20, sizeof(uint16));
+-
+-	v16 = besch.obsolete_date;
+-	node.write_data_at(fp, &v16, 22, sizeof(uint16));
+-
+-	v16 = besch.animation_time;
+-	node.write_data_at(fp, &v16, 24, sizeof(uint16));
++	node.write_uint8 (fp, (uint8) besch.gtyp,               2);
++	node.write_uint8 (fp, (uint8) besch.utype,              3);
++	node.write_uint16(fp, (uint16) besch.level,             4);
++	node.write_uint32(fp, (uint32) besch.bauzeit,           6);
++	node.write_uint16(fp, besch.groesse.x,                 10);
++	node.write_uint16(fp, besch.groesse.y,                 12);
++	node.write_uint8 (fp, (uint8) besch.layouts,           14);
++	node.write_uint16(fp, (uint16) besch.allowed_climates, 15);
++	node.write_uint8 (fp, (uint8) besch.enables,           17);
++	node.write_uint8 (fp, (uint8) besch.flags,             18);
++	node.write_uint8 (fp, (uint8) besch.chance,            19);
++	node.write_uint16(fp, besch.intro_date,                20);
++	node.write_uint16(fp, besch.obsolete_date,             22);
++	node.write_uint16(fp, besch.animation_time,            24);
+ 
+ 	// probably add some icons, if defined
+ 	slist_tpl<cstring_t> cursorkeys;
+Index: simutrans-99.18~0.svn1664/besch/writer/citycar_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/citycar_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/citycar_writer.cc
+@@ -25,20 +25,11 @@
+ 	besch.geschw  = obj.get_int("speed", 80) * 16;
+ 
+ 	// new version with intro and obsolete dates
+-	uint16 data = 0x8002;
+-	node.write_data_at(fp, &data, 0, sizeof(uint16));
+-
+-	data = (uint16)besch.gewichtung;
+-	node.write_data_at(fp, &data, 2, sizeof(uint16));
+-
+-	data = (uint16)besch.geschw;
+-	node.write_data_at(fp, &data, 4, sizeof(uint16));
+-
+-	data = besch.intro_date;
+-	node.write_data_at(fp, &data, 6, sizeof(uint16));
+-
+-	data = besch.obsolete_date;
+-	node.write_data_at(fp, &data, 8, sizeof(uint16));
++	node.write_uint16(fp, 0x8002,                    0); // version information
++	node.write_uint16(fp, (uint16) besch.gewichtung, 2);
++	node.write_uint16(fp, (uint16) besch.geschw,     4);
++	node.write_uint16(fp, besch.intro_date,          6);
++	node.write_uint16(fp, besch.obsolete_date,       8);
+ 
+ 	write_head(fp, node, obj);
+ 
+Index: simutrans-99.18~0.svn1664/besch/writer/crossing_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/crossing_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/crossing_writer.cc
+@@ -45,7 +45,7 @@
+ 	// Hajo: Version needs high bit set as trigger -> this is required
+ 	//       as marker because formerly nodes were unversionend
+ 	uint16 uv16 = 0x8001;
+-	node.write_data_at(fp, &uv16, 0, sizeof(uint16));
++	node.write_uint16(fp, 0x8001, 0);
+ 
+ 	// waytypes, waytype 2 will be on top
+ 	uint8 wegtyp1 = get_waytype(obj.get("waytype[0]"));
+@@ -54,8 +54,8 @@
+ 		printf("*** FATAL ***:\nIdentical ways cannot cross (check waytypes)!\n");
+ 		exit(0);
+ 	}
+-	node.write_data_at(fp, &wegtyp1, 2, sizeof(uint8));
+-	node.write_data_at(fp, &wegtyp2, 3, sizeof(uint8));
++	node.write_uint8(fp, wegtyp1, 2);
++	node.write_uint8(fp, wegtyp2, 3);
+ 
+ 	// Top speed of this way
+ 	uv16 = obj.get_int("speed[0]", 0);
+@@ -63,21 +63,21 @@
+ 		printf("*** FATAL ***:\nA maxspeed MUST be given for both ways!\n");
+ 		exit(0);
+ 	}
+-	node.write_data_at(fp, &uv16, 4, sizeof(uint16));
++	node.write_uint16(fp, uv16, 4);
+ 	uv16 = obj.get_int("speed[1]", 0);
+ 	if(uv16==0) {
+ 		printf("*** FATAL ***:\nA maxspeed MUST be given for both ways!\n");
+ 		exit(0);
+ 	}
+-	node.write_data_at(fp, &uv16, 6, sizeof(uint16));
++	node.write_uint16(fp, uv16, 6);
+ 
+ 	// time between frames for animation
+ 	uint32 uv32 = obj.get_int("animation_time_open", 0);
+-	node.write_data_at(fp, &uv32, 8, sizeof(sint32));
++	node.write_uint32(fp, uv32, 8);
+ 	uv32 = obj.get_int("animation_time_closed", 0);
+-	node.write_data_at(fp, &uv32, 12, sizeof(sint32));
++	node.write_uint32(fp, uv32, 12);
+ 
+-	node.write_data_at(fp, &sound_id, 16, sizeof(uint8));
++	node.write_uint8(fp, sound_id, 16);
+ 
+ 	if(sound_str.len() > 0) {
+ 		sint8 sv8 = sound_str.len();
+Index: simutrans-99.18~0.svn1664/besch/writer/factory_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/factory_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/factory_writer.cc
+@@ -23,23 +23,12 @@
+ 	besch.max_fields = obj.get_int("max_fields", 25);
+ 	besch.min_fields = obj.get_int("min_fields", 5);
+ 
+-	uint16 data = 0x8001;	// version
+-	node.write_data_at(outfp, &data, 0, sizeof(uint16));
+-
+-	uint8 v8 = besch.has_winter;
+-	node.write_data_at(outfp, &v8, 2, sizeof(uint8));
+-
+-	data = besch.probability;
+-	node.write_data_at(outfp, &data, 3, sizeof(uint16));
+-
+-	data = besch.production_per_field;
+-	node.write_data_at(outfp, &data, 5, sizeof(uint16));
+-
+-	data = besch.max_fields;
+-	node.write_data_at(outfp, &data, 7, sizeof(uint16));
+-
+-	data = besch.min_fields;
+-	node.write_data_at(outfp, &data, 9, sizeof(uint16));
++	node.write_uint16(outfp, 0x8001,                     0); // version
++	node.write_uint8 (outfp, besch.has_winter,           2);
++	node.write_uint16(outfp, besch.probability,          3);
++	node.write_uint16(outfp, besch.production_per_field, 5);
++	node.write_uint16(outfp, besch.max_fields,           7);
++	node.write_uint16(outfp, besch.min_fields,           9);
+ 
+ 	node.write(outfp);
+ }
+@@ -71,14 +60,10 @@
+ 	// Hajo: Version needs high bit set as trigger -> this is required
+ 	//       as marker because formerly nodes were unversionend
+ 	// new version 2: pax-level added
+-	uint16 data = 0x8001;
+-	node.write_data_at(outfp, &data, 0, sizeof(uint16));
+-
+-	data = capacity;
+-	node.write_data_at(outfp, &data, 2, sizeof(uint16));
++	node.write_uint16(outfp, 0x8001,   0);
+ 
+-	data = factor;
+-	node.write_data_at(outfp, &data, 4, sizeof(uint16));
++	node.write_uint16(outfp, capacity, 2);
++	node.write_uint16(outfp, factor,   4);
+ 
+ 	node.write(outfp);
+ }
+@@ -178,36 +163,17 @@
+ 	}
+ 
+ 	// new version with pax_level
+-	uint16 data = 0x8002;
+-	uint8 data8;
+-	node.write_data_at(fp, &data, 0, sizeof(uint16));
+-
+-	data = (uint16)besch.platzierung;
+-	node.write_data_at(fp, &data, 2, sizeof(uint16));
+-
+-	data = besch.produktivitaet;
+-	node.write_data_at(fp, &data, 4, sizeof(uint16));
+-
+-	data = besch.bereich;
+-	node.write_data_at(fp, &data, 6, sizeof(uint16));
+-
+-	data = besch.gewichtung;
+-	node.write_data_at(fp, &data, 8, sizeof(uint16));
+-
+-	data8 = besch.kennfarbe;
+-	node.write_data_at(fp, &data8, 10, sizeof(uint8));
+-
+-	data8 = besch.fields;
+-	node.write_data_at(fp, &data8, 11, sizeof(uint8));
+-
+-	data = besch.lieferanten;
+-	node.write_data_at(fp, &data, 12, sizeof(uint16));
+-
+-	data = besch.produkte;
+-	node.write_data_at(fp, &data, 14, sizeof(uint16));
++	node.write_uint16(fp, 0x8002,                      0); // version
+ 
+-	data = besch.pax_level;
+-	node.write_data_at(fp, &data, 16, sizeof(uint16));
++	node.write_uint16(fp, (uint16) besch.platzierung,  2);
++	node.write_uint16(fp, besch.produktivitaet,        4);
++	node.write_uint16(fp, besch.bereich,               6);
++	node.write_uint16(fp, besch.gewichtung,            8);
++	node.write_uint8 (fp, besch.kennfarbe,            10);
++	node.write_uint8 (fp, besch.fields,               11);
++	node.write_uint16(fp, besch.lieferanten,          12);
++	node.write_uint16(fp, besch.produkte,             14);
++	node.write_uint16(fp, besch.pax_level,            16);
+ 
+ 	node.write(fp);
+ }
+Index: simutrans-99.18~0.svn1664/besch/writer/good_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/good_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/good_writer.cc
+@@ -20,23 +20,22 @@
+ 	// Hajo: version number
+ 	// Hajo: Version needs high bit set as trigger -> this is required
+ 	//       as marker because formerly nodes were unversionend
+-	value = 0x8003;
+-	node.write_data_at(fp, &value, 0, sizeof(uint16));
++	node.write_uint16(fp, 0x8003, 0);
+ 
+ 	value = obj.get_int("value", 0);
+-	node.write_data_at(fp, &value, 2, sizeof(uint16));
++	node.write_uint16(fp, value,  2);
+ 
+ 	val8 = obj.get_int("catg", 0);
+-	node.write_data_at(fp, &val8, 4, sizeof(uint8));
++	node.write_uint8 (fp, val8,   4);
+ 
+ 	value = obj.get_int("speed_bonus", 0);
+-	node.write_data_at(fp, &value, 5, sizeof(uint16));
++	node.write_uint16(fp, value,  5);
+ 
+ 	value = obj.get_int("weight_per_unit", 100);
+-	node.write_data_at(fp, &value, 7, sizeof(uint16));
++	node.write_uint16(fp, value,  7);
+ 
+ 	val8 = obj.get_int("mapcolor", 255);
+-	node.write_data_at(fp, &val8, 9, sizeof(uint8));
++	node.write_uint8 (fp, val8,   9);
+ 
+ 	node.write(fp);
+ }
+Index: simutrans-99.18~0.svn1664/besch/writer/groundobj_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/groundobj_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/groundobj_writer.cc
+@@ -97,35 +97,16 @@
+ finish_images:
+ 	imagelist2d_writer_t::instance()->write_obj(fp, node, keys);
+ 
+-	// Hajo: temp vars of appropriate size
+-	sint32 s32;
+-	uint16 v16;
+-	uint8 v8;
+-
+ 	// Hajo: write version data
+-	v16 = 0x8001;
+-	node.write_data_at(fp, &v16, 0, sizeof(uint16));
+-
+-	v16 = (uint16) besch.allowed_climates;
+-	node.write_data_at(fp, &v16, 2, sizeof(uint16));
+-
+-	v16 = (uint16)besch.distribution_weight;
+-	node.write_data_at(fp, &v16, 4, sizeof(uint16));
+-
+-	v8 = (uint8) besch.number_of_seasons;
+-	node.write_data_at(fp, &v8, 6, sizeof(uint8));
+-
+-	v8 = (uint8) besch.trees_on_top;
+-	node.write_data_at(fp, &v8, 7, sizeof(uint8));
+-
+-	v16 = (uint16) besch.speed;
+-	node.write_data_at(fp, &v16, 8, sizeof(uint16));
+-
+-	v16 = (uint16)besch.waytype;
+-	node.write_data_at(fp, &v16, 10, sizeof(uint16));
++	node.write_uint16(fp, 0x8001,                              0);
+ 
+-	s32 = (sint32)besch.cost_removal;
+-	node.write_data_at(fp, &s32, 12, sizeof(sint32));
++	node.write_uint16(fp, (uint16) besch.allowed_climates,     2);
++	node.write_uint16(fp, (uint16) besch.distribution_weight,  4);
++	node.write_uint8 (fp, (uint8)  besch.number_of_seasons,    6);
++	node.write_uint8 (fp, (uint8)  besch.trees_on_top,         7);
++	node.write_uint16(fp, (uint16) besch.speed,                8);
++	node.write_uint16(fp, (uint16) besch.waytype,             10);
++	node.write_sint32(fp, (sint32) besch.cost_removal,        12);
+ 
+ 	node.write(fp);
+ }
+Index: simutrans-99.18~0.svn1664/besch/writer/image_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/image_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/image_writer.cc
+@@ -323,16 +323,14 @@
+ 	obj_node_t node(this, 12 + (bild.len * sizeof(uint16)), &parent, false);
+ 
+ 	// to avoid any problems due to structure changes, we write manually the data
+-	node.write_data_at(outfp, &bild.x, 0, sizeof(uint8));
+-	node.write_data_at(outfp, &bild.w, 1, sizeof(uint8));
+-	node.write_data_at(outfp, &bild.y, 2, sizeof(uint8));
+-	node.write_data_at(outfp, &bild.h, 3, sizeof(uint8));
+-	node.write_data_at(outfp, &bild.len, 4, sizeof(uint32));
+-	uint16 dummy16=0;
+-	node.write_data_at(outfp, &dummy16, 8, sizeof(uint16));
+-	node.write_data_at(outfp, &bild.zoomable, 10, sizeof(uint8));
+-	uint8 dummy8=0;
+-	node.write_data_at(outfp, &dummy8, 11, sizeof(uint8));
++	node.write_uint8 (outfp, bild.x,         0);
++	node.write_uint8 (outfp, bild.w,         1);
++	node.write_uint8 (outfp, bild.y,         2);
++	node.write_uint8 (outfp, bild.h,         3);
++	node.write_uint32(outfp, bild.len,       4);
++	node.write_uint16(outfp, 0,              8);
++	node.write_uint8 (outfp, bild.zoomable, 10);
++	node.write_uint8 (outfp, 0,             11);
+ 
+ 	if (bild.len) {
+ 		// only called, if there is something to store
+@@ -344,14 +342,13 @@
+ 	obj_node_t node(this, 10 + (bild.len * sizeof(uint16)), &parent, false);
+ 
+ 	// to avoid any problems due to structure changes, we write manually the data
+-	node.write_data_at(outfp, &bild.x, 0, sizeof(uint16));
+-	node.write_data_at(outfp, &bild.y, 2, sizeof(uint16));
+-	node.write_data_at(outfp, &bild.w, 4, sizeof(uint8));
+-	node.write_data_at(outfp, &bild.h, 5, sizeof(uint8));
+-	uint8 version=1;
+-	node.write_data_at(outfp, &version, 6, sizeof(uint8));
+-	node.write_data_at(outfp, &bild.len, 7, sizeof(uint16));
+-	node.write_data_at(outfp, &bild.zoomable, 9, sizeof(uint8));
++	node.write_uint16(outfp, bild.x,        0);
++	node.write_uint16(outfp, bild.y,        2);
++	node.write_uint8 (outfp, bild.w,        4);
++	node.write_uint8 (outfp, bild.h,        5);
++	node.write_uint8 (outfp, 1,             6); // version
++	node.write_uint16(outfp, bild.len,      7);
++	node.write_uint8 (outfp, bild.zoomable, 9);
+ 
+ 	if (bild.len) {
+ 		// only called, if there is something to store
+Index: simutrans-99.18~0.svn1664/besch/writer/imagelist2d_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/imagelist2d_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/imagelist2d_writer.cc
+@@ -19,8 +19,7 @@
+ 	while (iter.next()) {
+ 		imagelist_writer_t::instance()->write_obj(fp, node, iter.get_current());
+ 	}
+-	node.write_data_at(fp, &besch.anzahl, 0, sizeof(uint16));
+-	uint16 dummy16 = 0;
+-	node.write_data_at(fp, &dummy16, 2, sizeof(uint16));
++	node.write_uint16(fp, besch.anzahl, 0);
++	node.write_uint16(fp, 0,            2);
+ 	node.write(fp);
+ }
+Index: simutrans-99.18~0.svn1664/besch/writer/imagelist_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/imagelist_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/imagelist_writer.cc
+@@ -29,8 +29,7 @@
+ 	}
+ 	besch.anzahl = count;//keys.count();
+ 
+-	node.write_data_at(fp, &besch.anzahl, 0, sizeof(uint16));
+-	uint16 dummy16 = 0;
+-	node.write_data_at(fp, &dummy16, 2, sizeof(uint16));
++	node.write_uint16(fp, besch.anzahl, 0);
++	node.write_uint16(fp, 0,            2);
+ 	node.write(fp);
+ }
+Index: simutrans-99.18~0.svn1664/besch/writer/obj_node.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/obj_node.cc
++++ simutrans-99.18~0.svn1664/besch/writer/obj_node.cc
+@@ -24,7 +24,13 @@
+ void obj_node_t::write(FILE* fp)
+ {
+ 	fseek(fp, write_offset - sizeof(desc), SEEK_SET);
+-	fwrite(&desc, sizeof(desc), 1, fp);
++
++        uint32 type = endian_uint32(&desc.type);
++        uint16 children = endian_uint16(&desc.children);
++        uint16 size = endian_uint16(&desc.size);
++	fwrite(&type, 4, 1, fp);
++	fwrite(&children, 2, 1, fp);
++	fwrite(&size, 2, 1, fp);
+ 	if (parent) {
+ 		parent->desc.children++;
+ 	}
+@@ -56,3 +62,21 @@
+ 	fseek(fp, write_offset + offset, SEEK_SET);
+ 	fwrite(data, size, 1, fp);
+ }
++
++void obj_node_t::write_uint8(FILE* fp, uint8 data, int offset)
++{
++	this->write_data_at(fp, &data, offset, 1);
++}
++
++void obj_node_t::write_uint16(FILE* fp, uint16 data, int offset)
++{
++	uint16 data2 = endian_uint16(&data);
++	this->write_data_at(fp, &data2, offset, 2);
++}
++
++void obj_node_t::write_uint32(FILE* fp, uint32 data, int offset)
++{
++	uint32 data2 = endian_uint32(&data);
++	this->write_data_at(fp, &data2, offset, 4);
++}
++
+Index: simutrans-99.18~0.svn1664/besch/writer/obj_node.h
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/obj_node.h
++++ simutrans-99.18~0.svn1664/besch/writer/obj_node.h
+@@ -37,6 +37,20 @@
+ 		// Throws obj_pak_exception_t
+ 		void write_data_at(FILE* fp, const void* data, int offset, int size);
+ 
++		void write_uint8(FILE* fp, uint8 data, int offset);
++		void write_uint16(FILE* fp, uint16 data, int offset);
++		void write_uint32(FILE* fp, uint32 data, int offset);
++
++		void write_sint8(FILE* fp, sint8 data, int offset) {
++			this->write_uint8(fp, (uint8) data, offset);
++		}
++		void write_sint16(FILE* fp, sint16 data, int offset) {
++			this->write_uint16(fp, (uint16) data, offset);
++		}
++		void write_sint32(FILE* fp, sint32 data, int offset) {
++			this->write_uint32(fp, (sint32) data, offset);
++		}
++
+ 		// Write the internal node info to the file
+ 		// DO THIS AFTER ALL CHILD NODES ARE WRITTEN !!!
+ 		void write(FILE* fp);
+Index: simutrans-99.18~0.svn1664/besch/writer/roadsign_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/roadsign_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/roadsign_writer.cc
+@@ -29,34 +29,21 @@
+ 		(obj.get_int("end_of_choose", 0) > 0) * 128;
+ 	besch.wtyp =  get_waytype(obj.get("waytype"));
+ 
+-	// Hajo: temp vars of appropriate size
+-	uint32 v32;
+-	uint16 v16;
+-	uint8 v8;
+-
+ 	// Hajo: write version data
+-	v16 = 0x8003;
+-	node.write_data_at(fp, &v16, 0, sizeof(uint16));
+-
+-	v16 = (uint16) besch.min_speed;
+-	node.write_data_at(fp, &v16, 2, sizeof(uint16));
+-
+-	v32 = (uint32) besch.cost;
+-	node.write_data_at(fp, &v32, 4, sizeof(uint32));
+-
+-	v8 = (uint8)besch.flags;
+-	node.write_data_at(fp, &v8, 8, sizeof(uint8));
++	node.write_uint16(fp, 0x8003,                    0);
+ 
+-	v8 = (uint8)besch.wtyp;
+-	node.write_data_at(fp, &v8, 9, sizeof(uint8));
++	node.write_uint16(fp, (uint16) besch.min_speed,  2);
++	node.write_uint32(fp, (uint32) besch.cost,       4);
++	node.write_uint8 (fp, (uint8)  besch.flags,      8);
++	node.write_uint8 (fp, (uint8)  besch.wtyp,       9);
+ 
+ 	uint16 intro  = obj.get_int("intro_year", DEFAULT_INTRO_DATE) * 12;
+ 	intro += obj.get_int("intro_month", 1) - 1;
+-	node.write_data_at(fp, &intro, 10, sizeof(uint16));
++	node.write_uint16(fp,          intro,           10);
+ 
+ 	uint16 retire  = obj.get_int("retire_year", DEFAULT_RETIRE_DATE) * 12;
+ 	retire += obj.get_int("retire_month", 1) - 1;
+-	node.write_data_at(fp, &retire, 12, sizeof(uint16));
++	node.write_uint16(fp,          retire,          12);
+ 
+ 	write_head(fp, node, obj);
+ 
+Index: simutrans-99.18~0.svn1664/besch/writer/sound_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/sound_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/sound_writer.cc
+@@ -15,10 +15,10 @@
+ 	// Hajo: Version needs high bit set as trigger -> this is required
+ 	//       as marker because formerly nodes were unversionend
+ 	uint16 uv16 = 0x8001;
+-	node.write_data_at(fp, &uv16, 0, sizeof(uint16));
++	node.write_uint16(fp, uv16, 0);
+ 
+ 	uv16 = obj.get_int("sound_nr", NO_SOUND);	// for compatibility reasons; the old nr of a sound
+-	node.write_data_at(fp, &uv16, 2, sizeof(uint16));
++	node.write_uint16(fp, uv16, 2);
+ 
+ 	node.write(fp);
+ }
+Index: simutrans-99.18~0.svn1664/besch/writer/tree_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/tree_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/tree_writer.cc
+@@ -53,22 +53,12 @@
+ 	}
+ 	imagelist2d_writer_t::instance()->write_obj(fp, node, keys);
+ 
+-	// Hajo: temp vars of appropriate size
+-	uint16 v16;
+-	uint8 v8;
+-
+ 	// Hajo: write version data
+-	v16 = 0x8002;
+-	node.write_data_at(fp, &v16, 0, sizeof(uint16));
+-
+-	v16 = (uint16) besch.allowed_climates;
+-	node.write_data_at(fp, &v16, 2, sizeof(uint16));
+-
+-	v8 = (uint8)besch.distribution_weight;
+-	node.write_data_at(fp, &v8, 4, sizeof(uint8));
++	node.write_uint16(fp, 0x8002,                             0);
+ 
+-	v8 = (uint8) besch.number_of_seasons;
+-	node.write_data_at(fp, &v8, 5, sizeof(uint8));
++	node.write_uint16(fp, (uint16) besch.allowed_climates,    2);
++	node.write_uint8 (fp, (uint8)  besch.distribution_weight, 4);
++	node.write_uint8 (fp, (uint8)  besch.number_of_seasons,   5);
+ 
+ 	node.write(fp);
+ }
+Index: simutrans-99.18~0.svn1664/besch/writer/tunnel_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/tunnel_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/tunnel_writer.cc
+@@ -31,13 +31,13 @@
+ 	// Version uses always high bit set as trigger
+ 	// version 2: snow images
+ 	uint16 version = 0x8002;
+-	node.write_data_at(fp, &version,        0, 2);
+-	node.write_data_at(fp, &topspeed,       2, sizeof(uint32));
+-	node.write_data_at(fp, &preis,          6, sizeof(uint32));
+-	node.write_data_at(fp, &maintenance,   10, sizeof(uint32));
+-	node.write_data_at(fp, &wegtyp,        14, sizeof(uint8));
+-	node.write_data_at(fp, &intro_date,    15, sizeof(uint16));
+-	node.write_data_at(fp, &obsolete_date, 17, sizeof(uint16));
++	node.write_uint16(fp, version,        0);
++	node.write_uint32(fp, topspeed,       2);
++	node.write_uint32(fp, preis,          6);
++	node.write_uint32(fp, maintenance,   10);
++	node.write_uint8 (fp, wegtyp,        14);
++	node.write_uint16(fp, intro_date,    15);
++	node.write_uint16(fp, obsolete_date, 17);
+ 
+ 	sint8 number_seasons = 0;
+ 
+@@ -54,7 +54,7 @@
+ 
+ 	cstring_t str = obj.get(buf);
+ 	if (strlen(str) == 0) {
+-		node.write_data_at(fp, &number_seasons, 19, sizeof(uint8));
++		node.write_sint8(fp, number_seasons, 19);
+ 		write_head(fp, node, obj);
+ 
+ 		for (pos = 0; pos < 2; pos++) {
+@@ -79,7 +79,7 @@
+ 				break;
+ 			}
+ 		}
+-		node.write_data_at(fp, &number_seasons, 19, sizeof(uint8));
++		node.write_sint8(fp, number_seasons, 19);
+ 		write_head(fp, node, obj);
+ 
+ 		for (uint8 season = 0; season <= number_seasons ; season++) {
+Index: simutrans-99.18~0.svn1664/besch/writer/vehicle_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/vehicle_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/vehicle_writer.cc
+@@ -53,10 +53,7 @@
+ void vehicle_writer_t::write_obj(FILE* fp, obj_node_t& parent, tabfileobj_t& obj)
+ {
+ 	int i;
+-	uint32 uv32;
+-	uint16 uv16;
+ 	uint8  uv8;
+-	sint8  sv8;
+ 
+ 	int total_len = 31;
+ 
+@@ -87,62 +84,62 @@
+ 	// Hajo: version number
+ 	// Hajo: Version needs high bit set as trigger -> this is required
+ 	//       as marker because formerly nodes were unversionend
+-	uv16 = 0x8008;
+-	node.write_data_at(fp, &uv16, 0, sizeof(uint16));
++	uint16 version = 0x8008;
++	node.write_uint16(fp, version, 0);
+ 
+ 
+ 	// Hajodoc: Price of this vehicle in cent
+ 	// Hajoval: int
+-	uv32 = obj.get_int("cost", 0);
+-	node.write_data_at(fp, &uv32, 2, sizeof(uint32));
++	uint32 cost = obj.get_int("cost", 0);
++	node.write_uint32(fp, cost, 2);
+ 
+ 
+ 	// Hajodoc: Payload of this vehicle
+ 	// Hajoval: int
+-	uv16 = obj.get_int("payload", 0);
+-	node.write_data_at(fp, &uv16, 6, sizeof(uint16));
++	uint16 payload = obj.get_int("payload", 0);
++	node.write_uint16(fp, payload, 6);
+ 
+ 
+ 	// Hajodoc: Top speed of this vehicle. Must be greater than 0
+ 	// Hajoval: int
+-	uv16 = obj.get_int("speed", 0);
+-	node.write_data_at(fp, &uv16, 8, sizeof(uint16));
++	uint16 top_speed = obj.get_int("speed", 0);
++	node.write_uint16(fp, top_speed, 8);
+ 
+ 
+ 	// Hajodoc: Total weight of this vehicle in tons
+ 	// Hajoval: int
+-	uv16 = obj.get_int("weight", 0);
+-	node.write_data_at(fp, &uv16, 10, sizeof(uint16));
++	uint16 weight = obj.get_int("weight", 0);
++	node.write_uint16(fp, weight, 10);
+ 
+ 
+ 	// Hajodoc: Power of this vehicle in KW
+ 	// Hajoval: int
+-	uv32 = obj.get_int("power", 0);
+-	node.write_data_at(fp, &uv32, 12, sizeof(uint32));
++	uint32 power = obj.get_int("power", 0);
++	node.write_uint32(fp, power, 12);
+ 
+ 
+ 	// Hajodoc: Running costs, given in cent per square
+ 	// Hajoval: int
+-	uv16 = obj.get_int("runningcost", 0);
+-	node.write_data_at(fp, &uv16, 16, sizeof(uint16));
++	uint16 runningcost = obj.get_int("runningcost", 0);
++	node.write_uint16(fp, runningcost, 16);
+ 
+ 
+-	// Hajodoc: Introduction date (year * 16 + month)
++	// Hajodoc: Introduction date (year * 12 + month)
+ 	// Hajoval: int
+-	uv16  = obj.get_int("intro_year", DEFAULT_INTRO_DATE) * 12;
+-	uv16 += obj.get_int("intro_month", 1) - 1;
+-	node.write_data_at(fp, &uv16, 18, sizeof(uint16));
++	uint16 intro  = obj.get_int("intro_year", DEFAULT_INTRO_DATE) * 12;
++	intro += obj.get_int("intro_month", 1) - 1;
++	node.write_uint16(fp, intro, 18);
+ 
+-	// Hajodoc: retire date (year * 16 + month)
++	// Hajodoc: retire date (year * 12 + month)
+ 	// Hajoval: int
+-	uv16 = obj.get_int("retire_year", DEFAULT_RETIRE_DATE) * 12;
+-	uv16 += obj.get_int("retire_month", 1) - 1;
+-	node.write_data_at(fp, &uv16, 20, sizeof(uint16));
++	uint16 retire = obj.get_int("retire_year", DEFAULT_RETIRE_DATE) * 12;
++	retire += obj.get_int("retire_month", 1) - 1;
++	node.write_uint16(fp, retire, 20);
+ 
+ 	// Hajodoc: Engine gear (power multiplier)
+ 	// Hajoval: int
+-	uv16 = (obj.get_int("gear", 100) * 64) / 100;
+-	node.write_data_at(fp, &uv16, 22, sizeof(uint16));
++	uint16 gear = (obj.get_int("gear", 100) * 64) / 100;
++	node.write_uint16(fp, gear, 22);
+ 
+ 
+ 	// Hajodoc: Type of way this vehicle drives on
+@@ -150,7 +147,7 @@
+ 	const char* waytype = obj.get("waytype");
+ 	const char waytype_uint = get_waytype(waytype);
+ 	uv8 = (waytype_uint == overheadlines_wt ? track_wt : waytype_uint);
+-	node.write_data_at(fp, &uv8, 24, sizeof(uint8));
++	node.write_uint8 (fp, uv8, 24);
+ 
+ 	// Hajodoc: The freight type
+ 	// Hajoval: string
+@@ -312,7 +309,7 @@
+ 		xref_writer_t::instance()->write_obj(fp, node, obj_good, freight, false);
+ 	}
+ 
+-	node.write_data_at(fp, &sound_id, 25, sizeof(sint8));
++	node.write_sint8(fp, sound_id, 25);
+ 
+ 	if (waytype_uint == overheadlines_wt) {
+ 		// Hajo: compatibility for old style DAT files
+@@ -321,22 +318,20 @@
+ 		const char* engine_type = obj.get("engine_type");
+ 		uv8 = get_engine_type(engine_type, obj);
+ 	}
+-	node.write_data_at(fp, &uv8, 26, sizeof(uint8));
++	node.write_uint8(fp, uv8, 26);
+ 
+ 	// the length (default 8)
+-	uv8 = obj.get_int("length", 8);
+-	node.write_data_at(fp, &uv8, 27, sizeof(uint8));
++	uint8 length = obj.get_int("length", 8);
++	node.write_uint8(fp, length, 27);
+ 
+-	node.write_data_at(fp, &besch_vorgaenger, 28, sizeof(sint8));
+-	node.write_data_at(fp, &besch_nachfolger, 29, sizeof(sint8));
+-
+-	uv8 = freight_max;
+-	node.write_data_at(fp, &uv8, 30, sizeof(sint8));
+-
+-	if (sound_str.len() > 0) {
+-		sv8 = sound_str.len();
+-		node.write_data_at(fp, &sv8, 31, sizeof(sint8));
+-		node.write_data_at(fp, sound_str, 32, sound_str.len());
++	node.write_sint8(fp, besch_vorgaenger, 28);
++	node.write_sint8(fp, besch_nachfolger, 29);
++	node.write_uint8(fp, (uint8) freight_max, 30);
++
++	sint8 sound_str_len = sound_str.len();
++	if (sound_str_len > 0) {
++		node.write_sint8  (fp, sound_str_len, 31);
++		node.write_data_at(fp, sound_str,     32, sound_str_len);
+ 	}
+ 
+ 	node.write(fp);
+Index: simutrans-99.18~0.svn1664/besch/writer/way_obj_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/way_obj_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/way_obj_writer.cc
+@@ -15,7 +15,7 @@
+  */
+ void way_obj_writer_t::write_obj(FILE* outfp, obj_node_t& parent, tabfileobj_t& obj)
+ {
+-	static char* const ribi_codes[16] = {
++	static const char* const ribi_codes[16] = {
+ 		"-", "n",  "e",  "ne",  "s",  "ns",  "se",  "nse",
+ 		"w", "nw", "ew", "new", "sw", "nsw", "sew", "nsew"
+ 	};
+@@ -41,14 +41,15 @@
+ 	uint8 wtyp     =  get_waytype(obj.get("waytype"));
+ 	uint8 own_wtyp =  get_waytype(obj.get("own_waytype"));
+ 
+-	node.write_data_at(outfp, &version,      0, 2);
+-	node.write_data_at(outfp, &price,        2, 4);
+-	node.write_data_at(outfp, &maintenance,  6, 4);
+-	node.write_data_at(outfp, &topspeed,    10, 4);
+-	node.write_data_at(outfp, &intro,       14, 4);
+-	node.write_data_at(outfp, &retire,      16, 2);
+-	node.write_data_at(outfp, &wtyp,        18, 1);
+-	node.write_data_at(outfp, &own_wtyp,    19, 1);
++	node.write_uint16(outfp, version,      0);
++	node.write_uint32(outfp, price,        2);
++	node.write_uint32(outfp, maintenance,  6);
++	node.write_uint32(outfp, topspeed,    10);
++	// XXX: maybe uint32?  see original code
++	node.write_uint16(outfp, intro,       14);
++	node.write_uint16(outfp, retire,      16);
++	node.write_uint8 (outfp, wtyp,        18);
++	node.write_uint8 (outfp, own_wtyp,    19);
+ 
+ 	write_head(outfp, node, obj);
+ 
+Index: simutrans-99.18~0.svn1664/besch/writer/way_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/way_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/way_writer.cc
+@@ -15,7 +15,7 @@
+  */
+ void way_writer_t::write_obj(FILE* outfp, obj_node_t& parent, tabfileobj_t& obj)
+ {
+-	static char* const ribi_codes[16] = {
++	static const char* const ribi_codes[16] = {
+ 		"-", "n",  "e",  "ne",  "s",  "ns",  "se",  "nse",
+ 		"w", "nw", "ew", "new", "sw", "nsw", "sew", "nsew"
+ 	};
+@@ -52,16 +52,21 @@
+ 	uint8 draw_as_ding = (obj.get_int("draw_as_ding", 0) == 1);
+ 	sint8 number_seasons = 0;
+ 
+-	node.write_data_at(outfp, &version,       0, 2);
+-	node.write_data_at(outfp, &price,         2, 4);
+-	node.write_data_at(outfp, &maintenance,   6, 4);
+-	node.write_data_at(outfp, &topspeed,     10, 4);
+-	node.write_data_at(outfp, &max_weight,   14, 4);
+-	node.write_data_at(outfp, &intro,        18, 4);
+-	node.write_data_at(outfp, &retire,       20, 2);
+-	node.write_data_at(outfp, &wtyp,         22, 1);
+-	node.write_data_at(outfp, &styp,         23, 1);
+-	node.write_data_at(outfp, &draw_as_ding, 24, 1);
++	node.write_uint16(outfp, version,       0);
++	node.write_uint32(outfp, price,         2);
++	node.write_uint32(outfp, maintenance,   6);
++	node.write_uint32(outfp, topspeed,     10);
++	node.write_uint32(outfp, max_weight,   14);
++	// XXX: confirm weather to write uint32 or uint16
++	// (compare with retire below)
++	// node.write_data_at(outfp, &intro,        18, 4);
++	// node.write_uint32(outfp, intro,        18);
++	node.write_uint16(outfp, intro,        18);
++	// node.write_data_at(outfp, &retire,       20, 2);
++	node.write_uint16(outfp, retire,       20);
++	node.write_uint8 (outfp, wtyp,         22);
++	node.write_uint8 (outfp, styp,         23);
++	node.write_uint8 (outfp, draw_as_ding, 24);
+ 
+ 	slist_tpl<cstring_t> keys;
+ 	char buf[40];
+Index: simutrans-99.18~0.svn1664/Makefile
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/Makefile
++++ simutrans-99.18~0.svn1664/Makefile
+@@ -390,4 +390,5 @@
+ 
+ 
+ makeobj_prog:
+-	$(MAKE) -e -C makeobj
++	$(MAKE) -e -C makeobj FLAGS="$(FLAGS)"
++
+Index: simutrans-99.18~0.svn1664/makeobj/Makefile
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/makeobj/Makefile
++++ simutrans-99.18~0.svn1664/makeobj/Makefile
+@@ -15,8 +15,8 @@
+ 
+ ifeq ($(OSTYPE),linux)
+ LDLIBS=-lpng -lstdc++ -lm
+-CFLAGS   = -O
+-CXXFLAGS = -O
++CFLAGS   = -O -W -Wall
++CXXFLAGS = -O -W -Wall
+ endif
+ 
+ ifeq ($(OSTYPE),beos)
+@@ -26,6 +26,10 @@
+ 
+ endif
+ 
++ifdef FLAGS
++  CFLAGS   += $(FLAGS)
++  CXXFLAGS += $(FLAGS)
++endif
+ 
+ SOURCES=makeobj.cc
+ 
+Index: simutrans-99.18~0.svn1664/besch/writer/root_writer.cc
+===================================================================
+--- simutrans-99.18~0.svn1664.orig/besch/writer/root_writer.cc
++++ simutrans-99.18~0.svn1664/besch/writer/root_writer.cc
+@@ -20,6 +20,7 @@
+ 	);
+ 
+ 	l = COMPILER_VERSION_CODE;
++        l = endian_uint32(&l);
+ 	fwrite(&l, 1, sizeof(uint32), fp); // Compiler Version zum Checken
+ 
+ 	obj_node_t::set_start_offset(ftell(fp));
+@@ -267,7 +268,14 @@
+ 	root.children = 0;	// we will change this later
+ 	root.size = 0;
+ 	root.type = obj_root;
+-	fwrite(&root, sizeof(root), 1, outfp);
++
++        // XXX
++        uint32 type     = endian_uint32(&root.type);
++        uint16 children = endian_uint16(&root.children);
++        uint16 size     = endian_uint16(&root.size);
++        fwrite(&type,     4, 1, outfp);
++        fwrite(&children, 2, 1, outfp);
++        fwrite(&size,     2, 1, outfp);
+ 
+ 	for(  int i=0;  i<argc;  i++  ) {
+ 		bool any = false;
+@@ -287,7 +295,15 @@
+ 		}
+ 	}
+ 	fseek(outfp, start, SEEK_SET);
+-	fwrite(&root, sizeof(root), 1, outfp);
++
++        // XXX
++        type     = endian_uint32(&root.type);
++        children = endian_uint16(&root.children);
++        size     = endian_uint16(&root.size);
++        fwrite(&type,     4, 1, outfp);
++        fwrite(&children, 2, 1, outfp);
++        fwrite(&size,     2, 1, outfp);
++
+ 	fclose(outfp);
+ }
+ 

Modified: packages/trunk/simutrans/debian/patches/series
===================================================================
--- packages/trunk/simutrans/debian/patches/series	2008-03-23 13:10:44 UTC (rev 6279)
+++ packages/trunk/simutrans/debian/patches/series	2008-03-23 20:27:19 UTC (rev 6280)
@@ -3,3 +3,4 @@
 config.diff
 gcc-4.3-fixes
 fix-stdarg-calls
+makeobj-endianness

Modified: packages/trunk/simutrans/debian/rules
===================================================================
--- packages/trunk/simutrans/debian/rules	2008-03-23 13:10:44 UTC (rev 6279)
+++ packages/trunk/simutrans/debian/rules	2008-03-23 20:27:19 UTC (rev 6280)
@@ -24,8 +24,8 @@
 	$(MAKE)
 	convert simutrans.ico debian/simutrans.xpm
 
-	# try to build makeobj
-	$(MAKE) -C makeobj
+	# build makeobj
+	$(MAKE) makeobj_prog
 
 	touch $@
 




More information about the Pkg-games-commits mailing list