mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Extensions - Replace ace_parse_imagepath
with SQF regexFind
(#8243)
This commit is contained in:
parent
64decdd189
commit
94c62d8ed3
Binary file not shown.
Binary file not shown.
@ -27,8 +27,4 @@ class ACE_Extensions {
|
||||
windows = 1;
|
||||
client = 1;
|
||||
};
|
||||
class ace_parse_imagepath {
|
||||
windows = 1;
|
||||
client = 1;
|
||||
};
|
||||
};
|
||||
|
@ -91,8 +91,7 @@ for "_index" from 0 to ((count _configPath) - 1) do {
|
||||
_actionCondition = compile _actionCondition;
|
||||
_actionMaxDistance = _actionMaxDistance + 0.1; //increase range slightly
|
||||
|
||||
//extension ~4x as fast:
|
||||
private _iconImage = "ace_parse_imagepath" callExtension _actionDisplayNameDefault;
|
||||
private _iconImage = ((_actionDisplayNameDefault regexFind ["[\w\-\\\/]+.paa/gi", 0]) param [0, [""]]) select 0;
|
||||
|
||||
private _actionOffset = [_actionPosition] call _fnc_getMemPointOffset;
|
||||
private _memPointIndex = _memPoints find _actionPosition;
|
||||
|
@ -141,7 +141,6 @@ add_subdirectory(break_line)
|
||||
add_subdirectory(clipboard)
|
||||
add_subdirectory(advanced_ballistics)
|
||||
#add_subdirectory(medical) # After medical re-write this extension is no longer used
|
||||
add_subdirectory(parse_imagepath)
|
||||
add_subdirectory(artillerytables)
|
||||
|
||||
# Test Extension for dynamically loading/unloading built extensions; does not build in release
|
||||
|
@ -1,22 +0,0 @@
|
||||
set(ACE_EXTENSION_NAME "ace_parse_imagepath")
|
||||
|
||||
file(GLOB SOURCES *.h *.hpp *.c *.cpp)
|
||||
add_library( ${ACE_EXTENSION_NAME} SHARED ${SOURCES} ${GLOBAL_SOURCES})
|
||||
target_link_libraries(${ACE_EXTENSION_NAME} ace_common)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES FOLDER Extensions)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_START_STATIC 1)
|
||||
set_target_properties(${ACE_EXTENSION_NAME} PROPERTIES LINK_SEARCH_END_STATIC 1)
|
||||
endif()
|
||||
|
||||
# Copy and rename DLL to root
|
||||
if(USE_64BIT_BUILD)
|
||||
set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}_x64.dll)
|
||||
else()
|
||||
set(FINAL_DLL_NAME ${ACE_EXTENSION_NAME}.dll)
|
||||
endif()
|
||||
add_custom_command(TARGET ${ACE_EXTENSION_NAME} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:${ACE_EXTENSION_NAME}> ${PROJECT_SOURCE_DIR}/../${FINAL_DLL_NAME}
|
||||
)
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* 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);
|
||||
EXPORT void __stdcall RVExtensionVersion(char *output, int outputSize) {
|
||||
strncpy(output, ACE_FULL_VERSION_STR, outputSize - 1);
|
||||
}
|
||||
}
|
||||
|
||||
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 - 1);
|
||||
} else {
|
||||
strncpy(output, getImagePathFromStructuredText(function).c_str(), outputSize - 1);
|
||||
}
|
||||
EXTENSION_RETURN();
|
||||
}
|
Loading…
Reference in New Issue
Block a user