1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-01-26 00:47:00 +00:00

fixed read_model() which was crashing

This commit is contained in:
Zeno Rogue 2019-10-06 12:11:01 +02:00
parent d11b768bf1
commit 528cf9867a
3 changed files with 4 additions and 4 deletions

View File

@ -600,7 +600,7 @@ vector<geometryinfo> ginf = {
#define X3(x) x, x, x #define X3(x) x, x, x
/** list of available models (i.e., projections) */ /** list of available models (i.e., projections) */
const modelinfo mdinf[int(mdPolynomial)+1] = { vector<modelinfo> mdinf = {
{"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal}, {"disk/Gans", "general perspective", "general perspective", mf::azimuthal | mf::conformal},
{"half-plane", "inversion", "half-plane", mf::conformal}, {"half-plane", "inversion", "half-plane", mf::conformal},
{"band", "band", "Mercator", mf::band | mf::conformal}, {"band", "band", "Mercator", mf::band | mf::conformal},
@ -629,7 +629,7 @@ const modelinfo mdinf[int(mdPolynomial)+1] = {
{X3("Mollweide"), mf::euc_boring | mf::pseudoband | mf::equiarea }, {X3("Mollweide"), mf::euc_boring | mf::pseudoband | mf::equiarea },
{X3("central cylindrical"), mf::euc_boring | mf::band }, {X3("central cylindrical"), mf::euc_boring | mf::band },
{X3("Collignon"), mf::pseudoband | mf::equiarea }, {X3("Collignon"), mf::pseudoband | mf::equiarea },
{X3(""), 0}, {X3("guard"), 0},
{X3("polynomial"), mf::conformal} {X3("polynomial"), mf::conformal}
}; };

View File

@ -350,6 +350,6 @@ struct modelinfo {
const char* name; const char* name;
}; };
extern const modelinfo mdinf[int(mdPolynomial)+1]; extern std::vector<modelinfo> mdinf;
} }

View File

@ -658,7 +658,7 @@ EX namespace models {
#if CAP_COMMANDLINE #if CAP_COMMANDLINE
eModel read_model(const string& ss) { eModel read_model(const string& ss) {
for(int i=0; i<isize(ginf); i++) { for(int i=0; i<isize(mdinf); i++) {
if(appears(mdinf[i].name_hyperbolic, ss)) return eModel(i); if(appears(mdinf[i].name_hyperbolic, ss)) return eModel(i);
if(appears(mdinf[i].name_euclidean, ss)) return eModel(i); if(appears(mdinf[i].name_euclidean, ss)) return eModel(i);
if(appears(mdinf[i].name_spherical, ss)) return eModel(i); if(appears(mdinf[i].name_spherical, ss)) return eModel(i);