From df31cc20c63c9447ba057d599d48cc67c4555ca7 Mon Sep 17 00:00:00 2001 From: Gökçen Eraslan Date: Wed, 6 Jan 2016 18:52:51 +0100 Subject: GCGIO: Add a simple method to read GCG files using only the file names. --- quackleio/gcgio.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'quackleio/gcgio.cpp') diff --git a/quackleio/gcgio.cpp b/quackleio/gcgio.cpp index cafbf49..30fac0f 100644 --- a/quackleio/gcgio.cpp +++ b/quackleio/gcgio.cpp @@ -30,6 +30,24 @@ GCGIO::GCGIO() { } +Quackle::Game *GCGIO::read(const QString &filename, int flags) +{ + QFile file(filename); + Quackle::Game *ret = new Quackle::Game; + + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) + { + UVcerr << "Could not open gcg " << QuackleIO::Util::qstringToString(filename) << endl; + return ret; + } + + QTextStream in(&file); + ret = read(in, flags); + file.close(); + + return ret; +} + Quackle::Game *GCGIO::read(QTextStream &stream, int flags) { Quackle::Game *ret = new Quackle::Game; -- cgit v1.2.3