Esempio n. 1
0
gboolean g_ril_request_sim_read_record(GRil *gril,
					const struct req_sim_read_record *req,
					struct parcel *rilp)
{
	parcel_init(rilp);
	parcel_w_int32(rilp, CMD_READ_RECORD);
	parcel_w_int32(rilp, req->fileid);

	g_ril_append_print_buf(gril,
				"(cmd=0x%.2X,efid=0x%.4X,",
				CMD_READ_RECORD,
				req->fileid);

	if (set_path(gril, req->app_type, rilp, req->fileid,
			req->path, req->path_len) == FALSE)
		goto error;

	parcel_w_int32(rilp, req->record);      /* P1 */
	parcel_w_int32(rilp, 4);           /* P2 */
	parcel_w_int32(rilp, req->length);      /* P3 */
	parcel_w_string(rilp, NULL);       /* data; only req'd for writes */
	parcel_w_string(rilp, NULL);       /* pin2; only req'd for writes */
	parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */

	return TRUE;

error:
	return FALSE;
}
Esempio n. 2
0
/**
 * \brief Calculates the direction and the speed of the movement
 * depending on the target.
 */
void PathFindingMovement::recompute_movement() {

  if (target != nullptr) {
    PathFinding path_finding(get_entity()->get_map(), *get_entity(), *target);
    std::string path = path_finding.compute_path();

    uint32_t min_delay;
    if (path.size() == 0) {
      // the target is too far or there is no path
      path = create_random_path();

      // no path was found: no need to try again very soon
      // (note that the A* algorithm is very costly when it explores all nodes without finding a solution)
      min_delay = 3000;
    }
    else {
      // a path was found: we need to update it frequently (and the A* algorithm is much faster in general when there is a solution)
      min_delay = 300;
    }
    // compute a new path every random delay to avoid
    // having all path-finding entities of the map compute a path at the same time
    next_recomputation_date = System::now() + min_delay + Random::get_number(200);

    set_path(path);
  }
}
Esempio n. 3
0
int 
Recorder::open_path ( const char * filename ) {
   cerr << "Recorder::open_path  - - Nothin yet" << endl;
   cerr << "filename is " << filename << endl; 
   fstream fin;
#if (defined (WIN32) && defined(_MSC_VER) && (_MSC_VER <=1300)) /*VS 6.0*/
   fin.open ( filename, ios::in | ios::nocreate);
#else
   fin.open ( filename, ios::in );
#endif
   if ( !fin )
      {
         err_ret("Recorder::open_path: error opening file");
      }
   CameraPath * tmp = new CameraPath ( filename );
   if ( !tmp->read_stream (fin )) return 0;
   fin.close();
   _campaths.push_back ( tmp );
   _ui->add_path_entry ( _campaths.size()-1, filename );
   //set the opened path to be the current path
   cerr << "num is " << _campaths.size() << endl;
   set_path ( _campaths.size()-1 ) ;
   cerr << "end open " << endl;

   return 1;
}
Esempio n. 4
0
bool_t getattr_1_svc(ne_getattr_arg arg, ne_getattr_res *res, struct svc_req *req)
{
	char path[PATH_MAX];
	static struct stat stbuf;

	memset((char *)&stbuf, 0, sizeof(stbuf));
	set_path(path, arg.path);

	res->res = lstat(path, &stbuf);

	printf("getattr_svc:%s\n", path);
	res->stbuf.dev = stbuf.st_dev;
	res->stbuf.ino = stbuf.st_ino;
	res->stbuf.mode = stbuf.st_mode;
//	printf("%u\n", stbuf.st_mode);
	res->stbuf.nlink = stbuf.st_nlink;
	res->stbuf.uid = stbuf.st_uid;
	res->stbuf.gid = stbuf.st_gid;
	res->stbuf.rdev = stbuf.st_rdev;
	res->stbuf.size = stbuf.st_size;
	res->stbuf.atime = stbuf.st_atime;
	res->stbuf.mtime = stbuf.st_mtime;
	res->stbuf.ctime = stbuf.st_ctime;
	res->stbuf.blksize = stbuf.st_blksize;
	res->stbuf.blocks = stbuf.st_blocks;

	if (res->res == -1)
		res->res = -errno;

	return TRUE;
}
Esempio n. 5
0
int		main(int ac, char **av)
{
  int		v;
  t_map		map;
  t_graph	**pile;

  if (ac != 2)
    return (1);
  if (load_map(&map, av[1]) == -1 ||
      create_graph(&map) == -1 ||
      link_room(&map) == -1)
    return (1);
  if ((pile = malloc(sizeof(t_graph *))) == NULL)
    return (1);
  *pile = NULL;
  if ((v = search_path(map.start, map.end, &pile)) == 0)
    {
      printf("No solution found\n");
      return (1);
    }
  else if (v == -1)
    return (2);
  set_path(map.end);
  show_map(&map);
  free(pile);
  free_all(&map);
  return (0);
}
Esempio n. 6
0
bool_t readdir_1_svc(ne_readdir_arg arg, ne_readdir_res *res, struct svc_req *req)
{
	DIR *dp;
	struct dirent *de;
	ne_dirent **d;
	ne_dirent *p;
	char path[PATH_MAX];

	set_path(path, arg.path);

	printf("readdir_svc:%s\n", path);
	dp = opendir(path);
	//TODO
	if (dp == NULL) {
		return TRUE;
	}

	d = &(res->dirent);

	while ((de = readdir(dp)) != NULL) {
		p = *d = (ne_dirent *)malloc(sizeof(ne_dirent));
		//TODO:memory full
		p->d_ino = de->d_ino;
		p->d_name = strdup(de->d_name);
		d = &p->next;
	}
	*d = (ne_dirent *)NULL;

	closedir(dp);
	return TRUE;
}
Esempio n. 7
0
bool_t link_1_svc(ne_link_arg arg, ne_link_res *res, struct svc_req *req)
{
	char from[PATH_MAX];
	char to[PATH_MAX];

	set_path(from, arg.from);
	set_path(to, arg.to);

	printf("symlink_svc:%s%s\n", from, to);
	res->res = link(from, to);

	if (res->res == -1) 
		res->res = -errno;

	return TRUE;
}
Esempio n. 8
0
gboolean g_ril_request_sim_read_record(GRil *gril,
					const struct req_sim_read_record *req,
					struct parcel *rilp)
{
	parcel_init(rilp);
	parcel_w_int32(rilp, CMD_READ_RECORD);
	parcel_w_int32(rilp, req->fileid);

	g_ril_append_print_buf(gril,
				"(cmd=0x%.2X,efid=0x%.4X,",
				CMD_READ_RECORD,
				req->fileid);

	if (set_path(gril, req->app_type, rilp, req->fileid,
			req->path, req->path_len) == FALSE)
		goto error;

	parcel_w_int32(rilp, req->record);      /* P1 */
	parcel_w_int32(rilp, 4);           /* P2 */
	parcel_w_int32(rilp, req->length);      /* P3 */
	parcel_w_string(rilp, NULL);       /* data; only req'd for writes */
	parcel_w_string(rilp, NULL);       /* pin2; only req'd for writes */
	parcel_w_string(rilp, req->aid_str); /* AID (Application ID) */

	/* sessionId, specific to latest MTK modems (harmless for older ones) */
	if (g_ril_vendor(gril) == OFONO_RIL_VENDOR_MTK)
		parcel_w_int32(rilp, 0);

	return TRUE;

error:
	return FALSE;
}
Esempio n. 9
0
/**
 * \brief Updates the position.
 */
void PathFindingMovement::update() {

  PathMovement::update();

  if (target != nullptr && target->is_being_removed()) {
    target = nullptr;
  }

  if (is_suspended()) {
    return;
  }

  if (PathMovement::is_finished()) {

    // there was a collision or the path was made
    if (target != nullptr
        && System::now() >= next_recomputation_date
        && get_entity()->is_aligned_to_grid()) {
      recompute_movement();
    }
    else {
      set_path(create_random_path());
    }
  }
}
Esempio n. 10
0
void *file_new(const char *path)
{
	t_file *file = (t_file *) malloc( sizeof( t_file));

	id_init( &file->id, path);

	memset( file->id.name,'\0',_NAME_);
	memset( file->ext,'\0',_EXT_);
	memset( file->path,'\0',_PATH_);

	set_path( file->path, path);

	file->is_relative = 0;
	file->is_directory = 0;
	file->has_extention = 0;
	file->path_type = 0;

	file->data = NULL;
	file->lines = NULL;
	file->file = NULL;

	file->data_size = 0;
	file->tot_line = 0;
	file->dir_count = 0;
	file->exists = 0;

	bzero( file->dirs, FILE_MAX_DIR * _NAME_LONG_);
	bzero( file->dir_path, _PATH_);

	return file;
}
Esempio n. 11
0
int save_instance_struct (const ncInstance * instance)
{
    if (instance==NULL) {
	    logprintfl(EUCADEBUG, "save_instance_struct: NULL instance!\n");
        return ERROR;
    }

    char checkpoint_path [MAX_PATH];
    set_path (checkpoint_path, sizeof (checkpoint_path), instance, "instance.checkpoint");

    int fd;
    if ((fd = open (checkpoint_path, O_CREAT | O_WRONLY, BACKING_FILE_PERM)) < 0) {
	    logprintfl(EUCADEBUG, "[%s] save_instance_struct: failed to create instance checkpoint at %s\n", instance->instanceId, checkpoint_path);
        return ERROR;
    }

    if (write (fd, (char *)instance, sizeof(struct ncInstance_t)) != sizeof (struct ncInstance_t)) {
	    logprintfl(EUCADEBUG, "[%s] save_instance_struct: failed to write instance checkpoint at %s\n", instance->instanceId, checkpoint_path);
        close (fd);
        return ERROR;
    }
    close (fd);
    
    return OK;
}
Esempio n. 12
0
void 
Path::set_path (const std::string& colon_path)
{ 
  std::vector<symbol> result;
  parse_path (colon_path, result);
  set_path (result);
}
Esempio n. 13
0
int main(int argc, char * argv[]) {
	/* Starts a graphical session and then spins waiting for a kill (logout) signal */

	/* Load some session variables */
	set_username();
	set_homedir();
	set_path();

	int _wallpaper_pid = fork();
	if (!_wallpaper_pid) {
		char * args[] = {"/bin/wallpaper", NULL};
		execvp(args[0], args);
	}
	int _panel_pid = fork();
	if (!_panel_pid) {
		char * args[] = {"/bin/panel", NULL};
		execvp(args[0], args);
	}

	syscall_wait(_panel_pid);

	printf("Session leader has exited. Sending INT signals to %d.\n", _wallpaper_pid);

	syscall_send_signal(_wallpaper_pid, 2);

	printf("Waiting on wallpaper.\n");
	syscall_wait(_wallpaper_pid);

	printf("Session has ended.\n");

}
Esempio n. 14
0
static int stale_blob_examiner (const blockblob * bb)
{
    char work_path [MAX_PATH];
    
    set_path (work_path, sizeof (work_path), NULL, NULL);
    int work_path_len = strlen (work_path);
    assert (work_path_len > 0);

    char * s = strstr(bb->blocks_path, work_path);
    if (s==NULL || s!=bb->blocks_path)
        return 0; // blob not under work blobstore path

    // parse the path past the work directory base
    safe_strncpy (work_path, bb->blocks_path, sizeof (work_path));
    s = work_path + work_path_len + 1;
    char * user_id = strtok (s, "/");
    char * inst_id = strtok (NULL, "/"); 
    char * file    = strtok (NULL, "/");

    ncInstance * instance = find_instance (instances, inst_id);
    if (instance == NULL) { // not found among running instances => stale
        // while we're here, try to delete extra files that aren't managed by the blobstore
        // TODO: ensure we catch any other files - perhaps by performing this cleanup after all blobs are deleted
        char path [MAX_PATH];
#define del_file(filename) snprintf (path, sizeof (path), "%s/work/%s/%s/%s", instances_path, user_id, inst_id, filename); unlink (path);
        del_file("instance.xml");
        del_file("libvirt.xml");
        del_file("console.log");
        del_file("instance.checkpoint");
        return 1;
    }

    return 0;
}
Esempio n. 15
0
/* Increment the playcount of <file> by one. Either connect to a
 running instance of gtkpod and transfer the filename, or write the
 name to ~/.gtkpod/offline_playcounts.
 Return value: TRUE on success, FALSE if a non-recoverable error
 occurred */
