Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
unknown
authored and
unknown
committed
Jan 21, 2012
1 parent
2e06e72
commit 7e57793
Showing
76 changed files
with
65,595 additions
and
2,312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This is the default folder for lua scripts generated by LuaTrigz |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#ifndef LUATRIGCONTRL_H_ | ||
#define LUATRIGCONTRL_H_ | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
class Trigger; | ||
|
||
struct FileError | ||
{ | ||
std::string message; | ||
}; | ||
|
||
class FileController | ||
{ | ||
public: | ||
virtual void setPath(const char *)=0; | ||
virtual void write(const char *)=0; | ||
virtual void write()=0; | ||
virtual FileError read()=0; | ||
|
||
virtual void copyTriggers(FileController *)=0; | ||
virtual std::vector<Trigger *> getTriggers()=0; | ||
|
||
virtual const char *getPath()=0; | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "LuaFileController.h" | ||
#include "../lua/LuaFile.h" | ||
#include "../genie/Trigger.h" | ||
|
||
LuaFileController::LuaFileController() | ||
{ | ||
} | ||
|
||
void LuaFileController::setPath(const char *path) | ||
{ | ||
//whenever resetting the path, delete the old luafile that was stored | ||
delete luaFile; | ||
luaFile = new LuaFile(path); | ||
} | ||
|
||
FileError LuaFileController::read() | ||
{ | ||
bool hasErr = luaFile->read(); | ||
FileError err; | ||
if (hasErr) | ||
err.message.assign(luaFile->error()); | ||
|
||
return err; | ||
} | ||
|
||
//writes lua | ||
void LuaFileController::write(const char *writePath) | ||
{ | ||
luaFile->write(writePath); | ||
} | ||
|
||
void LuaFileController::write() | ||
{ | ||
write(luaFile->getPath().c_str()); | ||
} | ||
|
||
void LuaFileController::copyTriggers(FileController *other) | ||
{ | ||
luaFile->triggers = other->getTriggers(); | ||
} | ||
|
||
std::vector<Trigger *> LuaFileController::getTriggers() | ||
{ | ||
return luaFile->triggers; | ||
} | ||
|
||
const char *LuaFileController::getPath() | ||
{ | ||
return luaFile->getPath().c_str(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef LUA_FILE_CONTROLLER_H_ | ||
#define LUA_FILE_CONTROLLER_H_ | ||
|
||
#include "FileController.h" | ||
|
||
class LuaFile; //fwd so we don't have to include here | ||
|
||
class LuaFileController : public FileController | ||
{ | ||
private: | ||
LuaFile *luaFile; | ||
public: | ||
LuaFileController(); | ||
|
||
void setPath(const char *); | ||
void write(const char *); | ||
void write(); | ||
FileError read(); | ||
|
||
void copyTriggers(FileController *); | ||
std::vector<Trigger *> getTriggers(); | ||
|
||
const char *getPath(); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "ScenarioFileController.h" | ||
#include "../genie/Scenario.h" | ||
|
||
ScenarioFileController::ScenarioFileController() | ||
{ | ||
} | ||
|
||
void ScenarioFileController::setPath(const char *path) | ||
{ | ||
//whenever resetting the path, delete the old scen that was stored | ||
delete scenario; | ||
scenario = new Scenario(path); | ||
} | ||
|
||
FileError ScenarioFileController::read() | ||
{ | ||
scenario->open(); | ||
scenario->read(); | ||
scenario->cleanup(); | ||
FileError err; | ||
return err; | ||
} | ||
|
||
//writes scn | ||
void ScenarioFileController::write(const char *writePath) | ||
{ | ||
scenario->write(writePath); | ||
scenario->cleanup(); | ||
} | ||
|
||
void ScenarioFileController::write() | ||
{ | ||
write(scenario->getPath().c_str()); | ||
} | ||
|
||
|
||
void ScenarioFileController::copyTriggers(FileController *other) | ||
{ | ||
scenario->triggers = other->getTriggers(); | ||
} | ||
|
||
std::vector<Trigger *> ScenarioFileController::getTriggers() | ||
{ | ||
return scenario->triggers; | ||
} | ||
|
||
const char *ScenarioFileController::getPath() | ||
{ | ||
return scenario->getPath().c_str(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef SCENARIO_FILE_CONTROLLER_H_ | ||
#define SCENARIO_FILE_CONTROLLER_H_ | ||
|
||
#include "FileController.h" | ||
|
||
class Scenario; //fwd so we don't have to include here | ||
|
||
class ScenarioFileController : public FileController | ||
{ | ||
private: | ||
Scenario *scenario; | ||
public: | ||
ScenarioFileController(); | ||
|
||
void setPath(const char *); | ||
void write(const char *); | ||
void write(); | ||
FileError read(); | ||
|
||
void copyTriggers(FileController *); | ||
std::vector<Trigger *> getTriggers(); | ||
|
||
const char *getPath(); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.