mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-24 17:10:36 +00:00
orbinfos is a vector now
This commit is contained in:
parent
97c546db64
commit
c56287ae38
6
help.cpp
6
help.cpp
@ -375,15 +375,13 @@ string generateHelpForItem(eItem it) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(itemclass(it) == IC_ORB || it == itGreenStone || it == itOrbYendor) {
|
if(itemclass(it) == IC_ORB || it == itGreenStone || it == itOrbYendor) {
|
||||||
for(int i=0; i<ORBLINES; i++) {
|
for(auto& oi: orbinfos) {
|
||||||
const orbinfo& oi(orbinfos[i]);
|
|
||||||
if(oi.orb == it && oi.is_native()) describeOrb(help, oi);
|
if(oi.orb == it && oi.is_native()) describeOrb(help, oi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(itemclass(it) == IC_TREASURE) {
|
if(itemclass(it) == IC_TREASURE) {
|
||||||
for(int i=0; i<ORBLINES; i++) {
|
for(auto& oi: orbinfos) {
|
||||||
const orbinfo& oi(orbinfos[i]);
|
|
||||||
if(treasureType(oi.l) == it) {
|
if(treasureType(oi.l) == it) {
|
||||||
if(oi.gchance > 0) {
|
if(oi.gchance > 0) {
|
||||||
help += XLAT("\n\nOrb unlocked: %1", oi.orb);
|
help += XLAT("\n\nOrb unlocked: %1", oi.orb);
|
||||||
|
@ -214,8 +214,7 @@ namespace hr { namespace inv {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void gainGuestOrbs() {
|
void gainGuestOrbs() {
|
||||||
for(int k=0; k<ORBLINES; k++) {
|
for(auto& oi: orbinfos) {
|
||||||
auto& oi = orbinfos[k];
|
|
||||||
if(oi.flags & orbgenflags::OSM_AT10) {
|
if(oi.flags & orbgenflags::OSM_AT10) {
|
||||||
eItem it = treasureType(oi.l);
|
eItem it = treasureType(oi.l);
|
||||||
if(items[it] >= 10) {
|
if(items[it] >= 10) {
|
||||||
|
28
orbgen.cpp
28
orbgen.cpp
@ -1,8 +1,6 @@
|
|||||||
// Hyperbolic Rogue -- orb generation routines
|
// Hyperbolic Rogue -- orb generation routines
|
||||||
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
|
// Copyright (C) 2011-2018 Zeno Rogue, see 'hyper.cpp' for details
|
||||||
|
|
||||||
#define ORBLINES 70
|
|
||||||
|
|
||||||
namespace hr {
|
namespace hr {
|
||||||
// orbgen flags
|
// orbgen flags
|
||||||
|
|
||||||
@ -49,7 +47,7 @@ struct orbinfo {
|
|||||||
bool is_native() const { using namespace orbgenflags; return flags & NATIVE; }
|
bool is_native() const { using namespace orbgenflags; return flags & NATIVE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
const orbinfo orbinfos[ORBLINES] = {
|
const vector<orbinfo> orbinfos = {
|
||||||
{orbgenflags::S_NATIVE, laGraveyard, 200, 200,itGreenStone}, // must be first so that it does not reduce
|
{orbgenflags::S_NATIVE, laGraveyard, 200, 200,itGreenStone}, // must be first so that it does not reduce
|
||||||
{orbgenflags::S_NATIVE, laJungle, 1200, 1500,itOrbLightning},
|
{orbgenflags::S_NATIVE, laJungle, 1200, 1500,itOrbLightning},
|
||||||
{orbgenflags::S_NATIVE, laIce, 2000, 1500,itOrbFlash},
|
{orbgenflags::S_NATIVE, laIce, 2000, 1500,itOrbFlash},
|
||||||
@ -127,16 +125,16 @@ eItem nativeOrbType(eLand l) {
|
|||||||
if(inv::on && (l == laMirror || l == laMirrorOld || isCrossroads(l)))
|
if(inv::on && (l == laMirror || l == laMirrorOld || isCrossroads(l)))
|
||||||
return itOrbMirror;
|
return itOrbMirror;
|
||||||
if(l == laMirror || l == laMirrorOld) return itShard;
|
if(l == laMirror || l == laMirrorOld) return itShard;
|
||||||
for(int i=0; i<ORBLINES; i++)
|
for(auto& oi: orbinfos)
|
||||||
if(orbinfos[i].l == l && orbinfos[i].is_native())
|
if(oi.l == l && oi.is_native())
|
||||||
return orbinfos[i].orb;
|
return oi.orb;
|
||||||
return itNone;
|
return itNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
const orbinfo& getNativityOrbInfo(eItem orb) {
|
const orbinfo& getNativityOrbInfo(eItem orb) {
|
||||||
for(int i=0; i<ORBLINES; i++)
|
for(auto& oi: orbinfos)
|
||||||
if(orbinfos[i].orb == orb && orbinfos[i].is_native())
|
if(oi.orb == orb && oi.is_native())
|
||||||
return orbinfos[i];
|
return oi;
|
||||||
static orbinfo oi;
|
static orbinfo oi;
|
||||||
oi.l = laMirror;
|
oi.l = laMirror;
|
||||||
return oi;
|
return oi;
|
||||||
@ -398,8 +396,7 @@ void placePrizeOrb(cell *c) {
|
|||||||
if(l == laMinefield && hrand(100) >= 25) return;
|
if(l == laMinefield && hrand(100) >= 25) return;
|
||||||
if(l == laElementalWall && hrand(100) >= 25) return;
|
if(l == laElementalWall && hrand(100) >= 25) return;
|
||||||
|
|
||||||
for(int i=0; i<ORBLINES; i++) {
|
for(auto& oi: orbinfos) {
|
||||||
const orbinfo& oi(orbinfos[i]);
|
|
||||||
if(!(oi.flags & orbgenflags::GLOBAL25)) continue;
|
if(!(oi.flags & orbgenflags::GLOBAL25)) continue;
|
||||||
|
|
||||||
int mintreas = 25;
|
int mintreas = 25;
|
||||||
@ -446,8 +443,7 @@ void placeLocalOrbs(cell *c) {
|
|||||||
if(peace::on) return;
|
if(peace::on) return;
|
||||||
if(daily::on) return;
|
if(daily::on) return;
|
||||||
|
|
||||||
for(int i=0; i<ORBLINES; i++) {
|
for(auto& oi: orbinfos) {
|
||||||
const orbinfo& oi(orbinfos[i]);
|
|
||||||
if(!(oi.flags & orbgenflags::LOCAL10)) continue;
|
if(!(oi.flags & orbgenflags::LOCAL10)) continue;
|
||||||
if(oi.l != l) continue;
|
if(oi.l != l) continue;
|
||||||
if(yendor::on && (oi.orb == itOrbSafety || oi.orb == itOrbYendor))
|
if(yendor::on && (oi.orb == itOrbSafety || oi.orb == itOrbYendor))
|
||||||
@ -490,8 +486,7 @@ void placeLocalSpecial(cell *c, int outof, int loc=1, int priz=1) {
|
|||||||
void placeCrossroadOrbs(cell *c) {
|
void placeCrossroadOrbs(cell *c) {
|
||||||
if(peace::on) return;
|
if(peace::on) return;
|
||||||
if(daily::on) return;
|
if(daily::on) return;
|
||||||
for(int i=0; i<ORBLINES; i++) {
|
for(auto& oi: orbinfos) {
|
||||||
const orbinfo& oi(orbinfos[i]);
|
|
||||||
if(!(oi.flags & orbgenflags::CROSS10)) continue;
|
if(!(oi.flags & orbgenflags::CROSS10)) continue;
|
||||||
if(!oi.gchance) continue;
|
if(!oi.gchance) continue;
|
||||||
|
|
||||||
@ -526,8 +521,7 @@ void placeCrossroadOrbs(cell *c) {
|
|||||||
|
|
||||||
void placeOceanOrbs(cell *c) {
|
void placeOceanOrbs(cell *c) {
|
||||||
if(peace::on) return;
|
if(peace::on) return;
|
||||||
for(int i=0; i<ORBLINES; i++) {
|
for(auto& oi: orbinfos) {
|
||||||
const orbinfo& oi(orbinfos[i]);
|
|
||||||
if(!(oi.flags & orbgenflags::CROSS10)) continue;
|
if(!(oi.flags & orbgenflags::CROSS10)) continue;
|
||||||
|
|
||||||
int treas = items[treasureType(oi.l)] * landMultiplier(oi.l);
|
int treas = items[treasureType(oi.l)] * landMultiplier(oi.l);
|
||||||
|
Loading…
Reference in New Issue
Block a user