-
Notifications
You must be signed in to change notification settings - Fork 113
Add nle_settings to nledl interface, don't use environment variables #291
Conversation
Testing this has revealed a longstanding issue via test_system.py when run in debug mode.
And while we are at it, let's not actually write to disk for this one either. This allows us to remove _set_env_vars() from nethack.py.
c9b7e63
to
dab0d23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice feature! Looks neat.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
generally lgtm and a good change; just one question on off by ones, and one comment on putting many options in one spot (ie TERM to the options struct, and simplifying get env function - so if future we only set options in one location.)
*/ | ||
char hackdir[4096]; | ||
char options[32768]; | ||
char wizkit[4096]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need TERM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just saw that below we always set to "ansi" in get env. is it worth including it here instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We kind of require "ansi" as the value ever since dropping the dependency on ncurses, so any other user-supplied value would break it I think.
: dlpath_(std::move(dlpath)), obs_{}, spawn_monsters_(spawn_monsters) | ||
{ | ||
if (hackdir.size() > sizeof(settings_.hackdir) - 1) { | ||
throw std::length_error("hackdir too long"); | ||
} | ||
if (nethackoptions.size() > sizeof(settings_.options)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is one of these off by one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question. The reason for the difference is that in nle.c we need to add a /
at the end. This is perhaps a bit unclean, but reflects what NetHack itself does in a comparable situation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But that /
only needs to be added to HACKDIR.
void | ||
set_wizkit(std::string wizkit) | ||
{ | ||
if (wizkit.size() > sizeof(settings_.wizkit)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same viz sizes
This also gets rid of the need to write a file for WIZKIT.
Fixes the race condition in #287