1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

added ignore to fscanf

This commit is contained in:
Zeno Rogue 2019-02-10 14:58:23 +01:00 committed by ?
parent 79bb11413c
commit 6e94dbf674

View File

@ -52,26 +52,26 @@ int readArgs() {
if(!f) { shift(); printf("failed to open file\n"); return 0; }
int id;
lineinfo l0;
fscanf(f, "%d%d%d", &id, &l0.plus_matrices, &l0.minus_matrices);
ignore(fscanf(f, "%d%d%d", &id, &l0.plus_matrices, &l0.minus_matrices));
l0.locs.push_back(location{View, viewctr});
for(int i=1; i<l0.plus_matrices; i++)
l0.locs.push_back(loc_multiply(l0.locs.back(), xpush(1)));
lines[id] = std::move(l0);
while(true) {
fscanf(f, "%d", &id);
ignore(fscanf(f, "%d", &id));
println(hlog, "id=", id, ".");
if(id < 0) break;
auto& l1 = lines[id];
int step;
fscanf(f, "%d%d", &id, &step);
ignore(fscanf(f, "%d%d", &id, &step));
transmatrix T;
double d;
for(int a=0; a<9; a++) {
fscanf(f, "%lf", &d);
ignore(fscanf(f, "%lf", &d));
T[0][a] = d;
}
fscanf(f, "%d%d", &l1.plus_matrices, &l1.minus_matrices);
ignore(fscanf(f, "%d%d", &l1.plus_matrices, &l1.minus_matrices));
auto old = lines[id].locs[step];
println(hlog, "FROM ", old.lView, old.lviewctr, " id=", id, " step=", step);
l1.locs.push_back(loc_multiply(old, T));