[Change] Can only bribe each pilot once.

This commit is contained in:
Allanis 2014-01-28 18:53:00 +00:00
parent fb8c13495d
commit 35d03bbbd1

View File

@ -121,6 +121,7 @@ static void comm_bribe(unsigned int wid, char* unused) {
int answer; int answer;
int price; int price;
char* str; char* str;
lua_State* L;
/* Set up for the comm_get* functions. */ /* Set up for the comm_get* functions. */
ai_setPilot(comm_pilot); 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.\""); dialogue_msg("Bribe Pilot", "\"Pleasure to do business with you.\"");
else else
dialogue_msg("Bribe Pilot", "%s", str); dialogue_msg("Bribe Pilot", "%s", str);
/* Mark as bribed and don't allow bribing again. */
pilot_setFlag(comm_pilot, PILOT_BRIBED); 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. */ /* Reopen window. */
window_destroy(wid); window_destroy(wid);
comm_open(comm_pilot->id); comm_open(comm_pilot->id);