diff options
| author | jacob1 <jfu614@gmail.com> | 2012-12-07 00:51:33 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2012-12-07 00:51:33 (GMT) |
| commit | 226de5b6f88c95a4f76675be067de1af5de13902 (patch) | |
| tree | 30a4437815ac04f762c1e926a9eaec337835067c /src/simulation/elements/PRTO.cpp | |
| parent | a15372afbfce1dcb500541fa36ee0724023f1ac3 (diff) | |
| download | powder-226de5b6f88c95a4f76675be067de1af5de13902.zip powder-226de5b6f88c95a4f76675be067de1af5de13902.tar.gz | |
add back element descriptions in some cpp files, fix minor TRON search problem. Also,
TPT-jacksonmj: Also fix bugs with energy particles that pass directly from PIPE to portal
Diffstat (limited to 'src/simulation/elements/PRTO.cpp')
| -rw-r--r-- | src/simulation/elements/PRTO.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/simulation/elements/PRTO.cpp b/src/simulation/elements/PRTO.cpp index b4554ec..4a51657 100644 --- a/src/simulation/elements/PRTO.cpp +++ b/src/simulation/elements/PRTO.cpp @@ -46,6 +46,14 @@ Element_PRTO::Element_PRTO() Graphics = &Element_PRTO::graphics; } +/*these are the count values of where the particle gets stored, depending on where it came from + 0 1 2 + 7 . 3 + 6 5 4 + PRTO does (count+4)%8, so that it will come out at the opposite place to where it came in + PRTO does +/-1 to the count, so it doesn't jam as easily +*/ + //#TPT-Directive ElementHeader Element_PRTO static int update(UPDATE_FUNC_ARGS) int Element_PRTO::update(UPDATE_FUNC_ARGS) { @@ -114,7 +122,17 @@ int Element_PRTO::update(UPDATE_FUNC_ARGS) sim->fighters[(unsigned char)parts[np].tmp].spwn = 0; sim->fighters[(unsigned char)sim->portalp[parts[i].tmp][randomness][nnx].tmp].spwn = 1; } - parts[np] = sim->portalp[parts[i].tmp][randomness][nnx]; + if (sim->portalp[parts[i].tmp][randomness][nnx].vx == 0.0f && sim->portalp[parts[i].tmp][randomness][nnx].vy == 0.0f) + { + // particles that have passed from PIPE into PRTI have lost their velocity, so use the velocity of the newly created particle if the particle in the portal has no velocity + float tmp_vx = parts[np].vx; + float tmp_vy = parts[np].vy; + parts[np] = sim->portalp[parts[i].tmp][randomness][nnx]; + parts[np].vx = tmp_vx; + parts[np].vy = tmp_vy; + } + else + parts[np] = sim->portalp[parts[i].tmp][randomness][nnx]; parts[np].x = x+rx; parts[np].y = y+ry; sim->portalp[parts[i].tmp][randomness][nnx] = sim->emptyparticle; |
