예제 #1
0
void release(objectmachine_t *obj)
{
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;
    objectdecorator_setplayerposition_t *me = (objectdecorator_setplayerposition_t*)obj;

    expression_destroy(me->offset_x);
    expression_destroy(me->offset_y);

    decorated_machine->release(decorated_machine);
    free(obj);
}
예제 #2
0
void release(objectmachine_t *obj)
{
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;
    objectdecorator_setscale_t *me = (objectdecorator_setscale_t*)obj;

    expression_destroy(me->scale_x);
    expression_destroy(me->scale_y);

    decorated_machine->release(decorated_machine);
    free(obj);
}
예제 #3
0
void release(objectmachine_t *obj)
{
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;
    objectdecorator_textout_t *me = (objectdecorator_textout_t*)obj;

    expression_destroy(me->xpos);
    expression_destroy(me->ypos);
    expression_destroy(me->max_width);
    expression_destroy(me->index_of_first_char);
    expression_destroy(me->length);
    font_destroy(me->fnt);
    free(me->text);

    decorated_machine->release(decorated_machine);
    free(obj);
}
예제 #4
0
void release(objectmachine_t *obj)
{
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectdecorator_addlives_t *me = (objectdecorator_addlives_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;

    expression_destroy(me->lives);

    decorated_machine->release(decorated_machine);
    free(obj);
}
예제 #5
0
void release(objectmachine_t *obj)
{
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;
    objectdecorator_setplayerspeed_t *me = (objectdecorator_setplayerspeed_t*)obj;

    expression_destroy(me->speed);

    decorated_machine->release(decorated_machine);
    free(obj);
}
예제 #6
0
void release(objectmachine_t *obj)
{
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;
    objectdecorator_lockcamera_t *me = (objectdecorator_lockcamera_t*)obj;
    player_t *player = enemy_get_observed_player(obj->get_object_instance(obj));

    if(me->has_locked_somebody) {
        player->in_locked_area = FALSE;
        level_unlock_camera();
    }

    expression_destroy(me->x1);
    expression_destroy(me->x2);
    expression_destroy(me->y1);
    expression_destroy(me->y2);

    decorated_machine->release(decorated_machine);
    free(obj);
}
예제 #7
0
파일: tmnsh.c 프로젝트: ecdavis/tmnsh
/**
 * void main_loop(FILE *stream, int interactive)
 *
 * Reads, tokenises, parses ane executes input from the given stream. If
 * interactive mode is on, outputs a welcome message and a prompt.
 */
void main_loop(FILE *stream, int interactive) {
	char buffer[BUFFER_MAX_SIZE];
	char last_line[BUFFER_MAX_SIZE];
	int more_to_read = TRUE;
	tokarray_t *tokens;
	expression_t *expr;
	
	bzero(buffer, BUFFER_MAX_SIZE);
	bzero(last_line, BUFFER_MAX_SIZE);
	
	if (interactive == TRUE) {
		show_welcome();
	}
	
	while (more_to_read == TRUE) {
		if (interactive == TRUE) {
			show_prompt();
		}
		
		/* Read a line of input. */
		more_to_read = read_data(stream, buffer, BUFFER_MAX_SIZE);
		
		if (strlen(buffer) == 0) {
			continue;
		}
		
		strcpy(last_line, buffer);
		
		/* Tokenise the input. */
		tokens = tokenise_input(buffer);
		
		if (tokens == NULL) {
			printf("!tmnsh: Could not tokenise input: %s\n", last_line);
			continue;
		}
		
		/* Parse the tokens into an expression. */
		expr = parse_tokens(tokens);
		
		if (expr == NULL) {
			printf("!tmnsh: Could not parse input: %s\n", last_line);
			tokarray_destroy(tokens); /* Clean up. */
			continue;
		}
		
		/* Interpret the expression and execute the commands. */
		interpret_expression(expr);
		
		expression_destroy(expr); /* Clean up. */
		bzero(buffer, BUFFER_MAX_SIZE);
		bzero(last_line, BUFFER_MAX_SIZE);
	}
}
예제 #8
0
void release(objectmachine_t *obj)
{
    objectdecorator_children_t *me = (objectdecorator_children_t*)obj;
    objectdecorator_t *dec = (objectdecorator_t*)obj;
    objectmachine_t *decorated_machine = dec->decorated_machine;

    if(me->child_name != NULL)
        free(me->child_name);

    if(me->object_name != NULL)
        free(me->object_name);

    if(me->new_state_name != NULL)
        free(me->new_state_name);

    if(me->offset_x != NULL)
        expression_destroy(me->offset_x);

    if(me->offset_y != NULL)
        expression_destroy(me->offset_y);

    decorated_machine->release(decorated_machine);
    free(obj);
}