Esempio n. 1
0
Boolean shelf_push(int i, Boolean absolute, Boolean pushdir)
{
  FilePtr file = dirFile(shelfdir, i);
  String action;
  char path1[MAXPATHLEN+1], path2[MAXPATHLEN+1];

  root_modified = cur_modified = shelf_modified = cur_changed = False;
  if (file)
    if (!((action = push_action(fileType(file))) && *action) &&
	S_ISDIR(fileStats(file)->st_mode)) {
      return
	cur_chdir(resolve(path1, pathname(path2, dirName(shelfdir),
					  fileName(file))));
    } else {
      Boolean ret =
	filePush(shelfdir, i,
		 (pushdir && (fileStats(file)->st_mode &
			      (S_IXUSR | S_IXGRP | S_IXOTH)))?
		 dirName(curdir):NULL, absolute, True);
      update();
      return ret;
    }
  else
    return False;
}
Esempio n. 2
0
Boolean cur_push(int i, Boolean absolute, Boolean pushdir)
{
  FilePtr file = dirFile(curdir, i);
  String action;
  char path1[MAXPATHLEN+1], path2[MAXPATHLEN+1];

  root_modified = cur_modified = shelf_modified = cur_changed = False;
  if (file)
    if (!((action = push_action(fileType(file))) && *action) &&
	S_ISDIR(fileStats(file)->st_mode)) {
      return
	cur_chdir(shortestpath(path1, pathname(path2, dirName(curdir),
					       fileName(file))));
    } else {
      Boolean ret = filePush(curdir, i, NULL, absolute, False);
      update();
      return ret;
    }
  else
    return False;
}
Esempio n. 3
0
void AttackAction::fire_projectile(const Attribute<attr_type::attack> &att, const coord::phys3 &target) {

	// container terrain and initial position
	UnitContainer *container = this->entity->get_container();
	coord::phys3 current_pos = this->entity->location->pos.draw;
	current_pos.up = att.init_height;

	// create using the producer
	auto player = this->entity->get_attribute<attr_type::owner>().player;
	auto projectile_ref = container->new_unit(*att.ptype, player, current_pos);

	// send towards target using a projectile ability (creates projectile motion action)
	if (projectile_ref.is_valid()) {
		auto projectile = projectile_ref.get();
		auto &projectile_attr = projectile->get_attribute<attr_type::projectile>();
		projectile_attr.launcher = this->entity->get_ref();
		projectile_attr.launched = true;
		projectile->push_action(std::make_unique<ProjectileAction>(projectile, target), true);
	}
	else {
		this->entity->log(MSG(dbg) << "projectile launch failed");
	}
}