Skip to content

Commit

Permalink
Added proper functioning for Character.enter(). Now it fully works, Yay
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypersonic committed Feb 28, 2011
1 parent cee051f commit 69970bf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 46 deletions.
31 changes: 28 additions & 3 deletions Character.cpp
Expand Up @@ -8,11 +8,36 @@
*/
#include <iostream>
#include <string>
#include "Door.cpp"
#include "Door.h"
#include "Character.h"
void Character::enter (int cDoor) {

SetArea(cDoor);


void Character::enter (Door cDoor) {

// SetArea(cDoor.GetSide2());


if (GetArea()==cDoor.GetSide1()) { // If the character is on the first side of the door...
SetArea(cDoor.GetSide2()); // Bring them to the second side.
std::cout << "You enter the door, going to Area " << cDoor.GetSide2() << std::endl; } // And tell them that.

else {



if (GetArea()==cDoor.GetSide2()) { // If the character is on the second side of the door...
SetArea(cDoor.GetSide1()); // Bring them to the first side.
std::cout << "You enter the door, going to Area " << cDoor.GetSide1() << std::endl; // And tell them that.
}
else { // If the character is not on the first or second side of the door...
std::cout << "ERROR: Player is not on either side of door." << std::endl; // Tell them that crazy shit be goin on.
std::cout << "I'd exit() right now but I can't." << std::endl; } // Halt removed. Replaced with message.
}





}
void Character::SetArea(int nArea) {
Expand Down
2 changes: 1 addition & 1 deletion Character.h
Expand Up @@ -29,7 +29,7 @@ class Character {
int GetArea(); // Access function.

void SetArea(int nArea); // Function to set character's area.
void enter(int cDoor);
void enter(class Door cDoor);
};

#endif
42 changes: 0 additions & 42 deletions Door.cpp

This file was deleted.

0 comments on commit 69970bf

Please sign in to comment.