Merge branch 'gcc-werror' into develop

develop
lethosor 2021-09-08 12:26:09 -04:00
commit aa7f60530e
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
52 changed files with 50 additions and 128 deletions

@ -244,9 +244,10 @@ if(UNIX)
# enable C++11 features # enable C++11 features
add_definitions(-DLINUX_BUILD) add_definitions(-DLINUX_BUILD)
add_definitions(-D_GLIBCXX_USE_C99) add_definitions(-D_GLIBCXX_USE_C99)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g -Wall -Wno-unused-variable") set(GCC_COMMON_FLAGS "-fvisibility=hidden -mtune=generic -Wall -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -mtune=generic") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden -mtune=generic") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COMMON_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COMMON_FLAGS}")
if(DFHACK_BUILD_64) if(DFHACK_BUILD_64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mno-avx")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mno-avx") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64 -mno-avx")

@ -145,8 +145,8 @@ set(LIBPROTOC_SRCS
list(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS}) list(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS})
if(CMAKE_COMPILER_IS_GNUCC) if(CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Wno-sign-compare") 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") 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) elseif(MSVC)
# Disable warnings for integer conversion to smaller type # Disable warnings for integer conversion to smaller type
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")

@ -534,7 +534,6 @@ namespace DFHack
while(1) while(1)
{ {
unsigned char c; unsigned char c;
int isok;
unsigned char seq[2], seq2; unsigned char seq[2], seq2;
lock->unlock(); lock->unlock();
if(!read_char(c)) if(!read_char(c))

@ -314,8 +314,6 @@ DFhackCExport int DFH_SDL_Init(uint32_t flags)
// prevent any subprocesses from trying to load libdfhack.dylib // prevent any subprocesses from trying to load libdfhack.dylib
setenv("DYLD_INSERT_LIBRARIES", "", 1); setenv("DYLD_INSERT_LIBRARIES", "", 1);
DFHack::Core & c = DFHack::Core::getInstance();
int ret = SDL_Init(flags); int ret = SDL_Init(flags);
return ret; return ret;
} }

@ -139,10 +139,7 @@ DFhackCExport int SDL_Init(uint32_t flags)
fprintf(stderr,"dfhack: something went horribly wrong\n"); fprintf(stderr,"dfhack: something went horribly wrong\n");
exit(1); exit(1);
} }
/*
DFHack::Core & c = DFHack::Core::getInstance();
c.Init();
*/
int ret = _SDL_Init(flags); int ret = _SDL_Init(flags);
return ret; return ret;
} }

