Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* Bar missions should work with naev.missionStart().

  • Loading branch information...
commit b9a58b4d9531048fe8a2c886e776a7d8aed8d983 1 parent 0a6e8e2
@bobbens bobbens authored
Showing with 24 additions and 1 deletion.
  1. +6 −1 src/mission.c
  2. +17 −0 src/npc.c
  3. +1 −0  src/npc.h
View
7 src/mission.c
@@ -37,6 +37,7 @@
#include "gui_osd.h"
#include "npc.h"
#include "array.h"
+#include "land.h"
#define XML_MISSION_ID "Missions" /**< XML document identifier */
@@ -363,7 +364,11 @@ int mission_start( const char *name, unsigned int *id )
/* Try to run the mission. */
ret = mission_init( &mission, mdat, 1, 1, id );
- mission_cleanup( &mission ); /* Clean up in case not accepted. */
+ /* Add to mission giver if necessary. */
+ if (landed && (ret==0) && (mdat->avail.loc==MIS_AVAIL_BAR))
+ npc_patchMission( &mission );
+ else
+ mission_cleanup( &mission ); /* Clean up in case not accepted. */
return ret;
}
View
17 src/npc.c
@@ -359,6 +359,23 @@ void npc_generate (void)
/**
+ * @brief Patches a new mission bar npc into the bar system.
+ *
+ * @note Do not reuse the pointer once it's fed.
+ *
+ * @param misn Mission to patch in.
+ */
+void npc_patchMission( Mission *misn )
+{
+ /* Add mission giver. */
+ npc_add_giver( misn );
+
+ /* Sort NPC. */
+ npc_sort();
+}
+
+
+/**
* @brief Frees a single npc.
*/
static void npc_free( NPC_t *npc )
View
1  src/npc.h
@@ -33,6 +33,7 @@ int npc_rm_parentMission( Mission *misn );
*/
void npc_sort (void);
void npc_generate (void);
+void npc_patchMission( Mission *misn );
void npc_clear (void);
void npc_freeAll (void);
Please sign in to comment.
Something went wrong with that request. Please try again.