From acdb369aa8479edbfbd4e30327876ad7592ff870 Mon Sep 17 00:00:00 2001 From: David Corbett Date: Fri, 9 Dec 2016 13:41:14 -0500 Subject: [PATCH] Avoid non-trivial bitfield constructors --- library/include/modules/MapCache.h | 4 ++-- library/modules/Gui.cpp | 8 ++++---- library/modules/Maps.cpp | 2 +- plugins/building-hacks.cpp | 4 +++- plugins/burrows.cpp | 4 ++-- plugins/stocks.cpp | 2 +- plugins/workflow.cpp | 4 ++-- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/library/include/modules/MapCache.h b/library/include/modules/MapCache.h index b64cc7859..0048f5bd9 100644 --- a/library/include/modules/MapCache.h +++ b/library/include/modules/MapCache.h @@ -542,7 +542,7 @@ class DFHACK_EXPORT MapCache df::tile_designation designationAt (DFCoord tilecoord) { Block * b= BlockAtTile(tilecoord); - return b ? b->DesignationAt(tilecoord) : df::tile_designation(0); + return b ? b->DesignationAt(tilecoord) : df::tile_designation(); } bool setDesignationAt (DFCoord tilecoord, df::tile_designation des) { @@ -554,7 +554,7 @@ class DFHACK_EXPORT MapCache df::tile_occupancy occupancyAt (DFCoord tilecoord) { Block * b= BlockAtTile(tilecoord); - return b ? b->OccupancyAt(tilecoord) : df::tile_occupancy(0); + return b ? b->OccupancyAt(tilecoord) : df::tile_occupancy(); } bool setOccupancyAt (DFCoord tilecoord, df::tile_occupancy occ) { diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 2cc955d63..9a86e69ec 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -1303,16 +1303,16 @@ bool Gui::addCombatReportAuto(df::unit *unit, df::announcement_flags mode, int r void Gui::showAnnouncement(std::string message, int color, bool bright) { - df::announcement_flags mode(0); + df::announcement_flags mode; mode.bits.D_DISPLAY = mode.bits.A_DISPLAY = true; - makeAnnouncement(df::announcement_type(0), mode, df::coord(), message, color, bright); + makeAnnouncement(df::announcement_type(), mode, df::coord(), message, color, bright); } void Gui::showZoomAnnouncement( df::announcement_type type, df::coord pos, std::string message, int color, bool bright ) { - df::announcement_flags mode(0); + df::announcement_flags mode; mode.bits.D_DISPLAY = mode.bits.A_DISPLAY = true; makeAnnouncement(type, mode, pos, message, color, bright); @@ -1335,7 +1335,7 @@ void Gui::showAutoAnnouncement( ) { using df::global::announcements; - df::announcement_flags flags(0); + df::announcement_flags flags; flags.bits.D_DISPLAY = flags.bits.A_DISPLAY = true; if (is_valid_enum_item(type) && announcements) diff --git a/library/modules/Maps.cpp b/library/modules/Maps.cpp index e56ae3109..e9674437a 100644 --- a/library/modules/Maps.cpp +++ b/library/modules/Maps.cpp @@ -195,7 +195,7 @@ df::map_block *Maps::ensureTileBlock (int32_t x, int32_t y, int32_t z) slot->map_pos.z = z; // Assume sky - df::tile_designation dsgn(0); + df::tile_designation dsgn; dsgn.bits.light = true; dsgn.bits.outside = true; diff --git a/plugins/building-hacks.cpp b/plugins/building-hacks.cpp index 483082c67..bc989df30 100644 --- a/plugins/building-hacks.cpp +++ b/plugins/building-hacks.cpp @@ -391,7 +391,9 @@ static int addBuilding(lua_State* L) int y=lua_tonumber(L,-1); lua_pop(L,1); - newDefinition.connections.can_connect.push_back(-1);//TODO add this too... + df::machine_conn_modes modes; + modes.whole = -1; + newDefinition.connections.can_connect.push_back(modes);//TODO add this too... newDefinition.connections.tiles.push_back(df::coord(x,y,0)); lua_pop(L,1); diff --git a/plugins/burrows.cpp b/plugins/burrows.cpp index 87adbe734..69325331e 100644 --- a/plugins/burrows.cpp +++ b/plugins/burrows.cpp @@ -547,8 +547,8 @@ static bool setTilesByKeyword(df::burrow *target, std::string name, bool enable) { CHECK_NULL_POINTER(target); - df::tile_designation mask(0); - df::tile_designation value(0); + df::tile_designation mask; + df::tile_designation value; if (name == "ABOVE_GROUND") mask.bits.subterranean = true; diff --git a/plugins/stocks.cpp b/plugins/stocks.cpp index 8565c703f..3c7193701 100644 --- a/plugins/stocks.cpp +++ b/plugins/stocks.cpp @@ -1198,7 +1198,7 @@ private: if (state_to_apply == -1) state_to_apply = (item->flags.whole & flags.whole) ? 0 : 1; - grouped_entry->setFlags(flags.whole, state_to_apply); + grouped_entry->setFlags(flags, state_to_apply); } } diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index 18090afc6..55f1dc504 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -793,7 +793,7 @@ static ItemConstraint *get_constraint(color_ostream &out, const std::string &str if (item.subtype >= 0) weight += 10000; - df::dfhack_material_category mat_mask(0); + df::dfhack_material_category mat_mask; std::string maskstr = vector_get(tokens,1); if (!maskstr.empty() && !parseJobMaterialCategory(&mat_mask, maskstr)) { out.printerr("Cannot decode material mask: %s\n", maskstr.c_str()); @@ -1031,7 +1031,7 @@ static int cbEnumJobOutputs(lua_State *L) lua_settop(L, 6); - df::dfhack_material_category mat_mask(0); + df::dfhack_material_category mat_mask; if (!lua_isnil(L, 3)) Lua::CheckDFAssign(L, &mat_mask, 3);