Пример #1
0
void getString( unsigned char *buf, int maxLen )
{
    unsigned char ch;
    int par = 1;
    while ((ch=getASCII()) == ' ') {
    }

    if (ch!='(')
        return;

    while ((ch=getASCII()) == ' ') {
    }

    if (ch==')')
        return;

    do {
        *buf = ch;
        buf++;
        ch=getASCII();
        if (ch==')')
            par--;
        else if (ch=='(')
            par++;
    } while (maxLen-->0 && par>0);
    *buf = '\0' ;
}
Пример #2
0
void getWord( unsigned char *buf, int maxLen )
{
    unsigned char ch;
    do {
        ch=getASCII();
    } while (ch==' ' || ch=='(' || ch==')');

    do {
        *buf = ch;
        buf++;
        ch=getASCII();
    } while (ch != ' ' && maxLen-->0 && ch!='/' && ch!=')' && ch!='(');
    *buf = '\0' ;
}
Пример #3
0
/* In ASCII mode only the most important thing on a tile is displayed. */
void
shNCursesInterface::draw (int x, int y, shSpecialEffect e, shCreature *c,
                   shObjectIlk *oi, shObject *o, shFeature *f, shSquare *s)
{
    shGlyph g = getASCII (x, y, e, c, oi, o, f, s);
    wmove (mWin[kMain], y - mY0, x - mX0);
    if (!g.mBkgd)
        waddch (mWin[kMain], g.mSym | ColorMap[g.mColor]);
    else
        waddch (mWin[kMain], g.mSym | ColorMap[g.mBkgd] | A_REVERSE);
    return;
}
Пример #4
0
/* gen_iv will generate a 16 char IV based on the
 * GPS coordinates for longitude and latitude.
 */
void gen_iv(char* IV){
	// TODO: FOR DEMO, READ GPS DATA INSTEAD OF FAKE DATA
	char iv[17];
	iv[16] = '\0';
	long lat, lon;
	read_gps(&lat, &lon);
	long long latXlon = lat * lon * 2;
	for (int i = 0; i < BLK_SIZE; i++){
		long long temp = latXlon / (10^i);
		iv[i] = getASCII(temp);
	}
	strcpy(IV,iv);
}