Skip to content

Commit

Permalink
First pass for 0.40 compatibility; still lots left to do, but this wi…
Browse files Browse the repository at this point in the history
…ll at least build
  • Loading branch information
quietust committed Jul 21, 2014
1 parent b598cbb commit 97de213
Show file tree
Hide file tree
Showing 19 changed files with 76 additions and 88 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ if (NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhac
endif()

# set up versioning.
set(DF_VERSION "0.34.11")
SET(DFHACK_RELEASE "r5" CACHE STRING "Current release revision.")
set(DF_VERSION "0.40.04")
SET(DFHACK_RELEASE "r0" CACHE STRING "Current release revision.")

set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}")
add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}")
Expand Down
1 change: 0 additions & 1 deletion library/modules/Items.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,6 @@ int Items::getItemBaseValue(int16_t item_type, int16_t item_subtype, int16_t mat

case item_type::MEAT:
case item_type::PLANT:
case item_type::LEAVES:
case item_type::CHEESE:
value = 2;
break;
Expand Down
9 changes: 0 additions & 9 deletions library/modules/MapCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,15 +845,6 @@ t_matpair MapExtras::BlockInfo::getBaseMaterial(df::tiletype tt, df::coord2d pos
case ROOT:
case TREE:
case PLANT:
rv.mat_type = MaterialInfo::PLANT_BASE;
if (auto plant = plants[block->map_pos + df::coord(x,y,0)])
{
if (auto raw = df::plant_raw::find(plant->material))
{
rv.mat_type = raw->material_defs.type_basic_mat;
rv.mat_index = raw->material_defs.idx_basic_mat;
}
}
break;

case GRASS_LIGHT:
Expand Down
2 changes: 1 addition & 1 deletion library/modules/Maps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ void Maps::enableBlockUpdates(df::map_block *blk, bool flow, bool temperature)
blk->flags.bits.update_liquid_twice = true;
}

auto z_flags = world->map.z_level_flags;
auto z_flags = world->map_extras.z_level_flags;
int z_level = blk->map_pos.z;

if (z_flags && z_level >= 0 && z_level < world->map.z_count_block)
Expand Down
1 change: 0 additions & 1 deletion library/modules/Materials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ void MaterialInfo::getMatchBits(df::job_item_flags1 &ok, df::job_item_flags1 &ma
TEST(extract_bearing_fish, false);
TEST(extract_bearing_vermin, false);
TEST(processable_to_vial, structural && FLAG(plant, plant_raw_flags::EXTRACT_VIAL));
TEST(processable_to_bag, structural && FLAG(plant, plant_raw_flags::LEAVES));
TEST(processable_to_barrel, structural && FLAG(plant, plant_raw_flags::EXTRACT_BARREL));
TEST(solid, !(MAT_FLAG(ALCOHOL_PLANT) ||
MAT_FLAG(ALCOHOL_CREATURE) ||
Expand Down
2 changes: 1 addition & 1 deletion library/modules/Translation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ string Translation::TranslateName(const df::language_name * name, bool inEnglish
if (!name->nickname.empty())
{
word = "`" + name->nickname + "'";
switch (d_init ? d_init->nickname_dwarf : d_init_nickname::CENTRALIZE)
switch (d_init ? d_init->nickname[*df::global::gametype] : d_init_nickname::CENTRALIZE)
{
case d_init_nickname::REPLACE_ALL:
out = word;
Expand Down
2 changes: 1 addition & 1 deletion library/xml
48 changes: 24 additions & 24 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ endif()

OPTION(BUILD_ISOWORLD "Build isoworld (needs a checkout first)." OFF)
if(BUILD_ISOWORLD)
add_subdirectory (isoworld)
IF(UNIX)
if (APPLE)
#TODO: add an OSX runner script
else()
# On linux, copy our version of the df launch script which sets LD_PRELOAD
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/runisoworld
DESTINATION .)
endif()
ENDIF()
add_subdirectory (isoworld)
IF(UNIX)
if (APPLE)
#TODO: add an OSX runner script
else()
# On linux, copy our version of the df launch script which sets LD_PRELOAD
install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/runisoworld
DESTINATION .)
endif()
ENDIF()
endif()

OPTION(BUILD_DEV_PLUGINS "Build developer plugins." OFF)
Expand All @@ -38,12 +38,12 @@ endif()

OPTION(BUILD_MAPEXPORT "Build map exporter." ON)
if (BUILD_MAPEXPORT)
add_subdirectory (mapexport)
# add_subdirectory (mapexport)
endif()

OPTION(BUILD_DWARFEXPORT "Build dwarf exporter." ON)
if (BUILD_DWARFEXPORT)
add_subdirectory (dwarfexport)
# add_subdirectory (dwarfexport)
endif()

OPTION(BUILD_RUBY "Build ruby binding." ON)
Expand Down Expand Up @@ -84,7 +84,7 @@ OPTION(BUILD_SUPPORTED "Build the supported plugins (reveal, probe, etc.)." ON)
if (BUILD_SUPPORTED)
DFHACK_PLUGIN(3dveins 3dveins.cpp)
DFHACK_PLUGIN(add-spatter add-spatter.cpp)
DFHACK_PLUGIN(advtools advtools.cpp)
# DFHACK_PLUGIN(advtools advtools.cpp)
DFHACK_PLUGIN(autodump autodump.cpp)
DFHACK_PLUGIN(autolabor autolabor.cpp)
DFHACK_PLUGIN(automaterial automaterial.cpp)
Expand All @@ -104,23 +104,23 @@ if (BUILD_SUPPORTED)
DFHACK_PLUGIN(createitem createitem.cpp)
DFHACK_PLUGIN(cursecheck cursecheck.cpp)
DFHACK_PLUGIN(deramp deramp.cpp)
DFHACK_PLUGIN(dig dig.cpp)
# DFHACK_PLUGIN(dig dig.cpp)
DFHACK_PLUGIN(digFlood digFlood.cpp)
add_subdirectory(diggingInvaders)
# add_subdirectory(diggingInvaders)
DFHACK_PLUGIN(drybuckets drybuckets.cpp)
DFHACK_PLUGIN(dwarfmonitor dwarfmonitor.cpp)
# DFHACK_PLUGIN(dwarfmonitor dwarfmonitor.cpp)
DFHACK_PLUGIN(embark-tools embark-tools.cpp)
DFHACK_PLUGIN(eventful eventful.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(fastdwarf fastdwarf.cpp)
DFHACK_PLUGIN(feature feature.cpp)
DFHACK_PLUGIN(filltraffic filltraffic.cpp)
DFHACK_PLUGIN(fix-armory fix-armory.cpp)
# DFHACK_PLUGIN(fix-armory fix-armory.cpp)
DFHACK_PLUGIN(fixpositions fixpositions.cpp)
DFHACK_PLUGIN(fixveins fixveins.cpp)
DFHACK_PLUGIN(flows flows.cpp)
DFHACK_PLUGIN(follow follow.cpp)
DFHACK_PLUGIN(forceequip forceequip.cpp)
DFHACK_PLUGIN(getplants getplants.cpp)
# DFHACK_PLUGIN(getplants getplants.cpp)
DFHACK_PLUGIN(infiniteSky infiniteSky.cpp)
DFHACK_PLUGIN(initflags initflags.cpp)
DFHACK_PLUGIN(isoworldremote isoworldremote.cpp PROTOBUFS isoworldremote)
Expand All @@ -132,28 +132,28 @@ if (BUILD_SUPPORTED)
DFHACK_PLUGIN(misery misery.cpp)
DFHACK_PLUGIN(mousequery mousequery.cpp)
DFHACK_PLUGIN(petcapRemover petcapRemover.cpp)
DFHACK_PLUGIN(plants plants.cpp)
# DFHACK_PLUGIN(plants plants.cpp)
DFHACK_PLUGIN(probe probe.cpp)
DFHACK_PLUGIN(prospector prospector.cpp)
# DFHACK_PLUGIN(prospector prospector.cpp)
DFHACK_PLUGIN(power-meter power-meter.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(regrass regrass.cpp)
DFHACK_PLUGIN(remotefortressreader remotefortressreader.cpp PROTOBUFS RemoteFortressReader)
DFHACK_PLUGIN(remotefortressreader remotefortressreader.cpp PROTOBUFS RemoteFortressReader)
DFHACK_PLUGIN(rename rename.cpp LINK_LIBRARIES lua PROTOBUFS rename)
add_subdirectory(rendermax)
# add_subdirectory(rendermax)
DFHACK_PLUGIN(resume resume.cpp)
DFHACK_PLUGIN(reveal reveal.cpp)
DFHACK_PLUGIN(search search.cpp)
DFHACK_PLUGIN(seedwatch seedwatch.cpp)
DFHACK_PLUGIN(showmood showmood.cpp)
DFHACK_PLUGIN(siege-engine siege-engine.cpp LINK_LIBRARIES lua)
# DFHACK_PLUGIN(siege-engine siege-engine.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(sort sort.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(steam-engine steam-engine.cpp)
DFHACK_PLUGIN(stockflow stockflow.cpp LINK_LIBRARIES lua)
DFHACK_PLUGIN(stockpiles stockpiles.cpp)
DFHACK_PLUGIN(stocks stocks.cpp)
DFHACK_PLUGIN(strangemood strangemood.cpp)
DFHACK_PLUGIN(tiletypes tiletypes.cpp Brushes.h)
DFHACK_PLUGIN(treefarm treefarm.cpp)
# DFHACK_PLUGIN(treefarm treefarm.cpp)
DFHACK_PLUGIN(tubefill tubefill.cpp)
DFHACK_PLUGIN(tweak tweak.cpp)
DFHACK_PLUGIN(weather weather.cpp)
Expand Down
3 changes: 0 additions & 3 deletions plugins/automaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,6 @@ static bool is_valid_building_site(building_site &site, bool orthogonal_check, b
return false;
}

if (shape == tiletype_shape::TREE)
return false;

if (material == tiletype_material::FIRE ||
material == tiletype_material::POOL ||
material == tiletype_material::BROOK ||
Expand Down
2 changes: 1 addition & 1 deletion plugins/devel/dumpmats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ command_result df_dumpmats (color_ostream &out, vector<string> &parameters)
for (int i = 0; i < mat->reaction_class.size(); i++)
out.print("\t[REACTION_CLASS:%s]\n", mat->reaction_class[i]->c_str());
for (int i = 0; i < mat->reaction_product.id.size(); i++)
out.print("\t[MATERIAL_REACTION_PRODUCT:%s:%s:%s%s%s]\n", mat->reaction_product.id[i]->c_str(), mat->reaction_product.str[0][i]->c_str(), mat->reaction_product.str[1][i]->c_str(), mat->reaction_product.str[2][i]->size() ? ":" : "", mat->reaction_product.str[2][i]->c_str());
out.print("\t[MATERIAL_REACTION_PRODUCT:%s:%s:%s%s%s]\n", mat->reaction_product.id[i]->c_str(), mat->reaction_product.str[2][i]->c_str(), mat->reaction_product.str[3][i]->c_str(), mat->reaction_product.str[4][i]->size() ? ":" : "", mat->reaction_product.str[4][i]->c_str());

if (mat->hardens_with_water.mat_type != -1)
out.print("\t[HARDENS_WITH_WATER:%s:%s%s%s]\n", mat->hardens_with_water.str[0].c_str(), mat->hardens_with_water.str[1].c_str(), mat->hardens_with_water.str[2].size() ? ":" : "", mat->hardens_with_water.str[2].c_str());
Expand Down
34 changes: 17 additions & 17 deletions plugins/embark-tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class embark_tools_settings : public dfhack_viewscreen
void update_embark_sidebar (df::viewscreen_choose_start_sitest * screen)
{
bool is_top = false;
if (screen->embark_pos_min.y == 0)
if (screen->location.embark_pos_min.y == 0)
is_top = true;
std::set<df::interface_key> keys;
keys.insert(df::interface_key::SETUP_LOCAL_Y_MUP);
Expand All @@ -123,10 +123,10 @@ void resize_embark (df::viewscreen_choose_start_sitest * screen, int dx, int dy)
/* Reproduces DF's embark resizing functionality
* Local area resizes up and to the right, unless it's already touching the edge
*/
int x1 = screen->embark_pos_min.x,
x2 = screen->embark_pos_max.x,
y1 = screen->embark_pos_min.y,
y2 = screen->embark_pos_max.y,
int x1 = screen->location.embark_pos_min.x,
x2 = screen->location.embark_pos_max.x,
y1 = screen->location.embark_pos_min.y,
y2 = screen->location.embark_pos_max.y,
width = x2 - x1 + dx,
height = y2 - y1 + dy;
if (x1 == x2 && dx == -1)
Expand All @@ -150,10 +150,10 @@ void resize_embark (df::viewscreen_choose_start_sitest * screen, int dx, int dy)
}
y2 = std::min(15, y2);

screen->embark_pos_min.x = x1;
screen->embark_pos_max.x = x2;
screen->embark_pos_min.y = y1;
screen->embark_pos_max.y = y2;
screen->location.embark_pos_min.x = x1;
screen->location.embark_pos_max.x = x2;
screen->location.embark_pos_min.y = y1;
screen->location.embark_pos_max.y = y2;

update_embark_sidebar(screen);
}
Expand Down Expand Up @@ -183,10 +183,10 @@ int sticky_pos[] = {0, 0, 3, 3};
bool sticky_moved = false;
void sticky_save (df::viewscreen_choose_start_sitest * screen)
{
sticky_pos[0] = screen->embark_pos_min.x;
sticky_pos[1] = screen->embark_pos_max.x;
sticky_pos[2] = screen->embark_pos_min.y;
sticky_pos[3] = screen->embark_pos_max.y;
sticky_pos[0] = screen->location.embark_pos_min.x;
sticky_pos[1] = screen->location.embark_pos_max.x;
sticky_pos[2] = screen->location.embark_pos_min.y;
sticky_pos[3] = screen->location.embark_pos_max.y;
}

void sticky_apply (df::viewscreen_choose_start_sitest * screen)
Expand All @@ -196,10 +196,10 @@ void sticky_apply (df::viewscreen_choose_start_sitest * screen)
// Site finder is active - don't override default local position
return;
}
screen->embark_pos_min.x = sticky_pos[0];
screen->embark_pos_max.x = sticky_pos[1];
screen->embark_pos_min.y = sticky_pos[2];
screen->embark_pos_max.y = sticky_pos[3];
screen->location.embark_pos_min.x = sticky_pos[0];
screen->location.embark_pos_max.x = sticky_pos[1];
screen->location.embark_pos_min.y = sticky_pos[2];
screen->location.embark_pos_max.y = sticky_pos[3];
update_embark_sidebar(screen);
}

Expand Down
12 changes: 6 additions & 6 deletions plugins/feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ static command_result feature(color_ostream &out, vector <string> &parameters)
{
if (parameters.size() != 1)
return CR_WRONG_USAGE;
for (size_t i = 0; i < world->cur_savegame.map_features.size(); i++)
for (size_t i = 0; i < world->features.map_features.size(); i++)
{
df::feature_init *feature_init = world->cur_savegame.map_features[i];
df::feature_init *feature_init = world->features.map_features[i];
string name;
feature_init->getName(&name);
out.print("Feature #%i (\"%s\", type %s) is %s\n",
Expand All @@ -48,12 +48,12 @@ static command_result feature(color_ostream &out, vector <string> &parameters)
if (parameters.size() != 2)
return CR_WRONG_USAGE;
size_t i = atoi(parameters[1].c_str());
if ((i < 0) || (i >= world->cur_savegame.map_features.size()))
if ((i < 0) || (i >= world->features.map_features.size()))
{
out.print("No such feature!\n");
return CR_FAILURE;
}
df::feature_init *feature_init = world->cur_savegame.map_features[i];
df::feature_init *feature_init = world->features.map_features[i];
if (feature_init->flags.is_set(feature_init_flags::Discovered))
{
out.print("Selected feature is already discovered!\n");
Expand All @@ -70,12 +70,12 @@ static command_result feature(color_ostream &out, vector <string> &parameters)
if (parameters.size() != 2)
return CR_WRONG_USAGE;
size_t i = atoi(parameters[1].c_str());
if ((i < 0) || (i >= world->cur_savegame.map_features.size()))
if ((i < 0) || (i >= world->features.map_features.size()))
{
out.print("No such feature!\n");
return CR_FAILURE;
}
df::feature_init *feature_init = world->cur_savegame.map_features[i];
df::feature_init *feature_init = world->features.map_features[i];
if (!feature_init->flags.is_set(feature_init_flags::Discovered))
{
out.print("Selected feature is already hidden!\n");
Expand Down
6 changes: 3 additions & 3 deletions plugins/infiniteSky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ void doInfiniteSky(color_ostream& out, int32_t howMany) {
}
}
df::z_level_flags* flags = new df::z_level_flags[z_count_block+1];
memcpy(flags, world->map.z_level_flags, z_count_block*sizeof(df::z_level_flags));
memcpy(flags, world->map_extras.z_level_flags, z_count_block*sizeof(df::z_level_flags));
flags[z_count_block].whole = 0;
flags[z_count_block].bits.update = 1;
world->map.z_count_block++;
world->map.z_count++;
delete[] world->map.z_level_flags;
world->map.z_level_flags = flags;
delete[] world->map_extras.z_level_flags;
world->map_extras.z_level_flags = flags;
}

}
Expand Down
3 changes: 2 additions & 1 deletion plugins/manipulator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ const SkillColumn columns[] = {
{11, 3, profession::NONE, unit_labor::HAUL_REFUSE, job_skill::NONE, "Re"},
{11, 3, profession::NONE, unit_labor::HAUL_FURNITURE, job_skill::NONE, "Fu"},
{11, 3, profession::NONE, unit_labor::HAUL_ANIMAL, job_skill::NONE, "An"},
{11, 3, profession::NONE, unit_labor::PUSH_HAUL_VEHICLE, job_skill::NONE, "Ve"},
{11, 3, profession::NONE, unit_labor::HANDLE_VEHICLES, job_skill::NONE, "Ve"},
// Other Jobs
{12, 4, profession::ARCHITECT, unit_labor::ARCHITECT, job_skill::DESIGNBUILDING, "Ar"},
{12, 4, profession::ALCHEMIST, unit_labor::ALCHEMIST, job_skill::ALCHEMY, "Al"},
Expand Down Expand Up @@ -217,6 +217,7 @@ const SkillColumn columns[] = {
{15, 8, profession::NONE, unit_labor::NONE, job_skill::SITUATIONAL_AWARENESS, "Ob"},
{15, 8, profession::NONE, unit_labor::NONE, job_skill::COORDINATION, "Cr"},
{15, 8, profession::NONE, unit_labor::NONE, job_skill::BALANCE, "Ba"},
{15, 8, profession::NONE, unit_labor::NONE, job_skill::CLIMBING, "Cl"},
// Social
{16, 3, profession::NONE, unit_labor::NONE, job_skill::PERSUASION, "Pe"},
{16, 3, profession::NONE, unit_labor::NONE, job_skill::NEGOTIATION, "Ne"},
Expand Down
6 changes: 3 additions & 3 deletions plugins/prospector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ static command_result embark_prospector(color_ostream &out, df::viewscreen_choos
}

df::world_data *data = world->world_data;
coord2d cur_region = screen->region_pos;
coord2d cur_region = screen->location.region_pos;
auto cur_details = get_details(data, cur_region);

if (!cur_details)
Expand All @@ -512,9 +512,9 @@ static command_result embark_prospector(color_ostream &out, df::viewscreen_choos
biomes[screen->biome_rgn[screen->biome_idx]]++;
}*/

for (int x = screen->embark_pos_min.x; x <= screen->embark_pos_max.x; x++)
for (int x = screen->location.embark_pos_min.x; x <= screen->location.embark_pos_max.x; x++)
{
for (int y = screen->embark_pos_min.y; y <= screen->embark_pos_max.y; y++)
for (int y = screen->location.embark_pos_min.y; y <= screen->location.embark_pos_max.y; y++)
{
EmbarkTileLayout tile;
if (!estimate_underground(out, tile, cur_details, x, y) ||
Expand Down
14 changes: 11 additions & 3 deletions plugins/reveal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ void revealAdventure(color_ostream &out)
{
df::map_block *block = world->map.map_blocks[i];
// in 'no-hell'/'safe' mode, don't reveal blocks with hell and adamantine
if (!isSafe(block->map_pos))
continue;
// if (!isSafe(block->map_pos))
// continue;
designations40d & designations = block->designation;
// for each tile in block
for (uint32_t x = 0; x < 16; x++) for (uint32_t y = 0; y < 16; y++)
Expand Down Expand Up @@ -430,7 +430,9 @@ command_result revflood(color_ostream &out, vector<string> & params)
case tiletype_shape::STAIR_UP:
case tiletype_shape::RAMP:
case tiletype_shape::FLOOR:
case tiletype_shape::TREE:
case tiletype_shape::BRANCH:
case tiletype_shape::TRUNK_BRANCH:
case tiletype_shape::TWIG:
case tiletype_shape::SAPLING:
case tiletype_shape::SHRUB:
case tiletype_shape::BOULDER:
Expand All @@ -442,6 +444,12 @@ command_result revflood(color_ostream &out, vector<string> & params)
above = sides = true;
break;
}
if (tileMaterial(tt) == tiletype_material::PLANT || tileMaterial(tt) == tiletype_material::MUSHROOM)
{
if(from_below)
unhide = 0;
above = sides = true;
}
if(unhide)
{
des.bits.hidden = false;
Expand Down
Loading

0 comments on commit 97de213

Please sign in to comment.