aboutsummaryrefslogtreecommitdiff
path: root/pmpd3d_various.c
diff options
context:
space:
mode:
Diffstat (limited to 'pmpd3d_various.c')
-rw-r--r--pmpd3d_various.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pmpd3d_various.c b/pmpd3d_various.c
index 5b1915c..912dd00 100644
--- a/pmpd3d_various.c
+++ b/pmpd3d_various.c
@@ -469,13 +469,13 @@ void pmpd3d_forcesXT(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
{
if ( argc == 1 ) // apply forces on all masses
{
- j = max(x->nb_mass, npoints);
+ j = min(x->nb_mass, npoints);
for (i=0; i< j; i++)
{
x->mass[i].forceX += vec[i].w_float;
}
}
- else if ( argv[1].a_type == A_SYMBOL )
+ else if (( argc > 1 ) && ( argv[1].a_type == A_SYMBOL ))
{
i=0;
j=0;
@@ -515,13 +515,13 @@ void pmpd3d_forcesYT(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
{
if ( argc == 1 ) // apply forces on all masses
{
- j = max(x->nb_mass, npoints);
+ j = min(x->nb_mass, npoints);
for (i=0; i< j; i++)
{
x->mass[i].forceY += vec[i].w_float;
}
}
- else if ( argv[1].a_type == A_SYMBOL )
+ else if (( argc > 1 ) && (argv[1].a_type == A_SYMBOL ))
{
i=0;
j=0;
@@ -561,13 +561,13 @@ void pmpd3d_forcesZT(t_pmpd3d *x, t_symbol *s, int argc, t_atom *argv)
{
if ( argc == 1 ) // apply forces on all masses
{
- j = max(x->nb_mass, npoints);
+ j = min(x->nb_mass, npoints);
for (i=0; i< j; i++)
{
x->mass[i].forceZ += vec[i].w_float;
}
}
- else if ( argv[1].a_type == A_SYMBOL )
+ else if (( argc > 1 ) && ( argv[1].a_type == A_SYMBOL ))
{
i=0;
j=0;