[Avida-SVN] r2066 - in branches/energy: documentation source/main
beckma24 at myxo.css.msu.edu
beckma24 at myxo.css.msu.edu
Fri Sep 7 06:00:55 PDT 2007
Author: beckma24
Date: 2007-09-07 09:00:54 -0400 (Fri, 07 Sep 2007)
New Revision: 2066
Modified:
branches/energy/documentation/index.html
branches/energy/source/main/cDeme.cc
branches/energy/source/main/cDemeCellEvent.cc
branches/energy/source/main/cDemeCellEvent.h
Log:
Added cDemeCellEvent
Modified: branches/energy/documentation/index.html
===================================================================
--- branches/energy/documentation/index.html 2007-09-07 00:34:54 UTC (rev 2065)
+++ branches/energy/documentation/index.html 2007-09-07 13:00:54 UTC (rev 2066)
@@ -31,6 +31,7 @@
<p>
<a href="config.html">Setting up the Avida Configuration File</a>
+<br /><a href="energy_model.html">Energy model configuration</a>
<br /><a href="inst_set.html">Setting up the Instruction Set</a>
<br /><a href="events.html">Guidelines to setting up the Events File</a>
<br /><a href="environment.html">Guidelines to setting up Environments</a>
Modified: branches/energy/source/main/cDeme.cc
===================================================================
--- branches/energy/source/main/cDeme.cc 2007-09-07 00:34:54 UTC (rev 2065)
+++ branches/energy/source/main/cDeme.cc 2007-09-07 13:00:54 UTC (rev 2066)
@@ -66,7 +66,7 @@
for(int i = 0; i < cell_events.GetSize(); i++) {
cDemeCellEvent& event = cell_events[i];
if(event.GetDelay() == _age) {
- event.ActivateEvent(); //start event
+ event.ActivateEvent(m_world); //start event
int eventCell = event.GetNextEventCellID();
while(eventCell != -1) {
// place event ID in cells' data
@@ -169,7 +169,7 @@
void cDeme::SetCellEvent(int x1, int y1, int x2, int y2, int delay, int duration) {
std::cerr<<"cDeme::SetCellEvent1 " <<cell_events.GetSize()<<std::endl;
- cDemeCellEvent demeEvent = cDemeCellEvent(x1, y1, x2, y2, delay, duration, width, m_world);
+ cDemeCellEvent demeEvent = cDemeCellEvent(x1, y1, x2, y2, delay, duration, width);
cell_events.Push(demeEvent);
std::cerr<<"cDeme::SetCellEvent2 " <<cell_events.GetSize()<<std::endl;
}
Modified: branches/energy/source/main/cDemeCellEvent.cc
===================================================================
--- branches/energy/source/main/cDemeCellEvent.cc 2007-09-07 00:34:54 UTC (rev 2065)
+++ branches/energy/source/main/cDemeCellEvent.cc 2007-09-07 13:00:54 UTC (rev 2066)
@@ -1,10 +1,10 @@
#include "cDemeCellEvent.h"
#include "cWorld.h"
-cDemeCellEvent::cDemeCellEvent(int x1, int y1, int x2, int y2, int delay, int duration, int width, cWorld* m_world) :
+cDemeCellEvent::cDemeCellEvent(int x1, int y1, int x2, int y2, int delay, int duration, int width) :
m_delay(delay)
, m_duration(duration)
- , m_iter(-1)
+ , m_iter(0)
, m_active(false)
{
assert(x1 <= x2);
@@ -12,8 +12,6 @@
assert(y1 < width && y2 < width);
assert(delay >= 0);
assert(duration >= 0);
-
- m_world->GetRandom().GetInt(0x7FFFFFFF);
m_event_cells.ResizeClear((x2-x1+1) * (y2-y1+1));
int i = 0;
@@ -33,7 +31,8 @@
return -1;
}
-void cDemeCellEvent::ActivateEvent() {
+void cDemeCellEvent::ActivateEvent(cWorld* m_world) {
+ m_eventID = m_world->GetRandom().GetInt(0x7FFFFFFF);
m_active = true;
}
Modified: branches/energy/source/main/cDemeCellEvent.h
===================================================================
--- branches/energy/source/main/cDemeCellEvent.h 2007-09-07 00:34:54 UTC (rev 2065)
+++ branches/energy/source/main/cDemeCellEvent.h 2007-09-07 13:00:54 UTC (rev 2066)
@@ -11,14 +11,14 @@
bool m_active;
public:
- cDemeCellEvent() { cDemeCellEvent(-1, -1, -1, -1, 0, 0, 0, NULL); }
- cDemeCellEvent(int x1, int y1, int x2, int y2, int delay, int duration, int width, cWorld* m_world);
+ cDemeCellEvent() { cDemeCellEvent(-1, -1, -1, -1, 0, 0, 0); }
+ cDemeCellEvent(int x1, int y1, int x2, int y2, int delay, int duration, int width);
int GetNextEventCellID();
int GetDelay() { return m_delay; }
int GetDuration() { return m_duration; }
int GetEventID() { return m_eventID; }
- void ActivateEvent();
+ void ActivateEvent(cWorld* m_world);
void DeactivateEvent();
};
#endif
More information about the Avida-cvs
mailing list