Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit acdb369

Browse files
committed
Avoid non-trivial bitfield constructors
1 parent 8521b83 commit acdb369

7 files changed

Lines changed: 15 additions & 13 deletions

File tree

library/include/modules/MapCache.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ class DFHACK_EXPORT MapCache
542542
df::tile_designation designationAt (DFCoord tilecoord)
543543
{
544544
Block * b= BlockAtTile(tilecoord);
545-
return b ? b->DesignationAt(tilecoord) : df::tile_designation(0);
545+
return b ? b->DesignationAt(tilecoord) : df::tile_designation();
546546
}
547547
bool setDesignationAt (DFCoord tilecoord, df::tile_designation des)
548548
{
@@ -554,7 +554,7 @@ class DFHACK_EXPORT MapCache
554554
df::tile_occupancy occupancyAt (DFCoord tilecoord)
555555
{
556556
Block * b= BlockAtTile(tilecoord);
557-
return b ? b->OccupancyAt(tilecoord) : df::tile_occupancy(0);
557+
return b ? b->OccupancyAt(tilecoord) : df::tile_occupancy();
558558
}
559559
bool setOccupancyAt (DFCoord tilecoord, df::tile_occupancy occ)
560560
{

library/modules/Gui.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,16 +1303,16 @@ bool Gui::addCombatReportAuto(df::unit *unit, df::announcement_flags mode, int r
13031303

13041304
void Gui::showAnnouncement(std::string message, int color, bool bright)
13051305
{
1306-
df::announcement_flags mode(0);
1306+
df::announcement_flags mode;
13071307
mode.bits.D_DISPLAY = mode.bits.A_DISPLAY = true;
13081308

1309-
makeAnnouncement(df::announcement_type(0), mode, df::coord(), message, color, bright);
1309+
makeAnnouncement(df::announcement_type(), mode, df::coord(), message, color, bright);
13101310
}
13111311

13121312
void Gui::showZoomAnnouncement(
13131313
df::announcement_type type, df::coord pos, std::string message, int color, bool bright
13141314
) {
1315-
df::announcement_flags mode(0);
1315+
df::announcement_flags mode;
13161316
mode.bits.D_DISPLAY = mode.bits.A_DISPLAY = true;
13171317

13181318
makeAnnouncement(type, mode, pos, message, color, bright);
@@ -1335,7 +1335,7 @@ void Gui::showAutoAnnouncement(
13351335
) {
13361336
using df::global::announcements;
13371337

1338-
df::announcement_flags flags(0);
1338+
df::announcement_flags flags;
13391339
flags.bits.D_DISPLAY = flags.bits.A_DISPLAY = true;
13401340

13411341
if (is_valid_enum_item(type) && announcements)

library/modules/Maps.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ df::map_block *Maps::ensureTileBlock (int32_t x, int32_t y, int32_t z)
195195
slot->map_pos.z = z;
196196

197197
// Assume sky
198-
df::tile_designation dsgn(0);
198+
df::tile_designation dsgn;
199199
dsgn.bits.light = true;
200200
dsgn.bits.outside = true;
201201

plugins/building-hacks.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,9 @@ static int addBuilding(lua_State* L)
391391
int y=lua_tonumber(L,-1);
392392
lua_pop(L,1);
393393

394-
newDefinition.connections.can_connect.push_back(-1);//TODO add this too...
394+
df::machine_conn_modes modes;
395+
modes.whole = -1;
396+
newDefinition.connections.can_connect.push_back(modes);//TODO add this too...
395397
newDefinition.connections.tiles.push_back(df::coord(x,y,0));
396398

397399
lua_pop(L,1);

plugins/burrows.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,8 @@ static bool setTilesByKeyword(df::burrow *target, std::string name, bool enable)
547547
{
548548
CHECK_NULL_POINTER(target);
549549

550-
df::tile_designation mask(0);
551-
df::tile_designation value(0);
550+
df::tile_designation mask;
551+
df::tile_designation value;
552552

553553
if (name == "ABOVE_GROUND")
554554
mask.bits.subterranean = true;

plugins/stocks.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1198,7 +1198,7 @@ class ViewscreenStocks : public dfhack_viewscreen
11981198
if (state_to_apply == -1)
11991199
state_to_apply = (item->flags.whole & flags.whole) ? 0 : 1;
12001200

1201-
grouped_entry->setFlags(flags.whole, state_to_apply);
1201+
grouped_entry->setFlags(flags, state_to_apply);
12021202
}
12031203
}
12041204

plugins/workflow.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ static ItemConstraint *get_constraint(color_ostream &out, const std::string &str
793793
if (item.subtype >= 0)
794794
weight += 10000;
795795

796-
df::dfhack_material_category mat_mask(0);
796+
df::dfhack_material_category mat_mask;
797797
std::string maskstr = vector_get(tokens,1);
798798
if (!maskstr.empty() && !parseJobMaterialCategory(&mat_mask, maskstr)) {
799799
out.printerr("Cannot decode material mask: %s\n", maskstr.c_str());
@@ -1031,7 +1031,7 @@ static int cbEnumJobOutputs(lua_State *L)
10311031

10321032
lua_settop(L, 6);
10331033

1034-
df::dfhack_material_category mat_mask(0);
1034+
df::dfhack_material_category mat_mask;
10351035
if (!lua_isnil(L, 3))
10361036
Lua::CheckDFAssign(L, &mat_mask, 3);
10371037

0 commit comments

Comments
 (0)