Ejemplo n.º 1
0
HS_BOOL8 CHSInterface::LinkExits(HS_DBREF sexit, HS_DBREF dexit)
{
    if (!sexit || !dexit)
        return false;

#ifdef PENNMUSH
    if (!IsExit(sexit) || !IsExit(dexit))
        return false;

    Location(dexit) = Home(sexit);
    Location(sexit) = Home(dexit);
#endif

#if defined(TM3) || defined(MUX)
    if (!isExit(sexit) || !isExit(dexit))
        return false;
    s_Location(dexit, where_is(sexit));
    s_Location(sexit, where_is(dexit));
#endif

#ifdef TM3
    s_Modified(dexit);
    s_Modified(sexit);
#endif

    return true;
}
Ejemplo n.º 2
0
/* Clone an object. The new object is owned by the cloning player */
static dbref
clone_object(dbref player, dbref thing, const char *newname, int preserve)
{
  dbref clone;

  clone = new_object();

  Owner(clone) = Owner(player);
  Name(clone) = NULL;
  if (newname && *newname)
    set_name(clone, newname);
  else
    set_name(clone, Name(thing));
  s_Pennies(clone, Pennies(thing));
  AttrCount(clone) = 0;
  List(clone) = NULL;
  Locks(clone) = NULL;
  clone_locks(player, thing, clone);
  Zone(clone) = Zone(thing);
  Parent(clone) = Parent(thing);
  Flags(clone) = clone_flag_bitmask("FLAG", Flags(thing));
  if (!preserve) {
    clear_flag_internal(clone, "WIZARD");
    clear_flag_internal(clone, "ROYALTY");
    Warnings(clone) = 0;        /* zap warnings */
    Powers(clone) = new_flag_bitmask("POWER");  /* zap powers */
  } else {
    Powers(clone) = clone_flag_bitmask("POWER", Powers(thing));
    Warnings(clone) = Warnings(thing);
    if (Wizard(clone) || Royalty(clone) || Warnings(clone) ||
        !null_flagmask("POWER", Powers(clone)))
      notify(player,
             T
             ("Warning: @CLONE/PRESERVE on an object with WIZ, ROY, @powers, or @warnings."));
  }
  /* We give the clone the same modification time that its
   * other clone has, but update the creation time */
  ModTime(clone) = ModTime(thing);
  CreTime(clone) = mudtime;
  Type(clone) = Type(thing);

  Contents(clone) = Location(clone) = Next(clone) = NOTHING;
  if (IsRoom(thing))
    Exits(clone) = NOTHING;
  else
    Home(clone) = Home(thing);
  atr_cpy(clone, thing);

  queue_event(player, "OBJECT`CREATE", "%s,%s",
              unparse_objid(clone), unparse_objid(thing));
  return clone;

}
Ejemplo n.º 3
0
HS_DBREF CHSInterface::GetHome(HS_DBREF dbObject)
{
    if (dbObject)
        return Home(dbObject);

    return NOTHING;
}
Ejemplo n.º 4
0
void ClearPrompts(void)
{
    mvhline(47,60,' ',40);
    mvhline(48,60,' ',40);
    mvhline(49,60,' ',40);
    Home();
}
Ejemplo n.º 5
0
void PrintMsg(int i) 
{
    attron(COLOR_PAIR(11));
        
    if (i == 1) //should also be called when that unit is available
    {
        mvprintw(51,60,"You have entered an invalid input.");
    }
    else if (i == 2)
    {
        mvprintw(51,60,"You have insufficient funds to purchase");
        mvprintw(52,60,"this unit.");
    }
    else if (i == 3) 
    {
        mvprintw(51,60,"You cannot start the game with an empty");
        mvprintw(52,60,"queue.");
    }
    else if (i == 4) //Not used yet, check needs to be implemented
    {
        mvprintw(51,60,"No more units can be added on the spawn");
        mvprintw(52,60,"queue. Delete some if you want to add more.");
    }

    Home();
    attroff(COLOR_PAIR(11));
}
Ejemplo n.º 6
0
void HelpPopup::DoInitDialog() {
    ToLog(LOGMSG_DEBUGTRACE,"IN:HelpPopup::DoInitDialog");

    if (HelpEngine) {
        ui->HelpBrowserWidget->HelpEngine=HelpEngine;
        ui->ContentWidget->InitHelpEngine(HelpEngine);
        ui->FollowInterfaceCB->setChecked(*WikiFollowInterface);
        ui->HelpSplitter->setStretchFactor(0,1);
        ui->HelpSplitter->setStretchFactor(1,3);

        connect(ui->HelpBrowserWidget,SIGNAL(historyChanged()),SLOT(PageChanged()));
        connect(ui->HelpBrowserWidget,SIGNAL(sourceChanged(QUrl)),SLOT(SourceChanged(QUrl)));
        connect(ui->ContentWidget,SIGNAL(clicked(QModelIndex)),this,SLOT(UpdateUrl(QModelIndex)));
        connect(ui->ContentWidget,SIGNAL(collapsed(QModelIndex)),this,SLOT(CollapsedOrExpanded(QModelIndex)));
        connect(ui->ContentWidget,SIGNAL(expanded(QModelIndex)),this,SLOT(CollapsedOrExpanded(QModelIndex)));
        connect(ui->ExitBT,SIGNAL(pressed()),this,SLOT(Exit()));
        connect(ui->PreviousBT,SIGNAL(pressed()),this,SLOT(Back()));
        connect(ui->NextBT,SIGNAL(pressed()),this,SLOT(Next()));
        connect(ui->CCBYSABT,SIGNAL(pressed()),this,SLOT(CCBYSABT()));
        connect(ui->HomeBT,SIGNAL(pressed()),this,SLOT(Home()));
        connect(ui->WebSiteBT,SIGNAL(pressed()),this,SLOT(WebSite()));
        connect(ui->ForumBT,SIGNAL(pressed()),this,SLOT(Forum()));
        connect(ui->FollowInterfaceCB,SIGNAL(clicked()),this,SLOT(Follow()));
        PageChanged();
    }
}
Ejemplo n.º 7
0
int PowerCube70hw::init(const char device[])
{		
	std::cout<<"Init powercube"<<std::endl;
//serial port INit
	port.init(device);
	if(port.setBaud(38400)!=PORT_OK)
	{	
		std::cout<<"Error al inicializar puerto"<<std::endl;
		return ERROR_PORT;
	}

	int r;
	r=Reset();
	if(r!=NOERROR)return r;
	r=Home();
	if(r!=NOERROR)return r;
	std::cout<<"Homing..."<<std::endl;
#ifdef WIN32
	Sleep(4);
#else
	sleep(4);
#endif
	std::cout<<"Homed..."<<std::endl;
	SetSpeed(0.5,0.5);
	SetAccel(0.5,0.5);
	////Calibrado de Posicion a Tilt=0, Pan=0
	//Sleep?En el caso de que la posicion diste mucho del homing por PW.Init
	return NOERROR;
}
TEST (MazeReader, LoadMazeFromFile)
{
  char fileName[] = "mazefiles/empty.maz";
  ReadRealWallsFromFile (fileName);
  UpdateEntireMazeFromRealWalls ();
  EXPECT_EQ (ALL_SEEN + WEST_WALL + SOUTH_WALL + EAST_WALL, Walls (Home()));
}
Ejemplo n.º 9
0
/** Open a new exit.
 * \verbatim
 * This is the top-level function for @open. It calls do_real_open()
 * to do the real work of opening both the exit forward and the exit back.
 * \endverbatim
 * \param player the enactor.
 * \param direction name of the exit forward.
 * \param links 1-based array, possibly containing name of destination, name of exit back,
 * and room to open initial exit from.
 */
