This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <mutex> | |
template<typename T,typename M=std::mutex> | |
struct protected_variable | |
{ | |
T data; | |
M data_mutex; | |
template <typename F> | |
void with(F f){ | |
std::lock_guard<M> lock(data_mutex); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var LITHUANIAN = { | |
keyword: { | |
table: 'lentelė', | |
figure: 'paveikslėlis', | |
listing: 'sąrašas', | |
diagram: 'diagrama', | |
contents: 'Turinys', | |
sec: 'sk', | |
section: 'skyrius', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Log file created at: 2017/09/01 16:47:21 | |
Running on machine: DESKTOP-P4285VI | |
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg | |
@ 00007FFCFEC97799 principia__RenderedVesselTrajectory [0x00007FFCFEC97798+218356] | |
@ 00007FFCFEC0735F principia__FlightPlanRemoveLast [0x00007FFCFEC0735E+571018] | |
@ 00007FFCFEC254EB principia__FlightPlanRemoveLast [0x00007FFCFEC254EA+694294] | |
@ 00007FFCFEB0AEE8 principia__IteratorAtEnd [0x00007FFCFEB0AEE7+20463] | |
@ 00007FFCFEB2C620 principia__FreeVesselsAndPartsAndCollectPileUps [0x00007FFCFEB2C61F+107] | |
@ 000000002CFA1A4C (No symbol) [0x000000002CFA1A4B] | |
F0901 16:47:21.103809 6832 vessel.cpp:127] Check failed: !parts_.empty() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename T,long N> | |
constexpr long countof(T(&)[N]){return N;} | |
//TODO: add this -http://stackoverflow.com/a/24881903 | |
//TODO: file embedding lib | |
/* | |
void GetResourceAsString(int nResourceID, CStringA &strResourceString) | |
{ | |
HRSRC hResource = FindResource(NULL, MAKEINTRESOURCE(nResourceID), L"DATA"); | |
HGLOBAL hResHandle = LoadResource(NULL, hResource); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef VIRIDIS_HPP_INCLUDED | |
#define VIRIDIS_HPP_INCLUDED | |
void map_to_viridis(float v, uint8_t& r, uint8_t& g, uint8_t& b); | |
#endif | |
#ifdef VIRIDIS_IMPLEMENTATION | |
const double viridis_map[] = { | |
0.26700401, 0.00487433, 0.32941519, | |
0.26851048, 0.00960483, 0.33542652, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function set_histfig_material(item,base_material,figure_id) | |
local figure_base=219 | |
local creature_base=19 | |
item:setMaterial(figure_base+base_material-creature_base) | |
item:setMaterialIndex(figure_id) | |
end | |
function reaction_imbue(reaction,reaction_product,unit,input_items,input_reagents,output_items,call_native) | |
--printall(input_items[1]) | |
local mat_source=input_items[1] | |
local mat=mat_source:getActualMaterial() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- this requires a plugin that draws the map: https://github.com/warmist/dfhack/tree/twbt_experiments | |
--[[ | |
Ideas for future: | |
microtransactions (for rooms and stuff :D) jkjk | |
assignment to locations (e.g. performance etc) | |
see if idle location can be used for direct dwarf control | |
more info about dwarf | |
possesions (with a way to add/remove them) | |
rooms | |
artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local args={...} | |
flags=flags or {} | |
local ann=df.global.announcements.flags | |
if args[1]=='-s' then | |
print('saving') | |
for k,v in pairs(ann) do | |
flags[k]=copyall(v) | |
end | |
elseif args[1]=='-r' then | |
print('restoring') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
//source: https://github.com/WG21-SG14/SG14/blob/master/SG14/inplace_function.h | |
#include <type_traits> | |
#include <functional> | |
namespace stdext | |
{ | |
constexpr size_t InplaceFunctionDefaultCapacity = 32; | |
constexpr size_t InplaceFunctionDefaultAlignment = 16; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local args={...} | |
local site | |
for k,v in ipairs(df.global.world.world_data.sites) do | |
if dfhack.TranslateName(v.name)==args[1] then | |
site=v | |
end | |
end | |
if site==nil then |