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(RegisterTurrets)
15 GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
19 case CMD_REQUEST_COMMAND:
23 tur_config_alsoprint = -1;
24 string filename = argv(1);
28 filename = "turrets_dump.cfg";
29 tur_config_alsoprint = FALSE;
31 else if(filename == "-")
33 filename = "turrets_dump.cfg";
34 tur_config_alsoprint = TRUE;
36 tur_config_file = fopen(filename, FILE_WRITE);
38 if(tur_config_file >= 0)
40 Dump_Turret_Settings();
41 LOG_INFO(sprintf("Dumping turrets... File located in ^2data/data/%s^7.\n", filename));
42 fclose(tur_config_file);
44 tur_config_alsoprint = -1;
48 LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
51 LOG_INFO(_("Turrets dump command only works with sv_cmd.\n"));
57 case CMD_REQUEST_USAGE:
59 LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]"));
60 LOG_INFO(" Where 'filename' is the file to write (default is turrets_dump.cfg),\n");
61 LOG_INFO(" if supplied with '-' output to console as well as default,\n");
62 LOG_INFO(" if left blank, it will only write to default.\n");
69 const int TUR_FIRST = 1;
70 #define TUR_LAST (Turrets_COUNT - 1)
72 #define REGISTER_TURRET(id, inst) REGISTER(RegisterTurrets, TUR, Turrets, id, m_id, inst)
74 REGISTER_TURRET(Null, NEW(Turret));