From 35d03bbbd1b96be6a40d56cda534365cbdabe32a Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Tue, 28 Jan 2014 18:53:00 +0000
Subject: [PATCH] [Change] Can only bribe each pilot once.

---
 src/comm.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/comm.c b/src/comm.c
index 76319ad..efcf89f 100644
--- a/src/comm.c
+++ b/src/comm.c
@@ -121,6 +121,7 @@ static void comm_bribe(unsigned int wid, char* unused) {
   int answer;
   int price;
   char* str;
+  lua_State* L;
 
   /* Set up for the comm_get* functions. */
   ai_setPilot(comm_pilot);
@@ -162,7 +163,15 @@ static void comm_bribe(unsigned int wid, char* unused) {
       dialogue_msg("Bribe Pilot", "\"Pleasure to do business with you.\"");
     else
       dialogue_msg("Bribe Pilot", "%s", str);
+
+    /* Mark as bribed and don't allow bribing again. */
     pilot_setFlag(comm_pilot, PILOT_BRIBED);
+    L = comm_pilot->ai->L;
+    lua_getglobal(L, "mem");
+    lua_pushnil(L);
+    lua_setfield(L, -2, "bribe");
+    lua_pop(L, 1);
+
     /* Reopen window. */
     window_destroy(wid);
     comm_open(comm_pilot->id);