void
do_open(dbref player, const char *direction, char **links)
{
  dbref forward;
  dbref source = NOTHING;
  if (links[3]) {
    source =
      match_result(player, links[3], TYPE_ROOM,
                   MAT_HERE | MAT_ABSOLUTE | MAT_TYPE);
    if (!GoodObject(source)) {
      notify(player, T("Open from where?"));
      return;
    }
  }

  forward = do_real_open(player, direction, links[1], source);
  if (links[2] && GoodObject(forward) && GoodObject(Location(forward))) {
    char sourcestr[SBUF_LEN];   /* SBUF_LEN is the size used by unparse_dbref */
    if (!GoodObject(source)) {
      if (IsRoom(player)) {
        source = player;
      } else if (IsExit(player)) {
        source = Home(player);
      } else {
        source = Location(player);
      }
    }
    strcpy(sourcestr, unparse_dbref(source));
    do_real_open(player, links[2], sourcestr, Location(forward));
  }
}
TEST (MazeReader, LoadMazeFromInvalidFile)
{
  char fileName[] = "mazefiles/aaaaaa.maz";
  ReadRealWallsFromFile (fileName);
  UpdateEntireMazeFromRealWalls ();
  EXPECT_EQ (ALL_SEEN + NO_WALLS, Walls (Home()));
}
Ejemplo n.º 11
0
LRESULT CMainFrame::OnRuning(WPARAM wParam, LPARAM lParam)
{
#ifndef _DEBUG
	BeforeWorkPro();
	BeforeWork();
#endif

	if (GetIntValue(PK_PortCtrlMode) != PCM_USE_WEEK)
	{
		Sleep(500);//延时用于打开吸泵	
	}

	vector<TRACK> _vecTrack;
	//1.获取加工数据
	if(GetData(_vecTrack) == false)
	{
		OnCloseLoop(NULL, NULL);
		Home();
		return 0;
	}

	//2. 把数据丢进控制卡模块驱动硬件
	Run(_vecTrack);
	return 0;
}
Ejemplo n.º 12
0
static dbref
make_player(const char *name, const char *password, const char *host,
            const char *ip)
{
  dbref player;
  char temp[SBUF_LEN];
  char *flaglist, *flagname;
  char flagbuff[BUFFER_LEN];

  player = new_object();

  /* initialize everything */
  set_name(player, name);
  Location(player) = PLAYER_START;
  Home(player) = PLAYER_START;
  Owner(player) = player;
  Parent(player) = NOTHING;
  Type(player) = TYPE_PLAYER;
  Flags(player) = new_flag_bitmask("FLAG");
  strcpy(flagbuff, options.player_flags);
  flaglist = trim_space_sep(flagbuff, ' ');
  if (*flaglist != '\0') {
    while (flaglist) {
      flagname = split_token(&flaglist, ' ');
      twiddle_flag_internal("FLAG", player, flagname, 0);
    }
  }
  if (Suspect_Site(host, player) || Suspect_Site(ip, player))
    set_flag_internal(player, "SUSPECT");
  set_initial_warnings(player);
  /* Modtime tracks login failures */
  ModTime(player) = (time_t) 0;
  (void) atr_add(player, pword_attr, password_hash(password, NULL), GOD, 0);
  giveto(player, START_BONUS); /* starting bonus */
  (void) atr_add(player, "LAST", show_time(mudtime, 0), GOD, 0);
  (void) atr_add(player, "LASTSITE", host, GOD, 0);
  (void) atr_add(player, "LASTIP", ip, GOD, 0);
  (void) atr_add(player, "LASTFAILED", " ", GOD, 0);
  snprintf(temp, sizeof temp, "%d", START_QUOTA);
  (void) atr_add(player, "RQUOTA", temp, GOD, 0);
  (void) atr_add(player, "MAILCURF", "0", GOD,
                 AF_LOCKED | AF_NOPROG | AF_WIZARD);
  add_folder_name(player, 0, "inbox");
  /* link him to PLAYER_START */
  PUSH(player, Contents(PLAYER_START));

  add_player(player);
  add_lock(GOD, player, Basic_Lock, parse_boolexp(player, "=me", Basic_Lock),
           LF_DEFAULT);
  add_lock(GOD, player, Enter_Lock, parse_boolexp(player, "=me", Basic_Lock),
           LF_DEFAULT);
  add_lock(GOD, player, Use_Lock, parse_boolexp(player, "=me", Basic_Lock),
           LF_DEFAULT);

  current_state.players++;

  local_data_create(player);

  return player;
}
Ejemplo n.º 13
0
void RedrawResources(Level * lvl)
{
    mvhline(5,92,' ',6);
    attron(A_BOLD);
    mvprintw(5,92,"$%d",lvl->resources);
    attroff(A_BOLD);
    Home();
}
Ejemplo n.º 14
0
void RedrawHP(Level * lvl)
{
    mvhline(5,61,' ',5);
    attron(A_BOLD);
    mvprintw(5,60,"%d",lvl->health);
    attroff(A_BOLD);
    Home();
}
Ejemplo n.º 15
0
Archivo: move.c Proyecto: chazu/btmux
static void process_leave_loc(dbref thing, dbref dest, dbref cause,
							  int canhear, int hush)
{
	dbref loc;
	int quiet, pattr, oattr, aattr;

	loc = Location(thing);
	if((loc == NOTHING) || (loc == dest))
		return;

	if(dest == HOME)
		dest = Home(thing);

	/*
	 * Run the LEAVE attributes in the current room if we meet any of * * 
	 * 
	 * *  * * following criteria: * - The current room has wizard privs.
	 * * - * * * Neither the current room nor the moving object are dark. 
	 * * - The * *  * moving object can hear and does not hav wizard
	 * privs. * EXCEPT  * if * * we were called with the HUSH_LEAVE key. 
	 */

	quiet = (!(Wizard(loc) || (!Dark(thing) && !Dark(loc)) || (canhear &&
															   !(Wizard(thing)
																 &&
																 Dark
																 (thing)))))
		|| (hush & HUSH_LEAVE);
	oattr = quiet ? 0 : A_OLEAVE;
	aattr = quiet ? 0 : A_ALEAVE;
	pattr = (!mudconf.terse_movemsg && Terse(thing)) ? 0 : A_LEAVE;
	did_it(thing, loc, pattr, NULL, oattr, NULL, aattr, (char **) NULL, 0);

	/*
	 * Do OXENTER for receiving room 
	 */

	if((dest != NOTHING) && !quiet)
		did_it(thing, dest, 0, NULL, A_OXENTER, NULL, 0, (char **) NULL, 0);

	/*
	 * Display the 'has left' message if we meet any of the following * * 
	 * 
	 * *  * * criteria: * - Neither the current room nor the moving
	 * object are  * *  * dark. * - The object can hear and is not a dark 
	 * wizard. 
	 */

	if(!quiet)
		if((!Dark(thing) && !Dark(loc)) || (canhear && !(Wizard(thing) &&
														 Dark(thing)))) {
			notify_except2(loc, thing, thing, cause,
						   tprintf("%s has left.", Name(thing)));
		}
}
Ejemplo n.º 16
0
//=========================================================
// Clear OLED GDRAM
//=========================================================
void CLS(uint16 color) {
  Home();
  write_c(SSD1351_CMD_WRITERAM);    // Enable MCU to Write to RAM

  uint8_t c[256];
  for(uint32_t i=0;i<256;i++) c[i] = color;

  for(uint32_t j=0;j<128;j++) {
    oled_draw_rect(0,j,128,1,c);
  }
}
Ejemplo n.º 17
0
const char* Directory::ExpandTilde (const char* tildeName, int length) {
    const char* name = nil;

    if (length > 1) {
        static char buf[MAX_PATH_LENGTH+1];
        strncpy(buf, tildeName+1, length-1);
        buf[length-1] = '\0';
        name = buf;
    }
    return Home(name);
}        
Ejemplo n.º 18
0
const char* FBDirectory::ExpandTilde(const char* tildeName, int length) {
    const char* name = nil;

    if (length > 1) {
        static char buf[max_filename_length+1];
        strncpy(buf, tildeName+1, length-1);
        buf[length-1] = '\0';
        name = buf;
    }
    return Home(name);
}        
Ejemplo n.º 19
0
void die(int onsig)
{
    if (onsig <= NSIG)
	signal(onsig, SIG_DFL);
     
    /*
     * First check if there is a child running, if so, kill it.
     */
    if (e_pid) {
	if ((kill(e_pid, SIGTERM)) == 0)
	    Syslog('+', "SIGTERM to pid %d succeeded", e_pid);
	else {
	    if ((kill(e_pid, SIGKILL)) == 0)
		Syslog('+', "SIGKILL to pid %d succeeded", e_pid);
	    else
		WriteError("Failed to kill pid %d", e_pid);
	}
    }

    if (MsgBase.Locked)
	Msg_UnLock();
    if (MsgBase.Open)
	Msg_Close();

    Home();
    if (onsig) {
	if (onsig == SIGHUP) {
	    hanged_up = 1;
	    Syslog('+', "Lost Carrier");
	} else if (onsig == SIGPIPE) {
	    hanged_up = 1;
	    Syslog('+', "Broken Pipe");
	} else if (onsig == SIGALRM) {
	    Syslog('+', "User inactivity timeout");
	} else {
	    if (onsig <= NSIG) {
		hanged_up = 1;
		WriteError("Terminated on signal %d (%s)", onsig, SigName[onsig]);
	    } else {
		WriteError("Terminated with error %d", onsig);
	    }
	}
    } else {
	Syslog(' ', "Terminated by user");
    }

    if (onsig == SIGSEGV) {
	Syslog('+', "Last msg area %s", msgs.Name);
    }

    Good_Bye(onsig);
}
Ejemplo n.º 20
0
/** Returns the apparent location of object.
 * This is the location for players and things, source for exits, and
 * NOTHING for rooms.
 * \param thing object to get location of.
 * \return apparent location of object (NOTHING for rooms).
 */
