Skip to content

Instantly share code, notes, and snippets.

💭
Making a game or sth

Warmist warmist

💭
Making a game or sth
Block or report user

Report or block warmist

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@warmist
warmist / thign.hpp
Created Aug 7, 2018
threading experiment
View thign.hpp
#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);
@warmist
warmist / find_twbt.lua
Last active Oct 12, 2018
Find render_map offset for twbt
View find_twbt.lua
local ms=require('memscan')
local cs=ms.get_code_segment()
function get_ptr_size( )
local v=df.new('uintptr_t')
local ret=df.sizeof(v)
df.delete(v)
return ret
end
@warmist
warmist / lt_markdeep.js
Last active Apr 25, 2018
Lt language for markdeep
View lt_markdeep.js
var LITHUANIAN = {
keyword: {
table: 'lentelė',
figure: 'paveikslėlis',
listing: 'sąrašas',
diagram: 'diagrama',
contents: 'Turinys',
sec: 'sk',
section: 'skyrius',
View FATAL.20170901-164721.1716
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()
View imbue.lua
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()
View no-pause.lua
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')
@warmist
warmist / http.lua
Last active Dec 13, 2016
Work in progress
View http.lua
-- 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
View Function.hpp
#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;
@warmist
warmist / my_lib.hpp
Last active Aug 2, 2017
Misc cpp functions
View my_lib.hpp
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);
View viridis.h
#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,
You can’t perform that action at this time.