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,12 +1585,29 @@ 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 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}; 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 if(event.key.code == kb::Escape) {
&& (overall_mode != MODE_TALKING) && (overall_mode != MODE_SHOPPING)) { bool abort=true;
mini_map.setVisible(false); if (overall_mode == MODE_TALK_TOWN || overall_mode == MODE_LOOK_TOWN)
map_visible = false; overall_mode = MODE_TOWN;
mainPtr.setActive(); else if(overall_mode == MODE_LOOK_OUTDOORS)
return false; 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) if(overall_mode == MODE_STARTUP)

View File

@@ -750,11 +750,6 @@ void place_treasure(location where,short level,short loot,short mode) {
{100,90,80,70,0,0}, {100,90,80,70,0,0},
{100,80,80,75,75,75} {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] = { static const short max_mult[5][10] = {
{0,0,0,0,0,0,0,0,0,1}, {0,0,0,0,0,0,0,0,0,1},
{0,0,1,1,1,1,2,3,5,20}, {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; new_item.variety = eItemType::NO_ITEM;
if(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++) for(short i = 0; i < 6; i++)
if((univ.party[i].main_status == eMainStatus::ALIVE) 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; new_item.ident = true;
place_item(new_item,where); place_item(new_item,where);
} }

View File

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