Skip to content

Commit

Permalink
Clean up some redundant 4dir-related code
Browse files Browse the repository at this point in the history
  • Loading branch information
Wuzzy2 committed Mar 15, 2022
1 parent 6e389be commit 156ad76
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/client/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3469,7 +3469,7 @@ bool Game::nodePlacement(const ItemDefinition &selected_def,
} else if (predicted_f.param_type_2 == CPT2_FACEDIR ||
predicted_f.param_type_2 == CPT2_COLORED_FACEDIR ||
predicted_f.param_type_2 == CPT2_4DIR ||
predicted_f.param_type_2 == CPT2_FACEDIR) {
predicted_f.param_type_2 == CPT2_COLORED_4DIR) {
v3s16 dir = nodepos - floatToInt(client->getEnv().getLocalPlayer()->getPosition(), BS);

if (abs(dir.X) > abs(dir.Z)) {
Expand Down
2 changes: 1 addition & 1 deletion src/mapnode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ void MapNode::rotateAlongYAxis(const NodeDefManager *nodemgr, Rotation rot)
u8 index = facedir * 4 + rot;
param2 &= ~31;
param2 |= rotate_facedir[index];
} else {
} else if (cpt2 == CPT2_4DIR || cpt2 == CPT2_COLORED_4DIR) {
u8 fourdir = param2 & 3;
u8 index = fourdir + rot;
param2 &= ~3;
Expand Down
4 changes: 2 additions & 2 deletions src/nodedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,6 @@ void getNodeBoxUnion(const NodeBox &nodebox, const ContentFeatures &features,
if (features.param_type_2 == CPT2_FACEDIR ||
features.param_type_2 == CPT2_COLORED_FACEDIR ||
features.param_type_2 == CPT2_4DIR ||
features.param_type_2 == CPT2_COLORED_FACEDIR ||
features.param_type_2 == CPT2_COLORED_4DIR) {
// Get maximal coordinate
f32 coords[] = {
Expand Down Expand Up @@ -1702,7 +1701,8 @@ bool NodeDefManager::nodeboxConnects(MapNode from, MapNode to,
f2.param_type_2 == CPT2_COLORED_FACEDIR) {
return (f2.connect_sides
& rot[(connect_face * 4) + (to.param2 & 0x1F)]);
} else {
} else if (f2.param_type_2 == CPT2_4DIR ||
f2.param_type_2 == CPT2_COLORED_4DIR) {
return (f2.connect_sides
& rot[(connect_face * 4) + (to.param2 & 0x03)]);
}
Expand Down

0 comments on commit 156ad76

Please sign in to comment.