Re: Savegame editing

From: outis02 <uly_at_...>
Date: Tue, 03 Nov 2009 19:50:23 -0000


Anyway, before there's a better suggestion, I'm just gonna post what I've got so far. Below is the content of my KoDP.bt file, you can run it on any save file from 010 Editor, terribly formatted due partly to the line length here. You may also notice that there's an #include at the bottom, but it's just for some display functions that aren't really important to the file structure. Also ignore all the SetColor(), ???read and ???write functions; it's just for display within 010 Editor.

BigEndian(); BitfieldRightToLeft();
enum <byte> BOOL { False, True=0xFF};

////////////////////////////////////////////////////////////////DATE////////////////////////////////////////////////////////////////
typedef short DATE <read=DATEread>;
string DATEread (DATE &t) {

	int year = t / 11;
	enum { Sea1, Sea2, Fir1, Fir2, Ear1, Ear2, Dar1, Dar2, Sto1, Sto2, Sac } season = t % 11;
	string s = SPrintf(s, "%i·%s", year, EnumToString(season));
	return s;

}

////////////////////////////////////////////////////////////////STR////////////////////////////////////////////////////////////////
typedef struct {
SetForeColor(cPurple);

        short len;
SetForeColor(cDkPurple);

	local int64 pos = FTell();
	if (len) uchar Str[len];

SetForeColor(cNone);
} STR <read=STRread, write=STRwrite>;

string STRread (STR &v) { if (v.len) return v.Str; return ""; } void STRwrite (STR &v, string s) {

	if (v.len == Strlen(s)) Strncpy(v.Str, s, v.len);
	else {
		if (v.len < Strlen(s)) InsertBytes(v.pos, Strlen(s)-v.len);
		if (v.len > Strlen(s)) DeleteBytes(v.pos, v.len-Strlen(s));
		WriteBytes(s, v.pos, Strlen(s));
		v.len = Strlen(s);
	}

}

////////////////////////////////////////////////////////////////ARRAY////////////////////////////////////////////////////////////////
typedef struct {

        local int64 pos = FTell();
SetForeColor(cWhite);

        short ct;
SetForeColor(cDkBlue);

        if (ct) short Int[ct] <format=hex>;
SetForeColor(cNone);
} ARRAY <optimize=false, read=ARRAYread>;

string ARRAYread (ARRAY &v) { string s = SPrintf(s, "%i", v.ct); return s; }

////////////////////////////////////////////////////////////////CHIEF////////////////////////////////////////////////////////////////
typedef struct { enum <short> PERSONALITY { low=1, mid, high, pc=0xCDCD } ChiefDaring;

        PERSONALITY ChiefGenerosity; PERSONALITY ChiefGuile; PERSONALITY ChiefPiety; } CHIEF <read=CHIEFread>;

string CHIEFread (CHIEF &c) {

	string s;
	switch (c.ChiefDaring)			{ case 1 : s += "·Dar-"; break;	case 3 : s += "·Dar+"; break; }
	switch (c.ChiefGenerosity)	{ case 1 : s += "·Gen-"; break;	case 3 : s += "·Gen+"; break; }
	switch (c.ChiefGuile)				{ case 1 : s += "·Gui-"; break;	case 3 : s += "·Gui+"; break; }
	switch (c.ChiefPiety)				{ case 1 : s += "·Pie-"; break;	case 3 : s += "·Pie+"; break; }
	s = SubStr(s, 1);
	return s;

}

////////////////////////////////////////////////////////////////POP////////////////////////////////////////////////////////////////
typedef struct { short Healthy, Absent, Sick, Wounded; } POP <read=POPread>; string POPread (POP &v) { string s = SPrintf(s, "%i·%i·%i·%i", v.Healthy, v.Absent, v.Sick, v.Wounded); return s; }

////////////////////////////////////////////////////////////////GODS////////////////////////////////////////////////////////////////
typedef struct {

	long:1;							long Ancestors:1;	long ArganArgar:1;long Barntar:1;
	long ChalanaArroy:1;long Elmal:1;			long Ernalda:1;		long Eurmal:1;
	long Humakt:1;			long Issaries:1;	long KeroFin:1;		long LhankorMhy:1;
	long Malia:1;				long MaranGor:1;	long Odayla:1;		long Orlanth:1;
	long TarardRiel:1;	long Uralda:1;		long Urox:1;			long Vinga:1;
	long WindSpirits:1;

} GODS <read=GODSread>;

