Better belts removal
This commit is contained in:
parent
e1bd2b7359
commit
b963bfb503
1 changed files with 21 additions and 23 deletions
|
|
@ -1494,29 +1494,27 @@ namespace gmtk
|
|||
sink(*map_.world, belt[3], belt[2]);
|
||||
|
||||
auto & index = map_.world->index<path_index>();
|
||||
for (int i = 0; i < 3; ++i)
|
||||
|
||||
ecs::handle e[4];
|
||||
for (int i = 0; i <= 3; ++i)
|
||||
e[i] = index.get(belt[i]);
|
||||
|
||||
auto & sv = map_.world->get(e[0]).get<path_vertex>();
|
||||
|
||||
if (sv.belts_to.contains(e[1]))
|
||||
{
|
||||
auto p = belt[i];
|
||||
auto q = belt[i + 1];
|
||||
|
||||
auto s = index.get(p);
|
||||
auto t = index.get(q);
|
||||
|
||||
auto & sv = map_.world->get(s).get<path_vertex>();
|
||||
|
||||
if (sv.belts_to.contains(t))
|
||||
{
|
||||
remove_belt(*map_.world, s, t);
|
||||
if (tutorial_state_ <= 1)
|
||||
tutorial_state_ = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (remove_belt(*map_.world, t, s))
|
||||
if (tutorial_state_ <= 1)
|
||||
tutorial_state_ = 2;
|
||||
add_belt(*map_.world, s, t);
|
||||
}
|
||||
for (int i = 0; i < 3; ++i)
|
||||
remove_belt(*map_.world, e[i], e[i + 1]);
|
||||
}
|
||||
else if (sv.belts_from.contains(e[1]))
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
remove_belt(*map_.world, e[i + 1], e[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < 3; ++i)
|
||||
add_belt(*map_.world, e[i], e[i + 1]);
|
||||
}
|
||||
|
||||
if (tutorial_state_ <= 0)
|
||||
|
|
@ -2049,7 +2047,7 @@ namespace gmtk
|
|||
if (map_.world->get(e0).get<path_vertex>().belts_to.contains(e1))
|
||||
c = {244, 160, 160, 255};
|
||||
else if (map_.world->get(e0).get<path_vertex>().belts_from.contains(e1))
|
||||
c = {244, 244, 160, 255};
|
||||
c = {244, 160, 160, 255};
|
||||
|
||||
float w = 0.25f * std::pow(3.f, 1.f - selected_->level) / 2.f;
|
||||
painter_.line(selected_->center(), belt_start_->center(), w, c, true);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue