Ejemplo n.º 1
0
void unit_frame::redraw(const int frame_time,bool first_time,const map_location & src,const map_location & dst,int*halo_id,const frame_parameters & animation_val,const frame_parameters & engine_val,const bool primary)const
{
	const int xsrc = game_display::get_singleton()->get_location_x(src);
	const int ysrc = game_display::get_singleton()->get_location_y(src);
	const int xdst = game_display::get_singleton()->get_location_x(dst);
	const int ydst = game_display::get_singleton()->get_location_y(dst);
	const map_location::DIRECTION direction = src.get_relative_dir(dst);

	const frame_parameters current_data = merge_parameters(frame_time,animation_val,engine_val,primary);
	double tmp_offset = current_data.offset;

		// debug code allowing to see the number of frames and their position
		// you need to add a '/n'
		// if (tmp_offset) std::cout << (int)(tmp_offset*100) << ",";

	int d2 = game_display::get_singleton()->hex_size() / 2;
	if(first_time ) {
		// stuff sthat should be done only once per frame
		if(!current_data.sound.empty()  ) {
			sound::play_sound(current_data.sound);
		}
		if(!current_data.text.empty()  ) {
			game_display::get_singleton()->float_label(src,current_data.text,
			(current_data.text_color & 0x00FF0000) >> 16,
			(current_data.text_color & 0x0000FF00) >> 8,
			(current_data.text_color & 0x000000FF) >> 0);
		}
	}
Ejemplo n.º 2
0
static gboolean
milter_esmtp_parse_envelope_command_argument (gboolean accept_postmaster_path,
                                              const gchar  *argument,
                                              gchar       **path,
                                              GHashTable  **parameters,
                                              GError      **error)
{
    gint index = 0;
    gint parsed_position;
    gchar *parsed_path = NULL;
    GHashTable *parsed_parameters = NULL;

    if (!argument)
        RETURN_ERROR("argument should not be NULL");

    if (argument[0] != '<')
        RETURN_ERROR_WITH_POSITION("argument should start with '<'",
                                   argument, 0);

    if (!parse_path(accept_postmaster_path, argument, index, &parsed_position,
                    path ? &parsed_path : NULL,
                    error)) {
        return FALSE;
    }
    index += parsed_position;

    if (!parse_parameters(argument, index, &parsed_position,
                          parameters ? &parsed_parameters : NULL,
                          error)) {
        if (parsed_path)
            g_free(parsed_path);
        if (parsed_parameters)
            g_hash_table_unref(parsed_parameters);
        return FALSE;
    }

    index += parsed_position;

    if (argument[index]) {
        if (parsed_path)
            g_free(parsed_path);
        if (parsed_parameters)
            g_hash_table_unref(parsed_parameters);
        RETURN_ERROR_WITH_POSITION("there is a garbage at the last",
                                   argument, index);
    }

    if (parsed_path)
        *path = parsed_path;

    if (parsed_parameters) {
        if (*parameters) {
            merge_parameters(*parameters, parsed_parameters);
            g_hash_table_unref(parsed_parameters);
        } else {
            *parameters = parsed_parameters;
        }
    }

    return TRUE;
}