string GODSread (GODS &v) {

	string s;										if(v.Ancestors)	s+="·A";	if(v.ArganArgar)s+="·a";	if (v.Barntar)		s+="·B";
	if(v.ChalanaArroy)s+="·C";	if(v.Elmal)			s+="·El";	if(v.Ernalda)		s+="·Er";	if (v.Eurmal)			s+="·Eu";
	if(v.Humakt)			s+="·H";	if(v.Issaries)	s+="·Is";	if(v.KeroFin)		s+="·k";	if (v.LhankorMhy)	s+="·L";
	if(v.Malia)				s+="·m";	if(v.MaranGor)	s+="·mg";	if(v.Odayla)		s+="·Od";	if (v.Orlanth)		s+="·Or";
	if(v.TarardRiel)	s+="·t";	if(v.Uralda)		s+="·Ua";	if(v.Urox)			s+="·Ux";	if (v.Vinga)			s+="·V";
	if(v.WindSpirits)	s+="·w";	s = SubStr(s, 1);					return s;
}

////////////////////////////////////////////////////////////////RAID////////////////////////////////////////////////////////////////
typedef struct {

	short ClanIdx;
	enum <short> { Cattle=65527, Battle=65532 } Type;
 	DATE Date;
	enum <short> { draw, win_caught, loss_steal=65535 } Result;
} RAID <read=RAIDread>;

string RAIDread (RAID &r) {

	int i = r.ClanIdx-1;
	if (i<0) i = 0;
	string s = SPrintf(s, "%s·%s·%s·%s", DATEread(r.Date), EnumToString(r.Type), EnumToString(r.Result), SubStr(Clans.Clan[i].dataLR.Name.Str,0,Clans.Clan[i].dataLR.Name.len));
	return s;

}

////////////////////////////////////////////////////////////////BALANCE////////////////////////////////////////////////////////////////
enum <short> BALANCE { War, Balanced, Peace };

////////////////////////////////////////////////////////////////SKILL////////////////////////////////////////////////////////////////
typedef struct { SetForeColor(cDkBlue); LittleEndian();

	double Animals;	double Bargaining;	double Combat;	double Custom;	double Leadership;	double Magic;	double Plant;
	BigEndian(); SetForeColor(cNone);

} SKILLS <read=SKILLSread>;

string SKILLSread (SKILLS &v) { string s = SPrintf(s, "%1.f·%1.f·%1.f·%1.f·%1.f·%1.f·%1.f", v.Animals, v.Bargaining, v.Combat, v.Custom, v.Leadership, v.Magic, v.Plant); return s; }

////////////////////////////////////////////////////////////////TRAIT////////////////////////////////////////////////////////////////
typedef struct {

	long AntiAldryami :1, AntiUndead :1;
	long _aggressive:1; //alliance: appeal to generosity, greed; tribute: appeal to guile, generosity, war: raid feuding neighbours; diplo: we can survive alone
	long _Arrogant :1; //dictatorial, tribute: contest; kallyr: toast
	long _11:1;
	long _fearful :1; //tribute: avoid contest; trade: fear of ambush; magic: nervous of gods
	long _12:1;
	long _13:1;

	long _unconfident :1; //tribute: can't win contest
	long _21:1;
	long _lore:1; //cites lore
	long _peacelike :1;
	long Matriarchal :1;
	long Mumbler:1; //say crazy things, proverbial
	long _greedy :1; //alliance: appeal to generosity; tribute: annual tribute
	long Patriarchal :1;

	long _31:1;
	long _religious :1; //alliance: appeal to faith/orlanth
	long _Poetic :1; //alliance: appeal to poetry; wyrm: follow ancestor
	long _pacifist :1; //tribute: don't threaten
	long ProDragonewt :1, Proverbial :1;
	long _Tribelike :1; //diplo: gift neighbours to form tribe; trade: less trade, go explore (per omens)
	long _generous :1; //? Generous? korlmar

	long _hateful :1; //lousy XXX!
	long _41:1;
	long Religious :1; //alliance: worship
	long _Told:1; //war: "told you XXX were gonna raid us!"
	long Tradelike :1; //trade: more treasure
	long Tribelike :1; //alliance: tribe
	long Warlike :1;
	long _42:1;

} TRAIT <read=TRAITread>;

