Skip to content

Commit

Permalink
Merge branch 'develop' into testing
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 committed Sep 22, 2024
2 parents bb380ba + 0ad1fd5 commit 1deac1d
Show file tree
Hide file tree
Showing 27 changed files with 63 additions and 106 deletions.
24 changes: 20 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,27 @@ if(MSVC)
# see https://msdn.microsoft.com/en-us/library/074af4b6.aspx
add_compile_options("/wd4503")

# suppress C4267 - VC++ complains whenever we implicitly convert an integer to
# a smaller type, and most of the time this is just conversion from 64 to 32 bits
# for things like vector sizes, which are never that big anyway.
# suppress C4267 - VC++ considers a narrowing conversion from size_t to a smaller
# integer type a warning. this is technically correct but there are so many instances
# of this that we don't want to fix, so....
add_compile_options("/wd4267")

# suppress C4251 - VC++ will warn when exporting an entire class which contains members
# referencing unexported compound types as this is potentially unsafe. because we don't
# guarantee a stable ABI for exports, we don't really care about this, and so we choose to
# be lazy and continue to export entire classes instead of exporting on a method-by-method basis
add_compile_options("/wd4251")

# suppress C4068 - VC++ will warn for unknown pragmas by default. this is equivalent to gcc
# -Wno-unknown-pragmas (which is enabled for gcc below).
# we could work around this with sufficiently complex macros
add_compile_options("/wd4068")

# suppress C4244 - VC++ warns by default (with /W3) about narrowing conversions that may lose data
# (such as double -> int or int32_t -> int16_t). dfhack has many of these, mostly related to Lua
# this is equivalent to gcc -Wno_conversions which is the default as gcc -Wall doesn't enable -Wconversions
add_compile_options("/wd4244")

# MSVC panics if an object file contains more than 65,279 sections. this
# happens quite frequently with code that uses templates, such as vectors.
add_compile_options("/bigobj")
Expand Down Expand Up @@ -224,7 +240,7 @@ if(UNIX)
# default to hidden symbols
# ensure compatibility with older CPUs
add_definitions(-DLINUX_BUILD)
set(GCC_COMMON_FLAGS "-fvisibility=hidden -mtune=generic -Wall -Werror -Wl,--disable-new-dtags")
set(GCC_COMMON_FLAGS "-fvisibility=hidden -mtune=generic -Wall -Werror -Wl,--disable-new-dtags -Wno-unknown-pragmas")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_COMMON_FLAGS}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${GCC_COMMON_FLAGS}")
if(DFHACK_BUILD_64)
Expand Down
14 changes: 7 additions & 7 deletions data/blueprints/dreamfort.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2132,11 +2132,11 @@ build3/services_build3

