version 1.26 | | version 1.27 |
---|
| | |
CF_PLUGIN void* getPluginProperty(int* type, ...) | | CF_PLUGIN void* getPluginProperty(int* type, ...) |
{ | | { |
va_list args; | | va_list args; |
char* propname; | | const char* propname; |
int i; | | int i; |
static CommArray_s rtn_cmd; | | static CommArray_s rtn_cmd; |
| | |
va_start(args, type); | | va_start(args, type); |
propname = va_arg(args, char *); | | propname = va_arg(args, const char *); |
| | |
if (!strcmp(propname, "command?")) { | | if (!strcmp(propname, "command?")) { |
char* cmdname; | | const char* cmdname; |
cmdname = va_arg(args, char *); | | cmdname = va_arg(args, const char *); |
va_end(args); | | va_end(args); |
| | |
for (i = 0; i < NR_CUSTOM_CMD; i++) { | | for (i = 0; i < NR_CUSTOM_CMD; i++) { |
| | |
| | |
rv = 0; | | rv = 0; |
| | |
if (current_command < -999) { | | if (current_command < 0) { |
printf("Illegal call of runPluginCommand, call find_plugin_command first.\n"); | | printf("Illegal call of runPluginCommand, call find_plugin_command first.\n"); |
return 1; | | return 1; |
} | | } |
snprintf(buf, sizeof(buf), "%s.py", cf_get_maps_directory(CustomCommand[current_command].name)); | | snprintf(buf, sizeof(buf), "%s.py", cf_get_maps_directory(CustomCommand[current_command].script)); |
| | |
context = malloc(sizeof(CFPContext)); | | context = malloc(sizeof(CFPContext)); |
context->message[0] = 0; | | context->message[0] = 0; |
| | |
snprintf(context->options, sizeof(context->options), "%s", params); | | snprintf(context->options, sizeof(context->options), "%s", params); |
context->returnvalue = 1; /* Default is "command successful" */ | | context->returnvalue = 1; /* Default is "command successful" */ |
| | |
| | current_command = -999; |
| | |
if (!do_script(context, 0)) { | | if (!do_script(context, 0)) { |
freeContext(context); | | freeContext(context); |
return rv; | | return rv; |
| | |
context = popContext(); | | context = popContext(); |
rv = context->returnvalue; | | rv = context->returnvalue; |
freeContext(context); | | freeContext(context); |
printf("Execution complete"); | | /* printf("Execution complete"); */ |
return rv; | | return rv; |
} | | } |
| | |