Exemplo n.º 1
0
static int
pr_head(const struct chunk *cnk) {
	int pos = 0;

	pos += prs(cnk->ch_text->tx_fname);
	pos += prs(": line ");
	pos += pru(cnk->ch_first.ps_nl_cnt);
	pos += prs("-");
	pos += pru(cnk->ch_last.ps_nl_cnt - 1);
	return pos;
}
Exemplo n.º 2
0
void testPRUplus() {
  PRUplus::domainFunction = &testFunction;
  PRUplus::actionsDomain["AvailableAds"].insert("Monoprix");
  PRUplus::actionsDomain["AvailableAds"].insert("Restaurant");
  PRUplus::actionsDomain["AvailableAds"].insert("DoorE");
  PRUplus pru("pru.xml");
  std::cout << pru << std::endl;

  map<string, domain_type> stateVariableDomain;
  pru.fillSVdomain(stateVariableDomain);  
  std::cout << stateVariableDomain << std::endl;
}
Exemplo n.º 3
0
// Not good to basically have two independent "refresh" procedures... :-b
// hmmm in the original, pline called nscr!
void nscr()
{
  Short x_abs, y_abs, col, line;
  Short v_h = itsy_on ? visible_h_itsy : visible_h;
  Short v_w = itsy_on ? visible_w_itsy : visible_w;

  if (FrmGetActiveFormID() != MainForm) return;
  // XXX flags.nscrinh is used only in goto_level()  ..will need it though.
  if (you.uswallow || you.ux == FAR /*|| flags.nscrinh*/) return;
#ifdef I_AM_OS_2
  if (itsy_on) FntSetFont(ledFont);
#else
  if (itsy_on) FntSetFont(SmallFont);
#endif
  pru();
  for (y_abs = scrly ; y_abs <= scrhy ; y_abs++) {
    line = y_abs - visible_y;
    if (line < 0 || line >= v_h) continue;
    for (x_abs = scrlx ; x_abs <= scrhx ; x_abs++) {
      col = x_abs - visible_x;
      if (col < 0 || col >= v_w) continue;
      if (get_cell_new(floor_info[x_abs][y_abs])) {
	//	room = &levl[x_abs][y_abs]
	floor_info[x_abs][y_abs] &= ~NEW_CELL; // room->new = 0;
	put_char_at(line, col, floor_symbol[x_abs][y_abs], false);
      }
    }
  }
  scrlx = DCOLS;
  scrly = DROWS;
  scrhx = scrhy = 0;
#ifdef I_AM_OS_2
  if (itsy_on) FntSetFont(stdFont);
#else
  if (itsy_on) FntSetFont(BigFont);
#endif
}
Exemplo n.º 4
0
/* called with dx = dy = 0 with vertical bolts */
void
buzz(int type, xchar sx, xchar sy, int dx, int dy)
{
	int abstype = abs(type);
	const char *fltxt = (type == -1) ? "blaze of fire" : fl[abstype];
	struct rm *lev;
	xchar range;
	struct monst *mon;

	if(u.uswallow) {
		int tmp;

		if(type < 0) return;
		tmp = zhit(u.ustuck, type);
		pline("The %s rips into %s%s",
			fltxt, monnam(u.ustuck), exclam(tmp));
		return;
	}
	if(type < 0) pru();
	range = rn1(7,7);
	Tmp_at(-1, dirlet(dx,dy));	/* open call */
	while(range-- > 0) {
		sx += dx;
		sy += dy;
		if((lev = &levl[sx][sy])->typ) Tmp_at(sx,sy);
		else {
			int bounce = 0;
			if(cansee(sx-dx,sy-dy))
				pline("The %s bounces!", fltxt);
			if(ZAP_POS(levl[sx][sy-dy].typ))
				bounce = 1;
			if(ZAP_POS(levl[sx-dx][sy].typ)) {
				if(!bounce || rn2(2)) bounce = 2;
			}
			switch(bounce){
			case 0:
				dx = -dx;
				dy = -dy;
				continue;
			case 1:
				dy = -dy;
				sx -= dx;
				break;
			case 2:
				dx = -dx;
				sy -= dy;
				break;
			}
			Tmp_at(-2,dirlet(dx,dy));
			continue;
		}
		if(lev->typ == POOL && abstype == 1 /* fire */) {
			range -= 3;
			lev->typ = ROOM;
			if(cansee(sx,sy)) {
				mnewsym(sx,sy);
				pline("The water evaporates.");
			} else
				pline("You hear a hissing sound.");
		}
		if((mon = m_at(sx,sy)) &&
		   (type != -1 || mon->data->mlet != 'D')) {
			wakeup(mon);
			if(rnd(20) < 18 + mon->data->ac) {
				int tmp = zhit(mon,abstype);
				if(mon->mhp < 1) {
					if(type < 0) {
					    if(cansee(mon->mx,mon->my))
					      pline("%s is killed by the %s!",
						Monnam(mon), fltxt);
					    mondied(mon);
					} else
					    killed(mon);
				} else
					hit(fltxt, mon, exclam(tmp));
				range -= 2;
			} else
				miss(fltxt,mon);
		} else if(sx == u.ux && sy == u.uy) {
			nomul(0);
			if(rnd(20) < 18+u.uac) {
				int dam = 0;
				range -= 2;
				pline("The %s hits you!",fltxt);
				switch(abstype) {
				case 0:
					dam = d(2,6);
					break;
				case 1:
					if(Fire_resistance)
						pline("You don't feel hot!");
					else dam = d(6,6);
					if(!rn2(3))
						burn_scrolls();
					break;
				case 2:
					nomul(-rnd(25)); /* sleep ray */
					break;
				case 3:
					if(Cold_resistance)
						pline("You don't feel cold!");
					else dam = d(6,6);
					break;
				case 4:
					u.uhp = -1;
				}
				losehp(dam,fltxt);
			} else pline("The %s whizzes by you!",fltxt);
			stop_occupation();
		}
		if(!ZAP_POS(lev->typ)) {
			int bounce = 0, rmn;
			if(cansee(sx,sy)) pline("The %s bounces!",fltxt);
			range--;
			if(!dx || !dy || !rn2(20)){
				dx = -dx;
				dy = -dy;
			} else {
			  if(ZAP_POS(rmn = levl[sx][sy-dy].typ) &&
			    (IS_ROOM(rmn) || ZAP_POS(levl[sx+dx][sy-dy].typ)))
				bounce = 1;
			  if(ZAP_POS(rmn = levl[sx-dx][sy].typ) &&
			    (IS_ROOM(rmn) || ZAP_POS(levl[sx-dx][sy+dy].typ)))
				if(!bounce || rn2(2))
					bounce = 2;

			  switch(bounce){
			  case 0:
				dy = -dy;
				dx = -dx;
				break;
			  case 1:
				dy = -dy;
				break;
			  case 2:
				dx = -dx;
				break;
			  }
			  Tmp_at(-2, dirlet(dx,dy));
			}
		}
	}
	Tmp_at(-1,-1);
}