"#zone label(services_zones) start(18; 18) hidden() message(Don't forget to assign a doctor to the hospital!
If you'd like to fill your wells via bucket brigade instead of routing water (e.g. with the aquifer_tap library blueprint), activate the inactive pond zones one level down from where the wells will be built.) garbage dump, hospital, taverrn, barracks, archery range, and pond zones"
,,,,,,,,,,,,,"j{name=""Jail 1""}(4x5)",,,,"j{name=""Jail 2""}(4x5)",,,,"j{name=""Jail 3""}(4x5)",,,,"j{name=""Jail 4""}(4x5)",,,,"j{name=""Jail 5""}(4x5)"
,"b{location=tavern/bigpub name=""Rented room 1""}(1x3)","b{location=tavern/bigpub name=""Rented room 2""}(1x3)","b{location=tavern/bigpub name=""Rented room 3""}(1x3)",,"b{location=tavern/bigpub name=""Rented room 4""}(1x3)","b{location=tavern/bigpub name=""Rented room 5""}(1x3)","b{location=tavern/bigpub name=""Rented room 6""}(1x3)",,"b{location=tavern/bigpub name=""Rented room 7""}(1x3)","b{location=tavern/bigpub name=""Rented room 8""}(1x3)","b{location=tavern/bigpub name=""Rented room 9""}(1x3)",,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
"h{location=tavern/bigpub allow=residents name=""Grand hall tavern""}(13x31)",,`,,,,`,,,,`,,,,`,,,,`,,,,`,,,,`,,,,`
,,,,,,,,,,,,j/jail1,"j/jail1{name=""Jail 1""}(4x5)",j/jail1,j/jail1,j/jail1,"j{name=""Jail 2""}(4x5)",,,,"j{name=""Jail 3""}(4x5)",,,,"j{name=""Jail 4""}(4x5)",,,,"j{name=""Jail 5""}(4x5)"
,"b{location=tavern/bigpub name=""Rented room 1""}(1x3)","b{location=tavern/bigpub name=""Rented room 2""}(1x3)","b{location=tavern/bigpub name=""Rented room 3""}(1x3)",,"b{location=tavern/bigpub name=""Rented room 4""}(1x3)","b{location=tavern/bigpub name=""Rented room 5""}(1x3)","b{location=tavern/bigpub name=""Rented room 6""}(1x3)",,"b{location=tavern/bigpub name=""Rented room 7""}(1x3)","b{location=tavern/bigpub name=""Rented room 8""}(1x3)","b{location=tavern/bigpub name=""Rented room 9""}(1x3)",j/jail1,j/jail1,j/jail1,j/jail1,j/jail1,`,`,`,,`,`,`,,`,`,`,,`,`,`
,`,`,`,,`,`,`,,`,`,`,j/jail1,j/jail1,j/jail1,j/jail1,j/jail1,`,`,`,,`,`,`,,`,`,`,,`,`,`
,`,`,`,,`,`,`,,`,`,`,j/jail1,j/jail1,j/jail1,j/jail1,j/jail1,`,`,`,,`,`,`,,`,`,`,,`,`,`
"h{location=tavern/bigpub allow=residents name=""Grand hall tavern""}(13x31)",,`,,,,`,,,,`,,,j/jail1,j/jail1,j/jail1,j/jail1,,`,,,,`,,,,`,,,,`
,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`
,`,`,`,`,`,`,`,`,`,`,`,,,,,,,,,,,,,,`,o/interrogation,o/interrogation,o/interrogation,o/interrogation,o/interrogation,o/interrogation,o/interrogation
,`,`,`,`,`,`,`,`,`,`,`,,"B{name=""Marksdwarf barracks""}a{name=""Shooting gallery"" shoot_from=""south""}",Ba,Ba,Ba,Ba,Ba,Ba,Ba,Ba,Ba,Ba,,`,o/interrogation,"j{name=""Drunk tank""}",j,j,j,j,o/interrogation
Expand Down Expand Up @@ -2360,7 +2360,7 @@ Assign a minecart to the training ammo quantum dump with ""assign-minecarts all"

,`,b,`,,`,b,`,,`,b,`,,`,`,`,,`,`,`,,t,l,b,,`,`,`,,`,`,`
,`,h,`,,`,h,`,,`,h,`,,`,`,`,,`,`,`,,c,v,`,,`,`,`,,`,`,`
,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
,`,f,`,,`,f,`,,`,f,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
,,`,,,,`,,,,`,,,,`,,,,`,,,,d,,,,`,,,,`
,`,`,`,`,`,`,`,`,`,`,`,,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`
,`,`,`,`,`,`,`,`,`,`,`,,,,,,,,,,,,,,`
Expand Down Expand Up @@ -2468,7 +2468,7 @@ Assign a minecart to the training ammo quantum dump with ""assign-minecarts all"

,b,~,b,,b,~,b,,b,~,b,,t,l,b,,t,l,b,,~,~,~,,t,l,b,,t,l,b
,h,~,h,,h,~,h,,h,~,h,,c,v,`,,c,v,`,,~,~,`,,c,v,`,,c,v,`
,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
,f,~,f,,f,~,f,,f,~,f,,`,`,`,,`,`,`,,`,`,`,,`,`,`,,`,`,`
,,d,,,,d,,,,d,,,,d,,,,d,,,,~,,,,d,,,,d
,`,`,`,s,`,`,`,s,`,`,`,,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`,`
,`,`,`,`,`,`,`,`,`,`,`,,,,,,,,,,,,,,`
Expand Down
2 changes: 1 addition & 1 deletion depends/clsocket
Submodule clsocket updated 1 files
+2 −0 src/SimpleSocket.h
2 changes: 2 additions & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Template for new versions:
## New Features

## Fixes
- `preserve-rooms`: don't reserve a room for citizens that you expel from the fort
- `autobutcher`: fix regression in ordering of butcherable animals

## Misc Improvements

