Skip to content

Commit

Permalink
Initial commit from Scott's code
Browse files Browse the repository at this point in the history
  • Loading branch information
harper10 committed Dec 18, 2015
0 parents commit 908cf15
Show file tree
Hide file tree
Showing 54 changed files with 6,011 additions and 0 deletions.
69 changes: 69 additions & 0 deletions #creaturesample.xml#
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<map>
<room>
<name>Entrance</name>
<description>Room - Entrance</description>
<border>
<direction>north</direction>
<name>Main</name>
</border>
<item>axe</item>
</room>
<room>
<name>Main</name>
<creature>dragon</creature>
<item>sword</item>
<description>Room - Main</description>
<border>
<direction>south</direction>
<name>Entrance</name>
</border>
<border>
<direction>north</direction>
<name>Staircase</name>
</border>
</room>
<room>
<type>exit</type>
<name>Staircase</name>
<description>Room - Staircase (exit)</description>
<border>
<name>Main</name>
<direction>south</direction>
</border>
<container>bottle</container>
</room>
<item>
<name>sword</name>
</item>
<item>
<name>note</name>
<writing>You found the exit :-)</writing>
</item>
<item>
<name>axe</name>
</item>
<container>
<name>bottle</name>
<item>note</item>
</container>
<creature>
<name>giant</name>
<vulnerability>sword</vulnerability>
<vulnerability>axe</vulnerability>
<attack>
<action>Game Over</action>
</attack>
</creature>
<creature>
<name>dragon</name>
<vulnerability>sword</vulnerability>
<vulnerability>axe</vulnerability>
<attack>
<action>Add giant to Main</action>
<action>s</action>
<print>Giant scares you away</print>
<action>Delete dragon</action>
</attack>
</creature>
</map>
31 changes: 31 additions & 0 deletions Condition.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "Condition.h"

Condition::Condition(rapidxml::xml_node<>* conditionNode) {
string xmlname;
string xmldata;

conditionNode = conditionNode->first_node();
while (conditionNode != NULL) {
xmlname = conditionNode->name();
xmldata = conditionNode->value();


if (xmlname == "object")
this->object = xmldata;

else if (xmlname == "status")
this->status = xmldata;

else if (xmlname == "has" )
this->has = xmldata;

else if (xmlname == "owner")
this->owner = xmldata;

conditionNode = conditionNode->next_sibling();
}




}
23 changes: 23 additions & 0 deletions Condition.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#ifndef CONDITION_H_
#define CONDITION_H_

#include <vector>
#include <string>
#include <stdio.h>
#include <iostream>
#include "rapidxml.hpp"
#include <map>

using namespace std;
class Condition {
public:
string has;
string object;
string owner;
string status;

Condition(rapidxml::xml_node<>*);

};

#endif
46 changes: 46 additions & 0 deletions Container.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include "Container.h"

Container::Container(rapidxml::xml_node<>* containerNode) {

string xmlname;
string xmldata;
opened = false;
this->trigger = new Trigger();
containerNode = containerNode->first_node();
while (containerNode != NULL) {
xmlname = containerNode->name();
xmldata = containerNode->value();


if (xmlname == "name")
this->name = xmldata;

else if (xmlname == "status")
this->status = xmldata;

else if (xmlname == "description")
this->description = xmldata;

else if (xmlname == "item")
this->items.push_back(xmldata);

else if (xmlname == "accept")
this->accepted.push_back(xmldata);
else if (xmlname == "trigger")
this->trigger = new Trigger(containerNode);

containerNode = containerNode->next_sibling();
}




}








39 changes: 39 additions & 0 deletions Container.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef CONTAINER_H_
#define CONTAINER_H_

#include <vector>
#include <string>
#include <stdio.h>
#include <iostream>
#include "rapidxml.hpp"
#include <map>
#include "Trigger.h"

using namespace std;

class Container {

public:
Container(rapidxml::xml_node<>*);
//virtual ~Container();

string name;
string description;
string status;
bool opened;
Trigger* trigger;

vector<string> accepted;
vector<string> items;
//trigger






};


#endif

63 changes: 63 additions & 0 deletions Creature.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "Creature.h"

