mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-25 01:20:37 +00:00
allow setting the resource dir; autoconf should move *.dat file to resource dir
This commit is contained in:
parent
61e249a3af
commit
bf83959b4a
@ -1,9 +1,9 @@
|
|||||||
bin_PROGRAMS = hyperrogue
|
bin_PROGRAMS = hyperrogue
|
||||||
hyperroguedir = $(datadir)/hyperrogue
|
hyperroguedir = $(datadir)/hyperrogue
|
||||||
hyperrogue_SOURCES = hyper.cpp savepng.cpp
|
hyperrogue_SOURCES = hyper.cpp savepng.cpp
|
||||||
hyperrogue_CPPFLAGS = -DFONTDESTDIR=\"$(pkgdatadir)/DejaVuSans-Bold.ttf\" -DMUSICDESTDIR=\"$(pkgdatadir)/hyperrogue-music.txt\" -DSOUNDDESTDIR=\"$(pkgdatadir)/sounds/\"
|
hyperrogue_CPPFLAGS = -DFONTDESTDIR=\"$(pkgdatadir)/DejaVuSans-Bold.ttf\" -DMUSICDESTDIR=\"$(pkgdatadir)/hyperrogue-music.txt\" -DSOUNDDESTDIR=\"$(pkgdatadir)/sounds/\" -DRESOURCEDESTDIR=\"$(pkgdatadir)/\"
|
||||||
hyperrogue_CXXFLAGS = -O2 -std=c++11 ${AM_CXXFLAGS}
|
hyperrogue_CXXFLAGS = -O2 -std=c++11 ${AM_CXXFLAGS}
|
||||||
dist_hyperrogue_DATA = hyperrogue-music.txt DejaVuSans-Bold.ttf
|
dist_hyperrogue_DATA = hyperrogue-music.txt DejaVuSans-Bold.ttf solv-geodesics.dat shyp-geodesics.dat ssol-geodesics.dat honeycomb-435.dat honeycomb-534.dat honeycomb-535.dat
|
||||||
|
|
||||||
# docdir
|
# docdir
|
||||||
dist_doc_DATA = README.md
|
dist_doc_DATA = README.md
|
||||||
|
@ -8,6 +8,14 @@
|
|||||||
#include "hyper.h"
|
#include "hyper.h"
|
||||||
namespace hr {
|
namespace hr {
|
||||||
|
|
||||||
|
#ifdef RESOURCEDESTDIR
|
||||||
|
EX string rsrcdir = RESOURCEDESTDIR;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef RESOURCEDESTDIR
|
||||||
|
EX string rsrcdir = "";
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CAP_COMMANDLINE
|
#if CAP_COMMANDLINE
|
||||||
EX const char *scorefile = "hyperrogue.log";
|
EX const char *scorefile = "hyperrogue.log";
|
||||||
|
|
||||||
@ -142,6 +150,7 @@ int arg::readCommon() {
|
|||||||
// first phase options
|
// first phase options
|
||||||
|
|
||||||
if(argis("-s")) { PHASE(1); shift(); scorefile = argcs(); }
|
if(argis("-s")) { PHASE(1); shift(); scorefile = argcs(); }
|
||||||
|
else if(argis("-rsrc")) { PHASE(1); shift(); rsrcdir = args(); }
|
||||||
else if(argis("-nogui")) { PHASE(1); noGUI = true; }
|
else if(argis("-nogui")) { PHASE(1); noGUI = true; }
|
||||||
#ifndef EMSCRIPTEN
|
#ifndef EMSCRIPTEN
|
||||||
else if(argis("-font")) { PHASE(1); shift(); fontpath = args(); }
|
else if(argis("-font")) { PHASE(1); shift(); fontpath = args(); }
|
||||||
|
@ -85,7 +85,7 @@ EX namespace sn {
|
|||||||
void tabled_inverses::load() {
|
void tabled_inverses::load() {
|
||||||
if(loaded) return;
|
if(loaded) return;
|
||||||
FILE *f = fopen(fname.c_str(), "rb");
|
FILE *f = fopen(fname.c_str(), "rb");
|
||||||
// if(!f) f = fopen("/usr/lib/soltable.dat", "rb");
|
if(!f) f = fopen((rsrcdir + fname).c_str(), "rb");
|
||||||
if(!f) { addMessage(XLAT("geodesic table missing")); pmodel = mdPerspective; return; }
|
if(!f) { addMessage(XLAT("geodesic table missing")); pmodel = mdPerspective; return; }
|
||||||
ignore(fread(&PRECX, 4, 1, f));
|
ignore(fread(&PRECX, 4, 1, f));
|
||||||
ignore(fread(&PRECY, 4, 1, f));
|
ignore(fread(&PRECY, 4, 1, f));
|
||||||
|
1
reg3.cpp
1
reg3.cpp
@ -911,6 +911,7 @@ EX namespace reg3 {
|
|||||||
|
|
||||||
void load_ruleset(string fname) {
|
void load_ruleset(string fname) {
|
||||||
FILE *f = fopen(fname.c_str(), "rb");
|
FILE *f = fopen(fname.c_str(), "rb");
|
||||||
|
if(!f) f = fopen((rsrcdir + fname).c_str(), "rb");
|
||||||
string buf;
|
string buf;
|
||||||
buf.resize(1000000);
|
buf.resize(1000000);
|
||||||
int qty = fread(&buf[0], 1, 1000000, f);
|
int qty = fread(&buf[0], 1, 1000000, f);
|
||||||
|
Loading…
Reference in New Issue
Block a user