mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-10-21 00:47:40 +00:00
parser:: error handling now uses exceptions
This commit is contained in:
25
dialogs.cpp
25
dialogs.cpp
@@ -743,17 +743,20 @@ EX namespace dialog {
|
||||
}
|
||||
|
||||
EX void apply_edit() {
|
||||
exp_parser ep;
|
||||
ep.s = ne.s;
|
||||
ld x = real(ep.parse());
|
||||
if(!ep.ok()) return;
|
||||
if(ne.sc.positive && x <= 0) return;
|
||||
*ne.editwhat = x;
|
||||
if(ne.intval) *ne.intval = ldtoint(*ne.editwhat);
|
||||
#if CAP_ANIMATIONS
|
||||
if(ne.animatable) anims::animate_parameter(*ne.editwhat, ne.s, reaction ? reaction : reaction_final);
|
||||
#endif
|
||||
if(reaction) reaction();
|
||||
try {
|
||||
exp_parser ep;
|
||||
ep.s = ne.s;
|
||||
ld x = ep.rparse();
|
||||
if(ne.sc.positive && x <= 0) return;
|
||||
*ne.editwhat = x;
|
||||
if(ne.intval) *ne.intval = ldtoint(*ne.editwhat);
|
||||
#if CAP_ANIMATIONS
|
||||
if(ne.animatable) anims::animate_parameter(*ne.editwhat, ne.s, reaction ? reaction : reaction_final);
|
||||
#endif
|
||||
if(reaction) reaction();
|
||||
}
|
||||
catch(hr_parse_exception&) {
|
||||
}
|
||||
}
|
||||
|
||||
EX void bound_low(ld val) {
|
||||
|
Reference in New Issue
Block a user