mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
c426103f23
* Fix Medical HandleDamageWounds memory leak (#6809) * Use strncpy and disable MSVC unsafe warnings (#7171) * Set 64-bit correctly from generator string, Disable SSE2 flag on 64-bit (non-existent) * Tweaks for Linux extensions (#5762) * Tweak CMakeLists for Linux compilation * Conform SQF extensions check for Linux server extensions support * Add *.so to tools * Split extension check into Windows and Linux * Disable Medical extension loading for now * Add client/server separation to extension loading * Add Arma config documentation on extension creation
49 lines
1.3 KiB
C++
49 lines
1.3 KiB
C++
/*
|
|
* ace_parse_imagepath.cpp
|
|
* Author: PabstMirror
|
|
* Gets raw image path from structured text input.
|
|
*
|
|
* Takes:
|
|
* Structured text that usualy has an image:
|
|
* Example: "<img image='\A3\Ui_f\data\IGUI\Cfg\Actions\open_door_ca.paa' size='2.5' />";
|
|
*
|
|
* Returns:
|
|
* Just the image path or "" if none
|
|
*/
|
|
|
|
#include "shared.hpp"
|
|
|
|
#include <stdlib.h>
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
extern "C" {
|
|
EXPORT void __stdcall RVExtension(char *output, int outputSize, const char *function);
|
|
}
|
|
|
|
std::string getImagePathFromStructuredText(const std::string & input) {
|
|
std::string returnValue = "";
|
|
std::size_t endIndex = input.find(".paa");
|
|
std::size_t startIndex = endIndex - 1;
|
|
if ((endIndex != std::string::npos) && (endIndex > 1)) {
|
|
endIndex = endIndex + 4;
|
|
while ((startIndex > 0) && (returnValue == "")) {
|
|
if ((input[startIndex]) == '\'') {
|
|
returnValue = input.substr((startIndex + 1), (endIndex - startIndex - 1));
|
|
};
|
|
startIndex = startIndex - 1;
|
|
};
|
|
};
|
|
return returnValue;
|
|
}
|
|
|
|
void __stdcall RVExtension(char *output, int outputSize, const char *function) {
|
|
ZERO_OUTPUT();
|
|
if (!strcmp(function, "version")) {
|
|
strncpy(output, ACE_FULL_VERSION_STR, outputSize);
|
|
} else {
|
|
strncpy(output, getImagePathFromStructuredText(function).c_str(), outputSize);
|
|
}
|
|
EXTENSION_RETURN();
|
|
}
|