コード例 #1
0
ファイル: Symbol.c プロジェクト: aldavud/p
/* ========================================================================= */

SmallInt Symbol_hash(Symbol symbol)
{
    return symbol->hash;
}

NATIVE1(Symbol_at_)
    Optr w_arg0 = NATIVE_ARG(0);
    ASSERT_INSTANCE_OF(w_arg0, SmallInt_Class);
    long index  = unwrap_int(w_arg0) - 1;
    assert(0 <= index, printf("Index below 0: %li", index));
    assert(index < ((String)self)->size,
        printf("%li is out of Bounds[%lu]\n", index, ((String)self)->size));
    // printf("at: %i '%lc'\n", index, ((Symbol)self)->value[index]);
    RETURN_FROM_NATIVE(new_Character(((Symbol) self)->value[index]));
}

NATIVE1(Symbol_basicAt_)
    Optr w_arg0 = NATIVE_ARG(0);
    ASSERT_INSTANCE_OF(w_arg0, SmallInt_Class);
    long index  = unwrap_int(w_arg0) - 1;
    assert(0 <= index, printf("Index below 0: %li", index));
    assert(index < ((String)self)->size,
        printf("%li is out of Bounds[%lu]\n", index, ((String)self)->size));
    // printf("at: %i '%lc'\n", index, ((Symbol)self)->value[index]);
    RETURN_FROM_NATIVE(wrap_int(((Symbol) self)->value[index]));
}

NATIVE0(Symbol_asString)
    RETURN_FROM_NATIVE(new_String(((Symbol)self)->value));
コード例 #2
0
#include "CharacterController.h"
#include <stdio.h>
#include <iostream>

player_t *pc;
int *character_map;
character_t **character_list;
character_t NULL_CHARACTER = *(new_Character());//{speed : -1, timer : -1, id : -1};
int num_characters;
char *dis_map;
char *dis_map_tun;
int dead_monsters = 0;

playerClass::playerClass()
{
	pname = "";
	int i;
	for(i = 0; i < 12; i++)
	{
		equipment[i] = itemClass();
	}
	for(i = 0; i < 10; i++)
	{
		inventory[i] = itemClass();
	}
	for(i = 0; i < 16; i++)
	{
		spells[i] = itemClass();
	}
}