@ -50,8 +50,6 @@ using namespace DFHack;
Process::Process(const VersionInfoFactory& known_versions) : identified(false), my_pe(0) Process::Process(const VersionInfoFactory& known_versions) : identified(false), my_pe(0)
{ {
int target_result;
char path[1024]; char path[1024];
char *real_path; char *real_path;
uint32_t size = sizeof(path); uint32_t size = sizeof(path);

@ -48,11 +48,7 @@ using namespace DFHack;
Process::Process(const VersionInfoFactory& known_versions) : identified(false), my_pe(0) 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 * 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. // valgrind replaces readlink for /proc/self/exe, but not open.
char self_exe[1024]; char self_exe[1024];

@ -358,7 +358,7 @@ bool sendRemoteMessage(CSimpleSocket *socket, int16_t id, const MessageLite *msg
uint8_t *pstart = data + sizeof(RPCMessageHeader); uint8_t *pstart = data + sizeof(RPCMessageHeader);
uint8_t *pend = msg->SerializeWithCachedSizesToArray(pstart); uint8_t *pend = msg->SerializeWithCachedSizesToArray(pstart);
assert((pend - pstart) == size); assert((pend - pstart) == size); (void)pend;
int got = socket->Send(data, fullsz); int got = socket->Send(data, fullsz);
delete[] data; delete[] data;

@ -173,7 +173,6 @@ uint32_t Buildings::getNumBuildings()
bool Buildings::Read (const uint32_t index, t_building & building) bool Buildings::Read (const uint32_t index, t_building & building)
{ {
Core & c = Core::getInstance();
df::building *bld = world->buildings.all[index]; df::building *bld = world->buildings.all[index];
building.x1 = bld->x1; building.x1 = bld->x1;
@ -193,12 +192,10 @@ bool Buildings::Read (const uint32_t index, t_building & building)
bool Buildings::ReadCustomWorkshopTypes(map <uint32_t, string> & btypes) bool Buildings::ReadCustomWorkshopTypes(map <uint32_t, string> & btypes)
{ {
vector <building_def *> & bld_def = world->raws.buildings.all; vector <building_def *> & bld_def = world->raws.buildings.all;
uint32_t size = bld_def.size();
btypes.clear(); 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; btypes[temp->id] = temp->code;
} }
return true; return true;

@ -261,7 +261,7 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
case ViewUnits: case ViewUnits:
if (ui_selected_unit) 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"; focus += "/Some";

@ -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 //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. //around. Better to know the moment that becomes a problem.
bool success = disconnectJobGeneralRef(job, ref); bool success = disconnectJobGeneralRef(job, ref);
assert(success); assert(success); (void)success;
vector_erase_at(job->general_refs, 0); vector_erase_at(job->general_refs, 0);
if (ref != NULL) delete ref; if (ref != NULL) delete ref;

@ -470,7 +470,6 @@ public:
{ {
selected_column = 0; selected_column = 0;
auto last_selected_index = burrows_column.highlighted_index;
burrows_column.clear(); burrows_column.clear();
for (df::burrow *burrow : ui->burrows.list) for (df::burrow *burrow : ui->burrows.list)
@ -825,7 +824,6 @@ struct autochop_hook : public df::viewscreen_dwarfmodest
if (dims.menu_x1 <= 0) if (dims.menu_x1 <= 0)
return; return;
df::ui_sidebar_mode d = ui->main.mode;
if (!isInDesignationMenu()) if (!isInDesignationMenu())
return; return;

@ -350,7 +350,6 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame
size_t numItems = world->items.all.size(); size_t numItems = world->items.all.size();
MapCache MC; MapCache MC;
int i = 0;
int dumped_total = 0; int dumped_total = 0;
int cx, cy, cz; int cx, cy, cz;

@ -809,10 +809,6 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
// Reset step count since at this point it has reached 60 // Reset step count since at this point it has reached 60
step_count = 0; 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. // Create a vector of units. This will be populated in the following for loop.
std::vector<df::unit *> dwarfs; std::vector<df::unit *> dwarfs;

@ -794,8 +794,6 @@ static void assign_labor(unit_labor::unit_labor labor,
if (labor_infos[labor].mode() != AUTOMATIC) if (labor_infos[labor].mode() != AUTOMATIC)
return; return;
int best_dwarf = 0;
int best_value = -10000;
int best_skill = 0; int best_skill = 0;
std::vector<int> values(n_dwarfs); std::vector<int> values(n_dwarfs);
@ -804,8 +802,6 @@ static void assign_labor(unit_labor::unit_labor labor,
std::map<int, int> dwarf_skillxp; std::map<int, int> dwarf_skillxp;
std::vector<bool> previously_enabled(n_dwarfs); std::vector<bool> previously_enabled(n_dwarfs);
auto mode = labor_infos[labor].mode();
// Find candidate dwarfs, and calculate a preference value for each dwarf // Find candidate dwarfs, and calculate a preference value for each dwarf
for (int dwarf = 0; dwarf < n_dwarfs; dwarf++) for (int dwarf = 0; dwarf < n_dwarfs; dwarf++)
{ {
@ -1039,9 +1035,6 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
return CR_OK; return CR_OK;
step_count = 0; step_count = 0;
uint32_t race = ui->race_id;
uint32_t civ = ui->civ_id;
std::vector<df::unit *> dwarfs; std::vector<df::unit *> dwarfs;
bool has_butchers = false; 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); df::job_skill_class skill_class = ENUM_ATTR(job_skill, type, skill);
int skill_level = (*s)->rating; 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.) // Track total & highest skill among normal/medical skills. (We don't care about personal or social skills.)

@ -103,7 +103,6 @@ static map< int16_t, vector<MaterialDescriptor> > preferred_materials;
static map< int16_t, df::interface_key > hotkeys; static map< int16_t, df::interface_key > hotkeys;
static bool last_used_moved = false; static bool last_used_moved = false;
static bool auto_choose_materials = true; static bool auto_choose_materials = true;
static bool auto_choose_attempted = true;
static bool revert_to_last_used_type = false; static bool revert_to_last_used_type = false;
static bool allow_future_placement = false; static bool allow_future_placement = false;

@ -141,7 +141,7 @@ struct work_hook : df::building_workshopst{
DEFINE_VMETHOD_INTERPOSE(void, getPowerInfo, (df::power_info *info)) DEFINE_VMETHOD_INTERPOSE(void, getPowerInfo, (df::power_info *info))
{ {
if (auto def = find_def()) if (find_def())
{ {
df::power_info power; df::power_info power;
get_current_power(info); 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) static void setPower(df::building_workshopst* workshop, int power_produced, int power_consumed)
{ {
work_hook* ptr = static_cast<work_hook*>(workshop); work_hook* ptr = static_cast<work_hook*>(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); ptr->set_current_power(power_produced, power_consumed);
} }
@ -431,7 +431,7 @@ static int getPower(lua_State*L)
work_hook* ptr = static_cast<work_hook*>(workshop); work_hook* ptr = static_cast<work_hook*>(workshop);
if (!ptr) if (!ptr)
return 0; 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; df::power_info info;
ptr->get_current_power(&info); ptr->get_current_power(&info);

@ -105,7 +105,6 @@ private:
for (size_t i = 0; i < raws.inorganics.size(); i++) for (size_t i = 0; i < raws.inorganics.size(); i++)
{ {
df::inorganic_raw *p = raws.inorganics[i];
MaterialInfo material; MaterialInfo material;
material.decode(0, i); material.decode(0, i);
addMaterialEntry(selected_category, material, material.toString()); addMaterialEntry(selected_category, material, material.toString());
@ -120,7 +119,6 @@ private:
df::plant_raw *p = raws.plants.all[i]; df::plant_raw *p = raws.plants.all[i];
for (size_t j = 0; p->material.size() > 1 && j < p->material.size(); j++) 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") if (p->material[j]->id != "WOOD")
continue; continue;

@ -182,11 +182,6 @@ command_result changelayer (color_ostream &out, std::vector <std::string> & para
} }
DFCoord cursor (cursorX,cursorY,cursorZ); 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); MapExtras::Block * b = mc.BlockAt(cursor/16);
if(!b || !b->is_valid()) if(!b || !b->is_valid())
{ {

@ -353,8 +353,8 @@ command_result df_createitem (color_ostream &out, vector <string> & parameters)
for (size_t j = 0; j < creature->caste.size(); j++) for (size_t j = 0; j < creature->caste.size(); j++)
{ {
df::caste_raw *caste = creature->caste[j]; df::caste_raw *caste = creature->caste[j];
castes += " " + creature->caste[j]->caste_id; castes += " " + caste->caste_id;
if (creature->caste[j]->caste_id == tokens[1]) if (caste->caste_id == tokens[1])
{ {
mat_type = i; mat_type = i;
mat_index = j; mat_index = j;

@ -604,7 +604,8 @@ static command_result parseRegexParam(std::regex& target,
template<typename Callable1, typename Callable2, typename Callable3> template<typename Callable1, typename Callable2, typename Callable3>
static command_result applyCategoryFilters(color_ostream& out, static command_result applyCategoryFilters(color_ostream& out,
std::vector<std::string>& parameters, std::vector<std::string>& parameters,
size_t pos, Callable1 header, size_t pos,
Callable1 header,
Callable2 categoryMatch, Callable2 categoryMatch,
Callable3 listComplete) Callable3 listComplete)
{ {
@ -626,7 +627,7 @@ static command_result applyCategoryFilters(color_ostream& out,
auto& manager = DebugManager::getInstance(); auto& manager = DebugManager::getInstance();
std::lock_guard<std::mutex> lock(manager.access_mutex_); std::lock_guard<std::mutex> lock(manager.access_mutex_);
out << std::left; out << std::left;
auto guard = header(manager, categoryRegex, pluginRegex); auto VARIABLE_IS_NOT_USED guard = header(manager, categoryRegex, pluginRegex);
for (auto* category: manager) { for (auto* category: manager) {
DebugCategory::cstring_ref p = category->plugin(); DebugCategory::cstring_ref p = category->plugin();
DebugCategory::cstring_ref c = category->category(); DebugCategory::cstring_ref c = category->category();

@ -73,7 +73,7 @@ command_result df_deramp (color_ostream &out, vector <string> & parameters)
Job::removeJob(job); 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++) for (int i = 0; i < blocks_total; i++)
{ {
df::map_block *block = world->map.map_blocks[i]; df::map_block *block = world->map.map_blocks[i];

@ -299,13 +299,13 @@ void Checker::dispatch_primitive(const QueueItem & item, const CheckedStructure
FAIL("invalid value for bool: " << int(val)); FAIL("invalid value for bool: " << int(val));
} }
} }
else if (auto int_id = dynamic_cast<df::integer_identity_base *>(cs.identity)) else if (dynamic_cast<df::integer_identity_base *>(cs.identity))
{ {
check_possible_pointer(item, cs); check_possible_pointer(item, cs);
// TODO check ints? // TODO check ints?
} }
else if (auto float_id = dynamic_cast<df::float_identity_base *>(cs.identity)) else if (dynamic_cast<df::float_identity_base *>(cs.identity))
{ {
// TODO check floats? // TODO check floats?
} }
@ -876,6 +876,7 @@ void Checker::check_stl_string(const QueueItem & item)
ptrdiff_t capacity = (string->ptr - 1)->capacity; ptrdiff_t capacity = (string->ptr - 1)->capacity;
#endif #endif
(void)start;
if (length < 0) if (length < 0)
{ {
FAIL("string length is negative (" << length << ")"); FAIL("string length is negative (" << length << ")");

@ -38,11 +38,7 @@ command_result df_dumpmats (color_ostream &out, vector<string> &parameters)
out.print("\n[MATERIAL:%s] - reconstructed from data extracted from memory\n", mat->id.c_str()); 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}; int32_t def_color[6] = {-1,-1,-1,-1,-1,-1};
bool name_all = false;
bool name_all_solid = false;
string def_name[6]; string def_name[6];
bool adj_all = false;
bool adj_all_solid = false;
string def_adj[6]; string def_adj[6];
int32_t solid_color = mat->state_color[matter_state::Solid]; int32_t solid_color = mat->state_color[matter_state::Solid];

@ -253,7 +253,7 @@ struct Connected : public ClearMem<Connected> {
con[pos] = b->signal.connect( con[pos] = b->signal.connect(
[this](uint32_t) { [this](uint32_t) {
uint32_t old = callee.fetch_add(1); uint32_t old = callee.fetch_add(1);
assert(old != 0xDEDEDEDE); assert(old != 0xDEDEDEDE); (void)old;
std::this_thread::sleep_for(delay); std::this_thread::sleep_for(delay);
assert(callee != 0xDEDEDEDE); assert(callee != 0xDEDEDEDE);
}); });
@ -263,7 +263,7 @@ struct Connected : public ClearMem<Connected> {
b->con[pos] = signal.connect(b, b->con[pos] = signal.connect(b,
[bptr](int) { [bptr](int) {
uint32_t old = bptr->callee.fetch_add(1); uint32_t old = bptr->callee.fetch_add(1);
assert(old != 0xDEDEDEDE); assert(old != 0xDEDEDEDE); (void)old;
std::this_thread::sleep_for(delay); std::this_thread::sleep_for(delay);
assert(bptr->callee != 0xDEDEDEDE); assert(bptr->callee != 0xDEDEDEDE);
}); });
@ -280,7 +280,7 @@ struct Connected : public ClearMem<Connected> {
con[pos] = sig->connect(b, con[pos] = sig->connect(b,
[this](uint32_t) { [this](uint32_t) {
uint32_t old = callee.fetch_add(1); uint32_t old = callee.fetch_add(1);
assert(old != 0xDEDEDEDE); assert(old != 0xDEDEDEDE); (void)old;
std::this_thread::sleep_for(delay); std::this_thread::sleep_for(delay);
assert(callee != 0xDEDEDEDE); assert(callee != 0xDEDEDEDE);
}); });
@ -292,7 +292,7 @@ struct Connected : public ClearMem<Connected> {
con[pos] = b->signal.connect(a, con[pos] = b->signal.connect(a,
[this](uint32_t) { [this](uint32_t) {
uint32_t old = callee.fetch_add(1); uint32_t old = callee.fetch_add(1);
assert(old != 0xDEDEDEDE); assert(old != 0xDEDEDEDE); (void)old;
std::this_thread::sleep_for(delay); std::this_thread::sleep_for(delay);
assert(callee != 0xDEDEDEDE); assert(callee != 0xDEDEDEDE);
}); });
@ -419,7 +419,7 @@ command_result kittens (color_ostream &out, vector <string> & parameters)
"NYAN NYAN NYAN NYAN NYAN NYAN NYAN", "NYAN NYAN NYAN NYAN NYAN NYAN NYAN",
0 0
}; };
const char * kittenz1 []= const char VARIABLE_IS_NOT_USED * kittenz1 []=
{ {
" ____", " ____",
" (. \\", " (. \\",

@ -76,9 +76,7 @@ public:
{ {
size++; size++;
DFCoord cursor (x,y,z); DFCoord cursor (x,y,z);
uint32_t blockX = x / 16;
uint32_t tileX = x % 16; uint32_t tileX = x % 16;
uint32_t blockY = y / 16;
uint32_t tileY = y % 16; uint32_t tileY = y % 16;
MapExtras::Block * b = mc.BlockAt(cursor/16); MapExtras::Block * b = mc.BlockAt(cursor/16);
if(b && b->is_valid()) if(b && b->is_valid())

@ -217,8 +217,6 @@ command_result df_vectors (color_ostream &con, vector <string> & parameters)
return CR_FAILURE; return CR_FAILURE;
} }
uintptr_t pos = start;
const size_t ptr_size = sizeof(void*); const size_t ptr_size = sizeof(void*);
for (uintptr_t pos = start; pos < end; pos += ptr_size) for (uintptr_t pos = start; pos < end; pos += ptr_size)

@ -1282,7 +1282,6 @@ command_result digl (color_ostream &out, vector <string> & parameters)
stack <DFHack::DFCoord> flood; stack <DFHack::DFCoord> flood;
flood.push(xy); flood.push(xy);
int i = 0;
while( !flood.empty() ) while( !flood.empty() )
{ {
DFHack::DFCoord current = flood.top(); DFHack::DFCoord current = flood.top();

@ -68,11 +68,6 @@ int32_t assignJob(color_ostream& out, Edge firstImportantEdge, unordered_map<df:
} }
//out.print("first important edge: (%d,%d,%d) -> (%d,%d,%d)\n", pt1.x,pt1.y,pt1.z, pt2.x,pt2.y,pt2.z); //out.print("first important edge: (%d,%d,%d) -> (%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::coord location;
df::building* building = Buildings::findAtTile(pt2); df::building* building = Buildings::findAtTile(pt2);
df::coord buildingPos = pt2; df::coord buildingPos = pt2;

@ -472,7 +472,7 @@ void findAndAssignInvasionJob(color_ostream& out, void* tickTime) {
yMax *= 16; yMax *= 16;
MapExtras::MapCache cache; MapExtras::MapCache cache;
clock_t t0 = clock(); // clock_t t0 = clock();
clock_t totalEdgeTime = 0; clock_t totalEdgeTime = 0;
int32_t edgesExpanded = 0; int32_t edgesExpanded = 0;
while(!fringe.empty()) { while(!fringe.empty()) {
@ -529,7 +529,7 @@ void findAndAssignInvasionJob(color_ostream& out, void* tickTime) {
} }
delete myEdges; 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); //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(); fringe.clear();

@ -1333,19 +1333,17 @@ namespace embark_assist {
// off to compensate for the list starting with 1 at index 0. // off to compensate for the list starting with 1 at index 0.
// //
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0); auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
int16_t x = screen->location.region_pos.x;
int16_t y = screen->location.region_pos.y;
state->ui[static_cast<int8_t>(fields::x_dim)]->current_display_value = state->ui[static_cast<int8_t>(fields::x_dim)]->current_display_value =
Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0)->location.embark_pos_max.x - screen->location.embark_pos_max.x -
Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0)->location.embark_pos_min.x; screen->location.embark_pos_min.x;
state->ui[static_cast<int8_t>(fields::x_dim)]->current_index = state->ui[static_cast<int8_t>(fields::x_dim)]->current_index =
state->ui[static_cast<int8_t>(fields::x_dim)]->current_display_value; state->ui[static_cast<int8_t>(fields::x_dim)]->current_display_value;
state->ui[static_cast<int8_t>(fields::x_dim)]->current_value = state->ui[static_cast<int8_t>(fields::x_dim)]->current_value =
state->ui[static_cast<int8_t>(fields::x_dim)]->current_display_value + 1; state->ui[static_cast<int8_t>(fields::x_dim)]->current_display_value + 1;
state->ui[static_cast<int8_t>(fields::y_dim)]->current_display_value = state->ui[static_cast<int8_t>(fields::y_dim)]->current_display_value =
Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0)->location.embark_pos_max.y - screen->location.embark_pos_max.y -
Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0)->location.embark_pos_min.y; screen->location.embark_pos_min.y;
state->ui[static_cast<int8_t>(fields::y_dim)]->current_index = state->ui[static_cast<int8_t>(fields::y_dim)]->current_index =
state->ui[static_cast<int8_t>(fields::y_dim)]->current_display_value; state->ui[static_cast<int8_t>(fields::y_dim)]->current_display_value;
state->ui[static_cast<int8_t>(fields::y_dim)]->current_value = state->ui[static_cast<int8_t>(fields::y_dim)]->current_value =

@ -605,8 +605,6 @@ namespace embark_assist {
result.mineral_3 = finder->mineral_3 == -1; result.mineral_3 = finder->mineral_3 == -1;
bool failed_match = false; bool failed_match = false;
const uint16_t embark_size = finder->x_dim * finder->y_dim;
if (finder->biome_count_min != -1 || if (finder->biome_count_min != -1 ||
finder->biome_count_max != -1 || finder->biome_count_max != -1 ||
finder->biome_1 != -1 || finder->biome_1 != -1 ||

@ -2068,7 +2068,6 @@ void embark_assist::survey::survey_region_sites(embark_assist::defs::site_lists
// color_ostream_proxy out(Core::getInstance().getConsole()); // color_ostream_proxy out(Core::getInstance().getConsole());
auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0); auto screen = Gui::getViewscreenByType<df::viewscreen_choose_start_sitest>(0);
df::world_data *world_data = world->world_data; df::world_data *world_data = world->world_data;
int8_t index = 0;
site_list->clear(); site_list->clear();

@ -247,7 +247,6 @@ public:
{ {
df::interface_key key = *iter; df::interface_key key = *iter;
bool is_motion = false; bool is_motion = false;
int dx = 0, dy = 0;
switch (key) switch (key)
{ {
case df::interface_key::CURSOR_UP: case df::interface_key::CURSOR_UP:
@ -481,7 +480,6 @@ public:
virtual void after_render(start_sitest* screen) virtual void after_render(start_sitest* screen)
{ {
GET_EMBARK_POS(screen, x1, x2, y1, y2, width, height); 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_x = prev_x - 1;
int local_y = prev_y - 2; int local_y = prev_y - 2;
if (local_x >= x1 && local_x <= x2 && local_y >= y1 && local_y <= y2) if (local_x >= x1 && local_x <= x2 && local_y >= y1 && local_y <= y2)

@ -56,7 +56,7 @@ command_result df_fixveins (color_ostream &out, vector <string> & parameters)
int mineral_removed = 0, feature_removed = 0; int mineral_removed = 0, feature_removed = 0;
int mineral_added = 0, feature_added = 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++) for (int i = 0; i < blocks_total; i++)
{ {
df::map_block *block = world->map.map_blocks[i]; df::map_block *block = world->map.map_blocks[i];

@ -526,7 +526,6 @@ command_result df_getplants (color_ostream &out, vector <string> & parameters)
{ {
const df::plant *plant = world->plants.all[i]; const df::plant *plant = world->plants.all[i];
df::map_block *cur = Maps::getTileBlock(plant->pos); df::map_block *cur = Maps::getTileBlock(plant->pos);
bool dirty = false;
int x = plant->pos.x % 16; int x = plant->pos.x % 16;
int y = plant->pos.y % 16; int y = plant->pos.y % 16;

@ -72,7 +72,6 @@ static void find_active_keybindings(df::viewscreen *screen)
auto list = Core::getInstance().ListKeyBindings(sym); auto list = Core::getInstance().ListKeyBindings(sym);
for (auto invoke_cmd = list.begin(); invoke_cmd != list.end(); invoke_cmd++) for (auto invoke_cmd = list.begin(); invoke_cmd != list.end(); invoke_cmd++)
{ {
bool add_temp_binding = false;
if (invoke_cmd->find(":") == string::npos) if (invoke_cmd->find(":") == string::npos)
{ {
add_binding_if_valid(sym, *invoke_cmd, screen); add_binding_if_valid(sym, *invoke_cmd, screen);
@ -303,7 +302,6 @@ private:
static command_result hotkeys_cmd(color_ostream &out, vector <string> & parameters) static command_result hotkeys_cmd(color_ostream &out, vector <string> & parameters)
{ {
bool show_help = false;
if (parameters.empty()) if (parameters.empty())
{ {
if (Maps::IsValid()) if (Maps::IsValid())

@ -414,7 +414,7 @@ public:
df::building* bld = get_building_from_job(j); df::building* bld = get_building_from_job(j);
df::building_type type = bld->getType(); df::building_type type = bld->getType();
switch (bld->getType()) switch (type)
{ {
case df::building_type::NONE: case df::building_type::NONE:
return df::unit_labor::NONE; return df::unit_labor::NONE;
@ -513,7 +513,7 @@ public:
} }
debug("LABORMANAGER: Cannot deduce labor for destroy building job of type %s\n", 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(); debug_pause();
return df::unit_labor::NONE; return df::unit_labor::NONE;

@ -75,10 +75,6 @@ void impregnateMany() {
} }
if ( unit->flags1.bits.caged ) if ( unit->flags1.bits.caged )
continue; 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 //must have PET or PET_EXOTIC
if ( !Units::isTamable(unit)) if ( !Units::isTamable(unit))
continue; continue;

@ -650,8 +650,6 @@ command_result prospector (color_ostream &con, vector <string> & parameters)
matdata aquiferTiles; matdata aquiferTiles;
matdata tubeTiles; matdata tubeTiles;
uint32_t vegCount = 0;
for(uint32_t z = 0; z < z_max; z++) for(uint32_t z = 0; z < z_max; z++)
{ {
for(uint32_t b_y = 0; b_y < y_max; b_y++) for(uint32_t b_y = 0; b_y < y_max; b_y++)

@ -72,9 +72,10 @@ void GetBuildingSize(
rad_x_high = world->building_width / 2; rad_x_high = world->building_width / 2;
else else
rad_x_high = (world->building_width / 2) - 1; 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; rad_y_low = world->building_height / 2;
if (widthOdd) if (heightOdd)
rad_y_high = world->building_height / 2; rad_y_high = world->building_height / 2;
else else
rad_y_high = (world->building_height / 2) - 1; rad_y_high = (world->building_height / 2) - 1;
@ -474,7 +475,6 @@ command_result SetSideMenu(DFHack::color_ostream &stream, const DwarfControl::Si
default: default:
break; break;
} }
auto viewScreen = getCurViewscreen();
if (in->has_action()) if (in->has_action())
{ {
switch (in->action()) switch (in->action())

@ -699,7 +699,6 @@ map<DFCoord, uint16_t> spatterHashes;
bool IsspatterChanged(DFCoord pos) bool IsspatterChanged(DFCoord pos)
{ {
df::map_block * block = Maps::getBlock(pos); df::map_block * block = Maps::getBlock(pos);
bool changed = false;
std::vector<df::block_square_event_material_spatterst *> materials; std::vector<df::block_square_event_material_spatterst *> materials;
#if DF_VERSION_INT > 34011 #if DF_VERSION_INT > 34011
std::vector<df::block_square_event_item_spatterst *> items; std::vector<df::block_square_event_item_spatterst *> items;
@ -807,7 +806,7 @@ static command_result GetMaterialList(color_ostream &stream, const EmptyMessage
df::world_raws *raws = &world->raws; df::world_raws *raws = &world->raws;
df::world_history *history = &world->history; // df::world_history *history = &world->history;
MaterialInfo mat; MaterialInfo mat;
for (size_t i = 0; i < raws->inorganics.size(); i++) 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); NetBlock->add_water_stagnant(designation.bits.water_stagnant);
if (gamemode && (*gamemode == game_mode::ADVENTURE)) 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_hidden((TileDigDesignation)designation.bits.dig == TileDigDesignation::NO_DIG || designation.bits.hidden);
NetBlock->add_tile_dig_designation(TileDigDesignation::NO_DIG); NetBlock->add_tile_dig_designation(TileDigDesignation::NO_DIG);
NetBlock->add_tile_dig_designation_marker(false); 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++) for (int xx = 0; xx < width; xx++)
{ {
df::region_map_entry * map_entry = &data->region_map[xx][yy]; 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(); auto regionTile = out->add_region_tiles();
regionTile->set_elevation(map_entry->elevation); regionTile->set_elevation(map_entry->elevation);

@ -535,7 +535,6 @@ coord2d lightingEngineViewscreen::worldToViewportCoord(const coord2d& in,const r
return in-window2d+r.first; 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) void lightingEngineViewscreen::doSun(const lightSource& sky,MapExtras::MapCache& map)
{ {
//TODO fix this mess //TODO fix this mess
@ -673,7 +672,7 @@ void lightingEngineViewscreen::doOcupancyAndLights()
df::tiletype_shape shape = ENUM_ATTR(tiletype,shape,type); df::tiletype_shape shape = ENUM_ATTR(tiletype,shape,type);
bool is_wall=!ENUM_ATTR(tiletype_shape,passable_high,shape); bool is_wall=!ENUM_ATTR(tiletype_shape,passable_high,shape);
bool is_floor=!ENUM_ATTR(tiletype_shape,passable_low,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); df::tiletype_material tileMat= ENUM_ATTR(tiletype,material,type);
DFHack::t_matpair mat=b->staticMaterialAt(gpos); DFHack::t_matpair mat=b->staticMaterialAt(gpos);

@ -51,8 +51,6 @@ private:
rgbf adapt_to_light(const rgbf& light) rgbf adapt_to_light(const rgbf& light)
{ {
const float influence=0.0001f; 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; float intensity=(light.r+light.g+light.b)/3.0;
light_adaptation=intensity*influence+light_adaptation*(1-influence); light_adaptation=intensity*influence+light_adaptation*(1-influence);
float delta=light_adaptation-intensity; float delta=light_adaptation-intensity;
@ -77,7 +75,7 @@ private:
old_opengl* p=reinterpret_cast<old_opengl*>(parent); old_opengl* p=reinterpret_cast<old_opengl*>(parent);
float *fg = p->fg + tile * 4 * 6; float *fg = p->fg + tile * 4 * 6;
float *bg = p->bg + 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]); 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... for (int i = 0; i < 6; i++) { //oh how sse would do wonders here, or shaders...

@ -149,7 +149,7 @@ private:
old_opengl* p=reinterpret_cast<old_opengl*>(parent); old_opengl* p=reinterpret_cast<old_opengl*>(parent);
float *fg = p->fg + tile * 4 * 6; float *fg = p->fg + tile * 4 * 6;
float *bg = p->bg + 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; const float val=1/2.0;
float r=rFloat()*val - val/2; float r=rFloat()*val - val/2;
@ -264,7 +264,7 @@ private:
old_opengl* p=reinterpret_cast<old_opengl*>(parent); old_opengl* p=reinterpret_cast<old_opengl*>(parent);
float *fg = p->fg + tile * 4 * 6; float *fg = p->fg + tile * 4 * 6;
float *bg = p->bg + 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]; rgbf light=lightGrid[tile];
for (int i = 0; i < 6; i++) { for (int i = 0; i < 6; i++) {
*(fg++) *= light.r; *(fg++) *= light.r;
@ -343,7 +343,7 @@ private:
old_opengl* p=reinterpret_cast<old_opengl*>(parent); old_opengl* p=reinterpret_cast<old_opengl*>(parent);
float *fg = p->fg + tile * 4 * 6; float *fg = p->fg + tile * 4 * 6;
float *bg = p->bg + 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 fm=foreMult[tile];
rgbf fo=foreOffset[tile]; rgbf fo=foreOffset[tile];

@ -139,7 +139,6 @@ static int getGridsSize(lua_State* L)
{ {
if(current_mode!=MODE_LUA) if(current_mode!=MODE_LUA)
return -1; return -1;
renderer_lua* r=reinterpret_cast<renderer_lua*>(enabler->renderer);
lua_pushnumber(L,gps->dimx); lua_pushnumber(L,gps->dimx);
lua_pushnumber(L,gps->dimy); lua_pushnumber(L,gps->dimy);
return 2; return 2;

@ -488,8 +488,6 @@ command_result revflood(color_ostream &out, vector<string> & params)
} }
int32_t cx, cy, cz; int32_t cx, cy, cz;
Maps::getSize(x_max,y_max,z_max); 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); Gui::getCursorCoords(cx,cy,cz);
if(cx == -30000) if(cx == -30000)

@ -1400,7 +1400,7 @@ static int proposeUnitHits(lua_State *L)
static int computeNearbyWeight(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, 2, LUA_TTABLE);
luaL_checktype(L, 3, LUA_TTABLE); luaL_checktype(L, 3, LUA_TTABLE);
const char *fname = luaL_optstring(L, 4, "nearby_weight"); 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 target, last_passable;
df::coord tbase = engine->target.first; df::coord tbase = engine->target.first;
df::coord tsize = engine->getTargetSize(); df::coord tsize = engine->getTargetSize();
bool success = false;
for (int i = 0; i < 50; i++) for (int i = 0; i < 50; i++)
{ {
@ -1851,7 +1850,6 @@ struct building_hook : df::building_siegeenginest {
if (auto engine = find_engine(this)) if (auto engine = find_engine(this))
{ {
auto job = jobs[0]; auto job = jobs[0];
bool save_op = false;
bool load_op = false; bool load_op = false;
switch (job->job_type) switch (job->job_type)

@ -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 ); MaterialInfo mat_info = food_mat_by_token ( out, token );
int16_t type = mat_info.type; int16_t type = mat_info.type;
int32_t index = mat_info.index; int32_t index = mat_info.index;
int16_t food_idx2 = -1;
auto it = food_index[mat_category].find ( std::make_pair ( type, index ) ); auto it = food_index[mat_category].find ( std::make_pair ( type, index ) );
if ( it != food_index[mat_category].end() ) if ( it != food_index[mat_category].end() )
{ {

@ -499,7 +499,6 @@ static std::vector<std::string> clean_dfstock_list ( const std::string &path )
static int stockpiles_list_settings ( lua_State *L ) static int stockpiles_list_settings ( lua_State *L )
{ {
auto path = luaL_checkstring ( L, 1 ); auto path = luaL_checkstring ( L, 1 );
color_ostream &out = *Lua::GetOutput ( L );
if ( Filesystem::exists ( path ) && !Filesystem::isdir ( path ) ) if ( Filesystem::exists ( path ) && !Filesystem::isdir ( path ) )
{ {
lua_pushfstring ( L, "stocksettings path invalid: %s", path ); lua_pushfstring ( L, "stocksettings path invalid: %s", path );

@ -77,7 +77,7 @@ struct military_assign_hook : df::viewscreen_layer_militaryst {
int i1 = plist->getFirstVisible(), i2 = plist->getLastVisible(); int i1 = plist->getFirstVisible(), i2 = plist->getLastVisible();
int si = plist->getListCursor(); 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); auto unit = vector_get(positions.candidates, i);
if (!unit || unit->military.squad_id < 0) if (!unit || unit->military.squad_id < 0)

@ -3626,7 +3626,6 @@ static void autobutcher_unbutcherRace(color_ostream &out, unsigned id)
// push autobutcher settings on lua stack // push autobutcher settings on lua stack
static int autobutcher_getSettings(lua_State *L) static int autobutcher_getSettings(lua_State *L)
{ {
color_ostream &out = *Lua::GetOutput(L);
lua_newtable(L); lua_newtable(L);
int ctable = lua_gettop(L); int ctable = lua_gettop(L);
Lua::SetField(L, enable_autobutcher, ctable, "enable_autobutcher"); 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 // push the watchlist vector as nested table on the lua stack
static int autobutcher_getWatchList(lua_State *L) static int autobutcher_getWatchList(lua_State *L)
{ {
color_ostream &out = *Lua::GetOutput(L);
lua_newtable(L); lua_newtable(L);
for(size_t i=0; i<watched_races.size(); i++) for(size_t i=0; i<watched_races.size(); i++)