|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T s
Length: 2724 (0xaa4)
Types: TextFile
Names: »sectors.c«
└─⟦b20c6495f⟧ Bits:30007238 EUUGD18: Wien-båndet, efterår 1987
└─⟦this⟧ »EUUGD18/General/Empire.V/V1.1/EMPFIX/sectors.c«
#define D_SECTDES
#define D_SCTSTR
#define D_NATSTR
#define D_FILES
#include "empdef.h"
extern int xflg, wflg, mflg;
sectors()
{
char *cp, *getstri();
int i, j, offx, offy, num;
long k;
cp = getstri("Offset as country #? ");
if( *cp == '\0' ) return;
num = atoi(cp);
i = num * sizeof(nat);
lseek(natf, (long)i, 0);
i = read(natf, &nat, sizeof(nat));
if( i >= sizeof(nat) ) goto X156;
printf("Only %d bytes in that nation...\n", i);
return;
X156:
offx = nat.nat_xcap;
offy = nat.nat_ycap;
sectf = open(sectfil, O_RDWR);
X220:
xflg = wflg = mflg = 0;
cp = getstri("x,y? ");
if( *cp != '\0' ) goto X274;
close(sectf);
return;
X274:
i = atoip(&cp) + offx;
if( *cp++ == ',') goto X346;
printf("format is x,y\n");
goto X220;
X346:
j = atoip(&cp) + offy;
k = (((long)w_ysize + j)%w_ysize)*w_xsize + ((long)w_xsize + i)%w_xsize;
lseek(sectf, k * sizeof(sect), 0);
read(sectf, §, sizeof(sect));
printf("Sector %d, %d\n", i, j);
bytefix("owned", §.sct_owned, 0);
bytefix("desig", §.sct_desig, (int)(sect.sct_desig > S_MOUNT) ? S_RURAL : sect.sct_desig);
bytefix("effic", §.sct_effic, 0);
bytefix("miner", §.sct_miner, (int)sect.sct_miner);
bytefix("gmin", §.sct_gmin, (int)sect.sct_gmin);
bytefix("civil", §.sct_civil, 0);
bytefix("milit", §.sct_milit, 0);
bytefix("shell", §.sct_shell, 0);
bytefix("guns", §.sct_guns, 0);
bytefix("plane", §.sct_plane, 0);
bytefix("ore", §.sct_ore, 0);
bytefix("gold", §.sct_gold, 0);
bytefix("c_use", §.sct_c_use, 0);
bytefix("m_use", §.sct_m_use, 0);
bytefix("s_use", §.sct_s_use, 0);
bytefix("g_use", §.sct_g_use, 0);
bytefix("p_use", §.sct_p_use, 0);
bytefix("o_use", §.sct_o_use, 0);
bytefix("b_use", §.sct_b_use, 0);
bytefix("prdct", §.sct_prdct, 0);
bytefix("contr", §.sct_contr, 0);
wordfix("chkpt", §.sct_chkpt, 0);
bytefix("dfend", §.sct_dfend, 0);
wordfix("mobil", §.sct_mobil, 0);
bytefix("p_stage", §.sct_p_stage, 0);
bytefix("p_time", §.sct_p_time, 0);
wordfix("lstup", §.sct_lstup, 0);
if( mflg != 0 ) goto X1550;
goto X220;
X1550:
lseek(sectf, k * sizeof(sect), 0);
write(sectf, §, sizeof(sect));
printf("Rewritten\n");
goto X220;
}