diff --git a/CMakeLists.txt b/CMakeLists.txt index b22b0d2a0..f07cdf5af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -244,9 +244,10 @@ if(UNIX) # enable C++11 features add_definitions(-DLINUX_BUILD) add_definitions(-D_GLIBCXX_USE_C99) - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -mtune=generic") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic") + set(GCC_COMMON_FLAGS "-fvisibility=hidden -mtune=generic -Wall -Werror") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COMMON_FLAGS}") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COMMON_FLAGS}") if(DFHACK_BUILD_64) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mno-avx") diff --git a/depends/protobuf/CMakeLists.txt b/depends/protobuf/CMakeLists.txt index 619aba524..b12230b71 100644 --- a/depends/protobuf/CMakeLists.txt +++ b/depends/protobuf/CMakeLists.txt @@ -145,8 +145,8 @@ set(LIBPROTOC_SRCS list(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS}) if(CMAKE_COMPILER_IS_GNUCC) - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Wno-sign-compare") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result -Wno-unused-local-typedefs -Wno-misleading-indentation -Wno-class-memaccess") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-result -Wno-unused-local-typedefs -Wno-misleading-indentation -Wno-class-memaccess -Wno-sign-compare") elseif(MSVC) # Disable warnings for integer conversion to smaller type set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") diff --git a/library/Console-posix.cpp b/library/Console-posix.cpp index 3c8645ebf..49f54c5ef 100644 --- a/library/Console-posix.cpp +++ b/library/Console-posix.cpp @@ -534,7 +534,6 @@ namespace DFHack while(1) { unsigned char c; - int isok; unsigned char seq[2], seq2; lock->unlock(); if(!read_char(c)) diff --git a/library/Hooks-darwin.cpp b/library/Hooks-darwin.cpp index 22e7cc2e9..723d97970 100644 --- a/library/Hooks-darwin.cpp +++ b/library/Hooks-darwin.cpp @@ -314,8 +314,6 @@ DFhackCExport int DFH_SDL_Init(uint32_t flags) // prevent any subprocesses from trying to load libdfhack.dylib setenv("DYLD_INSERT_LIBRARIES", "", 1); - DFHack::Core & c = DFHack::Core::getInstance(); - int ret = SDL_Init(flags); return ret; } diff --git a/library/Hooks-linux.cpp b/library/Hooks-linux.cpp index 8291bf899..cb8ba20db 100644 --- a/library/Hooks-linux.cpp +++ b/library/Hooks-linux.cpp @@ -139,10 +139,7 @@ DFhackCExport int SDL_Init(uint32_t flags) fprintf(stderr,"dfhack: something went horribly wrong\n"); exit(1); } - /* - DFHack::Core & c = DFHack::Core::getInstance(); - c.Init(); - */ + int ret = _SDL_Init(flags); return ret; } diff --git a/library/Process-darwin.cpp b/library/Process-darwin.cpp index 4e1abc108..70598e18f 100644 --- a/library/Process-darwin.cpp +++ b/library/Process-darwin.cpp @@ -50,8 +50,6 @@ using namespace DFHack; Process::Process(const VersionInfoFactory& known_versions) : identified(false), my_pe(0) { - int target_result; - char path[1024]; char *real_path; uint32_t size = sizeof(path); diff --git a/library/Process-linux.cpp b/library/Process-linux.cpp index be3ebb5df..e50750015 100644 --- a/library/Process-linux.cpp +++ b/library/Process-linux.cpp @@ -48,11 +48,7 @@ using namespace DFHack; Process::Process(const VersionInfoFactory& known_versions) : identified(false), my_pe(0) { - const char * dir_name = "/proc/self/"; const char * exe_link_name = "/proc/self/exe"; - const char * cwd_name = "/proc/self/cwd"; - const char * cmdline_name = "/proc/self/cmdline"; - int target_result; // valgrind replaces readlink for /proc/self/exe, but not open. char self_exe[1024]; diff --git a/library/RemoteClient.cpp b/library/RemoteClient.cpp index 7735df028..6a8becaae 100644 --- a/library/RemoteClient.cpp +++ b/library/RemoteClient.cpp @@ -358,7 +358,7 @@ bool sendRemoteMessage(CSimpleSocket *socket, int16_t id, const MessageLite *msg uint8_t *pstart = data + sizeof(RPCMessageHeader); uint8_t *pend = msg->SerializeWithCachedSizesToArray(pstart); - assert((pend - pstart) == size); + assert((pend - pstart) == size); (void)pend; int got = socket->Send(data, fullsz); delete[] data; diff --git a/library/modules/Buildings.cpp b/library/modules/Buildings.cpp index 3d0d5a563..1d6681ee8 100644 --- a/library/modules/Buildings.cpp +++ b/library/modules/Buildings.cpp @@ -173,7 +173,6 @@ uint32_t Buildings::getNumBuildings() bool Buildings::Read (const uint32_t index, t_building & building) { - Core & c = Core::getInstance(); df::building *bld = world->buildings.all[index]; building.x1 = bld->x1; @@ -193,12 +192,10 @@ bool Buildings::Read (const uint32_t index, t_building & building) bool Buildings::ReadCustomWorkshopTypes(map & btypes) { vector & bld_def = world->raws.buildings.all; - uint32_t size = bld_def.size(); btypes.clear(); - for (auto iter = bld_def.begin(); iter != bld_def.end();iter++) + for (building_def *temp : bld_def) { - building_def * temp = *iter; btypes[temp->id] = temp->code; } return true; diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 6db89df64..963b2ecd6 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -261,7 +261,7 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode) case ViewUnits: if (ui_selected_unit) { - if (auto unit = vector_get(world->units.active, *ui_selected_unit)) + if (vector_get(world->units.active, *ui_selected_unit)) { focus += "/Some"; diff --git a/library/modules/Job.cpp b/library/modules/Job.cpp index 4feb33bad..44808a9c5 100644 --- a/library/modules/Job.cpp +++ b/library/modules/Job.cpp @@ -383,7 +383,7 @@ bool DFHack::Job::removeJob(df::job *job) { //a great way of recovering since we can't properly destroy the job & we can't leave it //around. Better to know the moment that becomes a problem. bool success = disconnectJobGeneralRef(job, ref); - assert(success); + assert(success); (void)success; vector_erase_at(job->general_refs, 0); if (ref != NULL) delete ref; diff --git a/plugins/autochop.cpp b/plugins/autochop.cpp index 8f2225f72..d28cf59b3 100644 --- a/plugins/autochop.cpp +++ b/plugins/autochop.cpp @@ -470,7 +470,6 @@ public: { selected_column = 0; - auto last_selected_index = burrows_column.highlighted_index; burrows_column.clear(); for (df::burrow *burrow : ui->burrows.list) @@ -825,7 +824,6 @@ struct autochop_hook : public df::viewscreen_dwarfmodest if (dims.menu_x1 <= 0) return; - df::ui_sidebar_mode d = ui->main.mode; if (!isInDesignationMenu()) return; diff --git a/plugins/autodump.cpp b/plugins/autodump.cpp index 97d266333..054d28f77 100644 --- a/plugins/autodump.cpp +++ b/plugins/autodump.cpp @@ -350,7 +350,6 @@ static command_result autodump_main(color_ostream &out, vector & parame size_t numItems = world->items.all.size(); MapCache MC; - int i = 0; int dumped_total = 0; int cx, cy, cz; diff --git a/plugins/autohauler.cpp b/plugins/autohauler.cpp index dffce56d7..35bf90ca1 100644 --- a/plugins/autohauler.cpp +++ b/plugins/autohauler.cpp @@ -809,10 +809,6 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) // Reset step count since at this point it has reached 60 step_count = 0; - // xxx I don't know what this does - uint32_t race = ui->race_id; - uint32_t civ = ui->civ_id; - // Create a vector of units. This will be populated in the following for loop. std::vector dwarfs; diff --git a/plugins/autolabor.cpp b/plugins/autolabor.cpp index 0fb46a3b6..d6921f1ac 100644 --- a/plugins/autolabor.cpp +++ b/plugins/autolabor.cpp @@ -794,8 +794,6 @@ static void assign_labor(unit_labor::unit_labor labor, if (labor_infos[labor].mode() != AUTOMATIC) return; - int best_dwarf = 0; - int best_value = -10000; int best_skill = 0; std::vector values(n_dwarfs); @@ -804,8 +802,6 @@ static void assign_labor(unit_labor::unit_labor labor, std::map dwarf_skillxp; std::vector previously_enabled(n_dwarfs); - auto mode = labor_infos[labor].mode(); - // Find candidate dwarfs, and calculate a preference value for each dwarf for (int dwarf = 0; dwarf < n_dwarfs; dwarf++) { @@ -1039,9 +1035,6 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) return CR_OK; step_count = 0; - uint32_t race = ui->race_id; - uint32_t civ = ui->civ_id; - std::vector dwarfs; bool has_butchers = false; @@ -1163,7 +1156,6 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) df::job_skill_class skill_class = ENUM_ATTR(job_skill, type, skill); int skill_level = (*s)->rating; - int skill_experience = (*s)->experience; // Track total & highest skill among normal/medical skills. (We don't care about personal or social skills.) diff --git a/plugins/automaterial.cpp b/plugins/automaterial.cpp index 7940fbdb9..8fc1cf1f2 100644 --- a/plugins/automaterial.cpp +++ b/plugins/automaterial.cpp @@ -103,7 +103,6 @@ static map< int16_t, vector > preferred_materials; static map< int16_t, df::interface_key > hotkeys; static bool last_used_moved = false; static bool auto_choose_materials = true; -static bool auto_choose_attempted = true; static bool revert_to_last_used_type = false; static bool allow_future_placement = false; diff --git a/plugins/building-hacks.cpp b/plugins/building-hacks.cpp index 17390cd5a..2c75d4622 100644 --- a/plugins/building-hacks.cpp +++ b/plugins/building-hacks.cpp @@ -141,7 +141,7 @@ struct work_hook : df::building_workshopst{ DEFINE_VMETHOD_INTERPOSE(void, getPowerInfo, (df::power_info *info)) { - if (auto def = find_def()) + if (find_def()) { df::power_info power; get_current_power(info); @@ -420,7 +420,7 @@ static int addBuilding(lua_State* L) static void setPower(df::building_workshopst* workshop, int power_produced, int power_consumed) { work_hook* ptr = static_cast(workshop); - if (workshop_hack_data* def = ptr->find_def())//check if it's really hacked workshop + if (ptr->find_def()) // check if it's really hacked workshop { ptr->set_current_power(power_produced, power_consumed); } @@ -431,7 +431,7 @@ static int getPower(lua_State*L) work_hook* ptr = static_cast(workshop); if (!ptr) return 0; - if (workshop_hack_data* def = ptr->find_def())//check if it's really hacked workshop + if (ptr->find_def()) // check if it's really hacked workshop { df::power_info info; ptr->get_current_power(&info); diff --git a/plugins/buildingplan.cpp b/plugins/buildingplan.cpp index 316d0e1ca..d0eeb28d8 100644 --- a/plugins/buildingplan.cpp +++ b/plugins/buildingplan.cpp @@ -105,7 +105,6 @@ private: for (size_t i = 0; i < raws.inorganics.size(); i++) { - df::inorganic_raw *p = raws.inorganics[i]; MaterialInfo material; material.decode(0, i); addMaterialEntry(selected_category, material, material.toString()); @@ -120,7 +119,6 @@ private: df::plant_raw *p = raws.plants.all[i]; for (size_t j = 0; p->material.size() > 1 && j < p->material.size(); j++) { - auto t = p->material[j]; if (p->material[j]->id != "WOOD") continue; diff --git a/plugins/changelayer.cpp b/plugins/changelayer.cpp index 5c252b102..79081c040 100644 --- a/plugins/changelayer.cpp +++ b/plugins/changelayer.cpp @@ -182,11 +182,6 @@ command_result changelayer (color_ostream &out, std::vector & para } DFCoord cursor (cursorX,cursorY,cursorZ); - uint32_t blockX = cursorX / 16; - uint32_t tileX = cursorX % 16; - uint32_t blockY = cursorY / 16; - uint32_t tileY = cursorY % 16; - MapExtras::Block * b = mc.BlockAt(cursor/16); if(!b || !b->is_valid()) { diff --git a/plugins/createitem.cpp b/plugins/createitem.cpp index ad80cff64..ffc2e1ca8 100644 --- a/plugins/createitem.cpp +++ b/plugins/createitem.cpp @@ -353,8 +353,8 @@ command_result df_createitem (color_ostream &out, vector & parameters) for (size_t j = 0; j < creature->caste.size(); j++) { df::caste_raw *caste = creature->caste[j]; - castes += " " + creature->caste[j]->caste_id; - if (creature->caste[j]->caste_id == tokens[1]) + castes += " " + caste->caste_id; + if (caste->caste_id == tokens[1]) { mat_type = i; mat_index = j; diff --git a/plugins/debug.cpp b/plugins/debug.cpp index a842de430..ee35bcdf6 100644 --- a/plugins/debug.cpp +++ b/plugins/debug.cpp @@ -604,7 +604,8 @@ static command_result parseRegexParam(std::regex& target, template static command_result applyCategoryFilters(color_ostream& out, std::vector& parameters, - size_t pos, Callable1 header, + size_t pos, + Callable1 header, Callable2 categoryMatch, Callable3 listComplete) { @@ -626,7 +627,7 @@ static command_result applyCategoryFilters(color_ostream& out, auto& manager = DebugManager::getInstance(); std::lock_guard lock(manager.access_mutex_); out << std::left; - auto guard = header(manager, categoryRegex, pluginRegex); + auto VARIABLE_IS_NOT_USED guard = header(manager, categoryRegex, pluginRegex); for (auto* category: manager) { DebugCategory::cstring_ref p = category->plugin(); DebugCategory::cstring_ref c = category->category(); diff --git a/plugins/deramp.cpp b/plugins/deramp.cpp index 97a3dc184..62679cae0 100644 --- a/plugins/deramp.cpp +++ b/plugins/deramp.cpp @@ -73,7 +73,7 @@ command_result df_deramp (color_ostream &out, vector & parameters) Job::removeJob(job); } - int num_blocks = 0, blocks_total = world->map.map_blocks.size(); + int blocks_total = world->map.map_blocks.size(); for (int i = 0; i < blocks_total; i++) { df::map_block *block = world->map.map_blocks[i]; diff --git a/plugins/devel/check-structures-sanity/dispatch.cpp b/plugins/devel/check-structures-sanity/dispatch.cpp index d93833513..05dcc0377 100644 --- a/plugins/devel/check-structures-sanity/dispatch.cpp +++ b/plugins/devel/check-structures-sanity/dispatch.cpp @@ -299,13 +299,13 @@ void Checker::dispatch_primitive(const QueueItem & item, const CheckedStructure FAIL("invalid value for bool: " << int(val)); } } - else if (auto int_id = dynamic_cast(cs.identity)) + else if (dynamic_cast(cs.identity)) { check_possible_pointer(item, cs); // TODO check ints? } - else if (auto float_id = dynamic_cast(cs.identity)) + else if (dynamic_cast(cs.identity)) { // TODO check floats? } @@ -876,6 +876,7 @@ void Checker::check_stl_string(const QueueItem & item) ptrdiff_t capacity = (string->ptr - 1)->capacity; #endif + (void)start; if (length < 0) { FAIL("string length is negative (" << length << ")"); diff --git a/plugins/devel/dumpmats.cpp b/plugins/devel/dumpmats.cpp index 42c97e8e6..6cb7ccac1 100644 --- a/plugins/devel/dumpmats.cpp +++ b/plugins/devel/dumpmats.cpp @@ -38,11 +38,7 @@ command_result df_dumpmats (color_ostream &out, vector ¶meters) out.print("\n[MATERIAL:%s] - reconstructed from data extracted from memory\n", mat->id.c_str()); int32_t def_color[6] = {-1,-1,-1,-1,-1,-1}; - bool name_all = false; - bool name_all_solid = false; string def_name[6]; - bool adj_all = false; - bool adj_all_solid = false; string def_adj[6]; int32_t solid_color = mat->state_color[matter_state::Solid]; diff --git a/plugins/devel/kittens.cpp b/plugins/devel/kittens.cpp index b978fab7f..fce924aff 100644 --- a/plugins/devel/kittens.cpp +++ b/plugins/devel/kittens.cpp @@ -253,7 +253,7 @@ struct Connected : public ClearMem { con[pos] = b->signal.connect( [this](uint32_t) { uint32_t old = callee.fetch_add(1); - assert(old != 0xDEDEDEDE); + assert(old != 0xDEDEDEDE); (void)old; std::this_thread::sleep_for(delay); assert(callee != 0xDEDEDEDE); }); @@ -263,7 +263,7 @@ struct Connected : public ClearMem { b->con[pos] = signal.connect(b, [bptr](int) { uint32_t old = bptr->callee.fetch_add(1); - assert(old != 0xDEDEDEDE); + assert(old != 0xDEDEDEDE); (void)old; std::this_thread::sleep_for(delay); assert(bptr->callee != 0xDEDEDEDE); }); @@ -280,7 +280,7 @@ struct Connected : public ClearMem { con[pos] = sig->connect(b, [this](uint32_t) { uint32_t old = callee.fetch_add(1); - assert(old != 0xDEDEDEDE); + assert(old != 0xDEDEDEDE); (void)old; std::this_thread::sleep_for(delay); assert(callee != 0xDEDEDEDE); }); @@ -292,7 +292,7 @@ struct Connected : public ClearMem { con[pos] = b->signal.connect(a, [this](uint32_t) { uint32_t old = callee.fetch_add(1); - assert(old != 0xDEDEDEDE); + assert(old != 0xDEDEDEDE); (void)old; std::this_thread::sleep_for(delay); assert(callee != 0xDEDEDEDE); }); @@ -419,7 +419,7 @@ command_result kittens (color_ostream &out, vector & parameters) "NYAN NYAN NYAN NYAN NYAN NYAN NYAN", 0 }; - const char * kittenz1 []= + const char VARIABLE_IS_NOT_USED * kittenz1 []= { " ____", " (. \\", diff --git a/plugins/devel/stockcheck.cpp b/plugins/devel/stockcheck.cpp index bc4bea52f..b29cb53f0 100644 --- a/plugins/devel/stockcheck.cpp +++ b/plugins/devel/stockcheck.cpp @@ -76,9 +76,7 @@ public: { size++; DFCoord cursor (x,y,z); - uint32_t blockX = x / 16; uint32_t tileX = x % 16; - uint32_t blockY = y / 16; uint32_t tileY = y % 16; MapExtras::Block * b = mc.BlockAt(cursor/16); if(b && b->is_valid()) diff --git a/plugins/devel/vectors.cpp b/plugins/devel/vectors.cpp index 0052fcede..28183874d 100644 --- a/plugins/devel/vectors.cpp +++ b/plugins/devel/vectors.cpp @@ -217,8 +217,6 @@ command_result df_vectors (color_ostream &con, vector & parameters) return CR_FAILURE; } - uintptr_t pos = start; - const size_t ptr_size = sizeof(void*); for (uintptr_t pos = start; pos < end; pos += ptr_size) diff --git a/plugins/dig.cpp b/plugins/dig.cpp index 83ca2ef2d..7f3d66362 100644 --- a/plugins/dig.cpp +++ b/plugins/dig.cpp @@ -1282,7 +1282,6 @@ command_result digl (color_ostream &out, vector & parameters) stack flood; flood.push(xy); - int i = 0; while( !flood.empty() ) { DFHack::DFCoord current = flood.top(); diff --git a/plugins/diggingInvaders/assignJob.cpp b/plugins/diggingInvaders/assignJob.cpp index 7e3dfaf8c..2eaad9eb5 100644 --- a/plugins/diggingInvaders/assignJob.cpp +++ b/plugins/diggingInvaders/assignJob.cpp @@ -68,11 +68,6 @@ int32_t assignJob(color_ostream& out, Edge firstImportantEdge, unordered_map (%d,%d,%d)\n", pt1.x,pt1.y,pt1.z, pt2.x,pt2.y,pt2.z); - df::map_block* block1 = Maps::getTileBlock(pt1); - df::map_block* block2 = Maps::getTileBlock(pt2); - bool passable1 = block1->walkable[pt1.x&0xF][pt1.y&0xF]; - bool passable2 = block2->walkable[pt2.x&0xF][pt2.y&0xF]; - df::coord location; df::building* building = Buildings::findAtTile(pt2); df::coord buildingPos = pt2; diff --git a/plugins/diggingInvaders/diggingInvaders.cpp b/plugins/diggingInvaders/diggingInvaders.cpp index 4afcae6f8..09d045090 100644 --- a/plugins/diggingInvaders/diggingInvaders.cpp +++ b/plugins/diggingInvaders/diggingInvaders.cpp @@ -472,7 +472,7 @@ void findAndAssignInvasionJob(color_ostream& out, void* tickTime) { yMax *= 16; MapExtras::MapCache cache; - clock_t t0 = clock(); + // clock_t t0 = clock(); clock_t totalEdgeTime = 0; int32_t edgesExpanded = 0; while(!fringe.empty()) { @@ -529,7 +529,7 @@ void findAndAssignInvasionJob(color_ostream& out, void* tickTime) { } delete myEdges; } - clock_t time = clock() - t0; + // clock_t time = clock() - t0; //out.print("tickTime = %d, time = %d, totalEdgeTime = %d, total points = %d, total edges = %d, time per point = %.3f, time per edge = %.3f, clocks/sec = %d\n", (int32_t)tickTime, time, totalEdgeTime, closedSet.size(), edgeCount, (float)time / closedSet.size(), (float)time / edgeCount, CLOCKS_PER_SEC); fringe.clear(); diff --git a/plugins/embark-assistant/finder_ui.cpp b/plugins/embark-assistant/finder_ui.cpp index aaaf8945e..1fb845d15 100644 --- a/plugins/embark-assistant/finder_ui.cpp +++ b/plugins/embark-assistant/finder_ui.cpp @@ -1333,19 +1333,17 @@ namespace embark_assist { // off to compensate for the list starting with 1 at index 0. // auto screen = Gui::getViewscreenByType(0); - int16_t x = screen->location.region_pos.x; - int16_t y = screen->location.region_pos.y; state->ui[static_cast(fields::x_dim)]->current_display_value = - Gui::getViewscreenByType(0)->location.embark_pos_max.x - - Gui::getViewscreenByType(0)->location.embark_pos_min.x; + screen->location.embark_pos_max.x - + screen->location.embark_pos_min.x; state->ui[static_cast(fields::x_dim)]->current_index = state->ui[static_cast(fields::x_dim)]->current_display_value; state->ui[static_cast(fields::x_dim)]->current_value = state->ui[static_cast(fields::x_dim)]->current_display_value + 1; state->ui[static_cast(fields::y_dim)]->current_display_value = - Gui::getViewscreenByType(0)->location.embark_pos_max.y - - Gui::getViewscreenByType(0)->location.embark_pos_min.y; + screen->location.embark_pos_max.y - + screen->location.embark_pos_min.y; state->ui[static_cast(fields::y_dim)]->current_index = state->ui[static_cast(fields::y_dim)]->current_display_value; state->ui[static_cast(fields::y_dim)]->current_value = diff --git a/plugins/embark-assistant/matcher.cpp b/plugins/embark-assistant/matcher.cpp index 237b12d19..c19ad02a6 100644 --- a/plugins/embark-assistant/matcher.cpp +++ b/plugins/embark-assistant/matcher.cpp @@ -605,8 +605,6 @@ namespace embark_assist { result.mineral_3 = finder->mineral_3 == -1; bool failed_match = false; - const uint16_t embark_size = finder->x_dim * finder->y_dim; - if (finder->biome_count_min != -1 || finder->biome_count_max != -1 || finder->biome_1 != -1 || diff --git a/plugins/embark-assistant/survey.cpp b/plugins/embark-assistant/survey.cpp index f0e14378a..57c4a1470 100644 --- a/plugins/embark-assistant/survey.cpp +++ b/plugins/embark-assistant/survey.cpp @@ -2068,7 +2068,6 @@ void embark_assist::survey::survey_region_sites(embark_assist::defs::site_lists // color_ostream_proxy out(Core::getInstance().getConsole()); auto screen = Gui::getViewscreenByType(0); df::world_data *world_data = world->world_data; - int8_t index = 0; site_list->clear(); diff --git a/plugins/embark-tools.cpp b/plugins/embark-tools.cpp index da6a2f3b1..b87295020 100644 --- a/plugins/embark-tools.cpp +++ b/plugins/embark-tools.cpp @@ -247,7 +247,6 @@ public: { df::interface_key key = *iter; bool is_motion = false; - int dx = 0, dy = 0; switch (key) { case df::interface_key::CURSOR_UP: @@ -481,7 +480,6 @@ public: virtual void after_render(start_sitest* screen) { GET_EMBARK_POS(screen, x1, x2, y1, y2, width, height); - int mouse_x = gps->mouse_x, mouse_y = gps->mouse_y; int local_x = prev_x - 1; int local_y = prev_y - 2; if (local_x >= x1 && local_x <= x2 && local_y >= y1 && local_y <= y2) diff --git a/plugins/fixveins.cpp b/plugins/fixveins.cpp index 88eeb3b61..84d475518 100644 --- a/plugins/fixveins.cpp +++ b/plugins/fixveins.cpp @@ -56,7 +56,7 @@ command_result df_fixveins (color_ostream &out, vector & parameters) int mineral_removed = 0, feature_removed = 0; int mineral_added = 0, feature_added = 0; - int num_blocks = 0, blocks_total = world->map.map_blocks.size(); + int blocks_total = world->map.map_blocks.size(); for (int i = 0; i < blocks_total; i++) { df::map_block *block = world->map.map_blocks[i]; diff --git a/plugins/getplants.cpp b/plugins/getplants.cpp index 242f56c3f..25823eb17 100644 --- a/plugins/getplants.cpp +++ b/plugins/getplants.cpp @@ -526,7 +526,6 @@ command_result df_getplants (color_ostream &out, vector & parameters) { const df::plant *plant = world->plants.all[i]; df::map_block *cur = Maps::getTileBlock(plant->pos); - bool dirty = false; int x = plant->pos.x % 16; int y = plant->pos.y % 16; diff --git a/plugins/hotkeys.cpp b/plugins/hotkeys.cpp index 2728afcf9..e4cd13574 100644 --- a/plugins/hotkeys.cpp +++ b/plugins/hotkeys.cpp @@ -72,7 +72,6 @@ static void find_active_keybindings(df::viewscreen *screen) auto list = Core::getInstance().ListKeyBindings(sym); for (auto invoke_cmd = list.begin(); invoke_cmd != list.end(); invoke_cmd++) { - bool add_temp_binding = false; if (invoke_cmd->find(":") == string::npos) { add_binding_if_valid(sym, *invoke_cmd, screen); @@ -303,7 +302,6 @@ private: static command_result hotkeys_cmd(color_ostream &out, vector & parameters) { - bool show_help = false; if (parameters.empty()) { if (Maps::IsValid()) diff --git a/plugins/labormanager/joblabormapper.cpp b/plugins/labormanager/joblabormapper.cpp index 6a97aa75f..d9b8a6306 100644 --- a/plugins/labormanager/joblabormapper.cpp +++ b/plugins/labormanager/joblabormapper.cpp @@ -414,7 +414,7 @@ public: df::building* bld = get_building_from_job(j); df::building_type type = bld->getType(); - switch (bld->getType()) + switch (type) { case df::building_type::NONE: return df::unit_labor::NONE; @@ -513,7 +513,7 @@ public: } debug("LABORMANAGER: Cannot deduce labor for destroy building job of type %s\n", - ENUM_KEY_STR(building_type, bld->getType()).c_str()); + ENUM_KEY_STR(building_type, type).c_str()); debug_pause(); return df::unit_labor::NONE; diff --git a/plugins/petcapRemover.cpp b/plugins/petcapRemover.cpp index 7504ab20e..4b1b53a46 100644 --- a/plugins/petcapRemover.cpp +++ b/plugins/petcapRemover.cpp @@ -75,10 +75,6 @@ void impregnateMany() { } if ( unit->flags1.bits.caged ) continue; - int32_t race = unit->race; - int16_t caste = unit->caste; - df::creature_raw* creatureRaw = world->raws.creatures.all[race]; - df::caste_raw* casteRaw = creatureRaw->caste[caste]; //must have PET or PET_EXOTIC if ( !Units::isTamable(unit)) continue; diff --git a/plugins/prospector.cpp b/plugins/prospector.cpp index cd15ebe96..7bc8f2388 100644 --- a/plugins/prospector.cpp +++ b/plugins/prospector.cpp @@ -650,8 +650,6 @@ command_result prospector (color_ostream &con, vector & parameters) matdata aquiferTiles; matdata tubeTiles; - uint32_t vegCount = 0; - for(uint32_t z = 0; z < z_max; z++) { for(uint32_t b_y = 0; b_y < y_max; b_y++) diff --git a/plugins/remotefortressreader/dwarf_control.cpp b/plugins/remotefortressreader/dwarf_control.cpp index 98b51175f..3a5933464 100644 --- a/plugins/remotefortressreader/dwarf_control.cpp +++ b/plugins/remotefortressreader/dwarf_control.cpp @@ -72,9 +72,10 @@ void GetBuildingSize( rad_x_high = world->building_width / 2; else rad_x_high = (world->building_width / 2) - 1; - bool heightOdd = world->building_width % 2; + + bool heightOdd = world->building_height % 2; rad_y_low = world->building_height / 2; - if (widthOdd) + if (heightOdd) rad_y_high = world->building_height / 2; else rad_y_high = (world->building_height / 2) - 1; @@ -474,7 +475,6 @@ command_result SetSideMenu(DFHack::color_ostream &stream, const DwarfControl::Si default: break; } - auto viewScreen = getCurViewscreen(); if (in->has_action()) { switch (in->action()) diff --git a/plugins/remotefortressreader/remotefortressreader.cpp b/plugins/remotefortressreader/remotefortressreader.cpp index a0521e64d..9ab9a7502 100644 --- a/plugins/remotefortressreader/remotefortressreader.cpp +++ b/plugins/remotefortressreader/remotefortressreader.cpp @@ -699,7 +699,6 @@ map spatterHashes; bool IsspatterChanged(DFCoord pos) { df::map_block * block = Maps::getBlock(pos); - bool changed = false; std::vector materials; #if DF_VERSION_INT > 34011 std::vector items; @@ -807,7 +806,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage df::world_raws *raws = &world->raws; - df::world_history *history = &world->history; + // df::world_history *history = &world->history; MaterialInfo mat; for (size_t i = 0; i < raws->inorganics.size(); i++) { @@ -1080,7 +1079,7 @@ void CopyDesignation(df::map_block * DfBlock, RemoteFortressReader::MapBlock * N NetBlock->add_water_stagnant(designation.bits.water_stagnant); if (gamemode && (*gamemode == game_mode::ADVENTURE)) { - auto fog_of_war = DfBlock->fog_of_war[xx][yy]; + // auto fog_of_war = DfBlock->fog_of_war[xx][yy]; NetBlock->add_hidden((TileDigDesignation)designation.bits.dig == TileDigDesignation::NO_DIG || designation.bits.hidden); NetBlock->add_tile_dig_designation(TileDigDesignation::NO_DIG); NetBlock->add_tile_dig_designation_marker(false); @@ -2172,7 +2171,7 @@ static command_result GetWorldMapNew(color_ostream &stream, const EmptyMessage * for (int xx = 0; xx < width; xx++) { df::region_map_entry * map_entry = &data->region_map[xx][yy]; - df::world_region * region = data->regions[map_entry->region_id]; + // df::world_region * region = data->regions[map_entry->region_id]; auto regionTile = out->add_region_tiles(); regionTile->set_elevation(map_entry->elevation); diff --git a/plugins/rendermax/renderer_light.cpp b/plugins/rendermax/renderer_light.cpp index d76889220..cc5d569c0 100644 --- a/plugins/rendermax/renderer_light.cpp +++ b/plugins/rendermax/renderer_light.cpp @@ -535,7 +535,6 @@ coord2d lightingEngineViewscreen::worldToViewportCoord(const coord2d& in,const r return in-window2d+r.first; } -static size_t max_list_size = 100000; // Avoid iterating over huge lists void lightingEngineViewscreen::doSun(const lightSource& sky,MapExtras::MapCache& map) { //TODO fix this mess @@ -673,7 +672,7 @@ void lightingEngineViewscreen::doOcupancyAndLights() df::tiletype_shape shape = ENUM_ATTR(tiletype,shape,type); bool is_wall=!ENUM_ATTR(tiletype_shape,passable_high,shape); bool is_floor=!ENUM_ATTR(tiletype_shape,passable_low,shape); - df::tiletype_shape_basic basic_shape = ENUM_ATTR(tiletype_shape, basic_shape, shape); + // df::tiletype_shape_basic basic_shape = ENUM_ATTR(tiletype_shape, basic_shape, shape); df::tiletype_material tileMat= ENUM_ATTR(tiletype,material,type); DFHack::t_matpair mat=b->staticMaterialAt(gpos); diff --git a/plugins/rendermax/renderer_light.hpp b/plugins/rendermax/renderer_light.hpp index 4e779f3fa..89a2092d5 100644 --- a/plugins/rendermax/renderer_light.hpp +++ b/plugins/rendermax/renderer_light.hpp @@ -51,8 +51,6 @@ private: rgbf adapt_to_light(const rgbf& light) { const float influence=0.0001f; - const float max_adapt=1; - const float min_adapt=0; float intensity=(light.r+light.g+light.b)/3.0; light_adaptation=intensity*influence+light_adaptation*(1-influence); float delta=light_adaptation-intensity; @@ -77,7 +75,7 @@ private: old_opengl* p=reinterpret_cast(parent); float *fg = p->fg + tile * 4 * 6; float *bg = p->bg + tile * 4 * 6; - float *tex = p->tex + tile * 2 * 6; + // float *tex = p->tex + tile * 2 * 6; rgbf light=lightGrid[tile];//for light adaptation: rgbf light=adapt_to_light(lightGrid[tile]); for (int i = 0; i < 6; i++) { //oh how sse would do wonders here, or shaders... diff --git a/plugins/rendermax/renderer_opengl.hpp b/plugins/rendermax/renderer_opengl.hpp index a0a920e69..33952f7f0 100644 --- a/plugins/rendermax/renderer_opengl.hpp +++ b/plugins/rendermax/renderer_opengl.hpp @@ -149,7 +149,7 @@ private: old_opengl* p=reinterpret_cast(parent); float *fg = p->fg + tile * 4 * 6; float *bg = p->bg + tile * 4 * 6; - float *tex = p->tex + tile * 2 * 6; + // float *tex = p->tex + tile * 2 * 6; const float val=1/2.0; float r=rFloat()*val - val/2; @@ -264,7 +264,7 @@ private: old_opengl* p=reinterpret_cast(parent); float *fg = p->fg + tile * 4 * 6; float *bg = p->bg + tile * 4 * 6; - float *tex = p->tex + tile * 2 * 6; + // float *tex = p->tex + tile * 2 * 6; rgbf light=lightGrid[tile]; for (int i = 0; i < 6; i++) { *(fg++) *= light.r; @@ -343,7 +343,7 @@ private: old_opengl* p=reinterpret_cast(parent); float *fg = p->fg + tile * 4 * 6; float *bg = p->bg + tile * 4 * 6; - float *tex = p->tex + tile * 2 * 6; + // float *tex = p->tex + tile * 2 * 6; rgbf fm=foreMult[tile]; rgbf fo=foreOffset[tile]; diff --git a/plugins/rendermax/rendermax.cpp b/plugins/rendermax/rendermax.cpp index 17fd6fa95..d391bdb36 100644 --- a/plugins/rendermax/rendermax.cpp +++ b/plugins/rendermax/rendermax.cpp @@ -139,7 +139,6 @@ static int getGridsSize(lua_State* L) { if(current_mode!=MODE_LUA) return -1; - renderer_lua* r=reinterpret_cast(enabler->renderer); lua_pushnumber(L,gps->dimx); lua_pushnumber(L,gps->dimy); return 2; diff --git a/plugins/reveal.cpp b/plugins/reveal.cpp index 93e2041bd..39720926c 100644 --- a/plugins/reveal.cpp +++ b/plugins/reveal.cpp @@ -488,8 +488,6 @@ command_result revflood(color_ostream &out, vector & params) } int32_t cx, cy, cz; Maps::getSize(x_max,y_max,z_max); - uint32_t tx_max = x_max * 16; - uint32_t ty_max = y_max * 16; Gui::getCursorCoords(cx,cy,cz); if(cx == -30000) diff --git a/plugins/siege-engine.cpp b/plugins/siege-engine.cpp index 30a582c0d..55ea4eeab 100644 --- a/plugins/siege-engine.cpp +++ b/plugins/siege-engine.cpp @@ -1400,7 +1400,7 @@ static int proposeUnitHits(lua_State *L) static int computeNearbyWeight(lua_State *L) { - auto engine = find_engine(L, 1); + find_engine(L, 1); luaL_checktype(L, 2, LUA_TTABLE); luaL_checktype(L, 3, LUA_TTABLE); const char *fname = luaL_optstring(L, 4, "nearby_weight"); @@ -1606,7 +1606,6 @@ struct projectile_hook : df::proj_itemst { df::coord target, last_passable; df::coord tbase = engine->target.first; df::coord tsize = engine->getTargetSize(); - bool success = false; for (int i = 0; i < 50; i++) { @@ -1851,7 +1850,6 @@ struct building_hook : df::building_siegeenginest { if (auto engine = find_engine(this)) { auto job = jobs[0]; - bool save_op = false; bool load_op = false; switch (job->job_type) diff --git a/plugins/stockpiles/OrganicMatLookup.cpp b/plugins/stockpiles/OrganicMatLookup.cpp index 09ac9c659..5167ece4a 100644 --- a/plugins/stockpiles/OrganicMatLookup.cpp +++ b/plugins/stockpiles/OrganicMatLookup.cpp @@ -129,7 +129,6 @@ int16_t OrganicMatLookup::food_idx_by_token ( std::ostream &out, organic_mat_cat MaterialInfo mat_info = food_mat_by_token ( out, token ); int16_t type = mat_info.type; int32_t index = mat_info.index; - int16_t food_idx2 = -1; auto it = food_index[mat_category].find ( std::make_pair ( type, index ) ); if ( it != food_index[mat_category].end() ) { diff --git a/plugins/stockpiles/stockpiles.cpp b/plugins/stockpiles/stockpiles.cpp index f8f56b9bc..dbd255377 100644 --- a/plugins/stockpiles/stockpiles.cpp +++ b/plugins/stockpiles/stockpiles.cpp @@ -499,7 +499,6 @@ static std::vector clean_dfstock_list ( const std::string &path ) static int stockpiles_list_settings ( lua_State *L ) { auto path = luaL_checkstring ( L, 1 ); - color_ostream &out = *Lua::GetOutput ( L ); if ( Filesystem::exists ( path ) && !Filesystem::isdir ( path ) ) { lua_pushfstring ( L, "stocksettings path invalid: %s", path ); diff --git a/plugins/tweak/tweaks/military-assign.h b/plugins/tweak/tweaks/military-assign.h index 45f97eac3..92b101e08 100644 --- a/plugins/tweak/tweaks/military-assign.h +++ b/plugins/tweak/tweaks/military-assign.h @@ -77,7 +77,7 @@ struct military_assign_hook : df::viewscreen_layer_militaryst { int i1 = plist->getFirstVisible(), i2 = plist->getLastVisible(); int si = plist->getListCursor(); - for (int y = y1, i = i1; i <= i2; i++, y++) + for (int y = y1, i = i1; i <= i2 && y <= y2; i++, y++) { auto unit = vector_get(positions.candidates, i); if (!unit || unit->military.squad_id < 0) diff --git a/plugins/zone.cpp b/plugins/zone.cpp index 25b4be950..385d79728 100644 --- a/plugins/zone.cpp +++ b/plugins/zone.cpp @@ -3626,7 +3626,6 @@ static void autobutcher_unbutcherRace(color_ostream &out, unsigned id) // push autobutcher settings on lua stack static int autobutcher_getSettings(lua_State *L) { - color_ostream &out = *Lua::GetOutput(L); lua_newtable(L); int ctable = lua_gettop(L); Lua::SetField(L, enable_autobutcher, ctable, "enable_autobutcher"); @@ -3642,7 +3641,6 @@ static int autobutcher_getSettings(lua_State *L) // push the watchlist vector as nested table on the lua stack static int autobutcher_getWatchList(lua_State *L) { - color_ostream &out = *Lua::GetOutput(L); lua_newtable(L); for(size_t i=0; i