diff options
author | Dmitry Marakasov <amdmi3@FreeBSD.org> | 2015-04-23 20:36:23 +0000 |
---|---|---|
committer | Dmitry Marakasov <amdmi3@FreeBSD.org> | 2015-04-23 20:36:23 +0000 |
commit | d4fa20069ec06ee89dfdb3a4cc19442237d69761 (patch) | |
tree | 94d700b8a2c88fd6033c1bd97ea4cd4ba8ec0f91 /games/naev | |
parent | 1b6531fbe3b5ccf6be24f272cb03c891d234ceda (diff) | |
download | ports-d4fa20069ec06ee89dfdb3a4cc19442237d69761.tar.gz ports-d4fa20069ec06ee89dfdb3a4cc19442237d69761.zip |
Notes
Diffstat (limited to 'games/naev')
-rw-r--r-- | games/naev/Makefile | 62 | ||||
-rw-r--r-- | games/naev/distinfo | 4 | ||||
-rw-r--r-- | games/naev/files/patch-src_board.c | 38 | ||||
-rw-r--r-- | games/naev/files/patch-src_equipment.c | 15 | ||||
-rw-r--r-- | games/naev/files/patch-src_hook.c | 16 | ||||
-rw-r--r-- | games/naev/files/patch-src_info.c | 87 | ||||
-rw-r--r-- | games/naev/files/patch-src_land.c | 137 | ||||
-rw-r--r-- | games/naev/files/patch-src_land.h | 18 | ||||
-rw-r--r-- | games/naev/files/patch-src_land__outfits.c | 15 | ||||
-rw-r--r-- | games/naev/files/patch-src_land__shipyard.c | 15 | ||||
-rw-r--r-- | games/naev/files/patch-src_mission.c | 219 | ||||
-rw-r--r-- | games/naev/files/patch-src_mission.h | 22 | ||||
-rw-r--r-- | games/naev/files/patch-src_nlua__hook.c | 14 | ||||
-rw-r--r-- | games/naev/files/patch-src_nlua__misn.c | 49 | ||||
-rw-r--r-- | games/naev/files/patch-src_npc.c | 14 | ||||
-rw-r--r-- | games/naev/files/patch-src_pilot__hook.c | 44 | ||||
-rw-r--r-- | games/naev/files/patch-src_player.c | 44 | ||||
-rw-r--r-- | games/naev/files/patch-src_space.c | 13 | ||||
-rw-r--r-- | games/naev/files/pkg-message.in | 9 | ||||
-rw-r--r-- | games/naev/pkg-descr | 2 |
20 files changed, 797 insertions, 40 deletions
diff --git a/games/naev/Makefile b/games/naev/Makefile index 2f948f72b5ad..10a2eb477dea 100644 --- a/games/naev/Makefile +++ b/games/naev/Makefile @@ -2,56 +2,62 @@ # $FreeBSD$ PORTNAME= naev -PORTVERSION= 0.5.3 -PORTREVISION= 4 +PORTVERSION= 0.6.0 CATEGORIES= games -MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-${PORTVERSION} \ - ${MASTER_SITE_GOOGLE_CODE} +MASTER_SITES= SF/${PORTNAME}/${PORTNAME}-${PORTVERSION}/ DIST_SUBDIR= ${PORTNAME} MAINTAINER= acm@FreeBSD.org COMMENT= 2D action/RPG space game +LICENSE= GPLv3 +LICENSE_FILE= ${WRKSRC}/LICENSE + LIB_DEPENDS= libpng.so:${PORTSDIR}/graphics/png \ libfreetype.so:${PORTSDIR}/print/freetype2 \ - libvorbisfile.so:${PORTSDIR}/audio/libvorbis -RUN_DEPENDS= ${LOCALBASE}/share/${PORTNAME}/ndata-${PORTVERSION}:${PORTSDIR}/games/naev-data + libvorbisfile.so:${PORTSDIR}/audio/libvorbis \ + libzip.so:${PORTSDIR}/archivers/libzip \ + libcsparse.so:${PORTSDIR}/math/suitesparse +RUN_DEPENDS= ${DATADIR}/ndata-${PORTVERSION}.zip:${PORTSDIR}/games/naev-data -USES= gmake pkgconfig tar:bzip2 -USE_AUTOTOOLS= automake:env aclocal:env autoconf:env +USES= autoreconf:build gmake pkgconfig tar:bzip2 GNU_CONFIGURE= yes USE_GL= glu USE_GNOME= libxml2 -USE_SDL= sdl image -CONFIGURE_ARGS= --with-ndata-path=${DATADIR}/ndata-${PORTVERSION} +CONFIGURE_ARGS= --with-ndata-path="${DATADIR}/ndata-${PORTVERSION}.zip" \ + --enable-debug=no CPPFLAGS+= -I${LOCALBASE}/include LIBS+= -L${LOCALBASE}/lib -lm -PLIST_FILES= bin/${PORTNAME} man/man6/naev.6.gz -SUB_FILES= pkg-message +PORTDATA= * +PORTDOCS= * + +PLIST_FILES= bin/${PORTNAME} man/man6/naev.6.gz \ + share/applications/${PORTNAME}.desktop \ + share/appdata/${PORTNAME}.appdata.xml \ + share/pixmaps/${PORTNAME}.png + +OPTIONS_DEFINE= DOCS OPENAL SDL2 SDL_MIXER +OPTIONS_DEFAULT= OPENAL SDL2 SDL_MIXER -OPTIONS_DEFINE= OPENAL SDL_MIXER +OPENAL_USES= openal +OPENAL_CONFIGURE_WITH= openal SDL_MIXER_DESC= SDL_mixer sound backend +SDL_MIXER_CONFIGURE_WITH= sdlmixer +SDL2_DESC= Use SDL2 instead of SDL +SDL2_CONFIGURE_WITH= sdl2 +SDL2_USE= SDL=sdl2 +SDL2_USE_OFF= SDL=sdl .include <bsd.port.options.mk> -.if ${PORT_OPTIONS:MOPENAL} -USES+= openal -CONFIGURE_ARGS+= --with-openal=yes -.else -CONFIGURE_ARGS+= --with-openal=no -.endif - .if ${PORT_OPTIONS:MSDL_MIXER} -USE_SDL+= mixer -CONFIGURE_ARGS+= --with-sdlmixer=yes -.else -CONFIGURE_ARGS+= --with-sdlmixer=no +. if ${PORT_OPTIONS:MSDL2} +USE_SDL+= mixer2 +. else +USE_SDL+= mixer +. endif .endif -do-install: - ${INSTALL_PROGRAM} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin - ${INSTALL_MAN} ${WRKSRC}/${PORTNAME}.6 ${STAGEDIR}${MAN6PREFIX}/man/man6 - .include <bsd.port.mk> diff --git a/games/naev/distinfo b/games/naev/distinfo index 02baa6301abc..451bbc7e082d 100644 --- a/games/naev/distinfo +++ b/games/naev/distinfo @@ -1,2 +1,2 @@ -SHA256 (naev/naev-0.5.3.tar.bz2) = b2d026abb099bcb884e13a26b1bce4273f094830690340468f752a3b9b64c719 -SIZE (naev/naev-0.5.3.tar.bz2) = 997522 +SHA256 (naev/naev-0.6.0.tar.bz2) = 0f0b498c7642e36dfaa15f284e13b9aa2d20e4aa01ed812fb7854583e7161cac +SIZE (naev/naev-0.6.0.tar.bz2) = 1054649 diff --git a/games/naev/files/patch-src_board.c b/games/naev/files/patch-src_board.c new file mode 100644 index 000000000000..11934ec2669c --- /dev/null +++ b/games/naev/files/patch-src_board.c @@ -0,0 +1,38 @@ +# 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 --git a/games/naev/files/patch-src_equipment.c b/games/naev/files/patch-src_equipment.c new file mode 100644 index 000000000000..f8e22d7b45cf --- /dev/null +++ b/games/naev/files/patch-src_equipment.c @@ -0,0 +1,15 @@ +# 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 --git a/games/naev/files/patch-src_hook.c b/games/naev/files/patch-src_hook.c new file mode 100644 index 000000000000..7a6a3eaaf2e8 --- /dev/null +++ b/games/naev/files/patch-src_hook.c @@ -0,0 +1,16 @@ +# 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 --git a/games/naev/files/patch-src_info.c b/games/naev/files/patch-src_info.c new file mode 100644 index 000000000000..66524fd4d7bb --- /dev/null +++ b/games/naev/files/patch-src_info.c @@ -0,0 +1,87 @@ +# 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 --git a/games/naev/files/patch-src_land.c b/games/naev/files/patch-src_land.c new file mode 100644 index 000000000000..c2093607e949 --- /dev/null +++ b/games/naev/files/patch-src_land.c @@ -0,0 +1,137 @@ +# 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 --git a/games/naev/files/patch-src_land.h b/games/naev/files/patch-src_land.h new file mode 100644 index 000000000000..6d4afe9ba1af --- /dev/null +++ b/games/naev/files/patch-src_land.h @@ -0,0 +1,18 @@ +# 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 --git a/games/naev/files/patch-src_land__outfits.c b/games/naev/files/patch-src_land__outfits.c new file mode 100644 index 000000000000..a5ee02a3eb84 --- /dev/null +++ b/games/naev/files/patch-src_land__outfits.c @@ -0,0 +1,15 @@ +# 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 --git a/games/naev/files/patch-src_land__shipyard.c b/games/naev/files/patch-src_land__shipyard.c new file mode 100644 index 000000000000..e40bb32052aa --- /dev/null +++ b/games/naev/files/patch-src_land__shipyard.c @@ -0,0 +1,15 @@ +# 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 --git a/games/naev/files/patch-src_mission.c b/games/naev/files/patch-src_mission.c new file mode 100644 index 000000000000..71379465be38 --- /dev/null +++ b/games/naev/files/patch-src_mission.c @@ -0,0 +1,219 @@ +# 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 --git a/games/naev/files/patch-src_mission.h b/games/naev/files/patch-src_mission.h new file mode 100644 index 000000000000..69a79c893ad6 --- /dev/null +++ b/games/naev/files/patch-src_mission.h @@ -0,0 +1,22 @@ +# 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 --git a/games/naev/files/patch-src_nlua__hook.c b/games/naev/files/patch-src_nlua__hook.c new file mode 100644 index 000000000000..5852e4b89975 --- /dev/null +++ b/games/naev/files/patch-src_nlua__hook.c @@ -0,0 +1,14 @@ +# 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 --git a/games/naev/files/patch-src_nlua__misn.c b/games/naev/files/patch-src_nlua__misn.c new file mode 100644 index 000000000000..e4aaf36076a6 --- /dev/null +++ b/games/naev/files/patch-src_nlua__misn.c @@ -0,0 +1,49 @@ +# 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 --git a/games/naev/files/patch-src_npc.c b/games/naev/files/patch-src_npc.c new file mode 100644 index 000000000000..04558e586815 --- /dev/null +++ b/games/naev/files/patch-src_npc.c @@ -0,0 +1,14 @@ +# 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 --git a/games/naev/files/patch-src_pilot__hook.c b/games/naev/files/patch-src_pilot__hook.c new file mode 100644 index 000000000000..e4fa07d543e0 --- /dev/null +++ b/games/naev/files/patch-src_pilot__hook.c @@ -0,0 +1,44 @@ +# 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 --git a/games/naev/files/patch-src_player.c b/games/naev/files/patch-src_player.c new file mode 100644 index 000000000000..4886ab11ab58 --- /dev/null +++ b/games/naev/files/patch-src_player.c @@ -0,0 +1,44 @@ +# 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 --git a/games/naev/files/patch-src_space.c b/games/naev/files/patch-src_space.c new file mode 100644 index 000000000000..67c7c1915bd0 --- /dev/null +++ b/games/naev/files/patch-src_space.c @@ -0,0 +1,13 @@ +# 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) diff --git a/games/naev/files/pkg-message.in b/games/naev/files/pkg-message.in deleted file mode 100644 index 4e2361faac01..000000000000 --- a/games/naev/files/pkg-message.in +++ /dev/null @@ -1,9 +0,0 @@ -############################################################################### - -The NAEV space game was installed - -1) You can find the conf.lua config file into your ~/.config/naev/ directory - -2) Enjoy it :) - -############################################################################### diff --git a/games/naev/pkg-descr b/games/naev/pkg-descr index 584ae4cfd4af..abebd9508f00 100644 --- a/games/naev/pkg-descr +++ b/games/naev/pkg-descr @@ -1,4 +1,4 @@ NAEV is a 2D space game that combines elements from the action, RPG, and simulation genres. -WWW: http://code.google.com/p/naev/ +WWW: http://sourceforge.net/projects/naev/ |