dbref
where_is(dbref thing)
{
  if (!GoodObject(thing))
    return NOTHING;
  switch (Typeof(thing)) {
  case TYPE_ROOM:
    return NOTHING;
  case TYPE_EXIT:
    return Home(thing);
  default:
    return Location(thing);
  }
}
Ejemplo n.º 21
0
/* ---- cursor right key: right one character position ---- */
static void Forward(WINDOW wnd)
{
    char *cc = CurrChar+1;
    if (*cc == '\0')
        return;
    if (*CurrChar == '\n')    {
        Home(wnd);
        Downward(wnd);
    }
    else    {
        wnd->CurrCol++;
        if (WndCol == ClientWidth(wnd))
            SendMessage(wnd, HORIZSCROLL, TRUE, 0);
    }
}
Ejemplo n.º 22
0
void AppNodeStar::HandleInternalPathChanged( const std::string& sPath ) {
  root()->clear();
  std::cout << "HandleInternalPathChanged: " << sPath << " ";
  mapInternalPathChanged_t::const_iterator iter = m_mapInternalPathChanged.find( sPath );
  if ( m_mapInternalPathChanged.end() != iter ) {
    std::cout << "iter" << std::endl;
    iter->second( root() );
  }
  else {
    // default home page, or error page, and register a default page
    std::cout << "root" << std::endl;
    Home( root() );
  }
  std::cout << "end HandleInternalPathChanged" << std::endl;
}
Ejemplo n.º 23
0
int main(int argc,char* argv[])
{
	SP<Amplifier> Amp(new Amplifier() );
	SP<CdPlayer> Cd( new CdPlayer());
	SP<DVDPlayer> Dvd( new DVDPlayer());
	SP<PopcornPopper> PopCorn( new PopcornPopper());
	SP<Projector> Pro(new Projector());
	SP<Screen> Scr(new Screen());
	SP<TheaterLights> Light(new TheaterLights());
	SP<Tuner> Tun(new Tuner());

	SP<HomeTheaterFacade> Home(new HomeTheaterFacade(Amp,Cd,Dvd,PopCorn,Pro,Scr,Light,Tun));

	Home->watchMovie("The Lord of the Rings.3");
	Home->endMovie();
	return 0;
}
Ejemplo n.º 24
0
void CMainWnd::OnClick( TNotifyUI &msg )
{
	CDuiString sName = msg.pSender->GetName();
	sName.MakeLower();

	if( msg.pSender == m_pCloseBtn ) {
		PostQuitMessage(0);
		return; 
	}
	else if( msg.pSender == m_pMinBtn ) { 
		SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); return; }
	else if( msg.pSender == m_pMaxBtn ) { 
		SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); return; }
	else if( msg.pSender == m_pRestoreBtn ) { 
		SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); return; }
	else if( msg.pSender == m_pMenuBtn ) {
	}
	else if(sName.CompareNoCase(_T("newtab")) == 0)
	{
		CreateNewTabAndGo(NULL);
	}
	else if(sName.CompareNoCase(_T("address_go")) == 0)
	{
		AddressGo();
	}
	else if(sName.CompareNoCase(_T("search_go")) == 0) {
		SearchGo();
	}
	else if(sName.CompareNoCase(_T("back_btn")) == 0) {
		Back();
	}
	else if(sName.CompareNoCase(_T("forward_btn")) == 0) {
		Forward();
	}
	else if(sName.CompareNoCase(_T("refresh_btn")) == 0) {
		Refresh();
	}
	else if(sName.CompareNoCase(_T("home_go")) == 0) {
		Home();
	}
	else if(sName.CompareNoCase(_T("qq_btn")) == 0)
	{
		CreateNewTabAndGo(_T("tencent://Message/?Uin=656067418&Menu=yes"));
	}
}
Ejemplo n.º 25
0
Archivo: move.c Proyecto: chazu/btmux
void move_object(dbref thing, dbref dest)
{
	dbref src;

	/*
	 * Remove from the source location 
	 */

	src = Location(thing);
	if(src != NOTHING)
		s_Contents(src, remove_first(Contents(src), thing));

	/*
	 * Special check for HOME 
	 */

	if(dest == HOME)
		dest = Home(thing);

	/*
	 * Add to destination location 
	 */

	if(dest != NOTHING)
		s_Contents(dest, insert_first(Contents(dest), thing));
	else
		s_Next(thing, NOTHING);
	s_Location(thing, dest);

	/*
	 * Look around and do the penny check 
	 */

	look_in(thing, dest, (LK_SHOWEXIT | LK_OBEYTERSE));
	if(isPlayer(thing) && (mudconf.payfind > 0) &&
	   (Pennies(thing) < mudconf.paylimit) && (!Controls(thing, dest)) &&
	   ((random() % mudconf.payfind) == 0)) {
		giveto(thing, 1);
		notify_printf(thing, "You found a %s!", mudconf.one_coin);
	}
}
Ejemplo n.º 26
0
void RedrawQueue(UnitList *SQ)
{   
    ClearSpawnQueue();
    Unit *tempUnit;

    for (int i = 0; i < UnitSize(SQ); i++)
    {
        tempUnit = UnitPeek(i,SQ);
        attron(COLOR_PAIR(UnitID(tempUnit)-96));
        if (UnitSize(SQ) <= 36)
        {
            mvprintw(7+i,113,"%d",tempUnit->health);
        }
        else if (UnitSize(SQ) <= 73)
        {
            if (i <= 36)
            {
                mvprintw(7+i,111,"%d",tempUnit->health);
            }
            else
                mvprintw(7+i-37,115,"%d",tempUnit->health);
        }
        else if (UnitSize(SQ) <= 111)
        {
            if (i <= 36)
            {
                mvprintw(7+i,111,"%d",tempUnit->health);
            }
            else if (i <= 73)
                mvprintw(7+i-37,113,"%d",tempUnit->health);
            else
                mvprintw(7+i-74,115,"%d",tempUnit->health);
        }

        attroff(COLOR_PAIR(UnitID(tempUnit)-96));
    }
    Home();
}
Ejemplo n.º 27
0
/** @brief Initialize all HD44780 control pins, set default mode, and return home
  * @retval None
  */
