Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
Fixed crash caused by setting Tribe pointer to 0.
Removed debug messages.
  • Loading branch information
RyanBabij committed Jul 16, 2018
1 parent 3c72c47 commit 2790d62
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CompileCount.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
*/
#include <string>

const std::string COMPILE_COUNT = "4734";
const std::string COMPILE_COUNT = "4741";
#endif
18 changes: 9 additions & 9 deletions Tribe_Human.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ void Tribe_Human::combat (Tribe* _target)
{
if (_target == 0) { return; }

std::cout<<"Combat initiated.\n";
std::cout<<"Attacker: "<<name<<". ("<<vCharacter.size()<<").\n";
std::cout<<"Defender: "<<_target->name<<". ("<<_target->vCharacter.size()<<").\n";
//std::cout<<"Combat initiated.\n";
//std::cout<<"Attacker: "<<name<<". ("<<vCharacter.size()<<").\n";
//std::cout<<"Defender: "<<_target->name<<". ("<<_target->vCharacter.size()<<").\n";

if ( vCharacter.size() > _target->vCharacter.size() )
{
std::cout<<"Picking force.\n";
//std::cout<<"Picking force.\n";

Vector <Character*> vAttackingForce;

Expand All @@ -286,25 +286,25 @@ void Tribe_Human::combat (Tribe* _target)
vAttackingForce.push(vCharacter(i));
}
}
std::cout<<"Attacking with a force of "<<vAttackingForce.size()<<".\n";
// std::cout<<"Attacking with a force of "<<vAttackingForce.size()<<".\n";

if ( vAttackingForce.size() > _target->vCharacter.size() )
{
// DIRECT ATTACK ON TARGET CAMP.
std::cout<<"The target was annihilated.\n";
//std::cout<<"The target was annihilated.\n";
//_target->isAlive = false;
}
else
{
// SKIRMISH / RAID / AMBUSH
std::cout<<"The target was ambushed.\n";
// std::cout<<"The target was ambushed.\n";

//Each attacker will pick a target.



}

TribalArtifact_BattleSite * testArtifact = new TribalArtifact_BattleSite;
testArtifact->worldX = worldX;
testArtifact->worldY = worldY;
Expand All @@ -314,7 +314,7 @@ void Tribe_Human::combat (Tribe* _target)
}
else
{
std::cout<<"Declined.\n";
//std::cout<<"Declined.\n";
}

return;
Expand Down
4 changes: 1 addition & 3 deletions World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ void World::incrementTicks(int nTicks)
if ( vTribe(i)->isAlive == false )
{
destroyInfluence(vTribe(i));
vTribe(i) = 0;
//vTribe(i) = 0;
}
else if (vTribe(i) != 0)
{
Expand All @@ -345,7 +345,6 @@ void World::incrementTicks(int nTicks)
//vCiv(i)->incrementTicks(nTicks);
}



while (monthlyCounter >= 2592000)
{
Expand All @@ -360,7 +359,6 @@ void World::incrementTicks(int nTicks)
dailyCounter-=86400;
}


//std::cout<<"Incrementing the world by "<<nTicks<<" ticks.\n";
//std::cout<<"Date: "<<calendar.toString()<<".\n";

Expand Down

0 comments on commit 2790d62

Please sign in to comment.