Exemplo n.º 1
0
/**
 *  Konstruktor von @p iwOptionsWindow.
 *
 *  @author OLiver
 */
iwOptionsWindow::iwOptionsWindow(dskGameInterface* gameDesktop)
    : IngameWindow(CGI_OPTIONSWINDOW, 0xFFFF, 0xFFFF, 300, 515, _("Game menu"), LOADER.GetImageN("resource", 41))
{
    this->gameDesktop = gameDesktop;

    // Der Soldat oben
    AddImage(1, 150, 36, LOADER.GetImageN("io", 30));

    // Versionszeile
    AddVarText(2, 150, 76, _("Return To The Roots v%s-%s"), COLOR_YELLOW, glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_BOTTOM, NormalFont, 2, GetWindowVersion(), GetWindowRevisionShort());
    // Copyright
    AddVarText(3, 150, 96, _("© 2005 - %s Settlers Freaks"), COLOR_YELLOW, glArchivItem_Font::DF_CENTER | glArchivItem_Font::DF_BOTTOM, NormalFont, 1, GetCurrentYear());

    // "Tastaturbelegung"
    AddImageButton(4, 35, 120, 35, 35, TC_GREEN2, LOADER.GetImageN("io", 79));
    AddText(5, 85, 140, _("Keyboard layout"), COLOR_YELLOW, 0 | glArchivItem_Font::DF_BOTTOM, NormalFont);

    // "'Lies mich'-Datei laden"
    AddImageButton(6, 35, 160, 35, 35, TC_GREEN2, LOADER.GetImageN("io", 79));
    AddText(7, 85, 180, _("Load 'ReadMe' file"), COLOR_YELLOW, 0 | glArchivItem_Font::DF_BOTTOM, NormalFont);

    // "Spiel laden!"
    // TODO: Implement
    //AddImageButton( 8, 35, 210, 35, 35, TC_GREEN2, LOADER.GetImageN("io", 48));
    //AddText(9, 85, 230, _("Load game!"), COLOR_YELLOW, 0 | glArchivItem_Font::DF_BOTTOM, NormalFont);

    // "Spiel speichern!"
    // TODO: Move back down to y=250 (Button) 270 (Text) after Load button is implemented
    AddImageButton(10, 35, 230, 35, 35, TC_GREEN2, LOADER.GetImageN("io", 47));
    AddText(11, 85, 255, _("Save game!"), COLOR_YELLOW, 0 | glArchivItem_Font::DF_BOTTOM, NormalFont);

    // Geräusche an/aus
    AddImageButton(12, 35, 300, 35, 35, TC_GREEN2, LOADER.GetImageN("io", 114 + !SETTINGS.sound.effekte)); //-V807

    // Musik an/aus
    AddImageButton(13, 35, 340, 35, 35, TC_GREEN2, LOADER.GetImageN("io", 116 + !SETTINGS.sound.musik));

    // Geräuschlautstärke
    AddProgress(14, 100, 306, 160, 22, TC_GREEN2, 139, 138, 10)
    ->SetPosition(SETTINGS.sound.effekte_volume * 10 / 255);

    // Musiklautstärke
    AddProgress(15, 100, 346, 160, 22, TC_GREEN2, 139, 138, 10)
    ->SetPosition(SETTINGS.sound.musik_volume * 10 / 255);

    //// Music Player
    AddTextButton(16, 100, 380, 160, 22, TC_GREEN2, _("Music player"), NormalFont);

    // Advanced Options
    AddTextButton(18, 67, 412, 168, 24, TC_GREEN2, _("Advanced"), NormalFont);

    // "Spiel aufgeben"
    AddTextButton(17, 67, 443, 168, 24, TC_RED1, _("Surrender"), NormalFont);
    // "Spiel beenden"
    AddTextButton(0, 67, 474, 168, 24, TC_RED1, _("End game"), NormalFont);

}
Exemplo n.º 2
0
iwMilitary::iwMilitary(const GameWorldViewer& gwv, GameCommandFactory& gcFactory):
    IngameWindow(CGI_MILITARY, IngameWindow::posAtMouse,  168, 330, _("Military"), LOADER.GetImageN("io", 5)),
    gwv(gwv), gcFactory(gcFactory), settings_changed(false)
{
    // Einzelne Balken
    AddProgress(0, 17, 25, 132, 26, TC_GREY, 119, 120, MILITARY_SETTINGS_SCALE[0], "", 4, 4, 0, _("Fewer recruits"), _("More recruits")); /* pitch: 4, 4 */
    AddProgress(1, 17, 57, 132, 26, TC_GREY, 121, 122, MILITARY_SETTINGS_SCALE[1], "", 4, 4, 0, _("Weak defense"), _("Strong defense"));
    AddProgress(2, 17, 89, 132, 26, TC_GREY, 123, 124, MILITARY_SETTINGS_SCALE[2], "", 4, 4, 0, _("Fewer defenders"), _("More defenders"));
    AddProgress(3, 17, 121, 132, 26, TC_GREY, 209, 210, MILITARY_SETTINGS_SCALE[3], "", 4, 4, 0, _("Less attackers"), _("More attackers"));
    AddProgress(4, 17, 153, 132, 26, TC_GREY, 129, 130, MILITARY_SETTINGS_SCALE[4], "", 4, 4, 0, _("Interior"), _("Interior"));
    AddProgress(5, 17, 185, 132, 26, TC_GREY, 127, 128, MILITARY_SETTINGS_SCALE[5], "", 4, 4, 0, _("Center of country"), _("Center of country"));
    AddProgress(6, 17, 217, 132, 26, TC_GREY, 1000, 1001, MILITARY_SETTINGS_SCALE[6], "", 4, 4, 0, _("Near harbor points"), _("Near harbor points"));
    AddProgress(7, 17, 249, 132, 26, TC_GREY, 125, 126, MILITARY_SETTINGS_SCALE[7], "", 4, 4, 0, _("Border areas"), _("Border areas"));

    // unteren 2 Buttons
    AddImageButton(20, 18, 282, 30, 32, TC_GREY, LOADER.GetImageN("io", 225), _("Help"));
    AddImageButton(21, 120, 282, 30, 32, TC_GREY, LOADER.GetImageN("io", 191), _("Default"));

    // Falls Verteidiger ändern verboten ist, einfach die Bar ausblenden
    if (gwv.GetWorld().GetGGS().getSelection(AddonId::DEFENDER_BEHAVIOR) == 1)
    {
        GetCtrl<ctrlProgress>(2)->SetVisible(false);
    }

    // Absendetimer, in 2s-Abschnitten wird jeweils das ganze als Netzwerknachricht ggf. abgeschickt
    AddTimer(22, 2000);
    UpdateSettings();
}
Exemplo n.º 3
0
unsigned __stdcall ThinkThread( LPVOID _p ){
/**************************************************************
思考ルーチンを呼び出すスレッド
**************************************************************/
	int ret = 0;
	THINK_INFO info;
	MOVE* pmove = (MOVE*)_p;
	MOVE move;
	MMRESULT tid;
	int num;
	int msec_mate = 0;

	memset( &info, 0, sizeof(THINK_INFO) );

	// 定跡を調べる。
	if( pbook != NULL ){
		ret = pbook->GetMove( pshogi, move );
		if( ret != 0 ){
			// 定跡の表示
			moves.Init();
			num = pbook->GetMoveAll( pshogi, moves );
			DisplayBook( num, moves );
		}
	}

	if( ret == 0 ){
		// 詰み探索
		sikou_flag = 1;

		// タイマーオン
		if( limit > 0 ){
			// 詰みを調べる時間(最大1秒)
			msec_mate = limit * 1000 / 10;
			if( msec_mate > 1000 ){
				msec_mate = 1000;
			}

			tid = timeSetEvent( msec_mate, 10, timelimit2, 0, TIME_ONESHOT );
		}

		ret = pthink->DfPnSearch( pshogi, &move, NULL, &info, &chudanDfPn );

		// タイマーオフ
		if( limit > 0 ){
			timeKillEvent( tid );
		}

		if( ret ){
			DisplayResult( &info );
			AddProgress( pshogi->GetStrMove( move ).c_str() );
		}
	}

	if( ret == 0 ){
		// 通常探索
		sikou_flag = 1;

		// タイマーオン
		if( limit > 0 ){
			tid = timeSetEvent( limit * 1000 - msec_mate, 10, timelimit, 0, TIME_ONESHOT );
		}

		// 反復深化探索
		ret = pthink->Search( pshogi, &move, 32, &info, &chudan, 1 );

		// タイマーオフ
		if( limit > 0 ){
			timeKillEvent( tid );
		}

		DisplayResult( &info );

		// 投了
		if( ret != 0 && presign->bad( info ) ){
			ret = 0;
		}
	}

	sikou_flag = 0;

	if( ret == 0 )
		// 指し手がない
		return (DWORD)0;

	*(pmove) = move;

	return (DWORD)1;
}
Exemplo n.º 4
0
/**
 *  Konstruktor von @p iwTools.
 *
 *  @author OLiver
 */
