FreeBSD Bugzilla – Attachment 163117 Details for
Bug 204543
[PATCH] games/naev and games/naev-data: Update to 0.6.1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Proposed patch for games/naev (since 395464 revision)
naev_0.6.0,1-0.6.1.diff (text/plain), 32.14 KB, created by
lightside
on 2015-11-14 17:23:32 UTC
(
hide
)
Description:
Proposed patch for games/naev (since 395464 revision)
Filename:
MIME Type:
Creator:
lightside
Created:
2015-11-14 17:23:32 UTC
Size:
32.14 KB
patch
obsolete
>diff -ruN naev.orig/Makefile naev/Makefile >--- naev.orig/Makefile 2015-08-28 14:48:41.000000000 +0400 >+++ naev/Makefile 2015-11-10 09:18:03.007344000 +0400 >@@ -2,8 +2,7 @@ > # $FreeBSD: head/games/naev/Makefile 395464 2015-08-28 10:48:41Z makc $ > > PORTNAME= naev >-PORTVERSION= 0.6.0 >-PORTREVISION= 1 >+PORTVERSION= 0.6.1 > CATEGORIES= games > MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-${PORTVERSION}/ > DIST_SUBDIR= ${PORTNAME} >diff -ruN naev.orig/distinfo naev/distinfo >--- naev.orig/distinfo 2015-04-24 00:36:23.000000000 +0400 >+++ naev/distinfo 2015-11-13 16:49:21.887018000 +0400 >@@ -1,2 +1,2 @@ >-SHA256 (naev/naev-0.6.0.tar.bz2) = 0f0b498c7642e36dfaa15f284e13b9aa2d20e4aa01ed812fb7854583e7161cac >-SIZE (naev/naev-0.6.0.tar.bz2) = 1054649 >+SHA256 (naev/naev-0.6.1.tar.bz2) = 71d4cf06d2af1a1b84dfb9ed0fd5e4b9b2295f119fc65079d8d36f102ba00b4b >+SIZE (naev/naev-0.6.1.tar.bz2) = 1047908 >diff -ruN naev.orig/files/patch-src_board.c naev/files/patch-src_board.c >--- naev.orig/files/patch-src_board.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_board.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,38 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/8b4ceb3c5db7171b65f918f278e2d3a0685bf0f2 >-# Subject: Correctly pass boarding ship to pilot board hook >-# Origin: https://github.com/naev/naev/commit/0b545ee49f33632e892e242807543d6b386a02af >-# Subject: Run pilot board hook for all pilot, not just player >- >---- src/board.c.orig 2015-02-16 17:49:03 UTC >-+++ src/board.c >-@@ -143,7 +143,8 @@ void player_board (void) >- hparam[0].u.lp.pilot = p->id; >- hparam[1].type = HOOK_PARAM_SENTINEL; >- hooks_runParam( "board", hparam ); >-- pilot_runHook(p, PILOT_HOOK_BOARD); >-+ hparam[0].u.lp.pilot = PLAYER_ID; >-+ pilot_runHookParam(p, PILOT_HOOK_BOARD, hparam, 1); >- >- if (board_stopboard) { >- board_boarded = 0; >-@@ -526,6 +527,7 @@ static void board_update( unsigned int w >- int pilot_board( Pilot *p ) >- { >- Pilot *target; >-+ HookParam hparam[2]; >- >- /* Make sure target is sane. */ >- target = pilot_get(p->target); >-@@ -554,6 +556,12 @@ int pilot_board( Pilot *p ) >- /* Set time it takes to board. */ >- p->ptimer = 3.; >- >-+ /* Run pilot board hook. */ >-+ hparam[0].type = HOOK_PARAM_PILOT; >-+ hparam[0].u.lp.pilot = p->id; >-+ hparam[1].type = HOOK_PARAM_SENTINEL; >-+ pilot_runHookParam(target, PILOT_HOOK_BOARD, hparam, 1); >-+ >- return 1; >- } >- >diff -ruN naev.orig/files/patch-src_equipment.c naev/files/patch-src_equipment.c >--- naev.orig/files/patch-src_equipment.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_equipment.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,15 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/9fd2a7dcb3690bc1befe7f9a05d02e204dcfe8a1 >-# Subject: Avoid regenerating the land tabs over top of themselves >- >---- src/equipment.c.orig 2015-03-18 02:22:35 UTC >-+++ src/equipment.c >-@@ -234,6 +234,9 @@ void equipment_open( unsigned int wid ) >- GLfloat colour[4*4]; >- const char *buf; >- >-+ /* Mark as generated. */ >-+ land_tabGenerate(LAND_WINDOW_EQUIPMENT); >-+ >- /* Set global WID. */ >- equipment_wid = wid; >- >diff -ruN naev.orig/files/patch-src_hook.c naev/files/patch-src_hook.c >--- naev.orig/files/patch-src_hook.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_hook.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,16 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/74b9a086a20f80f21ce2f3866b31318e651a6235 >-# Subject: Turn player_missions in an array of pointers >- >---- src/hook.c.orig 2015-02-16 17:49:03 UTC >-+++ src/hook.c >-@@ -837,8 +837,8 @@ static Mission *hook_getMission( Hook *h >- { >- int i; >- for (i=0; i<MISSION_MAX; i++) >-- if (player_missions[i].id == hook->u.misn.parent) >-- return &player_missions[i]; >-+ if (player_missions[i]->id == hook->u.misn.parent) >-+ return player_missions[i]; >- >- return NULL; >- } >diff -ruN naev.orig/files/patch-src_info.c naev/files/patch-src_info.c >--- naev.orig/files/patch-src_info.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_info.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,87 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/74b9a086a20f80f21ce2f3866b31318e651a6235 >-# Subject: Turn player_missions in an array of pointers >- >---- src/info.c.orig 2015-02-16 17:49:03 UTC >-+++ src/info.c >-@@ -785,8 +785,8 @@ static void cargo_jettison( unsigned int >- /* Get the mission. */ >- f = 0; >- for (i=0; i<MISSION_MAX; i++) { >-- for (j=0; j<player_missions[i].ncargo; j++) { >-- if (player_missions[i].cargo[j] == player.p->commodities[pos].id) { >-+ for (j=0; j<player_missions[i]->ncargo; j++) { >-+ if (player_missions[i]->cargo[j] == player.p->commodities[pos].id) { >- f = 1; >- break; >- } >-@@ -799,7 +799,7 @@ static void cargo_jettison( unsigned int >- player.p->commodities[pos].id); >- return; >- } >-- misn = &player_missions[i]; >-+ misn = player_missions[i]; >- >- /* We run the "abort" function if it's found. */ >- ret = misn_tryRun( misn, "abort" ); >-@@ -807,9 +807,7 @@ static void cargo_jettison( unsigned int >- /* Now clean up mission. */ >- if (ret != 2) { >- mission_cleanup( misn ); >-- memmove( misn, &player_missions[i+1], >-- sizeof(Mission) * (MISSION_MAX-i-1) ); >-- memset( &player_missions[MISSION_MAX-1], 0, sizeof(Mission) ); >-+ mission_shift(pos); >- } >- >- /* Reset markers. */ >-@@ -1005,8 +1003,10 @@ static void mission_menu_genList( unsign >- misn_names = malloc(sizeof(char*) * MISSION_MAX); >- j = 0; >- for (i=0; i<MISSION_MAX; i++) >-- if (player_missions[i].id != 0) >-- misn_names[j++] = (player_missions[i].title!=NULL) ? strdup(player_missions[i].title) : NULL; >-+ if (player_missions[i]->id != 0) >-+ misn_names[j++] = (player_missions[i]->title != NULL) ? >-+ strdup(player_missions[i]->title) : NULL; >-+ >- if (j==0) { /* no missions */ >- misn_names[0] = strdup("No Missions"); >- j = 1; >-@@ -1035,7 +1035,7 @@ static void mission_menu_update( unsigne >- } >- >- /* Modify the text. */ >-- misn = &player_missions[ toolkit_getListPos(wid, "lstMission" ) ]; >-+ misn = player_missions[ toolkit_getListPos(wid, "lstMission" ) ]; >- window_modifyText( wid, "txtReward", misn->reward ); >- window_modifyText( wid, "txtDesc", misn->desc ); >- window_enableButton( wid, "btnAbortMission" ); >-@@ -1052,7 +1052,7 @@ static void mission_menu_abort( unsigned >- { >- (void)str; >- int pos; >-- Mission* misn; >-+ Mission *misn; >- int ret; >- >- if (dialogue_YesNo( "Abort Mission", >-@@ -1060,7 +1060,7 @@ static void mission_menu_abort( unsigned >- >- /* Get the mission. */ >- pos = toolkit_getListPos(wid, "lstMission" ); >-- misn = &player_missions[pos]; >-+ misn = player_missions[pos]; >- >- /* We run the "abort" function if it's found. */ >- ret = misn_tryRun( misn, "abort" ); >-@@ -1068,9 +1068,7 @@ static void mission_menu_abort( unsigned >- /* Now clean up mission. */ >- if (ret != 2) { >- mission_cleanup( misn ); >-- memmove( misn, &player_missions[pos+1], >-- sizeof(Mission) * (MISSION_MAX-pos-1) ); >-- memset( &player_missions[MISSION_MAX-1], 0, sizeof(Mission) ); >-+ mission_shift(pos); >- } >- >- /* Reset markers. */ >diff -ruN naev.orig/files/patch-src_land.c naev/files/patch-src_land.c >--- naev.orig/files/patch-src_land.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_land.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,137 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/74b9a086a20f80f21ce2f3866b31318e651a6235 >-# Subject: Turn player_missions in an array of pointers >-# Origin: https://github.com/naev/naev/commit/9fd2a7dcb3690bc1befe7f9a05d02e204dcfe8a1 >-# Subject: Avoid regenerating the land tabs over top of themselves >-# Origin: https://github.com/naev/naev/commit/b9bad809027529c0b0e95d9b8a011cb880229a5d >-# Subject: Fixed "buy map" button not showing up until after land hooks. >- >---- src/land.c.orig 2015-03-05 22:11:11 UTC >-+++ src/land.c >-@@ -69,6 +69,8 @@ >- #define has_visited(f) (land_visited & (f)) /**< Check if player has visited. */ >- static unsigned int land_visited = 0; /**< Contains what the player visited. */ >- >-+/* Which tabs have been generated by their respective open functions. */ >-+unsigned int land_generated = 0; >- >- /* >- * land variables >-@@ -187,6 +189,9 @@ static void commodity_exchange_open( uns >- char **goods; >- int w, h; >- >-+ /* Mark as generated. */ >-+ land_tabGenerate(LAND_WINDOW_COMMODITY); >-+ >- /* Get window dimensions. */ >- window_dimWindow( wid, &w, &h ); >- >-@@ -566,6 +571,9 @@ static void bar_open( unsigned int wid ) >- { >- int w, h, iw, ih, bw, bh, dh, th; >- >-+ /* Mark as generated. */ >-+ land_tabGenerate(LAND_WINDOW_BAR); >-+ >- /* Set window functions. */ >- window_onClose( wid, bar_close ); >- >-@@ -822,6 +830,9 @@ static void misn_open( unsigned int wid >- int w, h; >- int y; >- >-+ /* Mark as generated. */ >-+ land_tabGenerate(LAND_WINDOW_MISSION); >-+ >- /* Get window dimensions. */ >- window_dimWindow( wid, &w, &h ); >- >-@@ -900,7 +911,7 @@ static void misn_accept( unsigned int wi >- >- /* Make sure player can accept the mission. */ >- for (i=0; i<MISSION_MAX; i++) >-- if (player_missions[i].data == NULL) break; >-+ if (player_missions[i]->data == NULL) break; >- if (i >= MISSION_MAX) { >- dialogue_alert("You have too many active missions."); >- return; >-@@ -1180,6 +1191,9 @@ void land_genWindows( int load, int chan >- if (land_wid > 0) { >- land_regen = 2; /* Mark we're regenning. */ >- window_destroy(land_wid); >-+ >-+ /* Mark tabs as not generated. */ >-+ land_generated = 0; >- } >- land_loaded = 0; >- >-@@ -1255,6 +1269,9 @@ void land_genWindows( int load, int chan >- /* 1) Create main tab. */ >- land_createMainTab( land_getWid(LAND_WINDOW_MAIN) ); >- >-+ /* Add local system map button. */ >-+ land_checkAddMap(); >-+ >- /* 2) Set as landed and run hooks. */ >- if (!regen) { >- landed = 1; >-@@ -1274,24 +1291,34 @@ void land_genWindows( int load, int chan >- } >- >- /* 4) Create other tabs. */ >-+#define should_open(s, w) \ >-+ (planet_hasService(land_planet, s) && (!land_tabGenerated(w))) >-+ >-+ /* Things get a bit hairy here. Hooks may have triggered a GUI reload via >-+ * e.g. player.swapShip, so the land tabs may have been generated already >-+ * and we need to check that before regenerating them. >-+ */ >-+ >- /* Basic - bar + missions */ >-- if (planet_hasService(land_planet, PLANET_SERVICE_BAR)) >-+ if (should_open( PLANET_SERVICE_BAR, LAND_WINDOW_BAR )) >- bar_open( land_getWid(LAND_WINDOW_BAR) ); >-- if (planet_hasService(land_planet, PLANET_SERVICE_MISSIONS)) >-+ if (should_open( PLANET_SERVICE_MISSIONS, LAND_WINDOW_MISSION )) >- misn_open( land_getWid(LAND_WINDOW_MISSION) ); >- /* Outfits. */ >-- if (planet_hasService(land_planet, PLANET_SERVICE_OUTFITS)) >-+ if (should_open( PLANET_SERVICE_OUTFITS, LAND_WINDOW_OUTFITS )) >- outfits_open( land_getWid(LAND_WINDOW_OUTFITS) ); >- /* Shipyard. */ >-- if (planet_hasService(land_planet, PLANET_SERVICE_SHIPYARD)) >-+ if (should_open( PLANET_SERVICE_SHIPYARD, LAND_WINDOW_SHIPYARD )) >- shipyard_open( land_getWid(LAND_WINDOW_SHIPYARD) ); >- /* Equipment. */ >-- if (planet_hasService(land_planet, PLANET_SERVICE_OUTFITS) || >-- planet_hasService(land_planet, PLANET_SERVICE_SHIPYARD)) >-+ if ((planet_hasService(land_planet, PLANET_SERVICE_OUTFITS) || >-+ planet_hasService(land_planet, PLANET_SERVICE_SHIPYARD)) && >-+ !land_tabGenerated( LAND_WINDOW_EQUIPMENT )) >- equipment_open( land_getWid(LAND_WINDOW_EQUIPMENT) ); >- /* Commodity. */ >-- if (planet_hasService(land_planet, PLANET_SERVICE_COMMODITY)) >-+ if (should_open( PLANET_SERVICE_COMMODITY, LAND_WINDOW_COMMODITY )) >- commodity_exchange_open( land_getWid(LAND_WINDOW_COMMODITY) ); >-+#undef should_open >- >- if (!regen) { >- /* Reset markers if needed. */ >-@@ -1310,9 +1337,6 @@ void land_genWindows( int load, int chan >- if (changetab && land_windowsMap[ last_window ] != -1) >- window_tabWinSetActive( land_wid, "tabLand", land_windowsMap[ last_window ] ); >- >-- /* Add local system map button. */ >-- land_checkAddMap(); >-- >- /* Refuel if necessary. */ >- land_refuel(); >- >-@@ -1689,6 +1713,7 @@ void land_cleanup (void) >- land_planet = NULL; >- landed = 0; >- land_visited = 0; >-+ land_generated = 0; >- >- /* Destroy window. */ >- if (land_wid > 0) >diff -ruN naev.orig/files/patch-src_land.h naev/files/patch-src_land.h >--- naev.orig/files/patch-src_land.h 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_land.h 1970-01-01 03:00:00.000000000 +0300 >@@ -1,18 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/9fd2a7dcb3690bc1befe7f9a05d02e204dcfe8a1 >-# Subject: Avoid regenerating the land tabs over top of themselves >- >---- src/land.h.orig 2015-03-05 22:11:11 UTC >-+++ src/land.h >-@@ -46,6 +46,12 @@ extern int landed; >- extern Planet* land_planet; >- >- >-+/* Tracking for which tabs have been generated. */ >-+#define land_tabGenerate(w) (land_generated |= (1 << w)) /**< Mark tab generated. */ >-+#define land_tabGenerated(w) (land_generated & (1 << w)) /**< Check if tab has been generated. */ >-+extern unsigned int land_generated; >-+ >-+ >- /* >- * Main interface. >- */ >diff -ruN naev.orig/files/patch-src_land__outfits.c naev/files/patch-src_land__outfits.c >--- naev.orig/files/patch-src_land__outfits.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_land__outfits.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,15 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/9fd2a7dcb3690bc1befe7f9a05d02e204dcfe8a1 >-# Subject: Avoid regenerating the land tabs over top of themselves >- >---- src/land_outfits.c.orig 2015-03-05 22:11:11 UTC >-+++ src/land_outfits.c >-@@ -95,6 +95,9 @@ void outfits_open( unsigned int wid ) >- { >- int w, h, iw, ih, bw, bh, off; >- >-+ /* Mark as generated. */ >-+ land_tabGenerate(LAND_WINDOW_OUTFITS); >-+ >- /* Get dimensions. */ >- outfits_getSize( wid, &w, &h, &iw, &ih, &bw, &bh ); >- >diff -ruN naev.orig/files/patch-src_land__shipyard.c naev/files/patch-src_land__shipyard.c >--- naev.orig/files/patch-src_land__shipyard.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_land__shipyard.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,15 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/9fd2a7dcb3690bc1befe7f9a05d02e204dcfe8a1 >-# Subject: Avoid regenerating the land tabs over top of themselves >- >---- src/land_shipyard.c.orig 2015-03-05 22:11:11 UTC >-+++ src/land_shipyard.c >-@@ -61,6 +61,9 @@ void shipyard_open( unsigned int wid ) >- int y; >- const char *buf; >- >-+ /* Mark as generated. */ >-+ land_tabGenerate(LAND_WINDOW_SHIPYARD); >-+ >- /* Init vars. */ >- shipyard_selected = NULL; >- >diff -ruN naev.orig/files/patch-src_mission.c naev/files/patch-src_mission.c >--- naev.orig/files/patch-src_mission.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_mission.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,219 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/74b9a086a20f80f21ce2f3866b31318e651a6235 >-# Subject: Turn player_missions in an array of pointers >- >---- src/mission.c.orig 2015-02-16 17:49:03 UTC >-+++ src/mission.c >-@@ -50,7 +50,7 @@ >- * current player missions >- */ >- static unsigned int mission_id = 0; /**< Mission ID generator. */ >--Mission player_missions[MISSION_MAX]; /**< Player's active missions. */ >-+Mission *player_missions[MISSION_MAX]; /**< Player's active missions. */ >- >- >- /* >-@@ -95,7 +95,7 @@ static unsigned int mission_genID (void) >- >- /* we save mission ids, so check for collisions with player's missions */ >- for (i=0; i<MISSION_MAX; i++) >-- if (id == player_missions[i].id) /* mission id was loaded from save */ >-+ if (id == player_missions[i]->id) /* mission id was loaded from save */ >- return mission_genID(); /* recursively try again */ >- return id; >- } >-@@ -240,7 +240,7 @@ int mission_alreadyRunning( MissionData* >- { >- int i; >- for (i=0; i<MISSION_MAX; i++) >-- if (player_missions[i].data==misn) >-+ if (player_missions[i]->data == misn) >- return 1; >- return 0; >- } >-@@ -416,15 +416,15 @@ void mission_sysMark (void) >- >- for (i=0; i<MISSION_MAX; i++) { >- /* Must be a valid player mission. */ >-- if (player_missions[i].id == 0) >-+ if (player_missions[i]->id == 0) >- continue; >- /* Must have markers. */ >-- if (player_missions[i].markers == NULL) >-+ if (player_missions[i]->markers == NULL) >- continue; >- >-- n = array_size( player_missions[i].markers ); >-+ n = array_size( player_missions[i]->markers ); >- for (j=0; j<n; j++) { >-- m = &player_missions[i].markers[j]; >-+ m = &player_missions[i]->markers[j]; >- >- /* Add the individual markers. */ >- space_addMarker( m->sys, m->type ); >-@@ -562,6 +562,30 @@ void mission_cleanup( Mission* misn ) >- >- >- /** >-+ * @brief Puts the specified mission at the end of the player_missions array. >-+ * >-+ * @param pos Mission's position within player_missions >-+ */ >-+void mission_shift( int pos ) >-+{ >-+ Mission *misn; >-+ >-+ if (pos >= (MISSION_MAX-1)) >-+ return; >-+ >-+ /* Store specified mission. */ >-+ misn = player_missions[pos]; >-+ >-+ /* Move other missions down. */ >-+ memmove( &player_missions[pos], &player_missions[pos+1], >-+ sizeof(Mission*) * (MISSION_MAX - pos - 1) ); >-+ >-+ /* Put the specified mission at the end of the array. */ >-+ player_missions[MISSION_MAX - 1] = misn; >-+} >-+ >-+ >-+/** >- * @brief Frees MissionData. >- * >- * @param mission MissionData to free. >-@@ -622,8 +646,8 @@ void missions_activateClaims (void) >- int i; >- >- for (i=0; i<MISSION_MAX; i++) >-- if (player_missions[i].claims != NULL) >-- claim_activate( player_missions[i].claims ); >-+ if (player_missions[i]->claims != NULL) >-+ claim_activate( player_missions[i]->claims ); >- } >- >- >-@@ -869,9 +893,14 @@ static int mission_parse( MissionData* t >- */ >- int missions_load (void) >- { >-- int m; >-+ int i, m; >- uint32_t bufsize; >-- char *buf = ndata_read( MISSION_DATA_PATH, &bufsize ); >-+ char *buf; >-+ >-+ for (i=0; i<MISSION_MAX; i++) >-+ player_missions[i] = calloc(1, sizeof(Mission)); >-+ >-+ buf = ndata_read( MISSION_DATA_PATH, &bufsize ); >- >- xmlNodePtr node; >- xmlDocPtr doc = xmlParseMemory( buf, bufsize ); >-@@ -933,6 +962,10 @@ void missions_free (void) >- free( mission_stack ); >- mission_stack = NULL; >- mission_nstack = 0; >-+ >-+ /* Free the player mission stack. */ >-+ for (i=0; i<MISSION_MAX; i++) >-+ free(player_missions[i]); >- } >- >- >-@@ -944,7 +977,7 @@ void missions_cleanup (void) >- int i; >- >- for (i=0; i<MISSION_MAX; i++) >-- mission_cleanup( &player_missions[i] ); >-+ mission_cleanup( player_missions[i] ); >- } >- >- >-@@ -963,26 +996,26 @@ int missions_saveActive( xmlTextWriterPt >- xmlw_startElem(writer,"missions"); >- >- for (i=0; i<MISSION_MAX; i++) { >-- if (player_missions[i].id != 0) { >-+ if (player_missions[i]->id != 0) { >- xmlw_startElem(writer,"mission"); >- >- /* data and id are attributes because they must be loaded first */ >-- xmlw_attr(writer,"data","%s",player_missions[i].data->name); >-- xmlw_attr(writer,"id","%u",player_missions[i].id); >-+ xmlw_attr(writer,"data","%s",player_missions[i]->data->name); >-+ xmlw_attr(writer,"id","%u",player_missions[i]->id); >- >-- xmlw_elem(writer,"title","%s",player_missions[i].title); >-- xmlw_elem(writer,"desc","%s",player_missions[i].desc); >-- xmlw_elem(writer,"reward","%s",player_missions[i].reward); >-+ xmlw_elem(writer,"title","%s",player_missions[i]->title); >-+ xmlw_elem(writer,"desc","%s",player_missions[i]->desc); >-+ xmlw_elem(writer,"reward","%s",player_missions[i]->reward); >- >- /* Markers. */ >- xmlw_startElem( writer, "markers" ); >-- if (player_missions[i].markers != NULL) { >-- n = array_size( player_missions[i].markers ); >-+ if (player_missions[i]->markers != NULL) { >-+ n = array_size( player_missions[i]->markers ); >- for (j=0; j<n; j++) { >- xmlw_startElem(writer,"marker"); >-- xmlw_attr(writer,"id","%d",player_missions[i].markers[j].id); >-- xmlw_attr(writer,"type","%d",player_missions[i].markers[j].type); >-- xmlw_str(writer,"%s", system_getIndex(player_missions[i].markers[j].sys)->name); >-+ xmlw_attr(writer,"id","%d",player_missions[i]->markers[j].id); >-+ xmlw_attr(writer,"type","%d",player_missions[i]->markers[j].type); >-+ xmlw_str(writer,"%s", system_getIndex(player_missions[i]->markers[j].sys)->name); >- xmlw_endElem(writer); /* "marker" */ >- } >- } >-@@ -990,19 +1023,19 @@ int missions_saveActive( xmlTextWriterPt >- >- /* Cargo */ >- xmlw_startElem(writer,"cargos"); >-- for (j=0; j<player_missions[i].ncargo; j++) >-- xmlw_elem(writer,"cargo","%u", player_missions[i].cargo[j]); >-+ for (j=0; j<player_missions[i]->ncargo; j++) >-+ xmlw_elem(writer,"cargo","%u", player_missions[i]->cargo[j]); >- xmlw_endElem(writer); /* "cargos" */ >- >- /* OSD. */ >-- if (player_missions[i].osd > 0) { >-+ if (player_missions[i]->osd > 0) { >- xmlw_startElem(writer,"osd"); >- >- /* Save attributes. */ >-- items = osd_getItems(player_missions[i].osd, &nitems); >-- xmlw_attr(writer,"title","%s",osd_getTitle(player_missions[i].osd)); >-+ items = osd_getItems(player_missions[i]->osd, &nitems); >-+ xmlw_attr(writer,"title","%s",osd_getTitle(player_missions[i]->osd)); >- xmlw_attr(writer,"nitems","%d",nitems); >-- xmlw_attr(writer,"active","%d",osd_getActive(player_missions[i].osd)); >-+ xmlw_attr(writer,"active","%d",osd_getActive(player_missions[i]->osd)); >- >- /* Save messages. */ >- for (j=0; j<nitems; j++) >-@@ -1013,12 +1046,12 @@ int missions_saveActive( xmlTextWriterPt >- >- /* Claims. */ >- xmlw_startElem(writer,"claims"); >-- claim_xmlSave( writer, player_missions[i].claims ); >-+ claim_xmlSave( writer, player_missions[i]->claims ); >- xmlw_endElem(writer); /* "claims" */ >- >- /* Write Lua magic */ >- xmlw_startElem(writer,"lua"); >-- nxml_persistLua( player_missions[i].L, writer ); >-+ nxml_persistLua( player_missions[i]->L, writer ); >- xmlw_endElem(writer); /* "lua" */ >- >- xmlw_endElem(writer); /* "mission" */ >-@@ -1078,7 +1111,7 @@ static int missions_parseActive( xmlNode >- node = parent->xmlChildrenNode; >- do { >- if (xml_isNode(node,"mission")) { >-- misn = &player_missions[m]; >-+ misn = player_missions[m]; >- >- /* process the attributes to create the mission */ >- xmlr_attr(node,"data",buf); >diff -ruN naev.orig/files/patch-src_mission.h naev/files/patch-src_mission.h >--- naev.orig/files/patch-src_mission.h 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_mission.h 1970-01-01 03:00:00.000000000 +0300 >@@ -1,22 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/74b9a086a20f80f21ce2f3866b31318e651a6235 >-# Subject: Turn player_missions in an array of pointers >- >---- src/mission.h.orig 2015-02-16 17:49:03 UTC >-+++ src/mission.h >-@@ -129,7 +129,7 @@ typedef struct Mission_ { >- * current player missions >- */ >- #define MISSION_MAX 12 /**< No sense in allowing the player have infinite missions. */ >--extern Mission player_missions[MISSION_MAX]; /**< Player's active missions. */ >-+extern Mission *player_missions[MISSION_MAX]; /**< Player's active missions. */ >- >- >- /* >-@@ -165,6 +165,7 @@ int mission_unlinkCargo( Mission* misn, >- */ >- int missions_load (void); >- void mission_cleanup( Mission* misn ); >-+void mission_shift( int pos ); >- void missions_free (void); >- void missions_cleanup (void); >- >diff -ruN naev.orig/files/patch-src_nlua__hook.c naev/files/patch-src_nlua__hook.c >--- naev.orig/files/patch-src_nlua__hook.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_nlua__hook.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,14 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/74b9a086a20f80f21ce2f3866b31318e651a6235 >-# Subject: Turn player_missions in an array of pointers >- >---- src/nlua_hook.c.orig 2015-03-17 16:29:43 UTC >-+++ src/nlua_hook.c >-@@ -246,7 +246,7 @@ static unsigned int hook_generic( lua_St >- if (running_mission != NULL) { >- /* make sure mission is a player mission */ >- for (i=0; i<MISSION_MAX; i++) >-- if (player_missions[i].id == running_mission->id) >-+ if (player_missions[i]->id == running_mission->id) >- break; >- if (i>=MISSION_MAX) { >- WARN("Mission not in stack trying to hook, forgot to run misn.accept()?"); >diff -ruN naev.orig/files/patch-src_nlua__misn.c naev/files/patch-src_nlua__misn.c >--- naev.orig/files/patch-src_nlua__misn.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_nlua__misn.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,49 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/74b9a086a20f80f21ce2f3866b31318e651a6235 >-# Subject: Turn player_missions in an array of pointers >-# Origin: https://github.com/naev/naev/commit/155a7fdaf07e1b5549e6314a433425b4187bb33f >-# Subject: Don't use a pointer to a pointer >- >---- src/nlua_misn.c.orig 2015-02-16 17:49:03 UTC >-+++ src/nlua_misn.c >-@@ -283,13 +283,13 @@ int misn_runFunc( Mission *misn, const c >- if (misn_delete) { >- ret = 2; >- mission_cleanup( cur_mission ); >-- for (i=0; i<MISSION_MAX; i++) >-- if (cur_mission == &player_missions[i]) { >-- memmove( &player_missions[i], &player_missions[i+1], >-- sizeof(Mission) * (MISSION_MAX-i-1) ); >-- memset( &player_missions[MISSION_MAX-1], 0, sizeof(Mission) ); >-- break; >-- } >-+ for (i=0; i<MISSION_MAX; i++) { >-+ if (cur_mission != player_missions[i]) >-+ continue; >-+ >-+ mission_shift(i); >-+ break; >-+ } >- } >- >- return ret; >-@@ -609,7 +609,7 @@ static int misn_accept( lua_State *L ) >- >- /* find last mission */ >- for (i=0; i<MISSION_MAX; i++) >-- if (player_missions[i].data == NULL) >-+ if (player_missions[i]->data == NULL) >- break; >- >- cur_mission = misn_getFromLua(L); >-@@ -620,9 +620,9 @@ static int misn_accept( lua_State *L ) >- else if (i>=MISSION_MAX) >- ret = 1; >- else { /* copy it over */ >-- memcpy( &player_missions[i], cur_mission, sizeof(Mission) ); >-+ memcpy( player_missions[i], cur_mission, sizeof(Mission) ); >- memset( cur_mission, 0, sizeof(Mission) ); >-- cur_mission = &player_missions[i]; >-+ cur_mission = player_missions[i]; >- cur_mission->accepted = 1; /* Mark as accepted. */ >- >- /* Need to change pointer. */ >diff -ruN naev.orig/files/patch-src_npc.c naev/files/patch-src_npc.c >--- naev.orig/files/patch-src_npc.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_npc.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,14 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/74b9a086a20f80f21ce2f3866b31318e651a6235 >-# Subject: Turn player_missions in an array of pointers >- >---- src/npc.c.orig 2015-02-16 17:49:03 UTC >-+++ src/npc.c >-@@ -559,7 +559,7 @@ static int npc_approach_giver( NPC_t *np >- >- /* Make sure player can accept the mission. */ >- for (i=0; i<MISSION_MAX; i++) >-- if (player_missions[i].data == NULL) >-+ if (player_missions[i]->data == NULL) >- break; >- if (i >= MISSION_MAX) { >- dialogue_alert("You have too many active missions."); >diff -ruN naev.orig/files/patch-src_pilot__hook.c naev/files/patch-src_pilot__hook.c >--- naev.orig/files/patch-src_pilot__hook.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_pilot__hook.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,44 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/6f4005f921650c1a8930721bbd1c0eab163673f8 >-# Subject: * Hook param off by one. >-# https://github.com/naev/naev/commit/3ba9cafb369f94115c897717b6f38415348f4c8f >-# Subject: * Too many bugs in the code, should fix bugs with pilot hooks when using >1 parameter. >- >---- src/pilot_hook.c.orig 2015-02-16 17:49:03 UTC >-+++ src/pilot_hook.c >-@@ -39,26 +39,26 @@ static int pilot_hookCleanup = 0; /**< A >- int pilot_runHookParam( Pilot* p, int hook_type, HookParam* param, int nparam ) >- { >- int n, i, run, ret; >-- HookParam hparam[3], *hdynparam; >-+ HookParam hstaparam[5], *hdynparam, *hparam; >- >- /* Set up hook parameters. */ >-- if (nparam <= 1) { >-- hparam[0].type = HOOK_PARAM_PILOT; >-- hparam[0].u.lp.pilot = p->id; >-+ if (nparam <= 3) { >-+ hstaparam[0].type = HOOK_PARAM_PILOT; >-+ hstaparam[0].u.lp.pilot = p->id; >- n = 1; >-- if (nparam == 1) { >-- memcpy( &hparam[n], param, sizeof(HookParam) ); >-- n++; >-- } >-- hparam[n].type = HOOK_PARAM_SENTINEL; >-+ memcpy( &hstaparam[n], param, sizeof(HookParam)*nparam ); >-+ n += nparam; >-+ hstaparam[n].type = HOOK_PARAM_SENTINEL; >- hdynparam = NULL; >-+ hparam = hstaparam; >- } >- else { >- hdynparam = malloc( sizeof(HookParam) * (nparam+2) ); >- hdynparam[0].type = HOOK_PARAM_PILOT; >- hdynparam[0].u.lp.pilot = p->id; >- memcpy( &hdynparam[1], param, sizeof(HookParam)*nparam ); >-- hdynparam[nparam].type = HOOK_PARAM_SENTINEL; >-+ hdynparam[nparam+1].type = HOOK_PARAM_SENTINEL; >-+ hparam = hdynparam; >- } >- >- /* Run pilot specific hooks. */ >diff -ruN naev.orig/files/patch-src_player.c naev/files/patch-src_player.c >--- naev.orig/files/patch-src_player.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_player.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,44 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/74b9a086a20f80f21ce2f3866b31318e651a6235 >-# Subject: Turn player_missions in an array of pointers >-# Origin: https://github.com/naev/naev/commit/34651062f0f26b43489214137862148c7cf842c1 >-# Subject: Regenerate the player's ship list when removing a ship >- >---- src/player.c.orig 2015-03-05 22:11:11 UTC >-+++ src/player.c >-@@ -665,7 +665,7 @@ credits_t player_shipPrice( char* shipna >- */ >- void player_rmShip( char* shipname ) >- { >-- int i; >-+ int i, w; >- >- for (i=0; i<player_nstack; i++) { >- /* Not the ship we are looking for. */ >-@@ -684,6 +684,12 @@ void player_rmShip( char* shipname ) >- player_stack = realloc( player_stack, >- sizeof(PlayerShip_t) * (player_nstack) ); >- } >-+ >-+ /* Update ship list if landed. */ >-+ if (landed) { >-+ w = land_getWid( LAND_WINDOW_EQUIPMENT ); >-+ equipment_regenLists( w, 0, 1 ); >-+ } >- } >- >- >-@@ -3011,11 +3017,11 @@ static int player_saveShip( xmlTextWrite >- found = 0; >- for (j=0; j<MISSION_MAX; j++) { >- /* Only check active missions. */ >-- if (player_missions[j].id > 0) { >-+ if (player_missions[j]->id > 0) { >- /* Now check if it's in the cargo list. */ >-- for (k=0; k<player_missions[j].ncargo; k++) { >-+ for (k=0; k<player_missions[j]->ncargo; k++) { >- /* See if it matches a cargo. */ >-- if (player_missions[j].cargo[k] == ship->commodities[i].id) { >-+ if (player_missions[j]->cargo[k] == ship->commodities[i].id) { >- found = 1; >- break; >- } >diff -ruN naev.orig/files/patch-src_space.c naev/files/patch-src_space.c >--- naev.orig/files/patch-src_space.c 2015-04-24 00:36:23.000000000 +0400 >+++ naev/files/patch-src_space.c 1970-01-01 03:00:00.000000000 +0300 >@@ -1,13 +0,0 @@ >-# Origin: https://github.com/naev/naev/commit/173bad4a7bab85903575798a51259ff6f3dd42c8 >-# Subject: Memory leak fix >- >---- src/space.c.orig 2015-02-16 17:49:03 UTC >-+++ src/space.c >-@@ -2978,6 +2978,7 @@ void space_exit (void) >- free(pnt->land_func); >- free(pnt->land_msg); >- free(pnt->bribe_msg); >-+ free(pnt->bribe_ack_msg); >- >- /* tech */ >- if (pnt->tech != NULL)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 204543
: 163117 |
163118
|
163119
|
163128