From: Daniel Karbach Date: Sun, 26 Aug 2012 19:55:22 +0000 (+0200) Subject: added test data X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=b7fcb21d8f1a6edba4693c879a2930db6f2fa95e;p=l2e.git added test data --- diff --git a/src/main.cpp b/src/main.cpp index 424404f..ddd6b7a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -78,9 +77,8 @@ int main(int argc, char **argv) { // std::srand(std::time(0)); try { - std::ifstream file("test-data/test.l2s"); ParsedSource source; - Parser parser(file, source); + Parser parser("test-data/test.l2s", source); parser.Parse(); cout << source; @@ -738,6 +736,9 @@ int main(int argc, char **argv) { app.Run(); return 0; + } catch (Parser::Error &e) { + cerr << "parsing exception in file " << e.File() << " on line " << e.Line() << ": " << e.what() << endl; + return 1; } catch (exception &e) { cerr << "exception in main(): " << e.what() << endl; return 1; diff --git a/test-data/test.l2s b/test-data/test.l2s new file mode 100644 index 0000000..ef1cce2 --- /dev/null +++ b/test-data/test.l2s @@ -0,0 +1,106 @@ +Number frameTime 33 +Number twoFramesTime 66 +Number fiveFramesTime 165 + +export Monster lizard { + name: "Lizard", + sprite: Sprite { + image: "monster.png", + size: <64,64> + }, + level: 1, + maxHealth: 8, + stats: Stats { + attack: 14, + defense: 6, + strength: 6, + agility: 6, + intelligence: 6, + gut: 6, + magicResistance: 6 + }, + attackAnimation: SimpleAnimation { + sprite: Sprite { + image: "attack-monster.png", + size: <96,64> + }, + frametime: frameTime, + framecount: 14 + } +} + +Sprite maximSprite { + image: "maxim.png", + size: <64,64> +} +export Hero maxim { + name: "Maxim", + level: 1, + sprite: maximSprite, + maxHealth: 33, + health: 33, + maxMana: 20, + mana: 20, + ip: 0, + stats: Stats { + attack: 28, + defense: 22, + strength: 28, + agility: 17, + intelligence: 14, + gut: 100, + magicResistance: 10 + }, + attackAnimation: ComplexAnimation { + sprite: maximSprite, + frametime: frameTime, + repeat: false, + frames: [ + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 4,-1> }, + { column: 1, row: 0, disposition: < 4,-1> }, + { column: 2, row: 0, disposition: < 4,-2> }, + { column: 2, row: 0, disposition: < 4,-2> }, + { column: 2, row: 0, disposition: < 6,-2> }, + { column: 2, row: 0, disposition: < 6,-2> }, + { column: 2, row: 1, disposition: < 6,-1> }, + { column: 2, row: 1, disposition: < 3,-1> }, + { column: 2, row: 1, disposition: < 3,-1> }, + { column: 2, row: 1, disposition: < 0, 0> }, + { column: 2, row: 2, disposition: < 0, 0> }, + { column: 2, row: 2, disposition: < 0, 0> }, + { column: 2, row: 2, disposition: < 2, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> }, + { column: 1, row: 0, disposition: < 0, 0> } + ] + }, + spellAnimation: ComplexAnimation { + sprite: maximSprite, + frametime: fiveFramesTime, + repeat: false, + frames: [ + { column: 3, row: 0, disposition: < 0, 0> }, + { column: 3, row: 0, disposition: < 0, 0> }, + { column: 3, row: 1, disposition: < 0, 0> } + ] + }, + meleeAnimation: SimpleAnimation { + sprite: Sprite { + image: "melee-maxim.png", + size: <96,96> + }, + frametime: twoFramesTime, + framecount: 4 + } +}