[Avida-SVN] r2826 - branches/hjg-dev/source/main

hjg at myxo.css.msu.edu hjg at myxo.css.msu.edu
Thu Oct 9 14:47:17 PDT 2008


Author: hjg
Date: 2008-10-09 17:47:17 -0400 (Thu, 09 Oct 2008)
New Revision: 2826

Modified:
   branches/hjg-dev/source/main/cOrganism.cc
   branches/hjg-dev/source/main/cOrganism.h
Log:
bug fix

Modified: branches/hjg-dev/source/main/cOrganism.cc
===================================================================
--- branches/hjg-dev/source/main/cOrganism.cc	2008-10-09 19:00:09 UTC (rev 2825)
+++ branches/hjg-dev/source/main/cOrganism.cc	2008-10-09 21:47:17 UTC (rev 2826)
@@ -76,6 +76,8 @@
   , m_net(NULL)
   , m_msg(0)
   , m_opinion(0)
+  , m_self_raw_materials(100)
+  , m_other_raw_materials(0)
 {
   m_hardware = m_world->GetHardwareManager().Create(this);
 
@@ -737,7 +739,7 @@
  */
 void cOrganism::SetOpinion(const Opinion& opinion)
 {
-  InitOpinions();
+//  InitOpinions();
   m_opinion->opinion_list.push_back(std::make_pair(opinion, m_world->GetStats().GetUpdate()));
 }
 
@@ -749,7 +751,7 @@
 bool cOrganism::SubtractSelfRawMaterials (int amount)
 {
 	bool isSuccessful = false;
-	InitReputation();
+//	InitReputation();
 	if (amount < m_self_raw_materials) { 
 		isSuccessful = true; 
 		m_self_raw_materials -= amount;
@@ -763,7 +765,7 @@
 
 bool cOrganism::AddOtherRawMaterials (int amount) {
 	bool isSuccessful = true;
-	InitReputation();
+//	InitReputation();
 	m_other_raw_materials += amount;
 	return isSuccessful;
 }
@@ -771,7 +773,7 @@
 /* Called when a orgaism receives a donation in order to turn the recipient to 
 face its donor. It is designed to work in conjunction with the fact that an 
 orgaism donates to the neighbor it is facing. */
-void cOrganism::RotateToFaceOrganism(cOrganism& org) {
+//void cOrganism::RotateToFaceOrganism(cOrganism& org) {
 //	this->GetWorld()->GetPopulation().GetCell(this->GetCellID()).ConnectionList().Front().ConnectionList().Rotate(org);
 
-}
+//}

Modified: branches/hjg-dev/source/main/cOrganism.h
===================================================================
--- branches/hjg-dev/source/main/cOrganism.h	2008-10-09 19:00:09 UTC (rev 2825)
+++ branches/hjg-dev/source/main/cOrganism.h	2008-10-09 21:47:17 UTC (rev 2826)
@@ -448,16 +448,16 @@
 	// receive raw materials from others
 	bool AddOtherRawMaterials(int amount);
 	// retrieve the organism's own amount of raw materials
-	int GetSelfRawMaterials() {InitReputation(); return m_self_raw_materials; }
+	int GetSelfRawMaterials() { return m_self_raw_materials; }
 	// retrieve the amount of raw materials collected from others
-	int GetOtherRawMaterials() {InitReputation(); return m_other_raw_materials; }
+	int GetOtherRawMaterials() { return m_other_raw_materials; }
 	// Rotate the organism to face a specific neighboring organism. 
 	// This functionality is used to turn the donation recipient to the donor.	
-	void RotateToFaceOrganism(cOrganism& org); 
+	//void RotateToFaceOrganism(cOrganism& org); 
 		
 protected:
 	// Initialize reputation support
-	inline void InitReputation() {if (!m_self_raw_materials) {m_self_raw_materials = 100; m_other_raw_materials =0; }}
+//	inline void InitReputation() {if (!m_self_raw_materials) {m_self_raw_materials = 100; m_other_raw_materials =0; }}
 	// The organism's own raw materials
 	int m_self_raw_materials; 
 	// The raw materials an oranism has collected from others




More information about the Avida-cvs mailing list