Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef WORMHOLES_H
- #define WORMHOLES_H
- #include "Empty.h"
- #include "json/writer.h"
- using namespace std;
- class Wormholes : public Empty {
- public:
- virtual void applyTo(json::Object& starSystem, json::Array& gameObjects) {
- // These are the neighbouring starsystems:
- json::Array& neighbours = starSystem["neighbours"];
- json::Array::iterator itNeighbour;
- int r = rand() % 10;
- // For each neighbour, generate a wormhole:
- for(itNeighbour = neighbours.Begin(); itNeighbour != neighbours.End(); ++itNeighbour) {
- json::Object apply;
- apply["targetStarSystem"] = json::Number(*itNeighbour);
- gameObjects.Insert(gob("wormhole", 50 * r++, 50 * r, 50 * r, apply));
- }
- //cout << "EnemyBase: Cannot decorate with enemybase. We have no enemy base :( " << endl;
- }
- };
- #endif // WORMHOLES_H
Advertisement
Add Comment
Please, Sign In to add comment