string TRAITread (TRAIT &t) { string s;

	if (t.AntiAldryami) s += "·Elf-";
	if (t.AntiUndead) s += "·Undead-";
	if (t._aggressive) s += "·?";
	if (t._Arrogant) s += "·_Arrogant";
	if (t._11) s += "·11";
	if (t._fearful) s += "·_fearful";
	if (t._12) s += "·12";
	if (t._13) s += "·13";

	if (t._unconfident) s += "·_unconfid";
	if (t._21) s += "·21";
	if (t._lore) s += "·_lore";
	if (t._peacelike) s += "·_peace";
	if (t.Matriarchal) s += "·Matri";
	if (t.Mumbler) s += "·Mumbler";
	if (t._greedy) s += "·?";
	if (t.Patriarchal) s += "·Patri";

	if (t._31) s += "·31";
	if (t._religious) s += "·_religious";
	if (t._Poetic) s += "·_Poetic";
	if (t._pacifist) s += "·_pacifist";
	if (t.ProDragonewt) s += "·Newt+";
	if (t.Proverbial) s += "·Proverbial";
	if (t._Tribelike) s += "·?";
	if (t._generous) s += "·?";

	if (t._hateful) s += "·_hateful";
	if (t._41) s += "·41";
	if (t.Religious) s += "·Religious";
	if (t._Told) s += "·_Told";
	if (t.Tradelike) s += "·_trade?";
	if (t.Tribelike) s += "·_tribe?";
	if (t.Warlike) s += "·Warlike";
	if (t._42) s += "·42";
	s = SubStr(s, 1);
	return s;

}

////////////////////////////////////////////////////////////////LEADER////////////////////////////////////////////////////////////////
typedef struct {
SetBackColor(cDkGray);

        short Age;
SetBackColor(cLtPurple);

	short ClanIdx;
	enum <short> { Male=1, Female } Gender;
	short TurnsUnavailable;
	BOOL Heroic; //contest win, etc
	enum <short> { Home, emissary, explorer=13, caravan=16, enthralled=18, Dead } Location; //enthralled by horsespawn
	STR Name;
	char Picture[12];
	GODS Religion;
	short Seat, Sick;
	SKILLS Skills;
	enum <short> { Alive, Dead_tmp1, Dead_tmp2, Dead_perm } State;
SetBackColor(cLtRed);
	TRAIT Trait;
SetBackColor(cLtPurple);
	enum <short> { craft=1, farm, heal, hunter, law, magic, noble, trader, trick, war } Type;
	short Wounded, YearsOnRing;

} LEADER <optimize=false, read=LEADERread, write=LEADERwrite>;

string LEADERread (LEADER &v) { string s; if (v.Seat>0) s = "+"; else s = "-"; return s + v.Name.Str + ": " + TRAITread(v.Trait); } void LEADERwrite (LEADER &v, string s) { string t = s; STRwrite(v.Name, t); }

////////////////////////////////////////////////////////////////RELATION////////////////////////////////////////////////////////////////
typedef struct {

        short ClanIdx, Attitude;
SetForeColor(cDkGreen);

        short _always0;
SetForeColor(cNone);

	short Favors, Alliance, Feud;
	BOOL Trade;
	BOOL Near; //canRaid (N)
	BOOL Neighbour; //canSeize
SetForeColor(cDkGreen);
	short _; //short
SetForeColor(cNone);
	short TimesRaidedBy; //negative
SetForeColor(cDkGreen);
	short _;
SetForeColor(cNone);
	short TimesRaided;
SetForeColor(cDkGreen);
	short _;
SetForeColor(cNone);
	short Slights;
	struct { short _wePayTribute, Cattle, Food, Goods; } Tribute;
SetForeColor(cDkGreen);
	short _;
SetForeColor(cNone);
	short _Flag; //changes whether a clan is displayed
} RELATION <optimize=false, read=RELATIONread>;

string RELATIONread (RELATION &v) {

	int i = v.Attitude;
	string s = SPrintf(s, "%s=%i", SubStr(Clans.Clan[v.ClanIdx-1].dataLR.Name.Str, 0, Clans.Clan[v.ClanIdx-1].dataLR.Name.len), i);
	return s;

}

