* Made MiniSwig limit whitespace it generates.
SVN-Revision: 4707
#include "object/camera.hpp"
#include "object/tilemap.hpp"
#include "object/coin.hpp"
+#include "object/block.hpp"
using namespace std;
int
Level::get_total_coins()
{
- // FIXME not really correct as coins can also be inside blocks...
int total_coins = 0;
for(Sectors::iterator i = sectors.begin(); i != sectors.end(); ++i) {
Sector* sector = *i;
o != sector->gameobjects.end(); ++o) {
Coin* coin = dynamic_cast<Coin*> (*o);
if(coin)
+ {
total_coins++;
+ continue;
+ }
+ BonusBlock *block = dynamic_cast<BonusBlock*> (*o);
+ if(block)
+ {
+ if (block->contents == BonusBlock::CONTENT_COIN)
+ {
+ total_coins++;
+ continue;
+ }
+#if 0
+ // FIXME: do we want this? q.v. src/object/oneup.cpp
+ else if (block->contents == BonusBlock::CONTENT_1UP)
+ {
+ total_coins += 100;
+ continue;
+ }
+#endif
+ }
}
}
return total_coins;
#include "object_factory.hpp"
#include "lisp/list_iterator.hpp"
#include "object_factory.hpp"
+#include "level.hpp"
static const float BOUNCY_BRICK_MAX_OFFSET = 8;
static const float BOUNCY_BRICK_SPEED = 90;
case CONTENT_COIN:
Sector::current()->add_object(new BouncyCoin(get_pos()));
player.get_status()->add_coins(1);
+ Sector::current()->get_level()->stats.coins++;
break;
case CONTENT_FIREGROW:
void try_open();
-protected:
- virtual void hit(Player& player);
-
-private:
enum Contents {
CONTENT_COIN,
CONTENT_FIREGROW,
};
Contents contents;
+protected:
+ virtual void hit(Player& player);
+
+private:
MovingObject* object;
};
#include "player.hpp"
#include "player_status.hpp"
#include "sector.hpp"
+#include "level.hpp"
+#include "statistics.hpp"
#include "video/drawing_context.hpp"
OneUp::OneUp(const Vector& pos, Direction direction)
Player* player = dynamic_cast<Player*> (&other);
if(player) {
player->get_status()->add_coins(100);
+#if 0
+ // FIXME: do we want this? q.v. src/level.cpp
+ Sector::current()->get_level()->stats.coins += 100;
+#endif
remove_me();
return ABORT_MOVE;
}
}
} // end of namespace Wrapper
-
void create_squirrel_instance(HSQUIRRELVM v, Scripting::DisplayEffect* object, bool setup_releasehook)
{
using namespace Wrapper;
}
out << "} // end of namespace Wrapper\n";
- out << "\n";
for(std::vector<AtomicType*>::iterator i = ns->types.begin();
i != ns->types.end(); ++i) {
out << "}\n"
<< "\n"
- << "} // end of namespace Scripting\n"
- << "\n";
+ << "} // end of namespace Scripting\n";
}
void
}
// call function
- out << ind << "\n";
+ out << "\n";
out << ind << "try {\n";
out << ind << ind;
if(!function->return_type.is_void()) {
out << ind << "sq_setreleasehook(vm, 1, "
<< _class->name << "_release_hook);\n";
}
- out << ind << "\n";
+ out << "\n";
// push return value back on stack and return
if(function->suspend) {
if(!function->return_type.is_void()) {
out << ind << ind << "return 1;\n";
}
- out << ind << "\n";
+ out << "\n";
out << ind << "} catch(std::exception& e) {\n";
out << ind << ind << "sq_throwerror(vm, e.what());\n";
out << ind << ind << "return SQ_ERROR;\n";
out << ind << ind << "sq_throwerror(vm, _SC(\"Unexpected exception while executing function '" << function->name << "'\"));\n";
out << ind << ind << "return SQ_ERROR;\n";
out << ind << "}\n";
- out << ind << "\n";
+ out << "\n";
out << "}\n";
out << "\n";