gboolean client_playcount(gchar *file) {
    if (socket_used()) { /* send filename to currently running gtkpod instance */
        struct sockaddr_un *server;

        server = g_malloc0(sizeof(struct sockaddr_un));
        set_path(server);
        if (g_file_test(server->sun_path, G_FILE_TEST_EXISTS)) {
            gint csock = socket(AF_UNIX, SOCK_STREAM, 0);
            if (csock != -1) {
                server->sun_family = AF_UNIX;
                if (connect(csock, (struct sockaddr *) server, sizeof(struct sockaddr_un)) != -1) {
                    gchar *buf = g_strdup_printf("%s%s", SOCKET_PLYC, file);
                    size_t buf_len = strlen(buf);
                    if (write(csock, buf, buf_len) != (ssize_t) buf_len) {
                        fprintf(stderr, "Error communicating to server. Playcount registered in offline database.\n");
                        register_playcount(file);
                    }
                    g_free(buf);
                }
                close(csock);
            }
        }
        g_free(server);
    }
    else { /* write filename to ~/.gtkpod/offline_playcounts */
        register_playcount(file);
    }
    return TRUE;
}
Esempio n. 16
0
void server_setup(void) {
    if (ssock != -1)
        return; /* already opened */
    if (socket_used()) {
        /* we are not the first instance of gtkpod -- the socket is
         already being used, so we pass */
        gtkpod_warning(_("Another instance of gtkpod was detected. Playcount server not started.\n"));
        return;
    }
    ssock = socket(AF_UNIX, SOCK_STREAM, 0);
    if (ssock != -1) {
        if (saddr == NULL) {
            saddr = g_malloc0(sizeof(struct sockaddr_un));
            saddr->sun_family = AF_UNIX;
        }
        set_path(saddr);
        unlink(saddr->sun_path);
        if (bind(ssock, (struct sockaddr *) saddr, sizeof(struct sockaddr_un)) != -1) {
            listen(ssock, 5);
            /* socket must be non-blocking -- otherwise
             received_message() will block */
            fcntl(ssock, F_SETFL, O_NONBLOCK);
            channel = g_io_channel_unix_new(ssock);
            inp_handler = g_io_add_watch(channel, G_IO_IN, received_message, NULL);
        }
        else {
            fprintf(stderr, "server: bind error: %s", strerror(errno));
            close(ssock);
            ssock = -1;
        }
    }
    else {
        fprintf(stderr, "server: socket error: %s", strerror(errno));
    }
}
Esempio n. 17
0
gboolean g_ril_request_sim_read_binary(GRil *gril,
					const struct req_sim_read_binary *req,
					struct parcel *rilp)
{
	g_ril_append_print_buf(gril,
				"(cmd=0x%.2X,efid=0x%.4X,",
				CMD_READ_BINARY,
				req->fileid);