void hd44780_c::Start(void){
  GPIO_InitTypeDef GPIO_InitStructure;
  //init EN pin
	RCC_APB2PeriphClockCmd(HD44780_EN_CLK, ENABLE);
	GPIO_InitStructure.GPIO_Pin   = HD44780_EN_PIN;
  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(HD44780_EN_PORT, &GPIO_InitStructure);
  GPIO_ResetBits(HD44780_EN_PORT, HD44780_EN_PIN);
  //init RS pin
  RCC_APB2PeriphClockCmd(HD44780_RS_CLK, ENABLE);
	GPIO_InitStructure.GPIO_Pin   = HD44780_RS_PIN;
  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(HD44780_RS_PORT, &GPIO_InitStructure);
  //init RW pin
  RCC_APB2PeriphClockCmd(HD44780_RW_CLK, ENABLE);
	GPIO_InitStructure.GPIO_Pin   = HD44780_RW_PIN;
  GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_Init(HD44780_RW_PORT, &GPIO_InitStructure);
  //init DATA pins
  RCC_APB2PeriphClockCmd(HD44780_DATA_CLK, ENABLE);
	GPIO_InitStructure.GPIO_Pin   = HD44780_DATA_PIN_4| HD44780_DATA_PIN_5| HD44780_DATA_PIN_6| HD44780_DATA_PIN_7;
	GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(HD44780_DATA_PORT, &GPIO_InitStructure);

  FunctionSet(false, false);
  FunctionSet(false, false);
  OnOff(true, true, true);
  EntryMode(false, true);
  Clear();
  Home();
  HLib::LoopDelay(1000000);
  Print("Wellcome to HLib");
}
Ejemplo n.º 28
0
//bool Camera::OnKeyboardMsg( UINT nChar, bool bKeyDown, bool bAltDown )
LRESULT Camera::HandleMessages( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
    switch( uMsg )
    {
        case WM_KEYDOWN:
            {
                UINT nChar = (UINT)wParam;
                switch( nChar )
                {
                case VK_HOME:
                    Home();
                    return true;
                case L'X':
                case L'Y':
                case L'Z':
                    bool key_shiftl = (0x8000 & GetKeyState(VK_LSHIFT)) != 0; 
                    bool key_shiftr = (0x8000 & GetKeyState(VK_RSHIFT)) != 0; 
                    bool key_shift = key_shiftl || key_shiftr || ((0x8000 & GetKeyState(VK_SHIFT)) != 0); 

                    D3DCUBEMAP_FACES face = D3DCUBEMAP_FACE_FORCE_DWORD;
                    if(nChar == L'X')
                        face = key_shift ? D3DCUBEMAP_FACE_NEGATIVE_X : D3DCUBEMAP_FACE_POSITIVE_X;
                    else if(nChar == L'Y')
                        face = key_shift ? D3DCUBEMAP_FACE_NEGATIVE_Y : D3DCUBEMAP_FACE_POSITIVE_Y;                         
                    else if(nChar == L'Z')
                        face = key_shift ? D3DCUBEMAP_FACE_NEGATIVE_Z : D3DCUBEMAP_FACE_POSITIVE_Z;

                    Place( face );
                    return true;
                }
            }
            break;
    };

    return __super::HandleMessages( hWnd, uMsg, wParam, lParam );
}
Ejemplo n.º 29
0
// Clones an object and returns the HS_DBREF of the new clone.
HS_DBREF CHSInterface::CloneThing(HS_DBREF model)
{
    HS_DBREF clone;

#ifdef PENNMUSH                 // No change in code between versions
    clone = new_object();

    // Copy the basic information from the model to the clone.
    memcpy(REFDB(clone), REFDB(model), sizeof(struct object));
    Owner(clone) = Owner(model);
    Name(clone) = NULL;

    // NULL-out some memory pointers we didn't really want copied.
    db[clone].list = NULL;

    // Now copy the pointer information.
    atr_cpy(clone, model);
    Locks(clone) = NULL;
    clone_locks(model, model, clone);
    Zone(clone) = Zone(model);
    Parent(clone) = Parent(model);
    Flags(clone) = clone_flag_bitmask("FLAG", Flags(model));
    set_name(clone, Name(model));
    s_Pennies(clone, Pennies(model));

#ifdef CREATION_TIMES
    /*
     * We give the clone the same modification time that its
     * other clone has, but update the creation time
     */
    db[clone].creation_time = time((time_t *) 0);
#endif

    db[clone].contents = db[clone].location = db[clone].next = NOTHING;
#endif

#if defined(TM3) || defined(MUX)
    clone = create_obj(Owner(model), Typeof(model),
                       Name(model), Pennies(model));

    //atr_free(clone);
    s_Name(clone, Name(model));
    s_Pennies(clone, Pennies(model));
    s_Parent(clone, Parent(model));
#ifdef TM3
    atr_cpy(Owner(clone), clone, model);
    s_Flags(clone, Flags(model));
    s_Flags2(clone, Flags2(model));
    s_Flags3(clone, Flags3(model));
#endif

#ifdef MUX
    atr_cpy(clone, model);
    s_Flags(clone, FLAG_WORD1, Flags(model));
    s_Flags(clone, FLAG_WORD2, Flags2(model));
    s_Flags(clone, FLAG_WORD3, Flags3(model));
    s_Home(clone, Home(model));
#endif
#endif

    return clone;
}
TEST (Direction, MazeGetDirection_defaultValue_getNORTH)
{
  location_t loc = Home();
  EXPECT_EQ (INVALID, Direction (loc));
}