From b7aae63b90e401dde202df2a65c19d3284991f4d Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 13 Nov 2022 13:39:28 +0100 Subject: [PATCH] rogueviz:: remove visible_from_help, it just displays a list --- rogueviz/rogueviz.cpp | 45 +++++++++++++++++++++++-------------------- rogueviz/rogueviz.h | 1 - rogueviz/sag.cpp | 12 +++++------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/rogueviz/rogueviz.cpp b/rogueviz/rogueviz.cpp index 14bf54f5..c6cab2bf 100644 --- a/rogueviz/rogueviz.cpp +++ b/rogueviz/rogueviz.cpp @@ -28,12 +28,14 @@ ld ggamma = 1; using namespace hr; -edgetype default_edgetype = { .1, .1, .1, DEFAULT_COLOR, 0xFF0000FF, "default" }; +edgetype default_edgetype = { .1, .1, DEFAULT_COLOR, 0xFF0000FF, "default" }; bool showlabels = false; bool specialmark = false; bool edge_legend = false; +int max_edges_help = 1000; + bool rog3 = false; int vertex_shape = 1; @@ -295,43 +297,44 @@ void rogueviz_help(int id, int pagenumber) { sort(alledges.begin(), alledges.end(), edgecmp); - for(int i=0; i<10 && i+pagenumber < noedges; i++) { - help_extension hex; - hex.key = 'a' + i; + int qty = 0; + + for(auto ei: alledges) { + help_extension hex; + hex.key = dialog::list_fake_key++; - edgeinfo *ei = alledges[pagenumber + i]; - if(ei->weight < ei->type->visible_from_help) continue; int k = ei->i ^ ei->j ^ id; hex.text = vdata[k].name; hex.color = vdata[k].cp.color1 >> 8; if(vizflags & RV_WHICHWEIGHT) { - if(which_weight) - hex.subtext = fts(ei->weight2); - else - hex.subtext = fts(ei->weight); + ld w = which_weight ? ei->weight2 : ei->weight; + if(vizflags & RV_INVERSE_WEIGHT) w = 1 / w; + hex.subtext = fts(w); } hex.action = [k] () { help_extensions.clear(); rogueviz_help(k, 0); }; help_extensions.push_back(hex); + + qty++; if(qty > max_edges_help) break; } - if(noedges > pagenumber + 10) { - help_extension hex; - hex.key = 'z'; - hex.text = "next page"; - hex.subtext = its(pagenumber+10) + "/" + its(noedges) + " edges"; - hex.action = [id, pagenumber] () { help_extensions.clear(); rogueviz_help(id, pagenumber + 10); }; - help_extensions.push_back(hex); - } - if((vizflags & RV_WHICHWEIGHT) && noedges) { help_extension hex; - hex.key = 'w'; + hex.key = '1'; hex.text = "displayed weight"; - hex.subtext = which_weight ? "attraction force" : "weight from the data"; + bool inv = vizflags & RV_INVERSE_WEIGHT; + hex.subtext = which_weight ? (inv ? "distance requested" : "attraction force") : (inv ? "inverse value from data" : "weight from the data"); hex.action = [id, pagenumber] () { which_weight = !which_weight; help_extensions.clear(); rogueviz_help(id, pagenumber); }; help_extensions.push_back(hex); } + + if(true) { + help_extension hex; + hex.key = '2'; + hex.text = "find this"; + hex.action = [id] () { search_for = id; popScreen(); }; + help_extensions.push_back(hex); + } } bool describe_monster(shmup::monster *m, string& out) { diff --git a/rogueviz/rogueviz.h b/rogueviz/rogueviz.h index 95968438..b7d809e0 100644 --- a/rogueviz/rogueviz.h +++ b/rogueviz/rogueviz.h @@ -44,7 +44,6 @@ namespace rogueviz { struct edgetype { double visible_from; double visible_from_hi; - double visible_from_help; unsigned color, color_hi; string name; }; diff --git a/rogueviz/sag.cpp b/rogueviz/sag.cpp index 38acda7e..09b353c9 100644 --- a/rogueviz/sag.cpp +++ b/rogueviz/sag.cpp @@ -1163,12 +1163,13 @@ int readArgs() { if(0) ; else if(argis("-sagmin")) { - shift_arg_formula(default_edgetype.visible_from); - default_edgetype.visible_from_hi = default_edgetype.visible_from; - default_edgetype.visible_from_help = default_edgetype.visible_from; + auto& ed = sag_edge ? *sag_edge : default_edgetype; + shift_arg_formula(ed.visible_from); + ed.visible_from_hi = ed.visible_from; } else if(argis("-sagminhi")) { - shift_arg_formula(default_edgetype.visible_from_hi); + auto& ed = sag_edge ? *sag_edge : default_edgetype; + shift_arg_formula(ed.visible_from_hi); } else if(argis("-sag_gdist")) { shift(); sag::gdist_prec = argi(); @@ -1213,9 +1214,6 @@ int readArgs() { if(method == smMatch) prepare_graph(); } - else if(argis("-sagminhelp")) { - shift_arg_formula(default_edgetype.visible_from_help); - } else if(argis("-sagformat")) { shift(); informat = argi(); }