////////////////////////////////////////////////////////////////TREASURE////////////////////////////////////////////////////////////////
typedef struct { local int Idx = TreasureIdx++; short Qt; short WearerIdx; } TREASURE <optimize=false, read=TREASUREread, write=TREASUREwrite>; void TREASUREwrite (TREASURE &t, string s) { int i; int j = SScanf(s, "%i", i); if (j) t.Qt = i; }

////////////////////////////////////////////////////////////////CLAN A-L////////////////////////////////////////////////////////////////
typedef struct {
SetBackColor(cLtBlue);

	struct {
		BOOL _Exists;
SetForeColor(cDkGreen);
		short _xAB; //short, alternates 1/0 from the first clan
SetForeColor(cNone);
		short Barley;
		BOOL _BaseOrlanthiClan;
		short Cattle;
SetForeColor(cDkGreen);
		CHIEF Chief;
SetForeColor(cNone);
		short Children[15];
		enum <short> { Player, Orlanthi, Foreigner } ClanClass; //guessed, affects whether borders are displayed on map
		short ClanIdx;
		BALANCE ClanType;
		POP Crafters;
		short Cropland;
		enum <short> { possible, failed, joined } TribeForm;
		STR Description;
		POP Farmers;
		short Food;
		struct { short Ditch :1, Hillfort :1, Ramparts :1, StakePerimeter :1, WoodenStockade :1, StoneWall :1, WatchTower :1, ImprovedStoneWall :1; } Fortifications;
		short Goods;
		GODS GreatTemples;
		short Harvest;
SetForeColor(cDkGreen);
		short _xH; //is short
SetForeColor(cNone);
		short Horses;
		POP Housecarls; //Weaponthanes; //Housecarls
		POP Hunters;
SetForeColor(cDkGreen);
		short _xHI[20]; //short
SetForeColor(cNone);
		short InnerPatrol, KingIdx, KingshipReputation;
SetForeColor(cDkGreen);
		short _xKL1; //short
		byte _xKL2[10]; //byte
SetForeColor(cNone);
		struct { RAID LastRaided, LastRaidedBy; } LastRaids;
SetForeColor(cDkGreen);
		short _xL; //LastPeace? 2=marriage alliance, 3=beaten/warned, decreases over time
SetForeColor(cNone);
	} dataAL;


////////////////////////////////////////////////////////////////LEADERS////////////////////////////////////////////////////////////////
struct { SetBackColor(cNone); SetForeColor(cWhite); short ct; SetForeColor(cNone); if (ct) LEADER Leader[ct]; } Leaders;
////////////////////////////////////////////////////////////////DATA L-R////////////////////////////////////////////////////////////////
struct { SetBackColor(cLtAqua); short Earthblood; struct { byte Children, Crops, Diplomacy, Health, Herds, Hunting, Mysteries, Quests, Trade, War, Destiny, Heroism; } Magics; enum <short> { Ancestors=1, ArganArgar, Barntar, ChalanaArroy, Elmal, Ernalda, Eurmal, Humakt, Issaries, KeroFin, LhankorMhy, Malia, MaranGor, Odayla, Orlanth, TarardRiel, Uralda, Urox, Vinga, WindSpirits } MainDeity; struct { short Clan, Farmer, Warrior; } Mood; STR Name; POP Nobles; SetForeColor(cDkGreen); short _xNO; //short SetForeColor(cNone); short OuterPatrol, Pasture, Pigs; struct { short Farmers, Oxen; } Planted; BOOL PlayerHasThralls; STR Plural; short Magic; //powerpoints struct { byte Plain, Fancy, Amulets, Gems, Greenware, Iron, Ivory; } Production; GODS MinorShrines; struct { struct RAIDS { SetForeColor(cWhite); short ct; SetForeColor(cNone); if (ct) RAID Raid[ct]; } Raided; RAIDS RaidedBy; } Raids; short VictoryScore; //increase over time? } dataLR;
////////////////////////////////////////////////////////////////RELATIONS////////////////////////////////////////////////////////////////
SetBackColor(cLtYellow); struct { SetForeColor(cWhite); short ct; SetForeColor(cNone); if (ct) RELATION Relation[ct]; } Relations;

SetBackColor(cNone);

////////////////////////////////////////////////////////////////DATA R-W////////////////////////////////////////////////////////////////
local int i = 0;

        struct {
SetColor(cNone,cLtAqua);

		short RingMemberIdx[7];
		BOOL RoyalClan;
SetForeColor(cDkGreen);
		short _RoyalJealousy; //=1 upon Einarth Milk-Eye prophecy, =3 tribe-bandits fight, =0 upon moot for new king
SetForeColor(cNone);
		short Rye;
		struct {
SetColor(cNone,cLtGreen);
			struct { byte Blessing[4], _; } Sacrifice[20];
			struct { byte Blessing[4], _; } Known[20];
SetColor(cNone,cLtAqua);
		} Rituals;
		byte Sacrificed[20]; //Gods
		short Sheep;
		GODS Shrines;
		short _Shrine_[2];
SetColor(cNone,cLtGreen);
		struct { byte _, Blessing[4]; } ShrinePermanent[20];
SetColor(cNone,cLtAqua);
		GODS Temples;
		POP Thralls;
		BOOL ThrallsOkay;


//i = 0;
struct { local int TreasureIdx = 1; SetForeColor(cWhite); short ct; SetForeColor(cNone); if (ct) TREASURE Treasure[ct]; TREASURE _Treasure;
//if (i) { local string s = SPrintf(s, "%s+", SubStr(dataLR.Name.Str, 0, dataLR.Name.len)); Printf("%s ", s); }
} Treasures; short Wildlands; short Wheat; } dataRW;

local int x; local string s;
x = dataAL._xH;
if (x != 0) { s = SPrintf(s, "%i %s: xH = %i \n", dataAL.ClanIdx, SubStr(dataLR.Name.Str, 0, dataLR.Name.len), x); Printf("%s", s); } x = dataAL._xKL1;
if (x != 0) { s = SPrintf(s, "%i %s: xKL1 = %i \n", dataAL.ClanIdx, SubStr(dataLR.Name.Str, 0, dataLR.Name.len), x); Printf("%s", s); } x = dataAL._xL;
if (x != -1) { s = SPrintf(s, "%i %s: xL = %i \n", dataAL.ClanIdx, SubStr(dataLR.Name.Str, 0, dataLR.Name.len), x); Printf("%s", s); } x = dataLR._xNO;
if (x != 0) { s = SPrintf(s, "%i %s: xNO = %i \n", dataAL.ClanIdx, SubStr(dataLR.Name.Str, 0, dataLR.Name.len), x); Printf("%s", s); } x = dataRW._RoyalJealousy;
if (x != 0) { s = SPrintf(s, "%i %s: RoyalJealousy = %i \n", dataAL.ClanIdx, SubStr(dataLR.Name.Str, 0, dataLR.Name.len), x); Printf("%s", s); }

//s = SPrintf(s, "%i %s: %i + %i + %i = %i\n", dataAL.ClanIdx, SubStr(dataLR.Name.Str, 0, dataLR.Name.len), dataAL.Cropland, dataLR.Pasture, dataRW.Wildlands, dataAL.Cropland+dataLR.Pasture+dataRW.Wildlands); Printf("%s", s);

        ARRAY Zones; //display only

//local string s = SPrintf(s, "%s = %d\n", dataLR.Name.Str, dataAL._xBC); Printf("%s",s);

////////////////////////////////////////////////////////////////HISTORY////////////////////////////////////////////////////////////////
        if (dataAL.ClanIdx==1) struct { //all data lengths confirmed SetBackColor(cNone);
SetForeColor(cDkGreen);

                short _x1; //increase per season, reset per year SetForeColor(cNone);

                enum <short> { ancestors=1, elmal, urox, odayla, ernalda, orlanth, issaries, lhankormhy, chalanaarroy, uralda } Awakened; SetForeColor(cDkGreen);

                short _x2[2]; //short
SetForeColor(cNone);

		GODS KnownDeities;
		enum <short> { Battle_of_Extinguishing_Field=1, Hundred_Day_Hunt, Jesteds_Settlement, Procession_of_Animals, Harnessed_Oxen, Hidden_Place, Marking_Bone, First_Pot, Clan_Making_Dance } EarliestEvent;
		struct {
			DATE LastEmissary, LastExplore;
		} LastMissions;
SetForeColor(cDkGreen);
		BOOL _x3;
		short _x4[3]; //short
SetForeColor(cNone);
		BOOL RaidedDuringEarth;
SetForeColor(cDkGreen);
		byte _x5[2];
		DATE _Date, _Date;
SetForeColor(cNone);
		enum <short> { needed=1, more, lots, huge } LandClaim;
SetForeColor(cDkGreen);
		DATE _LastMission; //last diplo/trade mission, not sure
SetForeColor(cNone);
		short _YearNow; //short
		short TribePolicy;
SetForeColor(cDkGreen);
		short _x1; //short
		short _x1; //increase per season, reset per year
SetForeColor(cNone);
		BALANCE ClanType;
SetForeColor(cDkGreen);
		short _x1; //short
		DATE _DateLastTrade; //not sure
SetForeColor(cNone);
		BOOL RaidedDuringSea;
		struct {
			short Cattle;
SetForeColor(cDkGreen);
			short _x[2]; //short
SetForeColor(cNone);
			short Horses, Pigs, Population, Sheep;
		} Resources;
SetForeColor(cDkGreen);
		long _x6; //long
SetForeColor(cNone);
		DATE _Date;
		BOOL HeroQuest[9];
SetForeColor(cDkGreen);
		byte _x7;
		short _Generosity; //short
		DATE _Date;
		short _x1; //short
SetForeColor(cNone);
		short Myth[15];
local string s = SPrintf(s, "History= %i, %i", _x1[0], _x1[2]); Printf(s);
	} History;

} CLAN <optimize=false, read=CLANread, write=CLANwrite>;

string CLANread (CLAN &v) { return v.dataLR.Name.Str + " (" + CHIEFread(v.dataAL.Chief) + ")"; } void CLANwrite (CLAN &v, string s) { string t = s;

	STRwrite(v.dataLR.Plural, t + "s");
	STRwrite(v.dataLR.Name, t);

}

//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////HEADER////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
struct {

	char Opal[4];
	byte _x1[8];
	short Omens; //or Omens
	short _x2;
	enum <short> { Short=1, Long } Length;
	DATE Date;
	short Harvest; //1 to 7

} Header;

////////////////////////////////////////////////////////////////VARS////////////////////////////////////////////////////////////////
struct {

        local int VarIdx = 0;
SetForeColor(cWhite);

        short ct;
SetForeColor(cNone);

	typedef struct {
		local int Idx = VarIdx++;
SetForeColor(cBlue);
		if (ReadShort(FTell())<0x7FF0 || ReadShort(FTell())>0x8000) long Value;
		else {
			enum <short> { Leader=0x7FF2, clan, tribe, treasure, leaders=0x7FFA, clans, tribes, treasures } Class <format=hex>;
			short Value;
		}
SetForeColor(cGray);
		short Short;
		BOOL Bool;
		STR String;
	} VAR <optimize=false, read=VARread>;
	VAR Var[ct];

} Vars;

////////////////////////////////////////////////////////////////MAP////////////////////////////////////////////////////////////////
SetBackColor(cLtYellow);
struct { struct { BOOL Hex[27]; } Line[32]; } Map;

////////////////////////////////////////////////////////////////TREASURES////////////////////////////////////////////////////////////////
SetBackColor(cNone);
struct {

	short Total;
	local int TreasureIdx = 1;
	typedef struct {
		local int Idx = TreasureIdx++;
		short Qt;
	} ONSALE <optimize=false, read=ONSALEread, write=ONSALEwrite>;
	ONSALE OnSale[120];

} Treasures;

void ONSALEwrite (ONSALE &t, string s) { int i; int j = SScanf(s, "%i", i); if (j) t.Qt = i; }

////////////////////////////////////////////////////////////////ARRAYS////////////////////////////////////////////////////////////////
struct { ARRAY Array[12]; } __arrays; //randomized at gamestart, all empty arrays for Tutorial and Opal

////////////////////////////////////////////////////////////////LEADERNAMES////////////////////////////////////////////////////////////////
struct {
SetForeColor(cWhite);

        short females;
SetForeColor(cNone);

	local int i = 0;
	typedef struct {
		local int Idx = i++;
		short Used;
	} FEMALE <optimize=false, read=FEMALEread>;
	if (females) FEMALE Female[females];

SetForeColor(cWhite);
	short males;
SetForeColor(cNone);
	i = 0;
	typedef struct {
		local int Idx = i++;
		short Used;
	} MALE <optimize=false, read=MALEread>;
	if (males) MALE Male[males];

} LeaderNames;

////////////////////////////////////////////////////////////////CLANS////////////////////////////////////////////////////////////////
struct {
SetBackColor(cLtBlue);
SetForeColor(cWhite);

        short ct;
SetForeColor(cNone);

        if (ct) CLAN Clan[ct] <optimize=false>; } Clans;
SetBackColor(cNone);

//////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////
struct {

	short _xLunarWar; //=0 gamestart, =2 upon Tarsh recruit event for Lunar war
	short _x2; //=-1 always

} __shorts1;

////////////////////////////////////////////////////////////////CLANNAMES////////////////////////////////////////////////////////////////
struct {

        typedef struct { short Name; } CLANNAME <optimize=false, read=CLANNAMEread>;

        struct {
SetForeColor(cWhite);

                short ct;
SetForeColor(cDkBlue);

                if (ct) CLANNAME Clan[ct];
SetForeColor(cNone);

        } ClanName;

	short count;
	byte _x3[7];
	struct {
SetForeColor(cWhite);
		short ct;
SetForeColor(cNone);
		if (ct) byte x[ct];
	} _x4;

	struct {
SetForeColor(cWhite);
		short ct;
SetForeColor(cDkBlue);
		if (ct) CLANNAME Clan[ct];
SetForeColor(cNone);
	} ClanPlural;

} ClanNames;

////////////////////////////////////////////////////////////////TRIBES////////////////////////////////////////////////////////////////
SetBackColor(cLtRed);
struct {
SetForeColor(cWhite);

        short ct;
SetForeColor(cNone);

	struct {
		DATE LastElection;
		byte _x1;
		STR Name;
		struct { short ClanIdx, LeaderIdx; } King;
		struct {
SetForeColor(cWhite);
			short ct;
SetForeColor(cNone);
			if (ct) struct {
				short ClanIdx;
				DATE DateJoined;
			} Clan[ct];
		} Clans;
		short _x2;
		long _x3 <format=hex>;
		short _x2;
		BOOL _x4;
		struct {
SetForeColor(cWhite);
			short ct;
SetForeColor(cNone);
			if (ct) byte _x[ct];
		} _x5;
	} Tribe[ct] <optimize=false>;

} Tribes;
SetBackColor(cNone);

////////////////////////////////////////////////////////////////?////////////////////////////////////////////////////////////////
//struct {

SetBackColor(cLtYellow);

        short __shorts2[5]; //tribes related? _x1[0]==-1 until tribe formed SetBackColor(cLtPurple);

        BOOL __bools[53];
SetBackColor(cNone);
//} __static; //always same value at gamestart (not randomized)

////////////////////////////////////////////////////////////////EVENTS////////////////////////////////////////////////////////////////
SetBackColor(cLtBlue);
struct {
SetForeColor(cWhite);

        short ct;
SetForeColor(cNone);

	typedef struct {
		short EventIdx;
		enum <short> { explore=0xFFF8, trade=0xFFFA, diplo, raid } Mission;
		short Turns;
		short _x3;
		short LeaderIdx, ClanIdx;
		short _x4;
		struct {
			short Weaponthane, Weaponthane, Fyrd, Cattle, Horses, Goods, Food;
			enum <short> { Slowly=1, Normally, Quickly } Travel;
			short Treasure;
		} Convoy;
		struct {
			short TargetX, TargetY;
			enum <short> { ask_cattle_route=1, ask_food, ask_info, ask_magic, tribute, gift, alliance, peace } Goal;
			enum <short> { Small=1, Medium, Large, Pathfinder=15328 } Caravan;
		} Objective;
	} QUE <optimize=false, read=QUEread>;
	if (ct) QUE Que[ct];

	local int EventIdx = 0;
	typedef struct {
		local int Idx = EventIdx++;
		short Value;
	} EVENT <optimize=false, read=EVENTread>;
SetBackColor(cLtGreen);
	struct { EventIdx = 0; EVENT Event[1579]; } Times; //how many times it happened?
SetBackColor(cLtAqua);
	struct { EventIdx = 0; EVENT Event[1579]; } Years; //upon event, usually set to 0x7FFF, -1 per year

} Events;

////////////////////////////////////////////////////////////////LANDS////////////////////////////////////////////////////////////////
SetBackColor(cLtYellow);
struct {
SetForeColor(cWhite);

        short ct;
SetForeColor(cNone);

        if (ct) short Owner[ct];
SetColor(cNone,cNone);

        char Opal[4];
} Zones;

#include "KoDPinc.bt"

Powered by hypermail