Skip to content

Commit 130a3ad

Browse files
committed
Added constructor from another JPAK Object.
1 parent 983e0f1 commit 130a3ad

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

cpp/JPAK.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ JPAK::JPAK() {
3030
ready = false;
3131
}
3232

33+
JPAK::JPAK(const JPAK &jpak) {
34+
string tmp = jpak.jpakfilename;
35+
if(tmp.size() > 0)
36+
LoadFromFile(tmp);
37+
}
38+
3339
JPAK::~JPAK() {
3440
if(jpakfile.is_open())
3541
jpakfile.close();
@@ -46,6 +52,7 @@ bool JPAK::LoadFromFile(string &filename) {
4652
unsigned int tableoffset;
4753
unsigned int fsize = 0;
4854
jpakfile.open(filename.c_str());
55+
jpakfilename = filename;
4956
if(jpakfile.good()) {
5057
jpakfile.read(magic,5);
5158
if(strncmp("JPAK1",magic,5) == 0) {

cpp/JPAK.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ class JPAK {
2727
bool ProcessTable(string &);
2828
public:
2929
JPAK();
30+
JPAK(const JPAK&);
3031
virtual ~JPAK();
3132

3233
Json::Value root;
34+
string jpakfilename;
35+
3336
bool LoadFromFile(string &);
3437
bool GetFile(string &, char **, int *);
3538
bool GetFile(const char *path, char **buf, int *size) { string t = path; return GetFile(t,buf,size); };

0 commit comments

Comments
 (0)