	parcel_init(rilp);
	parcel_w_int32(rilp, CMD_READ_BINARY);
	parcel_w_int32(rilp, req->fileid);

	if (set_path(gril, req->app_type, rilp, req->fileid,
			req->path, req->path_len) == FALSE)
		goto error;

	parcel_w_int32(rilp, (req->start >> 8));   /* P1 */
	parcel_w_int32(rilp, (req->start & 0xff)); /* P2 */
	parcel_w_int32(rilp, req->length);         /* P3 */
	parcel_w_string(rilp, NULL);          /* data; only req'd for writes */
	parcel_w_string(rilp, NULL);          /* pin2; only req'd for writes */
	parcel_w_string(rilp, req->aid_str);

	return TRUE;

error:
	return FALSE;
}
Esempio n. 18
0
void FindBar::build_widgets(Glib::RefPtr<Gtk::Builder>& builder) {
    builder->get_widget("find_bar", find_bar_);
    builder->get_widget("find_entry", find_entry_);
    builder->get_widget("replace_entry", replace_entry_);
    builder->get_widget("find_next_button", find_next_button_);
    builder->get_widget("replace_button", replace_button_);
    builder->get_widget("replace_all_button", replace_all_button_);
    builder->get_widget("find_close_button", close_button_);
    builder->get_widget("case_sensitive", case_sensitive_);

    find_entry_->signal_changed().connect(sigc::mem_fun(this, &FindBar::on_entry_changed));
    find_entry_->signal_activate().connect(sigc::mem_fun(this, &FindBar::on_entry_activated));
    find_entry_->signal_key_press_event().connect(sigc::mem_fun(this, &FindBar::on_entry_key_press));

    find_next_button_->signal_clicked().connect(sigc::mem_fun(this, &FindBar::on_find_next_clicked));

    close_button_->signal_clicked().connect([&]() {
        signal_close_requested_();
    });

    find_entry_->add_events(Gdk::KEY_PRESS_MASK);
    case_sensitive_->signal_state_changed().connect(sigc::mem_fun(this, &FindBar::on_case_sensitive_changed));

    auto context = Gtk::StyleContext::create();
    auto entry_path = find_entry_->get_path();
    context->set_path(entry_path);
    context->add_class("entry");

    default_entry_colour_ = context->get_color(Gtk::STATE_FLAG_FOCUSED);
}
Esempio n. 19
0
static void
set_slot_from_value (slot_info_t* pInfo, KvpValue* pValue)
{
    g_return_if_fail (pInfo != NULL);
    g_return_if_fail (pValue != NULL);

    switch (pInfo->context)
    {
    case FRAME:
    {
        auto key = get_key_from_path (pInfo->path);
        pInfo->pKvpFrame->set (key.c_str(), pValue);
        break;
    }
    case LIST:
    {
        pInfo->pList = g_list_append (pInfo->pList, pValue);
        break;
    }
    case NONE:
    default:
    {
        auto key = get_key_from_path (pInfo->path);
        auto path = get_path_from_path (pInfo->path);
        auto frame = pInfo->pKvpFrame;
        if (!path.empty())
        {
            frame->set_path ({path.c_str(), key.c_str()}, pValue);
        }
        else
            frame->set (key.c_str(), pValue);
        break;
    }
    }
}
Esempio n. 20
0
int mutt_open_append_compressed (CONTEXT * ctx)
{
    FILE *fh;
    COMPRESS_INFO *ci = set_compress_info (ctx);

    if (!get_append_command (ctx->path, ctx)) {
        if (ci->open && ci->close)
            return (mutt_open_read_compressed (ctx));

        ctx->magic = 0;
        mem_free (&ctx->compressinfo);
        return (-1);
    }

    set_path (ctx);

    ctx->magic = DefaultMagic;

    if (!is_new (ctx->realpath))
        if (ctx->magic == M_MBOX || ctx->magic == M_MMDF)
            if ((fh = safe_fopen (ctx->path, "w")))
                fclose (fh);
    /* No error checking - the parent function will catch it */

    return (0);
}
Esempio n. 21
0
static void
modify_environment (const struct passwd *pw, const char *shell)
{
  if (simulate_login)
    {
      /* Leave TERM unchanged.  Set HOME, SHELL, USER, LOGNAME, PATH.
         Unset all other environment variables.  */
      char *term = getenv ("TERM");
      if (term)
	term = xstrdup (term);
      environ = xmalloc ((6 + !!term) * sizeof (char *));
      environ[0] = NULL;
      if (term) {
	xsetenv ("TERM", term, 1);
	free(term);
      }
      xsetenv ("HOME", pw->pw_dir, 1);
      if (shell)
	xsetenv ("SHELL", shell, 1);
      xsetenv ("USER", pw->pw_name, 1);
      xsetenv ("LOGNAME", pw->pw_name, 1);
      set_path(pw);
    }
  else
    {
      /* Set HOME, SHELL, and (if not becoming a superuser)
	 USER and LOGNAME.  */
      if (change_environment)
        {
          xsetenv ("HOME", pw->pw_dir, 1);
	  if (shell)
            xsetenv ("SHELL", shell, 1);
	  if (getlogindefs_bool ("ALWAYS_SET_PATH", 0))
	    set_path(pw);

          if (pw->pw_uid)
            {
              xsetenv ("USER", pw->pw_name, 1);
              xsetenv ("LOGNAME", pw->pw_name, 1);
            }
        }
    }

  export_pamenv ();
}
Esempio n. 22
0
/*
class writer{
    typedef std::vector<std::string> str_vec;
public:
    writer (std::ostream::open_mode mode) : file_mode(mode) {};
    
    
    void set_path();
    void stream(std::string &string_out);
    void stream(std::vector<std::string> &output_vec);

private:
    void set_variables();
    bool valid_path(std::string tempPath);
    std::ostream & write(std::string &output, std::ostream & out);
    std::string path = "null";
    std::ostream::open_mode file_mode;
    int is_set_up = 0;
};*/
void writer::set_variables()
{
    if (is_set_up == 0)
    {
        //set the path
        set_path();
        ++is_set_up;
    }
}
Esempio n. 23
0
int BsdAttachListener::init() {
  char path[UNIX_PATH_MAX];          // socket file
  char initial_path[UNIX_PATH_MAX];  // socket file during setup
  int listener;                      // listener socket (file descriptor)

  // register function to cleanup
  ::atexit(listener_cleanup);

  int n = snprintf(path, UNIX_PATH_MAX, "%s/.java_pid%d",
                   os::get_temp_directory(), os::current_process_id());
  if (n < (int)UNIX_PATH_MAX) {
    n = snprintf(initial_path, UNIX_PATH_MAX, "%s.tmp", path);
  }
  if (n >= (int)UNIX_PATH_MAX) {
    return -1;
  }

  // create the listener socket
  listener = ::socket(PF_UNIX, SOCK_STREAM, 0);
  if (listener == -1) {
    return -1;
  }

  // bind socket
  struct sockaddr_un addr;
  addr.sun_family = AF_UNIX;
  strcpy(addr.sun_path, initial_path);
  ::unlink(initial_path);
  int res = ::bind(listener, (struct sockaddr*)&addr, sizeof(addr));
  if (res == -1) {
    ::close(listener);
    return -1;
  }

  // put in listen mode, set permissions, and rename into place
  res = ::listen(listener, 5);
  if (res == 0) {
    RESTARTABLE(::chmod(initial_path, S_IREAD|S_IWRITE), res);
    if (res == 0) {
      // make sure the file is owned by the effective user and effective group
      // (this is the default on linux, but not on mac os)
      RESTARTABLE(::chown(initial_path, geteuid(), getegid()), res);
      if (res == 0) {
        res = ::rename(initial_path, path);
      }
    }
  }
  if (res == -1) {
    ::close(listener);
    ::unlink(initial_path);
    return -1;
  }
  set_path(path);
  set_listener(listener);

  return 0;
}
TEST_F(ImapPlainTest, FindAccount)
{
    auto root = qof_instance_get_slots(QOF_INSTANCE(t_bank_account));
    auto acc1_val = new KvpValue(const_cast<GncGUID*>(xaccAccountGetGUID(t_expense_account1)));
    auto acc2_val = new KvpValue(const_cast<GncGUID*>(xaccAccountGetGUID(t_expense_account2)));
    root->set_path({IMAP_FRAME, "foo", "bar"}, acc1_val);
    root->set_path({IMAP_FRAME, "baz", "waldo"}, acc2_val);
    root->set_path({IMAP_FRAME, "pepper"}, acc1_val);
    root->set_path({IMAP_FRAME, "salt"}, acc2_val);

    EXPECT_EQ(t_expense_account1, gnc_account_imap_find_account(t_imap, "foo", "bar"));
    EXPECT_EQ(t_expense_account2,
              gnc_account_imap_find_account(t_imap, "baz", "waldo"));
    EXPECT_EQ(t_expense_account1,
              gnc_account_imap_find_account(t_imap, NULL, "pepper"));
    EXPECT_EQ(t_expense_account2, gnc_account_imap_find_account(t_imap, NULL, "salt"));
    EXPECT_EQ(nullptr, gnc_account_imap_find_account(t_imap, "salt", NULL));
}
Esempio n. 25
0
/**
 * @brief Sets the value of a property of this movement.
 *
 * Accepted keys:
 * - path
 * - speed
 * - loop
 * - ignore_obstacles
 * - snap_to_grid
 *
 * @param key key of the property to set (the accepted keys depend on the movement type)
 * @param value the value to set
 */
