I was hoping to release Simutrans-Experimental 7.0 this week-end, but have come upon rather a problem that I can't seem to solve. At the request of a few people here, I have tried to add a feature to allow factories that close down to be upgraded. To do that requires using the XREF writer/reader when reading fabrik_besch_t objects, to add an XREF instance to the factory reader/writer to link to another factory's besch (type) object. I have done something similar for vehicles successfully just by copying the existing code for coupling constraints and modifying it.
I have modified factory_writer.cc to this:
#include "../../dataobj/tabfile.h"
#include "obj_node.h"
#include "../skin_besch.h"
#include "../fabrik_besch.h"
#include "text_writer.h"
#include "building_writer.h"
#include "factory_writer.h"
#include "xref_writer.h"
void factory_field_writer_t::write_obj(FILE* outfp, obj_node_t& parent, tabfileobj_t& obj, const char *s)
{
field_besch_t besch;
memset(&besch, 0, sizeof(besch));
obj_node_t node(this, 11, &parent);
xref_writer_t::instance()->write_obj(outfp, node, obj_field, s, true);
besch.has_winter = obj.get_int("has_snow", 1);
besch.probability = obj.get_int("probability_to_spawn", 10); // 0,1 %
besch.production_per_field = obj.get_int("production_per_field", 16 );
besch.max_fields = obj.get_int("max_fields", 25);
besch.min_fields = obj.get_int("min_fields", 5);
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);
}
void factory_smoke_writer_t::write_obj(FILE* outfp, obj_node_t& parent, tabfileobj_t& obj)
{
rauch_besch_t besch;
memset(&besch, 0, sizeof(besch));
obj_node_t node(this, 10, &parent);
xref_writer_t::instance()->write_obj(outfp, node, obj_smoke, obj.get("smoke"), true);
besch.pos_off = obj.get_koord("smoketile", koord(0, 0));
besch.xy_off = obj.get_koord("smokeoffset", koord(0, 0));
besch.zeitmaske = obj.get_int( "smokespeed", 0);
node.write_sint16(outfp, besch.pos_off.x, 0);
node.write_sint16(outfp, besch.pos_off.y, 2);
node.write_sint16(outfp, besch.xy_off.x, 4);
node.write_sint16(outfp, besch.xy_off.y, 6);
node.write_sint16(outfp, besch.zeitmaske, 8);
node.write(outfp);
}
void factory_product_writer_t::write_obj(FILE* outfp, obj_node_t& parent, int capacity, int factor, const char* warename)
{
obj_node_t node(this, sizeof(uint16) * 3, &parent);
xref_writer_t::instance()->write_obj(outfp, node, obj_good, warename, true);
// Hajo: Version needs high bit set as trigger -> this is required
// as marker because formerly nodes were unversionend
// new version 2: pax-level added
node.write_uint16(outfp, 0x8001, 0);
node.write_uint16(outfp, capacity, 2);
node.write_uint16(outfp, factor, 4);
node.write(outfp);
}
void factory_supplier_writer_t::write_obj(FILE* outfp, obj_node_t& parent, int capacity, int count, int verbrauch, const char* warename)
{
fabrik_lieferant_besch_t besch;
obj_node_t node(this, 8, &parent);
besch.anzahl = count;
besch.kapazitaet = capacity;
besch.verbrauch = verbrauch;
xref_writer_t::instance()->write_obj(outfp, node, obj_good, warename, true);
node.write_uint16(outfp, besch.kapazitaet, 0);
node.write_uint16(outfp, besch.anzahl, 2);
node.write_uint16(outfp, besch.verbrauch, 4);
node.write_uint16(outfp, 0, 6); //dummy, unused (and uninitialized in past versions)
node.write(outfp);
}
void factory_writer_t::write_obj(FILE* fp, obj_node_t& parent, tabfileobj_t& obj)
{
fabrik_besch_t besch;
cstring_t str;
const char* placing = obj.get("location");
if (!STRICMP(placing, "land")) {
besch.platzierung = fabrik_besch_t::Land;
} else if (!STRICMP(placing, "water")) {
besch.platzierung = fabrik_besch_t::W****er;
} else if (!STRICMP(placing, "city")) {
besch.platzierung = fabrik_besch_t::Stadt;
}
besch.produktivitaet = obj.get_int("productivity", 10);
besch.bereich = obj.get_int("range", 10);
besch.gewichtung = obj.get_int("distributionweight", 1);
besch.kennfarbe = obj.get_int("mapcolor", 255);
if(besch.kennfarbe==255) {
printf("ERROR:\nmissing an indentification color!\n");
exit(0);
}
besch.pax_level = obj.get_int("pax_level", 12);
obj_node_t node(this, 21, &parent);
obj.put("type", "fac");
// name/copyright is in building - write_head(fp, node, obj);
building_writer_t::instance()->write_obj(fp, node, obj);
if (*obj.get("smoke")) {
factory_smoke_writer_t::instance()->write_obj(fp, node, obj);
} else {
xref_writer_t::instance()->write_obj(fp, node, obj_smoke, "", false);
}
for (besch.lieferanten = 0; ; besch.lieferanten++) {
char buf[40];
sprintf(buf, "inputgood[%d]", besch.lieferanten);
const char* good = obj.get(buf);
if (!good || !*good) {
break;
}
sprintf(buf, "inputsupplier[%d]", besch.lieferanten);
int supp = obj.get_int(buf, 0);
sprintf(buf, "inputcapacity[%d]", besch.lieferanten);
int cap = obj.get_int(buf, 0);
sprintf(buf, "inputfactor[%d]", besch.lieferanten);
int verbrauch = (obj.get_int(buf, 100) * 256) / 100;
factory_supplier_writer_t::instance()->write_obj(fp, node, cap, supp, verbrauch, good);
}
for (besch.produkte = 0; ; besch.produkte++) {
char buf[40];
sprintf(buf, "outputgood[%d]", besch.produkte);
const char* good = obj.get(buf);
if (!good || !*good) {
break;
}
sprintf(buf, "outputcapacity[%d]", besch.produkte);
int cap = obj.get_int(buf, 0);
sprintf(buf, "outputfactor[%d]", besch.produkte);
int fac = (obj.get_int(buf, 100) * 256) / 100;
factory_product_writer_t::instance()->write_obj(fp, node, cap, fac, good);
}
// fields (careful, are xref'ed)
besch.fields = 0;
if(*obj.get("fields")) {
besch.fields = 1;
factory_field_writer_t::instance()->write_obj(fp, node, obj, obj.get("fields"));
}
uint16 electricity_percent = obj.get_int("electricity_percent", 17);
// Upgrades: these are the industry types to which this industry
// can be upgraded.
// @author: jamespetts
sint8 upgrades = 0;
do {
char buf[40];
sprintf(buf, "upgrade[%d]", upgrades);
str = obj.get(buf);
if (str.len() > 0) {
if (upgrades == 0)
{
str = "";
}
xref_writer_t::instance()->write_obj(fp, node, obj_factory, str, false);
upgrades++;
}
} while (str.len() > 0);
// new version with pax_level
uint16 version = 0x8002;
// This is the overlay flag for Simutrans-Experimental
// This sets the *second* highest bit to 1.
version |= EXP_VER;
// Finally, this is the experimental version number. This is *added*
// to the standard version number, to be subtracted again when read.
// Start at 0x100 and increment in hundreds (hex).
// 0x200 - version 7.0 and greater. Includes xref factories for upgrades.
version += 0x200;
node.write_uint16(fp, version, 0); // version
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_uint16(fp, electricity_percent, 18);
node.write_sint8(fp, upgrades, 20);
node.write(fp);
}
cstring_t factory_writer_t::get_node_name(FILE* fp) const
{
obj_node_info_t node; // Gebäude - wehe nicht
fread(&node, sizeof(node), 1, fp);
if (node.type != obj_building) return ""; // ???
fseek(fp, node.size, SEEK_CUR);
return building_writer_t::instance()->get_node_name(fp);
}
I have modified factory_reader.cc to this:
#include <stdio.h>
#include "../../simfab.h"
#include "../../bauer/fabrikbauer.h"
#include "../../dings/wolke.h"
#include "../../dings/field.h"
#include "../../simdebug.h"
#include "../obj_node_info.h"
#include "../fabrik_besch.h"
#include "../xref_besch.h"
#include "factory_reader.h"
obj_besch_t *
factory_field_reader_t::read_node(FILE *fp, obj_node_info_t &node)
{
ALLOCA(char, besch_buf, node.size);
field_besch_t *besch = new field_besch_t();
besch->node_info = new obj_besch_t*[node.children];
// Hajo: Read data
fread(besch_buf, node.size, 1, fp);
char * p = besch_buf;
uint16 v = decode_uint16(p);
if(v==0x8001) {
besch->has_winter = decode_uint8(p);
besch->probability = decode_uint16(p);
besch->production_per_field = decode_uint16(p);
besch->max_fields = decode_uint16(p);
besch->min_fields = decode_uint16(p);
}
else {
dbg->fatal("factory_field_reader_t::read_node()","unknown version %i",v&0x00ff );
}
DBG_DEBUG("factory_field_reader_t::read_node()", "has_snow %i, probability %i, fields: max %i, min %i, production %i",besch->has_winter, besch->probability, besch->max_fields, besch->min_fields, besch->production_per_field );
besch->probability = 10000 - min(10000, besch->probability);
return besch;
}
void
factory_field_reader_t::register_obj(obj_besch_t *&data)
{
field_besch_t *besch = static_cast<field_besch_t *>(data);
// Xref ist hier noch nicht aufgelöst!
const char* name = static_cast<xref_besch_t*>(besch->get_child(0))->get_name();
field_t::register_besch(besch, name);
}
obj_besch_t *
factory_smoke_reader_t::read_node(FILE *fp, obj_node_info_t &node)
{
ALLOCA(char, besch_buf, node.size);
rauch_besch_t *besch = new rauch_besch_t();
besch->node_info = new obj_besch_t*[node.children];
// Hajo: Read data
fread(besch_buf, node.size, 1, fp);
char * p = besch_buf;
sint16 x = decode_sint16(p);
sint16 y = decode_sint16(p);
besch->pos_off = koord( x, y );
x = decode_sint16(p);
y = decode_sint16(p);
besch->xy_off = koord( x, y );
besch->zeitmaske = decode_sint16(p);
DBG_DEBUG("factory_product_reader_t::read_node()","zeitmaske=%d (size %i)",node.size);
return besch;
}
obj_besch_t *
factory_supplier_reader_t::read_node(FILE *fp, obj_node_info_t &node)
{
// DBG_DEBUG("factory_product_reader_t::read_node()", "called");
ALLOCA(char, besch_buf, node.size);
fabrik_lieferant_besch_t *besch = new fabrik_lieferant_besch_t();
besch->node_info = new obj_besch_t*[node.children];
// Hajo: Read data
fread(besch_buf, node.size, 1, fp);
char * p = besch_buf;
// Hajo: old versions of PAK files have no version stamp.
// But we know, the higher most bit was always cleared.
const uint16 v = decode_uint16(p);
const int version = v & 0x8000 ? v & 0x7FFF : 0;
if(version == 1) {
// Versioned node, version 1
// not there yet ...
}
else {
// old node, version 0
besch->kapazitaet = v;
besch->anzahl = decode_uint16(p);
besch->verbrauch = decode_uint16(p);
}
DBG_DEBUG("factory_product_reader_t::read_node()", "capacity=%d anzahl=%d, verbrauch=%d", version, besch->kapazitaet, besch->anzahl,besch->verbrauch);
return besch;
}
obj_besch_t *
factory_product_reader_t::read_node(FILE *fp, obj_node_info_t &node)
{
// DBG_DEBUG("factory_product_reader_t::read_node()", "called");
ALLOCA(char, besch_buf, node.size);
fabrik_produkt_besch_t *besch = new fabrik_produkt_besch_t();
besch->node_info = new obj_besch_t*[node.children];
// Hajo: Read data
fread(besch_buf, node.size, 1, fp);
char * p = besch_buf;
// Hajo: old versions of PAK files have no version stamp.
// But we know, the higher most bit was always cleared.
const uint16 v = decode_uint16(p);
const int version = v & 0x8000 ? v & 0x7FFF : 0;
if(version == 1) {
// Versioned node, version 1
besch->kapazitaet = decode_uint16(p);
besch->faktor = decode_uint16(p);
}
else {
// old node, version 0
decode_uint16(p);
besch->kapazitaet = v;
besch->faktor = 256;
}
DBG_DEBUG("factory_product_reader_t::read_node()", "version=%d capacity=%d factor=%x", version, besch->kapazitaet, besch->faktor);
return besch;
}
obj_besch_t *
factory_reader_t::read_node(FILE *fp, obj_node_info_t &node)
{
// DBG_DEBUG("factory_reader_t::read_node()", "called");
ALLOCA(char, besch_buf, node.size);
fabrik_besch_t *besch = new fabrik_besch_t();
besch->node_info = new obj_besch_t*[node.children];
// Hajo: Read data
fread(besch_buf, node.size, 1, fp);
char * p = besch_buf;
// Hajo: old versions of PAK files have no version stamp.
// But we know, the higher most bit was always cleared.
const uint16 v = decode_uint16(p);
int version = v & 0x8000 ? v & 0x7FFF : 0;
// Whether the read file is from Simutrans-Experimental
// @author: jamespetts
const bool experimental = version > 0 ? v & EXP_VER : false;
uint16 experimental_version = 0;
if(experimental)
{
// Experimental version to start at 0 and increment.
version = version & EXP_VER ? version & 0x3FFF : 0;
while(version > 0x100)
{
version -= 0x100;
experimental_version ++;
}
experimental_version -=1;
}
if(version == 2)
{
// Versioned node, version 2
besch->platzierung = (enum fabrik_besch_t::platzierung)decode_uint16(p); //"placement" (Babelfish)
besch->produktivitaet = decode_uint16(p); //"productivity" (Babelfish)
besch->bereich = decode_uint16(p); //"range" (Babelfish)
besch->gewichtung = decode_uint16(p); //"weighting" (Babelfish)
if(besch->gewichtung < 1)
{
// Avoid divide by zero errors when
// determining industry density figures.
besch->gewichtung = 1;
}
besch->kennfarbe = decode_uint8(p); //"identification colour code" (Babelfish)
besch->fields = decode_uint8(p); //"fields" (Babelfish)
besch->lieferanten = decode_uint16(p); //"supplier" (Babelfish)
besch->produkte = decode_uint16(p); //"products" (Babelfish)
besch->pax_level = decode_uint16(p);
if(experimental)
{
if(experimental_version >= 0)
{
besch->electricity_proportion = ((float)decode_uint16(p) / 100.0F);
besch->inverse_electricity_proportion = 1 / besch->electricity_proportion;
}
if(experimental_version >= 1)
{
besch->upgrades = decode_uint8(p);
}
else
{
besch->upgrades = 0;
}
if(experimental_version > 1)
{
// Check for incompatible future versions
dbg->fatal( "factory_reader_t::read_node()","Incompatible pak file version for Simutrans-Ex, number %i", experimental_version );
}
}
DBG_DEBUG("factory_reader_t::read_node()","version=2, platz=%i, lieferanten=%i, pax=%i", besch->platzierung, besch->lieferanten, besch->pax_level );
} else if(version == 1)
{
// Versioned node, version 1
besch->platzierung = (enum fabrik_besch_t::platzierung)decode_uint16(p);
besch->produktivitaet = decode_uint16(p);
besch->bereich = decode_uint16(p);
besch->gewichtung = decode_uint16(p);
if(besch->gewichtung < 1)
{
// Avoid divide by zero errors when
// determining industry density figures.
besch->gewichtung = 1;
}
besch->kennfarbe = (uint8)decode_uint16(p);
besch->lieferanten = decode_uint16(p);
besch->produkte = decode_uint16(p);
besch->pax_level = decode_uint16(p);
besch->fields = 0;
DBG_DEBUG("factory_reader_t::read_node()","version=1, platz=%i, lieferanten=%i, pax=%i", besch->platzierung, besch->lieferanten, besch->pax_level);
}
else
{
// old node, version 0, without pax_level
DBG_DEBUG("factory_reader_t::read_node()","version=0");
besch->platzierung = (enum fabrik_besch_t::platzierung)v;
decode_uint16(p); // alsways zero
besch->produktivitaet = decode_uint16(p)|0x8000;
besch->bereich = decode_uint16(p);
besch->gewichtung = decode_uint16(p);
if(besch->gewichtung < 1)
{
// Avoid divide by zero errors when
// determining industry density figures.
besch->gewichtung = 1;
}
besch->kennfarbe = (uint8)decode_uint16(p);
besch->lieferanten = decode_uint16(p);
besch->produkte = decode_uint16(p);
besch->pax_level = 12;
besch->fields = 0;
}
if(!experimental)
{
besch->electricity_proportion = 0.17F;
besch->inverse_electricity_proportion = 1.0F / besch->electricity_proportion;
besch->upgrades = 0;
}
return besch;
}
void factory_reader_t::register_obj(obj_besch_t *&data)
{
fabrik_besch_t* besch = static_cast<fabrik_besch_t*>(data);
size_t fab_name_len = strlen( besch->get_name() );
besch->electricity_producer = ( fab_name_len>11 && (strcmp(besch->get_name()+fab_name_len-9, "kraftwerk")==0 || strcmp(besch->get_name()+fab_name_len-11, "Power Plant")==0) );
fabrikbauer_t::register_besch(besch);
}
I have modified fabrik_besch.h to this:
/*
* Copyright (c) 1997 - 2002 by Volker Meyer & Hansjörg Malthaner
*
* This file is part of the Simutrans project under the artistic licence.
*/
#ifndef __FABRIK_BESCH_H
#define __FABRIK_BESCH_H
#include "obj_besch.h"
#include "haus_besch.h"
#include "skin_besch.h"
#include "ware_besch.h"
#include "../dataobj/koord.h"
/*
* Fields are xref'ed from skin_besch_t
*/
cl**** field_besch_t : public obj_besch_t {
friend cl**** factory_field_writer_t;
friend cl**** factory_field_reader_t;
private:
uint8 has_winter; // 0 or 1 for snow
uint16 probability; // between 0 ...10000
uint16 max_fields; // maximum number of fields around a single factory
uint16 min_fields; // number of fields to start with
uint16 production_per_field;
public:
const skin_besch_t *get_bilder() const { return static_cast<const skin_besch_t *>(get_child(0)); }
const char *get_name() const { return get_bilder()->get_name(); }
const char *get_copyright() const { return get_bilder()->get_copyright(); }
uint8 has_snow_bild() const { return has_winter; }
uint16 get_probability() const { return probability; }
uint16 get_max_fields() const { return max_fields; }
uint16 get_min_fields() const { return min_fields; }
uint16 get_field_production() const { return production_per_field; }
};
/*
* Autor:
* Volker Meyer
*
* Beschreibung:
* Der Rauch einer Fabrik verweist auf eine allgemeine Rauchbeschreibung
*
* Kindknoten:
* 0 SKin
*/
cl**** rauch_besch_t : public obj_besch_t {
friend cl**** factory_smoke_writer_t;
friend cl**** factory_smoke_reader_t;
private:
koord pos_off;
koord xy_off;
sint16 zeitmaske;
public:
const char *get_name() const { return get_bilder()->get_name(); }
const char *get_copyright() const { return get_bilder()->get_copyright(); }
const skin_besch_t *get_bilder() const { return static_cast<const skin_besch_t *>(get_child(0)); }
// get the tile with the smoke
koord get_pos_off( koord size, uint8 rotation) const {
switch( rotation%4 ) {
case 1: return koord( size.y-pos_off.y, pos_off.x );
case 2: return koord( size.x-pos_off.x, size.y-pos_off.y );
case 3: return koord( pos_off.y, size.x-pos_off.x );
}
return pos_off;
}
// offset in pixel (remember intern size TILE_STEPS==16)
koord get_xy_off(uint8 rotation) const {
switch( rotation%4 ) {
case 1: return koord( 0, xy_off.y+xy_off.x/2 );
case 2: return koord( -xy_off.x, xy_off.y );
case 3: return koord( 0, xy_off.y-xy_off.x/2 );
}
return xy_off;
}
sint16 get_zeitmaske() const { return zeitmaske; }
};
/*
* Autor:
* Volker Meyer
*
* Beschreibung:
* Ein Verbrauchsgut einer Fabriktyps
*
* Kindknoten:
* 0 Ware
*/
cl**** fabrik_lieferant_besch_t : public obj_besch_t {
friend cl**** factory_supplier_reader_t;
friend cl**** factory_supplier_writer_t;
private:
uint16 kapazitaet;
uint16 anzahl;
uint16 verbrauch;
public:
const ware_besch_t *get_ware() const { return static_cast<const ware_besch_t *>(get_child(0)); }
int get_kapazitaet() const { return kapazitaet; } //"capacity" (Babelfish)
int get_anzahl() const { return anzahl; } //"number" (Babelfish)
int get_verbrauch() const { return verbrauch; } //"consumption" (Babelfish)
};
/*
* Autor:
* Volker Meyer
*
* Beschreibung:
* Eine Produktion eines Fabriktyps
*
* Kindknoten:
* 0 Ware
*/
cl**** fabrik_produkt_besch_t : public obj_besch_t {
friend cl**** factory_product_writer_t;
friend cl**** factory_product_reader_t;
private:
uint16 kapazitaet;
/**
* How much of this product is derived from one unit of factory
* production? 256 means 1.0
* @author Hj. Malthaner
*/
uint16 faktor;
public:
const ware_besch_t *get_ware() const { return static_cast<const ware_besch_t *>(get_child(0)); }
uint32 get_kapazitaet() const { return kapazitaet; }
uint32 get_faktor() const { return faktor; }
};
/*
* Autor:
* Volker Meyer
*
* Beschreibung:
* Jetzt endlich die Ganze Fabrik
*
* Kindknoten:
* 0 Haus
* 1 Rauch
* 2 Lieferant 1
* 3 Lieferant 2
* ... ...
* n+1 Lieferant n
* n+2 Produkt 1
* n+3 Produkt 2
* ... ...
*/
cl**** fabrik_besch_t : public obj_besch_t {
friend cl**** factory_reader_t;
friend cl**** factory_writer_t;
public:
enum platzierung {Land, W****er, Stadt};
private:
enum platzierung platzierung; //"placement" (Babelfish)
uint16 produktivitaet; //"productivity" (Babelfish)
uint16 bereich; //"range" (Babelfish)
uint16 gewichtung; // Wie wahrscheinlich soll der Bau sein? ("How likely will the building be?" (Google)).
uint8 kennfarbe; //"identification colour code" (Babelfish)
uint16 lieferanten; //"supplier" (Babelfish)
uint16 produkte; //"products" (Babelfish)
uint8 fields; // only if there are any ...
uint16 pax_level;
float electricity_proportion; // Modifier of electricity consumption.
uint16 inverse_electricity_proportion;
bool electricity_producer;
uint8 upgrades; // The industry types to which this industry can be upgraded.
public:
/*
* Name und Copyright sind beim Gebäude gespeichert!
*/
const char *get_name() const { return get_haus()->get_name(); }
const char *get_copyright() const { return get_haus()->get_copyright(); }
const haus_besch_t *get_haus() const { return static_cast<const haus_besch_t *>(get_child(0)); }
const rauch_besch_t *get_rauch() const { return static_cast<const rauch_besch_t *>(get_child(1)); }
// we must take care, for the case of no producer/consumer
const fabrik_lieferant_besch_t *get_lieferant(int i) const //"supplier" (Babelfish)
{
return (i >= 0 && i < lieferanten) ? static_cast<const fabrik_lieferant_besch_t *>(get_child(2 + i)) : NULL;
}
const fabrik_produkt_besch_t *get_produkt(int i) const
{
return (i >= 0 && i < produkte) ? static_cast<const fabrik_produkt_besch_t *>(get_child(2 + lieferanten + i)) : NULL;
}
const field_besch_t *get_field() const {
if(!fields) return NULL;
return static_cast<const field_besch_t *>(get_child(2 + lieferanten + produkte));
}
int get_lieferanten() const { return lieferanten; } //"supplier" (Babelfish)
uint get_produkte() const { return produkte; }
/* where to built */
enum platzierung get_platzierung() const { return platzierung; }
int get_gewichtung() const { return gewichtung; }
uint8 get_kennfarbe() const { return kennfarbe; } //"identification colour code" (Babelfish)
void set_produktivitaet(int p) { produktivitaet=p; }
int get_produktivitaet() const { return produktivitaet; }
int get_bereich() const { return bereich; } //"range" (Babelfish)
/* level for post and p****enger generation */
int get_pax_level() const { return pax_level; }
float get_electricity_proportion() const { return electricity_proportion; }
uint16 get_inverse_electricity_proportion() const { return inverse_electricity_proportion; }
int is_electricity_producer() const { return electricity_producer; }
const fabrik_besch_t * get_upgrades(int i) const { return (i >= 0 && i < upgrades) ? static_cast<const fabrik_besch_t *>(get_child((2 + lieferanten + produkte + fields + i))) : NULL; }
int get_upgrades_count() const { return upgrades; }
};
#endif
Unfortunately, when I use Simutrans-Experimental with the industries that I have compiled using the version of Makeobj compiled as above, I find that clicking on industries gives no information window. There is no such problem when using industries from a standard pakset. I think that I must be doing something wrong with the XREF, but what? Can anyone familliar with the code explain how the XREF writer works, or at least, enough of how it works to ****ist me with this difficulty?