Creature::Creature(rapidxml::xml_node<>* creatureNode) {

string xmlname;
string xmldata;
rapidxml::xml_node<> * attacknode;
this->trigger = new Trigger();
creatureNode = creatureNode->first_node();
while (creatureNode != NULL) {
xmlname = creatureNode->name();
xmldata = creatureNode->value();


if (xmlname == "name")
this->name = xmldata;

else if (xmlname == "status")
this->status = xmldata;

else if (xmlname == "description")
this->description = xmldata;
else if (xmlname == "vulnerability")
this->vulnerabilities.push_back(xmldata);

else if (xmlname == "attack") {
attacknode = creatureNode->first_node();
while (attacknode != NULL) {
xmlname = attacknode->name();
xmldata = attacknode->value();
if (xmlname == "print")
this->attackPrints.push_back(xmldata);
else if (xmlname == "action")
this->attackActions.push_back(xmldata);
else if (xmlname == "condition")
{
this->conditions.push_back(new Condition(attacknode));

}
attacknode = attacknode->next_sibling();

}


}
else if (xmlname == "trigger") {
this->trigger = new Trigger(creatureNode);

}

creatureNode = creatureNode->next_sibling();
}



}







43 changes: 43 additions & 0 deletions Creature.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#ifndef CREATURE_H_
#define CREATURE_H_

#include <vector>
#include <string>
#include <stdio.h>
#include <iostream>
#include "rapidxml.hpp"
#include <map>
#include "Condition.h"
#include "Trigger.h"

using namespace std;

class Creature {

public:
Creature(rapidxml::xml_node<>*);
//virtual ~Creature();

string name;
string description;
string status;

Trigger* trigger;

vector<string> vulnerabilities;
vector<string> attackPrints;
vector<string> attackActions;
vector<Condition*> conditions;
//trigger






};


#endif

#pragma once
Binary file added Debug/Condition.obj
Binary file not shown.
Binary file added Debug/Container.obj
Binary file not shown.
Binary file added Debug/Creature.obj
Binary file not shown.
Binary file added Debug/Item.obj
Binary file not shown.
Binary file added Debug/Main.obj
Binary file not shown.
Binary file added Debug/Room.obj
Binary file not shown.
Binary file added Debug/Trigger.obj
Binary file not shown.
20 changes: 20 additions & 0 deletions Debug/Zork.Build.CppClean.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\vc140.pdb
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\vc140.idb
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\condition.obj
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\container.obj
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\creature.obj
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\item.obj
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\main.obj
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\room.obj
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\trigger.obj
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\zork_gameengine.obj
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\zork_resourcemanager.obj
c:\users\scott\documents\visual studio 2015\projects\zork\debug\zork.ilk
c:\users\scott\documents\visual studio 2015\projects\zork\debug\zork.exe
c:\users\scott\documents\visual studio 2015\projects\zork\debug\zork.pdb
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\zork.tlog\cl.command.1.tlog
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\zork.tlog\cl.read.1.tlog
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\zork.tlog\cl.write.1.tlog
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\zork.tlog\link.command.1.tlog
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\zork.tlog\link.read.1.tlog
c:\users\scott\documents\visual studio 2015\projects\zork\zork\debug\zork.tlog\link.write.1.tlog
1 change: 1 addition & 0 deletions Debug/Zork.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
 Zork.vcxproj -> C:\Users\scott\Documents\Visual Studio 2015\Projects\Zork\Debug\Zork.exe
Binary file added Debug/Zork.tlog/CL.command.1.tlog
Binary file not shown.
Binary file added Debug/Zork.tlog/CL.read.1.tlog
Binary file not shown.
Binary file added Debug/Zork.tlog/CL.write.1.tlog
Binary file not shown.
2 changes: 2 additions & 0 deletions Debug/Zork.tlog/Zork.lastbuildstate
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1
Debug|Win32|C:\Users\scott\Documents\Visual Studio 2015\Projects\Zork\|
Binary file added Debug/Zork.tlog/link.command.1.tlog
Binary file not shown.
Binary file added Debug/Zork.tlog/link.read.1.tlog
Binary file not shown.
Binary file added Debug/Zork.tlog/link.write.1.tlog
Binary file not shown.
Binary file added Debug/Zork_GameEngine.obj
Binary file not shown.
Binary file added Debug/Zork_ResourceManager.obj
Binary file not shown.
Binary file added Debug/vc140.idb
Binary file not shown.
Binary file added Debug/vc140.pdb
Binary file not shown.
Loading

0 comments on commit 908cf15

Please sign in to comment.