4 #include "../command/all.qh"
9 REGISTRY(Turrets, BITS(5))
10 #define Turrets_from(i) _Turrets_from(i, TUR_Null)
11 #define get_turretinfo(i) Turrets_from(i)
12 REGISTER_REGISTRY(Turrets)
13 REGISTRY_CHECK(Turrets)
16 GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
20 case CMD_REQUEST_COMMAND:
24 tur_config_alsoprint = -1;
25 string filename = argv(1);
29 filename = "turrets_dump.cfg";
30 tur_config_alsoprint = FALSE;
32 else if(filename == "-")
34 filename = "turrets_dump.cfg";
35 tur_config_alsoprint = TRUE;
37 tur_config_file = fopen(filename, FILE_WRITE);
39 if(tur_config_file >= 0)
41 Dump_Turret_Settings();
42 LOG_INFO(sprintf("Dumping turrets... File located in ^2data/data/%s^7.\n", filename));
43 fclose(tur_config_file);
45 tur_config_alsoprint = -1;
49 LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
52 LOG_INFO(_("Turrets dump command only works with sv_cmd.\n"));
58 case CMD_REQUEST_USAGE:
60 LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]"));
61 LOG_INFO(" Where 'filename' is the file to write (default is turrets_dump.cfg),\n");
62 LOG_INFO(" if supplied with '-' output to console as well as default,\n");
63 LOG_INFO(" if left blank, it will only write to default.\n");
70 const int TUR_FIRST = 1;
71 #define TUR_LAST (Turrets_COUNT - 1)
73 #define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst)
75 REGISTER_TURRET(Null, NEW(Turret));