mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-23 21:07:17 +00:00
rogueviz:: made it compile with the changes elsewhere
This commit is contained in:
parent
3a5c342f47
commit
5a3114d279
1
hyper.h
1
hyper.h
@ -1683,6 +1683,7 @@ namespace arg {
|
||||
void shift();
|
||||
|
||||
const string& args();
|
||||
const char* argcs();
|
||||
int argi();
|
||||
ld argf();
|
||||
bool argis(const string& s);
|
||||
|
38
kohonen.cpp
38
kohonen.cpp
@ -69,8 +69,8 @@ double vnorm(kohvec& a, kohvec& b) {
|
||||
void sominit(int);
|
||||
void uninit(int);
|
||||
|
||||
void loadsamples(const char *fname) {
|
||||
FILE *f = fopen(fname, "rt");
|
||||
void loadsamples(const string& fname) {
|
||||
FILE *f = fopen(fname.c_str(), "rt");
|
||||
if(!f) {
|
||||
fprintf(stderr, "Could not load samples\n");
|
||||
return;
|
||||
@ -747,9 +747,9 @@ namespace levelline {
|
||||
|
||||
}
|
||||
|
||||
void ksave(const char *fname) {
|
||||
void ksave(const string& fname) {
|
||||
sominit(1);
|
||||
FILE *f = fopen(fname, "wt");
|
||||
FILE *f = fopen(fname.c_str(), "wt");
|
||||
if(!f) {
|
||||
fprintf(stderr, "Could not save the network\n");
|
||||
return;
|
||||
@ -763,10 +763,10 @@ void ksave(const char *fname) {
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void kload(const char *fname) {
|
||||
void kload(const string& fname) {
|
||||
sominit(1);
|
||||
int xcells;
|
||||
FILE *f = fopen(fname, "rt");
|
||||
FILE *f = fopen(fname.c_str(), "rt");
|
||||
if(!f) {
|
||||
fprintf(stderr, "Could not load the network\n");
|
||||
return;
|
||||
@ -783,9 +783,9 @@ void kload(const char *fname) {
|
||||
analyze();
|
||||
}
|
||||
|
||||
void ksavew(const char *fname) {
|
||||
void ksavew(const string& fname) {
|
||||
sominit(1);
|
||||
FILE *f = fopen(fname, "wt");
|
||||
FILE *f = fopen(fname.c_str(), "wt");
|
||||
if(!f) {
|
||||
fprintf(stderr, "Could not save the weights\n");
|
||||
return;
|
||||
@ -795,9 +795,9 @@ void ksavew(const char *fname) {
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void kloadw(const char *fname) {
|
||||
void kloadw(const string& fname) {
|
||||
sominit(1);
|
||||
FILE *f = fopen(fname, "rt");
|
||||
FILE *f = fopen(fname.c_str(), "rt");
|
||||
if(!f) {
|
||||
fprintf(stderr, "Could not load the weights\n");
|
||||
return;
|
||||
@ -840,7 +840,7 @@ void progress(string s) {
|
||||
}
|
||||
}
|
||||
|
||||
void kclassify(const char *fname_classify) {
|
||||
void kclassify(const string& fname_classify) {
|
||||
|
||||
sominit(1);
|
||||
vector<double> bdiffs(samples, 1e20);
|
||||
@ -871,9 +871,9 @@ void kclassify(const char *fname_classify) {
|
||||
|
||||
for(int s=0; s<samples; s++) net[bids[s]].samples++;
|
||||
|
||||
if(fname_classify != NULL) {
|
||||
if(fname_classify != "") {
|
||||
printf("Listing classification...\n");
|
||||
FILE *f = fopen(fname_classify, "wt");
|
||||
FILE *f = fopen(fname_classify.c_str(), "wt");
|
||||
if(!f) {
|
||||
printf("Failed to open file\n");
|
||||
}
|
||||
@ -886,10 +886,10 @@ void kclassify(const char *fname_classify) {
|
||||
coloring();
|
||||
}
|
||||
|
||||
void klistsamples(const char *fname_samples, bool best, bool colorformat) {
|
||||
if(fname_samples != NULL) {
|
||||
void klistsamples(const string& fname_samples, bool best, bool colorformat) {
|
||||
if(fname_samples != "") {
|
||||
printf("Listing samples...\n");
|
||||
FILE *f = fopen(fname_samples, "wt");
|
||||
FILE *f = fopen(fname_samples.c_str(), "wt");
|
||||
if(!f) {
|
||||
printf("Failed to open file\n");
|
||||
}
|
||||
@ -918,10 +918,10 @@ void klistsamples(const char *fname_samples, bool best, bool colorformat) {
|
||||
}
|
||||
}
|
||||
|
||||
void neurondisttable(const char *fname) {
|
||||
FILE *f = fopen(fname, "wt");
|
||||
void neurondisttable(const string &name) {
|
||||
FILE *f = fopen(fname.c_str(), "wt");
|
||||
if(!f) {
|
||||
printf("Could not open file: %s\n", fname);
|
||||
printf("Could not open file: %s\n", fname.c_str());
|
||||
return;
|
||||
}
|
||||
int neurons = size(net);
|
||||
|
38
rogueviz.cpp
38
rogueviz.cpp
@ -406,7 +406,7 @@ namespace tree {
|
||||
tol[at].epos = ++xpos;
|
||||
}
|
||||
|
||||
void read(const char *fn) {
|
||||
void read(string fn) {
|
||||
fname = fn;
|
||||
init(); kind = kTree;
|
||||
printf("Reading the tree of life...\n");
|
||||
@ -773,8 +773,8 @@ namespace sag {
|
||||
sag::cost);
|
||||
}
|
||||
|
||||
void savesnake(const char *fname) {
|
||||
FILE *f = fopen(fname, "wt");
|
||||
void savesnake(const string& fname) {
|
||||
FILE *f = fopen(fname.c_str(), "wt");
|
||||
for(int i=0; i<N; i++)
|
||||
fprintf(f, "%s;%d\n", vdata[i].name.c_str(), snakeid[i]);
|
||||
fclose(f);
|
||||
@ -849,7 +849,7 @@ namespace sag {
|
||||
|
||||
ld edgepower=1, edgemul=1;
|
||||
|
||||
void read(const char *fn) {
|
||||
void read(string fn) {
|
||||
fname = fn;
|
||||
init(); kind = kSAG;
|
||||
temperature = 0; sagmode = sagOff;
|
||||
@ -967,13 +967,13 @@ void activate(shmup::monster *m) {
|
||||
else ealpha = 1; */
|
||||
}
|
||||
|
||||
void storevertex(vector<GLfloat>& tab, const hyperpoint& h) {
|
||||
for(int i=0; i<3; i++) tab.push_back(h[i]);
|
||||
void storevertex(vector<glvertex>& tab, const hyperpoint& h) {
|
||||
tab.push_back(glhr::pointtogl(h));
|
||||
}
|
||||
|
||||
double linequality = .1;
|
||||
|
||||
void storelineto(vector<GLfloat>& tab, const hyperpoint& h1, const hyperpoint& h2) {
|
||||
void storelineto(vector<glvertex>& tab, const hyperpoint& h1, const hyperpoint& h2) {
|
||||
if(intval(h1, h2) < linequality)
|
||||
storevertex(tab, h2);
|
||||
else {
|
||||
@ -983,7 +983,7 @@ void storelineto(vector<GLfloat>& tab, const hyperpoint& h1, const hyperpoint& h
|
||||
}
|
||||
}
|
||||
|
||||
void storeline(vector<GLfloat>& tab, const hyperpoint& h1, const hyperpoint& h2) {
|
||||
void storeline(vector<glvertex>& tab, const hyperpoint& h1, const hyperpoint& h2) {
|
||||
storevertex(tab, h1);
|
||||
storelineto(tab, h1, h2);
|
||||
}
|
||||
@ -1111,7 +1111,7 @@ void drawVertex(const transmatrix &V, cell *c, shmup::monster *m) {
|
||||
else
|
||||
storeline(ei->prec, T*h1, T*h2);
|
||||
}
|
||||
queuetable(shmup::ggmatrix(ei->orig), &ei->prec[0], size(ei->prec)/3, col, 0,
|
||||
queuetable(shmup::ggmatrix(ei->orig), ei->prec, size(ei->prec), col, 0,
|
||||
PPR_STRUCT0);
|
||||
}
|
||||
}
|
||||
@ -1257,8 +1257,8 @@ void drawExtra() {
|
||||
}
|
||||
}
|
||||
|
||||
void readcolor(const char *cfname) {
|
||||
FILE *f = fopen(cfname, "rt");
|
||||
void readcolor(const string& cfname) {
|
||||
FILE *f = fopen(cfname.c_str(), "rt");
|
||||
if(!f) { printf("color file missing\n"); exit(1); }
|
||||
while(true) {
|
||||
string lab = "";
|
||||
@ -1382,7 +1382,7 @@ void fixparam() {
|
||||
}
|
||||
|
||||
#if CAP_SDL
|
||||
void rvvideo(const char *fname) {
|
||||
void rvvideo(const string &fname) {
|
||||
if(kind == kCollatz) {
|
||||
pngformat = 2;
|
||||
sightrange_bonus = 3;
|
||||
@ -1513,7 +1513,7 @@ struct storydata { int s; int e; const char *text; } story[] = {
|
||||
conformal::movetophase();
|
||||
|
||||
char buf[500];
|
||||
snprintf(buf, 500, fname, i);
|
||||
snprintf(buf, 500, fname.c_str(), i);
|
||||
|
||||
if(i == 0) drawthemap();
|
||||
shmup::turn(100);
|
||||
@ -1526,7 +1526,7 @@ struct storydata { int s; int e; const char *text; } story[] = {
|
||||
}
|
||||
for(int i=0; i<1800; i++) {
|
||||
char buf[500];
|
||||
snprintf(buf, 500, fname, i);
|
||||
snprintf(buf, 500, fname.c_str(), i);
|
||||
shmup::pc[0]->base = currentmap->gamestart();
|
||||
shmup::pc[0]->at = spin(i * 2 * M_PI / (58*30.)) * xpush(1.7);
|
||||
if(i == 0) drawthemap();
|
||||
@ -1546,7 +1546,7 @@ int readArgs() {
|
||||
// options before reading
|
||||
if(0) ;
|
||||
else if(argis("-dftcolor")) {
|
||||
shift(); dftcolor = strtol(args(), NULL, 16);
|
||||
shift(); dftcolor = strtol(args().c_str(), NULL, 16);
|
||||
}
|
||||
|
||||
// tree visualizer (e.g. Tree of Life)
|
||||
@ -1615,7 +1615,7 @@ int readArgs() {
|
||||
else if(argis("-collatz")) {
|
||||
PHASE(3);
|
||||
using namespace collatz;
|
||||
shift(); sscanf(args(), "%lf,%lf,%lf,%lf", &s2, &p2, &s3, &p3);
|
||||
shift(); sscanf(argcs(), "%lf,%lf,%lf,%lf", &s2, &p2, &s3, &p3);
|
||||
start();
|
||||
}
|
||||
|
||||
@ -1623,7 +1623,7 @@ int readArgs() {
|
||||
PHASE(3);
|
||||
ld mul = 2;
|
||||
int N = 1000;
|
||||
shift(); sscanf(args(), LDF ",%d", &mul, &N);
|
||||
shift(); sscanf(argcs(), LDF ",%d", &mul, &N);
|
||||
spiral::place(N, mul);
|
||||
}
|
||||
|
||||
@ -1638,7 +1638,7 @@ int readArgs() {
|
||||
PHASE(3);
|
||||
ld shft = 1;
|
||||
ld mul = 1;
|
||||
shift(); sscanf(args(), LDF "," LDF, &shft, &mul);
|
||||
shift(); sscanf(argcs(), LDF "," LDF, &shft, &mul);
|
||||
spiral::edge(shft, mul);
|
||||
}
|
||||
|
||||
@ -1646,7 +1646,7 @@ int readArgs() {
|
||||
PHASE(3);
|
||||
ld period = 1;
|
||||
ld start = 1;
|
||||
shift(); sscanf(args(), LDF "," LDF, &period, &start);
|
||||
shift(); sscanf(argcs(), LDF "," LDF, &period, &start);
|
||||
start--;
|
||||
shift();
|
||||
spiral::color(start, period, parse(args()));
|
||||
|
Loading…
Reference in New Issue
Block a user