boe.actions.cpp: allow escaping the first phase of look/talking mode

+ correction of minor details...
This commit is contained in:
ALONSO Laurent
2021-10-02 13:12:39 +02:00
committed by Celtic Minstrel
parent 7ae29eeea3
commit d8ab170111
3 changed files with 31 additions and 14 deletions

View File

@@ -1585,13 +1585,30 @@ bool handle_keystroke(const sf::Event& event){
Key talk_chars[9] = {kb::L,kb::N,kb::J,kb::B,kb::S,kb::R,kb::D,kb::G,kb::A};
Key shop_chars[8] = {kb::A,kb::B,kb::C,kb::D,kb::E,kb::F,kb::G,kb::H};
if(map_visible && event.key.code == kb::Escape
&& (overall_mode != MODE_TALKING) && (overall_mode != MODE_SHOPPING)) {
if(event.key.code == kb::Escape) {
bool abort=true;
if (overall_mode == MODE_TALK_TOWN || overall_mode == MODE_LOOK_TOWN)
overall_mode = MODE_TOWN;
else if(overall_mode == MODE_LOOK_OUTDOORS)
overall_mode = MODE_OUTDOORS;
else if (overall_mode == MODE_LOOK_COMBAT)
overall_mode = MODE_COMBAT;
else
abort = false;
if (abort) {
play_sound(37);
add_string_to_buf("Aborted.");
print_buf();
obscureCursor();
return false;
}
if(map_visible && (overall_mode != MODE_TALKING) && (overall_mode != MODE_SHOPPING)) {
mini_map.setVisible(false);
map_visible = false;
mainPtr.setActive();
return false;
}
}
if(overall_mode == MODE_STARTUP)
return false;

View File

@@ -750,11 +750,6 @@ void place_treasure(location where,short level,short loot,short mode) {
{100,90,80,70,0,0},
{100,80,80,75,75,75}
};
static const short id_odds[21] = {
0,10,15,20,25,30,35,
39,43,47,51,55,59,63,
67,71,73,75,77,79,81
};
static const short max_mult[5][10] = {
{0,0,0,0,0,0,0,0,0,1},
{0,0,1,1,1,1,2,3,5,20},
@@ -838,9 +833,14 @@ void place_treasure(location where,short level,short loot,short mode) {
new_item.variety = eItemType::NO_ITEM;
if(new_item.variety != eItemType::NO_ITEM) {
static const short id_odds[21] = {
0,10,15,20,25,30,35,
39,43,47,51,55,59,63,
67,71,73,75,77,79,81
};
for(short i = 0; i < 6; i++)
if((univ.party[i].main_status == eMainStatus::ALIVE)
&& get_ran(1,1,100) < id_odds[univ.party[i].skill(eSkill::ITEM_LORE)])
&& get_ran(1,1,100) <= id_odds[univ.party[i].skill(eSkill::ITEM_LORE)])
new_item.ident = true;
place_item(new_item,where);
}

View File

@@ -79,7 +79,7 @@ std::string get_os_version() {
NSProcessInfo* info = [NSProcessInfo processInfo];
std::ostringstream os;
os << "Apple Mac OS X ";
os << [[info operatingSystemVersionString] cStringUsingEncoding:NSASCIIStringEncoding];
os << [[info operatingSystemVersionString] UTF8String];
return os.str();
}
@@ -148,9 +148,9 @@ void set_clipboard_img(sf::Image& img) {
std::copy(img.getPixelsPtr(), img.getPixelsPtr() + data_sz, [bmp bitmapData]);
NSImage * image = [[NSImage alloc] initWithSize: NSMakeSize(sz.x, sz.y)];
[image addRepresentation: bmp];
[bmp release];
NSArray* contents = [NSArray arrayWithObject: image];
[image release];
[bmp release];
NSPasteboard* pb = [NSPasteboard generalPasteboard];
[pb clearContents];
[pb writeObjects: contents];