[patch] raccourcis de fabrication

Crayona
Messages : 457
Inscription : 24 juin 2012, 18:53

[patch] raccourcis de fabrication

Message par Crayona »

Voici un patch qui ajoute deux raccourcis clavier K_MIXONE et K_MIXALL pour lancer la fabrication d'un objet ou plusieurs respectivement. Le résultat est égal aux boutons ">" et ">>". Provisoirement j'ai mis ALT-F5 et ALT-F6 comme touches par défaut. Une fois le patch appliqué on peut changer les touches en modifiant les fichiers key.ini ou key_linux.ini.

le181-mix_keys.patch

Code : Tout sélectionner

 gamewin.c |    8 ++++++++
 keys.c    |    4 ++++
 keys.h    |    2 ++
 3 files changed, 14 insertions(+)

diff --git a/gamewin.c b/gamewin.c
index a1a4cb8..605184e 100644
--- a/gamewin.c
+++ b/gamewin.c
@@ -2269,6 +2269,14 @@ int keypress_root_common (Uint32 key, Uint32 unikey)
 	{
 		toggle_sit_stand ();
 	}
+	else if (key == K_MIXONE)
+	{
+		mix_handler(1, mixbut_empty_str);
+	}
+	else if (key == K_MIXALL)
+	{
+		mix_handler(255, mixbut_empty_str);
+	}
 	else if (key == K_BROWSER)
 	{
 		open_last_seen_url();
diff --git a/keys.c b/keys.c
index beec8c2..fb8c343 100644
--- a/keys.c
+++ b/keys.c
@@ -92,6 +92,8 @@ Uint32 K_SCREENSHOT=CTRL|'p';
 Uint32 K_VIEWTEXTASOVERTEXT=ALT|'o';
 Uint32 K_AFK=CTRL|ALT|'a';
 Uint32 K_SIT=ALT|'s';
+Uint32 K_MIXONE=ALT|SDLK_F5;
+Uint32 K_MIXALL=ALT|SDLK_F6;
 #ifdef MISSILES
 Uint32 K_RANGINGLOCK=ALT|'r';
 #endif //MISSILES
@@ -215,6 +217,8 @@ static key_store_entry key_store[] =
 	{ "#K_VIEWTEXTASOVERTEXT", &K_VIEWTEXTASOVERTEXT },
 	{ "#K_AFK", &K_AFK },
 	{ "#K_SIT", &K_SIT },
+	{ "#K_MIXONE", &K_MIXONE },
+	{ "#K_MIXALL", &K_MIXALL },
 #ifdef ENGLISH
 	{ "#K_RANGINGLOCK", &K_RANGINGLOCK },
 #endif //ENGLISH
diff --git a/keys.h b/keys.h
index 8827a6a..4daea1c 100644
--- a/keys.h
+++ b/keys.h
@@ -70,6 +70,8 @@ extern Uint32 K_SCREENSHOT;		/*!< key used to make a screenshot */
 extern Uint32 K_VIEWTEXTASOVERTEXT; /*!< key used to toggle display of text bubbles (overtext) */
 extern Uint32 K_AFK;                /*!< key used to display AFK messages */
 extern Uint32 K_SIT;                /*!< key used to toggle sitting status, i.e. sit down/stand up */
+extern Uint32 K_MIXONE;             /*!< key used to mix one item */
+extern Uint32 K_MIXALL;             /*!< key used to mix all items */
 #ifdef MISSILES
 extern Uint32 K_RANGINGLOCK;        /*!< key used to toggle ranging-lock status */
 #endif //MISSILES

Répondre