Skip to content

Commit c080015

Browse files
authored
Merge branch 'develop' into refactor/hotkey_module
2 parents 0e341b7 + 7f6f80c commit c080015

6 files changed

Lines changed: 25 additions & 11 deletions

File tree

docs/changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Template for new versions:
6161
## Fixes
6262

6363
## Misc Improvements
64+
- `createitem`: created items can now be placed onto/into tables, nests, bookcases, display cases, and altars
6465
- `keybinding`: keybinds may now include the super key, and are no longer limited to particular keys ranges of keys, allowing any recognized by SDL.
6566
- The ``fpause`` console command can now be used to force world generation to pause (as it did prior to version 50).
6667

library/Crashlog.cpp

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "DFHackVersion.h"
2+
23
#include <csignal>
34
#include <iomanip>
45
#include <filesystem>
@@ -42,7 +43,8 @@ void signal_crashlog_complete() {
4243

4344
std::thread crashlog_thread;
4445

45-
extern "C" void dfhack_crashlog_handle_signal(int sig) {
46+
// Force this method to be inlined so that it doesn't create a stack frame
47+
[[gnu::always_inline]] inline void handle_signal_internal(int sig) {
4648
if (shutdown.load() || crashed.exchange(true) || crashlog_ready.load()) {
4749
// Ensure the signal handler doesn't try to write a crashlog
4850
// whilst the crashlog thread is unavailable.
@@ -61,8 +63,12 @@ extern "C" void dfhack_crashlog_handle_signal(int sig) {
6163
std::quick_exit(1);
6264
}
6365

66+
extern "C" void dfhack_crashlog_handle_signal(int sig) {
67+
handle_signal_internal(sig);
68+
}
69+
6470
void dfhack_crashlog_handle_terminate() {
65-
dfhack_crashlog_handle_signal(0);
71+
handle_signal_internal(0);
6672
}
6773

6874
std::string signal_name(int sig) {
@@ -105,10 +111,6 @@ std::filesystem::path get_crashlog_path() {
105111

106112
void dfhack_save_crashlog() {
107113
char** backtrace_strings = backtrace_symbols(crash_info.backtrace, crash_info.backtrace_entries);
108-
if (!backtrace_strings) {
109-
// Allocation failed, give up
110-
return;
111-
}
112114
try {
113115
std::filesystem::path crashlog_path = get_crashlog_path();
114116
std::ofstream crashlog(crashlog_path);
@@ -122,8 +124,14 @@ void dfhack_save_crashlog() {
122124
crashlog << "Signal " << signal << "\n";
123125
}
124126

125-
for (int i = 0; i < crash_info.backtrace_entries; i++) {
126-
crashlog << i << "> " << backtrace_strings[i] << "\n";
127+
if (crash_info.backtrace_entries >= 2 && backtrace_strings != nullptr) {
128+
// Skip the first backtrace entry as it will always be dfhack_crashlog_handle_(signal|terminate)
129+
for (int i = 1; i < crash_info.backtrace_entries; i++) {
130+
crashlog << i - 1 << "> " << backtrace_strings[i] << "\n";
131+
}
132+
} else {
133+
// Make it clear if no relevant backtrace was able to be obtained
134+
crashlog << "Failed to obtain relevant backtrace\n";
127135
}
128136
} catch (...) {}
129137

library/xml

plugins/createitem.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ command_result df_createitem (color_ostream &out, vector<string> &parameters) {
280280
}
281281
switch (building->getType())
282282
{ using namespace df::enums::building_type;
283+
case Table:
283284
case Coffin:
284285
case Furnace:
285286
case TradeDepot:
@@ -294,8 +295,12 @@ command_result df_createitem (color_ostream &out, vector<string> &parameters) {
294295
case AnimalTrap:
295296
case Cage:
296297
case Wagon:
298+
case Nest:
297299
case NestBox:
298300
case Hive:
301+
case Bookcase:
302+
case DisplayFurniture:
303+
case OfferingPlace:
299304
break;
300305
default:
301306
out.printerr("The selected building cannot be used for item storage!\n");

plugins/stonesense

scripts

0 commit comments

Comments
 (0)