Skip to content
Browse files

* Forgot files.

  • Loading branch information...
1 parent b608ea3 commit 1614233d10d039a2405ac1fc4ab72796842e50d9 @bobbens bobbens committed
Showing with 117 additions and 0 deletions.
  1. +31 −0 src/dev.c
  2. +14 −0 src/dev.h
  3. +58 −0 src/dev_outfit.c
  4. +14 −0 src/dev_outfit.h
View
31 src/dev.c
@@ -0,0 +1,31 @@
+/*
+ * See Licensing and Copyright notice in naev.h
+ */
+
+/**
+ * @file dev.c
+ *
+ * @brief Generic developement routines.
+ */
+
+#include "dev.h"
+
+#include "naev.h"
+
+#include "SDL.h"
+
+#include "dev_outfit.h"
+
+
+/**
+ */
+void dev_csv (void)
+{
+ printf("Generating CSV data...\n");
+
+ printf(" bolt.csv...");
+ dout_csvBolt( "bolt.csv" );
+ printf("done!\n");
+}
+
+
View
14 src/dev.h
@@ -0,0 +1,14 @@
+/*
+ * See Licensing and Copyright notice in naev.h
+ */
+
+
+
+#ifndef DEV_H
+# define DEV_H
+
+
+void dev_csv (void);
+
+
+#endif /* DEV_H */
View
58 src/dev_outfit.c
@@ -0,0 +1,58 @@
+/*
+ * See Licensing and Copyright notice in naev.h
+ */
+
+/**
+ * @file dev_outfit.c
+ *
+ * @brief Handles the outfit developement routines.
+ */
+
+#include "dev_outfit.h"
+
+#include "naev.h"
+
+#include "SDL.h"
+
+#include "outfit.h"
+
+
+/**
+ * @brief Dumps the bolt weapon data to csv.
+ */
+void dout_csvBolt( const char *path )
+{
+ Outfit *o;
+ int i, n, l;
+ SDL_RWops *rw;
+ char buf[ 1024 ];
+
+ /* File to output to. */
+ rw = SDL_RWFromFile( path, "w" );
+
+ /* Write "header" */
+ l = snprintf( buf, sizeof(buf),
+ "name,type,slot,license,mass,price,delay,speed,range,falloff,"
+ "accuracy,lockon,energy,cpu,dtype,damage,dps,eps\n"
+ );
+ SDL_RWwrite( rw, buf, l, 1 );
+
+ o = outfit_getAll( &n );
+ for (i=0; i<n; i++) {
+
+ /* Only handle bolt weapons. */
+ if (!outfit_isBolt(o))
+ continue;
+
+ l = snprintf( buf, sizeof(buf),
+ "name,type,slot,license,mass,price,delay,speed,range,falloff,"
+ "accuracy,lockon,energy,cpu,dtype,damage,dps,eps\n"
+ );
+ SDL_RWwrite( rw, buf, l, 1 );
+ }
+
+ /* Close file. */
+ SDL_RWclose( rw );
+}
+
+
View
14 src/dev_outfit.h
@@ -0,0 +1,14 @@
+/*
+ * See Licensing and Copyright notice in naev.h
+ */
+
+
+
+#ifndef DEV_OUTFIT_H
+# define DEV_OUTFIT_H
+
+
+void dout_csvBolt( const char *path );
+
+
+#endif /* DEV_OUTFIT_H */

0 comments on commit 1614233

Please sign in to comment.
Something went wrong with that request. Please try again.