iwTools::iwTools()
    : IngameWindow(CGI_TOOLS, 0xFFFE, 0xFFFE, 166 + (GAMECLIENT.GetGGS().isEnabled(ADDON_TOOL_ORDERING) ? 46 : 0), 432, _("Tools"), LOADER.GetImageN("io", 5)),
      settings_changed(false)
{
    // Einzelne Balken
    AddProgress( 0, 17,  25, 132, 26, TC_GREY, 141, 140, 10, _("Tongs"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress( 1, 17,  53, 132, 26, TC_GREY, 145, 144, 10, _("Axe"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress( 2, 17,  81, 132, 26, TC_GREY, 147, 146, 10, _("Saw"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress( 3, 17, 109, 132, 26, TC_GREY, 149, 148, 10, _("Pick-axe"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress( 4, 17, 137, 132, 26, TC_GREY, 143, 142, 10, _("Hammer"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress( 5, 17, 165, 132, 26, TC_GREY, 151, 150, 10, _("Shovel"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress( 6, 17, 193, 132, 26, TC_GREY, 153, 152, 10, _("Crucible"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress( 7, 17, 221, 132, 26, TC_GREY, 155, 154, 10, _("Rod and line"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress( 8, 17, 249, 132, 26, TC_GREY, 157, 156, 10, _("Scythe"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress( 9, 17, 277, 132, 26, TC_GREY, 159, 158, 10, _("Cleaver"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress(10, 17, 305, 132, 26, TC_GREY, 161, 160, 10, _("Rolling pin"), 4, 4, 0, _("Less often"), _("More often"));
    AddProgress(11, 17, 333, 132, 26, TC_GREY, 163, 162, 10, _("Bow"), 4, 4, 0, _("Less often"), _("More often"));

    if (GAMECLIENT.GetGGS().isEnabled(ADDON_TOOL_ORDERING))
    {
        // qx:tools
        for (unsigned i = 0; i < TOOL_COUNT; ++i)
        {
            AddImageButton(100 + i * 2, 174, 25   + i * 28, 20, 13, TC_GREY, LOADER.GetImageN("io",  33), "+1");
            AddImageButton(101 + i * 2, 174, 25 + 13 + i * 28, 20, 13, TC_GREY, LOADER.GetImageN("io",  34), "-1");
            std::stringstream str;
            str << std::max(0, int( GAMECLIENT.GetLocalPlayer().tools_ordered[i] + GAMECLIENT.GetLocalPlayer().tools_ordered_delta[i] ));
            AddDeepening  (200 + i, 151, 25 + 4 + i * 28, 20, 18, TC_GREY, str.str(), NormalFont, COLOR_YELLOW);
        }
    }
    m_Updated = GAMECLIENT.GetGFNumber();

    // Info
    AddImageButton(12,  18, 384, 30, 32, TC_GREY, LOADER.GetImageN("io",  21), _("Help"));
    // Standard
    AddImageButton(13, 118 + (GAMECLIENT.GetGGS().isEnabled(ADDON_TOOL_ORDERING) ? 46 : 0), 384, 30, 32, TC_GREY, LOADER.GetImageN("io", 191), _("Default"));

    // Einstellungen festlegen
    for(unsigned char i = 0; i < TOOL_COUNT; ++i)
        GetCtrl<ctrlProgress>(i)->SetPosition(GAMECLIENT.visual_settings.tools_settings[i]);

    // Netzwerk-Übertragungs-Timer
    AddTimer(14, 2000);
}