Menu

#482 land.c: add -d output directory flag

None
open
nobody
None
5
4 days ago
6 days ago
Rick Tanner
No

The proposed patch adds a "-d /path/to/dir" option (global outdir, default .) and routes all output files (world_*, cmap, lmap, pmap) through outdir, plus prints the "Output directory set to:"/"Output directory:" lines. Note: it doesn't create the directory if missing — fopen will fail if outdir doesn't exist.

The enclosed patch was generated via Claude Sonnet 4.6 and followed the guidelines from https://sourceforge.net/p/crossfire/crossfire-server/ci/master/tree/doc/Developers/programming_guide.md

The "parent ticket" to this patch was https://sourceforge.net/p/crossfire/patches/479/

1 Attachments

Discussion

  • Rick Tanner

    Rick Tanner - 6 days ago
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -The proposed patch adds a -d <dir> option (global outdir, default .) and routes all output files (world_*, cmap, lmap, pmap) through outdir, plus prints the "Output directory set to:"/"Output directory:" lines. Note: it doesn't create the directory if missing — fopen will fail if outdir doesn't exist.
    +The proposed patch adds a "-d /path/to/dir" option (global outdir, default .) and routes all output files (world_*, cmap, lmap, pmap) through outdir, plus prints the "Output directory set to:"/"Output directory:" lines. Note: it doesn't create the directory if missing — fopen will fail if outdir doesn't exist.
    
     The enclosed patch was generated via Claude Sonnet 4.6 and followed the guidelines from https://sourceforge.net/p/crossfire/crossfire-server/ci/master/tree/doc/Developers/programming_guide.md
    
    • Group: -->
     
  • Rick Tanner

    Rick Tanner - 6 days ago

    Fixed formatting issue in the summary

     
  • Kevin Zheng

    Kevin Zheng - 5 days ago

    Patch fails to apply for me:

    $ patch -p1 < land-d-option.patch
    Hmm...  Looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |--- a/land.c
    |+++ b/land.c
    --------------------------
    Patching file land.c using Plan A...
    Hunk #1 succeeded at 35 (offset 1 line).
    Hunk #2 succeeded at 100 (offset -1 lines).
    Hmm...  The next patch looks like a unified diff to me...
    The text leading up to this was:
    --------------------------
    |
    --------------------------
    File to patch: land.c
    Patching file land.c using Plan A...
    patch: **** malformed patch at line 31: @@ -263,7 +267,8 @@
    
     
  • Rick Tanner

    Rick Tanner - 5 days ago

    Well... both disappointing and embarrassing. Sorry about that.

    Second try with a recreated patch.

    Ran further testing.

    ~/crossfire-crossfire-maps/Info$ patch -p1 --dry-run < land_outdir-2.patch
    checking file land.c

    ~/crossfire-crossfire-maps/Info$ patch -p1 < land_outdir-2.patch
    patching file land.c

    No output of errors.

     
  • Sebastian Andersson

    I wouldn't use sprintf in new code, snprintf does the same thing but also makes sure you don't write outside of the given length:
    snprintf(path, sizeof(path), ....

     

Log in to post a comment.

Auth0 Logo