Expand Down
2 changes: 0 additions & 2 deletions library/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,10 @@ set(MAIN_HEADERS
include/Memory.h
include/MiscUtils.h
include/Module.h
include/Pragma.h
include/MemAccess.h
include/ModuleFactory.h
include/PluginManager.h
include/PluginStatics.h
include/Pragma.h
include/RemoteClient.h
include/RemoteServer.h
include/RemoteTools.h
Expand Down
1 change: 0 additions & 1 deletion library/include/BitArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ distribution.
*/

#pragma once
#include "Pragma.h"
#include "Export.h"
#include "Error.h"
#include <stdint.h>
Expand Down
1 change: 0 additions & 1 deletion library/include/ColorText.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ distribution.
*/

#pragma once
#include "Pragma.h"
#include "Export.h"

#include <list>
Expand Down
1 change: 0 additions & 1 deletion library/include/Console.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ distribution.
*/

#pragma once
#include "Pragma.h"
#include "Export.h"
#include "ColorText.h"
#include <atomic>
Expand Down
2 changes: 0 additions & 2 deletions library/include/Core.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ distribution.

#pragma once

#include "Pragma.h"

#include "Console.h"
#include "Export.h"
#include "Hooks.h"
Expand Down
1 change: 0 additions & 1 deletion library/include/Error.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ distribution.

#include "Export.h"
#include "MiscUtils.h"
#include "Pragma.h"

namespace DFHack
{
Expand Down
3 changes: 0 additions & 3 deletions library/include/Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,5 @@ distribution.
#define _FILE_OFFSET_BITS 64
#endif

// one file for telling the MSVC compiler where it can shove its pointless warnings
#include "Pragma.h"

// C99 integer types
#include <stdint.h>
1 change: 0 additions & 1 deletion library/include/MemAccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ distribution.
#ifndef PROCESS_H_INCLUDED
#define PROCESS_H_INCLUDED

#include "Pragma.h"
#include "Export.h"
#include <iostream>
#include <cstring>
Expand Down
65 changes: 0 additions & 65 deletions library/include/Pragma.h

This file was deleted.

1 change: 0 additions & 1 deletion library/include/RemoteClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ distribution.
*/

#pragma once
#include "Pragma.h"
#include "Export.h"
#include "ColorText.h"
#include "Core.h"
Expand Down
1 change: 0 additions & 1 deletion library/include/RemoteServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ distribution.
*/

#pragma once
#include "Pragma.h"
#include "Export.h"
#include "RemoteClient.h"
#include "Core.h"
Expand Down
1 change: 0 additions & 1 deletion library/include/RemoteTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ distribution.
*/

#pragma once
#include "Pragma.h"
#include "Export.h"
#include "RemoteServer.h"

Expand Down
1 change: 0 additions & 1 deletion library/include/TileTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ distribution.

#pragma once

#include "Pragma.h"
#include "Export.h"
#include "DataDefs.h"

Expand Down
1 change: 0 additions & 1 deletion library/include/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ distribution.

#include <algorithm>

#include "Pragma.h"
#include "Export.h"

#include "DataDefs.h"
Expand Down
1 change: 0 additions & 1 deletion library/include/VersionInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ distribution.
#include <vector>

#include "Export.h"
#include "Pragma.h"

namespace DFHack
{
Expand Down
1 change: 0 additions & 1 deletion library/include/VersionInfoFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ distribution.

#include <memory>

#include "Pragma.h"
#include "Export.h"

class TiXmlElement;
Expand Down
6 changes: 3 additions & 3 deletions library/modules/Units.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ bool Units::isGay(df::unit *unit) {
if (!unit->status.current_soul)
return false;

auto &o_flag = unit->status.current_soul->orientation_flags;
return (!isFemale(unit) || !(o_flag.bits.marry_male && o_flag.bits.romance_male))
&& (!isMale(unit) || !(o_flag.bits.marry_female && o_flag.bits.romance_female));
df::orientation_flags orientation = unit->status.current_soul->orientation_flags;
return (!Units::isFemale(unit) || !(orientation.whole & (orientation.mask_marry_male | orientation.mask_romance_male)))
&& (!Units::isMale(unit) || !(orientation.whole & (orientation.mask_marry_female | orientation.mask_romance_female)));
}

bool Units::isNaked(df::unit *unit, bool no_items) {
Expand Down
4 changes: 2 additions & 2 deletions plugins/autobutcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ static void doMarkForSlaughter(df::unit *unit) {
unit->flags2.bits.slaughter = 1;
}

// returns true if a should be butchered before b
// returns true if b should be butchered before a
static bool compareKids(df::unit *a, df::unit *b) {
if (isHighPriority(a) != isHighPriority(b))
return isHighPriority(b);
Expand All @@ -222,7 +222,7 @@ static bool compareKids(df::unit *a, df::unit *b) {
return Units::getAge(a, true) > Units::getAge(b, true);
}

// returns true if a should be butchered before b
// returns true if b should be butchered before a
static bool compareAdults(df::unit* a, df::unit* b) {
if (isHighPriority(a) != isHighPriority(b))
return isHighPriority(b);
Expand Down
2 changes: 1 addition & 1 deletion plugins/plant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ command_result df_createplant(color_ostream &out, const df::coord &pos, const pl

auto des = Maps::getTileDesignation(pos);
CHECK_NULL_POINTER(des);
if (des->bits.flow_size > (des->bits.liquid_type == tile_liquid::Magma ? 0 : 3))
if (des->bits.flow_size > (des->bits.liquid_type == tile_liquid::Magma ? 0U : 3U))
{
out.printerr("Can't create plant: Too much liquid!\n");
return CR_FAILURE;
Expand Down
25 changes: 24 additions & 1 deletion plugins/preserve-rooms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
#include "modules/Units.h"
#include "modules/World.h"

#include "df/army.h"
#include "df/army_controller.h"
#include "df/building_civzonest.h"
#include "df/historical_figure.h"
#include "df/historical_figure_info.h"
#include "df/histfig_hf_link.h"
#include "df/state_profilest.h"
#include "df/unit.h"
#include "df/world.h"

Expand Down Expand Up @@ -404,6 +408,15 @@ static void scrub_reservations(color_ostream &out) {
pending_reassignment.erase(hfid);
}

static bool was_expelled(df::historical_figure *hf) {
if (!hf || !hf->info || !hf->info->whereabouts)
return false;
auto army = df::army::find(hf->info->whereabouts->army_id);
if (!army || !army->controller)
return false;
return army->controller->goal == df::army_controller_goal_type::MOVE_TO_SITE;
}

// handles when units disappear from their assignments compared to the last scan
static void handle_missing_assignments(color_ostream &out,
const unordered_set<int32_t> & active_unit_ids,
Expand All @@ -421,6 +434,10 @@ static void handle_missing_assignments(color_ostream &out,
int32_t hfid = it->second.first;
int32_t spouse_hfid = it->second.second;
auto hf = df::historical_figure::find(hfid);
if (!hf) {
// if the historical figure was culled, bail
continue;
}
auto unit = df::unit::find(hf->unit_id);
if (!unit) {
// if unit data is completely gone, then they're not likely to come back
Expand All @@ -430,8 +447,14 @@ static void handle_missing_assignments(color_ostream &out,
// unit is still alive on the map; assume the unassigment was intentional/expected
continue;
}
if (!Units::isCitizen(unit, true) && !Units::isResident(unit, true))
if (!Units::isCitizen(unit, true) && !Units::isResident(unit, true)) {
// ignore units that are not members of the fort
continue;
}
if (was_expelled(hf)) {
// ignore expelled units
continue;
}
auto zone = virtual_cast<df::building_civzonest>(df::building::find(zone_id));
if (!zone)
continue;
Expand Down
2 changes: 1 addition & 1 deletion plugins/regrass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static bool valid_tile(color_ostream &out, regrass_options options, df::map_bloc
TRACE(log, out).print("Invalid tile: Tree\n");
return false; // Not ground tile.
}
else if (des.bits.flow_size > (des.bits.liquid_type == tile_liquid::Magma ? 0 : 3))
else if (des.bits.flow_size > (des.bits.liquid_type == tile_liquid::Magma ? 0U : 3U))
{ // Under water/magma (df::plant_raw::shrub_drown_level is usually 4).
TRACE(log, out).print("Invalid tile: Liquid\n");
return false;
Expand Down
2 changes: 1 addition & 1 deletion plugins/stonesense
Submodule stonesense updated 1 files
+1 −1 TileCondition.h
2 changes: 1 addition & 1 deletion scripts
Submodule scripts updated 1 files
+2 −3 necronomicon.lua

0 comments on commit 1deac1d

Please sign in to comment.