Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c80fbbc

Browse files
committed
Remove AS prefixes from add-spatter.cpp
The actual cause of this crash was fixed in #558 See #205
1 parent 962df78 commit c80fbbc

2 files changed

Lines changed: 21 additions & 21 deletions

File tree

library/PlugLoad-posix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace DFHack
2626
DFLibrary * OpenPlugin (const char * filename)
2727
{
2828
dlerror();
29-
DFLibrary * ret = (DFLibrary *) dlopen(filename, RTLD_NOW);
29+
DFLibrary * ret = (DFLibrary *) dlopen(filename, RTLD_NOW | RTLD_LOCAL);
3030
if(!ret)
3131
{
3232
std::cerr << dlerror() << std::endl;

plugins/add-spatter.cpp

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,44 +49,44 @@ REQUIRE_GLOBAL(ui);
4949

5050
typedef df::reaction_product_item_improvementst improvement_product;
5151

52-
struct ASReagentSource {
52+
struct ReagentSource {
5353
int idx;
5454
df::reaction_reagent *reagent;
5555

56-
ASReagentSource() : idx(-1), reagent(NULL) {}
56+
ReagentSource() : idx(-1), reagent(NULL) {}
5757
};
5858

59-
struct ASMaterialSource : ASReagentSource {
59+
struct MaterialSource : ReagentSource {
6060
bool product;
6161
std::string product_name;
6262

6363
int mat_type, mat_index;
6464

65-
ASMaterialSource() : product(false), mat_type(-1), mat_index(-1) {}
65+
MaterialSource() : product(false), mat_type(-1), mat_index(-1) {}
6666
};
6767

68-
struct ASProductInfo {
68+
struct ProductInfo {
6969
df::reaction *react;
7070
improvement_product *product;
7171

72-
ASReagentSource object;
73-
ASMaterialSource material;
72+
ReagentSource object;
73+
MaterialSource material;
7474

7575
bool isValid() {
7676
return object.reagent && (material.mat_type >= 0 || material.reagent);
7777
}
7878
};
7979

80-
struct ASReactionInfo {
80+
struct ReactionInfo {
8181
df::reaction *react;
8282

83-
std::vector<ASProductInfo> products;
83+
std::vector<ProductInfo> products;
8484
};
8585

86-
static std::map<std::string, ASReactionInfo> reactions;
87-
static std::map<df::reaction_product*, ASProductInfo*> products;
86+
static std::map<std::string, ReactionInfo> reactions;
87+
static std::map<df::reaction_product*, ProductInfo*> products;
8888

89-
static ASReactionInfo *find_reaction(const std::string &name)
89+
static ReactionInfo *find_reaction(const std::string &name)
9090
{
9191
auto it = reactions.find(name);
9292
return (it != reactions.end()) ? &it->second : NULL;
@@ -97,7 +97,7 @@ static bool is_add_spatter(const std::string &name)
9797
return name.size() > 12 && memcmp(name.data(), "SPATTER_ADD_", 12) == 0;
9898
}
9999

100-
static void find_material(int *type, int *index, df::item *input, ASMaterialSource &mat)
100+
static void find_material(int *type, int *index, df::item *input, MaterialSource &mat)
101101
{
102102
if (input && mat.reagent)
103103
{
@@ -146,7 +146,7 @@ static int has_contaminant(df::item_actual *item, int type, int index)
146146

147147
typedef std::map<int, std::vector<df::item*> > item_table;
148148

149-
static void index_items(item_table &table, df::job *job, ASReactionInfo *info)
149+
static void index_items(item_table &table, df::job *job, ReactionInfo *info)
150150
{
151151
for (int i = job->items.size()-1; i >= 0; i--)
152152
{
@@ -178,7 +178,7 @@ static void index_items(item_table &table, df::job *job, ASReactionInfo *info)
178178
}
179179
}
180180

181-
df::item* find_item(ASReagentSource &info, item_table &table)
181+
df::item* find_item(ReagentSource &info, item_table &table)
182182
{
183183
if (!info.reagent)
184184
return NULL;
@@ -192,7 +192,7 @@ struct item_hook : df::item_constructed {
192192

193193
DEFINE_VMETHOD_INTERPOSE(bool, isImprovable, (df::job *job, int16_t mat_type, int32_t mat_index))
194194
{
195-
ASReactionInfo *info;
195+
ReactionInfo *info;
196196

197197
if (job && job->job_type == job_type::CustomReaction &&
198198
(info = find_reaction(job->reaction_name)) != NULL)
@@ -226,7 +226,7 @@ struct item_hook : df::item_constructed {
226226
IMPLEMENT_VMETHOD_INTERPOSE(item_hook, isImprovable);
227227

228228
df::item* find_item(
229-
ASReagentSource &info,
229+
ReagentSource &info,
230230
std::vector<df::reaction_reagent*> *in_reag,
231231
std::vector<df::item*> *in_items
232232
) {
@@ -304,7 +304,7 @@ IMPLEMENT_VMETHOD_INTERPOSE(product_hook, produce);
304304
*/
305305

306306
static void find_reagent(
307-
color_ostream &out, ASReagentSource &info, df::reaction *react, std::string name
307+
color_ostream &out, ReagentSource &info, df::reaction *react, std::string name
308308
) {
309309
for (size_t i = 0; i < react->reagents.size(); i++)
310310
{
@@ -320,7 +320,7 @@ static void find_reagent(
320320
}
321321

322322
static void parse_product(
323-
color_ostream &out, ASProductInfo &info, df::reaction *react, improvement_product *prod
323+
color_ostream &out, ProductInfo &info, df::reaction *react, improvement_product *prod
324324
) {
325325
using namespace df::enums::reaction_product_improvement_flags;
326326

@@ -374,7 +374,7 @@ static bool find_reactions(color_ostream &out)
374374
auto itprod = strict_virtual_cast<improvement_product>(prod[i]);
375375
if (!itprod) continue;
376376

377-
out_prod.push_back(ASProductInfo());
377+
out_prod.push_back(ProductInfo());
378378
parse_product(out, out_prod.back(), it->second.react, itprod);
379379
}
380380

0 commit comments

Comments
 (0)