Exemplo n.º 1
0
void TileMap::addObjectToMap(GameState &state, sp<Vehicle> vehicle)
{
	if (vehicle->tileObject)
	{
		LogError("Vehicle already has tile object");
	}
	if (vehicle->shadowObject)
	{
		LogError("Vehicle already has shadow object");
	}
	if (vehicle->crashed && vehicle->smokeDoodad)
	{
		LogError("Vehicle already has smoke object");
	}
	// FIXME: mksp<> doesn't work for private (but accessible due to friend)
	// constructors?
	sp<TileObjectVehicle> obj(new TileObjectVehicle(*this, vehicle));
	obj->setPosition(vehicle->getPosition());
	vehicle->tileObject = obj;

	if (vehicle->type->directional_shadow_sprites.size() > 0)
	{
		sp<TileObjectShadow> shadow(new TileObjectShadow(*this, vehicle));
		shadow->setPosition(vehicle->getPosition());
		vehicle->shadowObject = shadow;
	}
	if (vehicle->crashed)
	{
		sp<Doodad> smoke = mksp<Doodad>(vehicle->position + SMOKE_DOODAD_SHIFT,
		                                StateRef<DoodadType>{&state, "DOODAD_13_SMOKE_FUME"});
		addObjectToMap(smoke);
		vehicle->smokeDoodad = smoke;
	}
}
Exemplo n.º 2
0
int EditorArea::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: changeTile(); break;
        case 1: saveGame((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 2: saveMap((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 3: addNpcToMap((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 4: addObjectToMap((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}