void PathMovement::set_property(const std::string &key, const std::string &value) {

  std::istringstream iss(value);

  if (key == "path") {
    std::string path;
    iss >> path;
    set_path(path);
  }
Esempio n. 26
0
		BreadCrumb(const Raul::Path& path, SPtr<GraphView> view = SPtr<GraphView>())
			: _path(path)
			, _view(view)
		{
			assert(!view || view->graph()->path() == path);
			set_border_width(0);
			set_path(path);
			set_can_focus(false);
			show_all();
		}
Esempio n. 27
0
/**
 * @brief Updates the movements: detects the collisions
 * in order to restart the movement.
 */
void RandomPathMovement::update() {

  PathMovement::update();

  if (!is_suspended() && PathMovement::is_finished()) {

    // there was a collision or the random path is finished: restart with a new random path
    set_path(create_random_path());
  }
}
Esempio n. 28
0
KvpValue*
KvpFrameImpl::set_path(Path path, KvpValue* value) noexcept
{
    auto cur_frame = this;
    auto last_key = path.back();
    path.pop_back();
    cur_frame = walk_path_and_create(const_cast<KvpFrame*>(this), path);
    if (last_key.find(delim) != std::string::npos)
        return set_path(make_vector(last_key), value);
    return cur_frame->set(last_key.c_str(), value);
}
Esempio n. 29
0
BEE::Background::Background (std::string new_name, std::string new_path) {
    reset();

    add_to_resources();
    if (id < 0) {
        game->messenger_send({"engine", "resource"}, BEE_MESSAGE_WARNING, "Failed to add background resource: \"" + new_name + "\" from " + new_path);
        throw(-1);
    }

    set_name(new_name);
    set_path(new_path);
}
events::Event
FileSystemEvents::volume_delete(const volumedriver::VolumeId& id,
                                const FrontendPath& path)
{
    events::Event ev;
    auto msg = ev.MutableExtension(events::volume_delete);

    msg->set_path(path.string());
    msg->set_name(id.str());

    return ev;
}