# on
bind mouse1 "+fire; +toggle cl_dummy_copy_moves 1 0"
# off
bind mouse1 +fire
This makes the dummy copy my moves when I fire. And keeps them afterwards. Like this:
2021-05-01
and 2021-08-01
are likely my fault, i'll fix that as soon as possible, not sure about the other ones thoughxft:DejaVu Sans Mono:pixelsize=14:hintstyle=hintnone:rgba=rgb:lcdfilter=lcddefault
and xft:DejaVu Sans Mono:pixelsize=14:hintstyle=hintnone
lcddefault
, lcdlight
and lcdlegacy
.c
file that is not compiled to cmake?.c
file that is not compiled to cmake? .h
, it would be confusingstr_copy
version which 'll get the destination size automatically.
diff --git src/base/system.h src/base/system.h
index af617d7ad..133345376 100644
--- src/base/system.h
+++ src/base/system.h
@@ -2423,6 +2423,13 @@ void set_exception_handler_log_file(const char *log_file_path);
#if defined(__cplusplus)
}
+
+template <int N>
+int str_copy(char (&dst)[N], const char *src)
+{
+ str_copy(dst, src, N);
+}
+
#endif
#endif
We have 477 uses of str_copy
, mostly stuff like str_copy(m_Password, pPassword, sizeof(m_Password));
, but sometimes even use hardcoded values:
https://github.com/ddnet/ddnet/blob/e14fc102a6f5f4492ab1eb26504642181c6aa933/src/game/client/gameclient.cpp#L1196
If we don't want to replace all cases (I think there are at least 300 uses like str_copy(a, b, sizeof(a))
) then we can at least add such functions and use them in new code.
And str_copy
is not the only case, there are also str_append(char *dst, const char *src, int dst_size)
, str_truncate
, str_hex(char *dst, int dst_size, ...)
, str_hex_decode(void *dst, int dst_size, ...)
,
All those manual and error-prone dst_size
can be set automatically. (edited)N
characters, where N
is figured out by compiler from the variable type; at compile time.char aNameTry[MAX_NAME_LENGTH];
str_copy(aNameTry, aTrimmedName, sizeof(aNameTry));
the type of aNameTry
is char[16]
. Our new str_copy()
can accept char[N]
as the first argument and know the N
at compile time.
So we can replace it with str_copy(aNameTry, aTrimmedName);
, which 'll compile only if it is safe. (edited)char *pBuf = aNameTry;
and then use pBuf?char *pBuf = aNameTry;
and then use pBuf? char aVar[N]
to char *pVar
conversion.
So we'll still have to use the current functions (in about 10% of cases, as I see). (edited)str_copy()
, repeat where it makes sense.
What is the benefit of replacing C arrays with std::array<char, N>
? I'm sure there are (e.g. we'll be able to use std::array::size()
instead of std::size
), but probably it won't be that lightweight change.char aNameTry[MAX_NAME_LENGTH];
str_copy(aNameTry, aTrimmedName, sizeof(aNameTry));
We'll replace it with std::array<char, MAX_NAME_LENGTH> aNameTry;
. Now what? str_copy
won't be more convenient (or we'll need another template for that).aNameTry = aTrimmedName;
, because they can have diff size and we do str_utf8_fix_truncation
on the result.string
from base/tl/string.h
with std::string
.
base/tl
component gone \o/tl/array
is the most annoying to do :/.c
without it being compiled?.c
without it being compiled? EXCLUDE_FROM_ALL
won't help?add_custom_target(my-extra-c-files SOURCES
my-file.c
)
bc5f46e
Add CHeap::StoreString method - Robyt3
e2a049f
Mark methods as const - Robyt3
3e1cfcd
Store localized strings in a CHeap instead of using tl/string.h - Robyt3
dee7393
Remove unused includes of base/tl/string.h - Robyt3
a1d092b
Replace remaining usage of base/tl/string with std::string - Robyt3
2256209
Remove base/tl/string.h - Robyt3
490704b
Merge #5073 - bors[bot]EXCLUDE_FROM_ALL
option:
add_executable(my-extra-c-files EXCLUDE_FROM_ALL my-file.c)
or use the custom target (which is excluded from ALL by default, and can be included using ALL
argument).
I would suggest to try the custom target first, and then maybe add a fake executable or library (excluded from ALL
) if this won't work for some reason. (edited)Build
button in IDE, or do cmake --build .
, the default CMake target is ALL
.
EXCLUDE_FROM_ALL
means that the (sub)target won't be a part of the default build. IOW it will be build only if something else depends on this target, or if you manually ask CMake to build it (e.g. cmake --build . --target my-extra-c-files
).Build
button in IDE, or do cmake --build .
, the default CMake target is ALL
.
EXCLUDE_FROM_ALL
means that the (sub)target won't be a part of the default build. IOW it will be build only if something else depends on this target, or if you manually ask CMake to build it (e.g. cmake --build . --target my-extra-c-files
). BASE
is the list of source files for target engine-shared
) and yet you want to exclude that file from the target.
I don't think this is possible in the intended way.
You can remove the file from BASE
later on, but then it'll also disappear e.g. from target source files in IDEs..h
extension#5017
, but it doesn't link to it.c
(or .cpp
, or any other type) file as a header file which can/should be included by other files but should not be compiled on its own.
https://cmake.org/cmake/help/latest/prop_sf/HEADER_FILE_ONLY.html (edited)set_source_files_properties(src/base/confusables_data.c PROPERTIES
HEADER_FILE_ONLY ON)
2.8.12
.
I also think that it makes sense to bump CMake version e.g. to 3.8
because it is the first version with declared C++17 support (and we need this support because we use std::size
). (edited)set_source_files_properties(src/base/confusables_data.c PROPERTIES
HEADER_FILE_ONLY ON)
everything
would mean everythingcmake -G Ninja -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-warnings-as-errors=*" -DCMAKE_C_CLANG_TIDY="clang-tidy;-warnings-as-errors=*" -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
cmake --build . --config Debug --target everything -- -k 0
(edited)everything
would mean everything EXCEPTIONS = [
) (edited)cmake -G Ninja -DCMAKE_CXX_CLANG_TIDY="clang-tidy;-warnings-as-errors=*" -DCMAKE_C_CLANG_TIDY="clang-tidy;-warnings-as-errors=*" -DCMAKE_BUILD_TYPE=Debug -Werror=dev -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=. ..
cmake --build . --config Debug --target everything -- -k 0
(edited)check-style
, but i guess i could also run the clang-tidy
oneas well CMakeFiles/DDNet.dir/src/game/generated/checksum.cpp.o
?