Beispiel #1
0
void Level::load_from_file(const Filename& filename)
{
    clear();
    status = GOOD;

    level_filename = filename.get_rootless();

    FileFormat fmt = get_file_format(filename);
    if (fmt == FORMAT_BINARY) {
        // load an original .LVL file from L1/ONML/...
        load_from_binary(filename);
    }
    else if (fmt == FORMAT_LEMMINI) {
        // load an .INI file from Lemmini
        load_from_lemmini(filename);
    }
    else {
        // load the regular Lix format
        std::vector <IO::Line> lines;
        if (IO::fill_vector_from_file(lines, filename.get_rootful())) {
            load_from_vector(lines);
        }
        else status = BAD_FILE_NOT_FOUND;
    }
    load_finalize();
}
Beispiel #2
0
Cutbit::Cutbit(const Filename& filename, const bool cut)
:
    bitmap  (0),
    xl      (0),
    yl      (0),
    x_frames(1),
    y_frames(1)
{
    // Angegebene Datei als Bild laden.
    // Wenn dies kein Bild ist, Fehlermeldung schreiben und abbrechen.
    bitmap = load_bitmap(filename.get_rootful().c_str(), 0);
    if (!bitmap) {
        std::string str = Language::log_bitmap_bad;
        str += " ";
        str += filename.get_rootless();
        Log::log(Log::ERROR, str);
        return;
    }
    if (cut) cut_bitmap();
    else {
        xl = bitmap->w;
        yl = bitmap->h;
    }
}