swarm-support
[Top][All Lists]
Advanced

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

problem with discrete2d method putObject:atX:Y:


From: surak
Subject: problem with discrete2d method putObject:atX:Y:
Date: Wed, 10 Mar 1999 11:25:46 -0600 (CST)

Hello, I am a student working with Dr. Jonathan Haas of The Field Museum in
Chicago on coding a simulation of Peruvian villages. Unfortunately, while
attempting to put a newly created object in a Discrete2d array the program
always segfaults. I'm not sure if I'm calling putObject:atX:Y: correctly,
initializing the object I want to put in the array correctly, or what.
I'm using Swarm 1.4.1 on a Debian GNU/Linux 2.1 system (installed from the
binary packages).

Here's what gdb has to say:
****
(gdb) run
Starting program: /home/alanl/peru/peru 

Program received signal SIGSEGV, Segmentation fault.
0x4000f174 in global constructors keyed to maxStates ()
(gdb) where
#0  0x4000f174 in global constructors keyed to maxStates ()
#1  0x804c2f0 in -[PeruModelSwarm buildObjects] (self=0x81705a0, 
    _cmd=0x80bfc30) at PeruModelSwarm.m:115
#2  0x804b78c in -[PeruObserverSwarm buildObjects] (self=0x8165d90, 
    _cmd=0x80bf708) at PeruObserverSwarm.m:57
#3  0x804ad0f in main (argc=1, argv=0xbffffaf4) at main.m:21
(gdb) 
****
And the code around PeruModelSwarm:115:
****
      id obj;
      obj = [Mountain create: [self getZone]];
      obj = [obj createEnd];
      [obj setXPos: xtmp YPos: i];
      printf("X: %d Y: %d", xtmp, i);
      [area putObject: obj atX: xtmp Y: i];
****
"area" is an instance of PeruSpace, which inherits everything from
Discrete2d and doesn't add anything new (originally it did, but I took that
code out). In a different implementation trying to put an object in area,
the problem was the same. What's going wrong? 

Thanks in advance,

Alan Liu
address@hidden


                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

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