swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: incompatible types in assignment


From: glen e. p. ropella
Subject: Re: incompatible types in assignment
Date: Tue, 28 Jan 1997 12:01:12 -0700

Hi Bruno,

> id modelActions;
> modelActions = [Collection create: [self getZone] setCount: speedRangeSize];
> 
> 
> for (i = 0 ; i < speedRangeSize ; i++) {
>   fprintf(stderr, "Creation du groupe d'action %d\n", i);
> 
>   modelActions[i] = [ActionGroup create: [self getZone]]; 
> ------------------^
> The compilation refuse this assignment. The error message is: "incompatible
> types in assignment" but I don't know why? 
>   
>   [modelActions[i] createActionForEach: agentDico[i]   message: M(step)];
> } 

You seem to be trying to treat the collection of modelActions
as if it were a C array.  This is probably not a good idea.
If you want a collection of actionGroups, you should probably
use something more like:

----------------------------------------------------------
id modelActions;                                                             
int i = 0;
id agentDico[SIZE];
[...]
modelActions = [Collection 
                   create: [self getZone]
                 setCount: speedRangeSize]; 

actIndx = [modelActions begin: [self getZone]];
while ((tmpAct = [actIndx next]) != nil) {

  fprintf(stderr, "Creation du groupe d'action %d\n", i);                    
  tmpAct = [ActionGroup create: [self getZone]];                    
  [tmpAct createActionForEach: agentDico[i]   message: M(step)];    
  i++;
}
-----------------------------------------------------------

Mind you, I'm not sure why you would want to create a 
collection of actionGroups.... But, this would be one
way to do it.  I'm afraid you're trying to do something
that is already done automatically by Roger's activity
machinery.

glen



reply via email to

[Prev in Thread] Current Thread [Next in Thread]