1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-10-31 19:36:16 +00:00

rogueviz::kohonen:: legends

This commit is contained in:
Zeno Rogue 2018-07-05 07:31:27 +02:00
parent 300d0b80ed
commit 223732bbfb
3 changed files with 19 additions and 8 deletions

View File

@ -594,14 +594,16 @@ int showsample(int id) {
return isize(samples_shown) - 1;
}
void showsample(string s) {
if(s == "") return;
int showsample(string s) {
if(s == "") return -1;
int ret = -1;
for(int i=0; i<samples; i++) {
if(s[0] != '*' && data[i].name == s)
showsample(i);
ret = showsample(i);
if(s[0] == '*' && data[i].name.find(s.substr(1)) != string::npos)
showsample(i);
ret = showsample(i);
}
return ret;
}
void showbestsamples() {

View File

@ -1298,8 +1298,17 @@ void readcolor(const string& cfname) {
colorpair x;
int c2 = fgetc(f);
int known_id = -1;
bool force = false;
if(kohonen::samples && c2 == '!') {
force = true;
c2 = fgetc(f);
if(c2 == 10 || c2 == 13) continue;
}
if(kohonen::samples && c2 == '+') {
kohonen::showsample(lab);
known_id = kohonen::showsample(lab);
c2 = fgetc(f);
if(c2 == 10 || c2 == 13) continue;
}
@ -1317,7 +1326,7 @@ void readcolor(const string& cfname) {
x = vdata[getid(lab2)].cp;
}
else if(c2 == '@') {
legend.push_back(getid(lab));
legend.push_back(known_id == -1 ? getid(lab) : known_id);
continue;
}
else if(c2 == '/') {
@ -1341,7 +1350,7 @@ void readcolor(const string& cfname) {
vdata[i].cp = x;
}
}
else if(kohonen::samples) {
else if(kohonen::samples && !force) {
for(int i=0; i<isize(vdata); i++)
if(vdata[i].name == lab) {
vdata[i].cp = x;

View File

@ -77,7 +77,7 @@ namespace rogueviz {
namespace kohonen {
extern int samples;
int showsample(int id);
void showsample(string id);
int showsample(string id);
void describe(cell *c);
void steps();
void showMenu();