Skip to content

Commit 991e6c9

Browse files
committed
Merge pull request #96923 from Repiteo/style/warning-admonition
Style: Add `WARNING:` as new comment admonition
2 parents 052b122 + 32c83a2 commit 991e6c9

File tree

13 files changed

+46
-34
lines changed

13 files changed

+46
-34
lines changed

core/input/input_builders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def make_default_controller_mappings(target, source, env):
3333
guid = line_parts[0]
3434
if guid in platform_mappings[current_platform]:
3535
g.write(
36-
"// WARNING - DATABASE {} OVERWROTE PRIOR MAPPING: {} {}\n".format(
36+
"// WARNING: DATABASE {} OVERWROTE PRIOR MAPPING: {} {}\n".format(
3737
src_path, current_platform, platform_mappings[current_platform][guid]
3838
)
3939
)

core/io/packet_peer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Ref<StreamPeer> PacketPeerStream::get_stream_peer() const {
299299

300300
void PacketPeerStream::set_input_buffer_max_size(int p_max_size) {
301301
ERR_FAIL_COND_MSG(p_max_size < 0, "Max size of input buffer size cannot be smaller than 0.");
302-
//warning may lose packets
302+
// WARNING: May lose packets.
303303
ERR_FAIL_COND_MSG(ring_buffer.data_left(), "Buffer in use, resizing would cause loss of data.");
304304
ring_buffer.resize(nearest_shift(next_power_of_2(p_max_size + 4)) - 1);
305305
input_buffer.resize(next_power_of_2(p_max_size + 4));

core/math/transform_2d.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,19 @@
3939
class String;
4040

4141
struct [[nodiscard]] Transform2D {
42-
// Warning #1: basis of Transform2D is stored differently from Basis. In terms of columns array, the basis matrix looks like "on paper":
42+
// WARNING: The basis of Transform2D is stored differently from Basis.
43+
// In terms of columns array, the basis matrix looks like "on paper":
4344
// M = (columns[0][0] columns[1][0])
4445
// (columns[0][1] columns[1][1])
45-
// This is such that the columns, which can be interpreted as basis vectors of the coordinate system "painted" on the object, can be accessed as columns[i].
46-
// Note that this is the opposite of the indices in mathematical texts, meaning: $M_{12}$ in a math book corresponds to columns[1][0] here.
46+
// This is such that the columns, which can be interpreted as basis vectors
47+
// of the coordinate system "painted" on the object, can be accessed as columns[i].
48+
// NOTE: This is the opposite of the indices in mathematical texts,
49+
// meaning: $M_{12}$ in a math book corresponds to columns[1][0] here.
4750
// This requires additional care when working with explicit indices.
4851
// See https://en.wikipedia.org/wiki/Row-_and_column-major_order for further reading.
4952

50-
// Warning #2: 2D be aware that unlike 3D code, 2D code uses a left-handed coordinate system: Y-axis points down,
51-
// and angle is measure from +X to +Y in a clockwise-fashion.
53+
// WARNING: Be aware that unlike 3D code, 2D code uses a left-handed coordinate system:
54+
// Y-axis points down, and angle is measure from +X to +Y in a clockwise-fashion.
5255

5356
Vector2 columns[3];
5457

editor/plugins/tiles/tile_set_atlas_source_editor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class TileSetAtlasSourceEditor : public HSplitContainer {
177177

178178
DRAG_TYPE_MAY_POPUP_MENU,
179179

180-
// Warning: keep in this order.
180+
// WARNING: Keep in this order.
181181
DRAG_TYPE_RESIZE_TOP_LEFT,
182182
DRAG_TYPE_RESIZE_TOP,
183183
DRAG_TYPE_RESIZE_TOP_RIGHT,

modules/gdscript/gdscript_compiler.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,9 +2629,10 @@ Error GDScriptCompiler::_parse_setter_getter(GDScript *p_script, const GDScriptP
26292629
return err;
26302630
}
26312631

2632-
// Prepares given script, and inner class scripts, for compilation. It populates class members and initializes method
2633-
// RPC info for its base classes first, then for itself, then for inner classes.
2634-
// Warning: this function cannot initiate compilation of other classes, or it will result in cyclic dependency issues.
2632+
// Prepares given script, and inner class scripts, for compilation. It populates class members and
2633+
// initializes method RPC info for its base classes first, then for itself, then for inner classes.
2634+
// WARNING: This function cannot initiate compilation of other classes, or it will result in
2635+
// cyclic dependency issues.
26352636
Error GDScriptCompiler::_prepare_compilation(GDScript *p_script, const GDScriptParser::ClassNode *p_class, bool p_keep_state) {
26362637
if (parsed_classes.has(p_script)) {
26372638
return OK;

modules/godot_physics_2d/godot_body_pair_2d.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ void GodotBodyPair2D::_validate_contacts() {
161161
}
162162
}
163163

164-
// _test_ccd prevents tunneling by slowing down a high velocity body that is about to collide so that next frame it will be at an appropriate location to collide (i.e. slight overlap)
165-
// Warning: the way velocity is adjusted down to cause a collision means the momentum will be weaker than it should for a bounce!
166-
// Process: only proceed if body A's motion is high relative to its size.
167-
// cast forward along motion vector to see if A is going to enter/pass B's collider next frame, only proceed if it does.
168-
// adjust the velocity of A down so that it will just slightly intersect the collider instead of blowing right past it.
164+
// `_test_ccd` prevents tunneling by slowing down a high velocity body that is about to collide so
165+
// that next frame it will be at an appropriate location to collide (i.e. slight overlap).
166+
// WARNING: The way velocity is adjusted down to cause a collision means the momentum will be
167+
// weaker than it should for a bounce!
168+
// Process: Only proceed if body A's motion is high relative to its size.
169+
// Cast forward along motion vector to see if A is going to enter/pass B's collider next frame, only proceed if it does.
170+
// Adjust the velocity of A down so that it will just slightly intersect the collider instead of blowing right past it.
169171
bool GodotBodyPair2D::_test_ccd(real_t p_step, GodotBody2D *p_A, int p_shape_A, const Transform2D &p_xform_A, GodotBody2D *p_B, int p_shape_B, const Transform2D &p_xform_B) {
170172
Vector2 motion = p_A->get_linear_velocity() * p_step;
171173
real_t mlen = motion.length();

modules/godot_physics_2d/godot_step_2d.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,14 @@ void GodotStep2D::step(GodotSpace2D *p_space, real_t p_delta) {
251251

252252
/* PRE-SOLVE CONSTRAINT ISLANDS */
253253

254-
// Warning: This doesn't run on threads, because it involves thread-unsafe processing.
254+
// WARNING: This doesn't run on threads, because it involves thread-unsafe processing.
255255
for (uint32_t island_index = 0; island_index < island_count; ++island_index) {
256256
_pre_solve_island(constraint_islands[island_index]);
257257
}
258258

259259
/* SOLVE CONSTRAINT ISLANDS */
260260

261-
// Warning: _solve_island modifies the constraint islands for optimization purpose,
261+
// WARNING: `_solve_island` modifies the constraint islands for optimization purpose,
262262
// their content is not reliable after these calls and shouldn't be used anymore.
263263
group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &GodotStep2D::_solve_island, nullptr, island_count, -1, true, SNAME("Physics2DConstraintSolveIslands"));
264264
WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);

modules/godot_physics_3d/godot_body_pair_3d.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,13 @@ void GodotBodyPair3D::validate_contacts() {
161161
}
162162
}
163163

164-
// _test_ccd prevents tunneling by slowing down a high velocity body that is about to collide so that next frame it will be at an appropriate location to collide (i.e. slight overlap)
165-
// Warning: the way velocity is adjusted down to cause a collision means the momentum will be weaker than it should for a bounce!
166-
// Process: only proceed if body A's motion is high relative to its size.
167-
// cast forward along motion vector to see if A is going to enter/pass B's collider next frame, only proceed if it does.
168-
// adjust the velocity of A down so that it will just slightly intersect the collider instead of blowing right past it.
164+
// `_test_ccd` prevents tunneling by slowing down a high velocity body that is about to collide so
165+
// that next frame it will be at an appropriate location to collide (i.e. slight overlap).
166+
// WARNING: The way velocity is adjusted down to cause a collision means the momentum will be
167+
// weaker than it should for a bounce!
168+
// Process: Only proceed if body A's motion is high relative to its size.
169+
// Cast forward along motion vector to see if A is going to enter/pass B's collider next frame, only proceed if it does.
170+
// Adjust the velocity of A down so that it will just slightly intersect the collider instead of blowing right past it.
169171
bool GodotBodyPair3D::_test_ccd(real_t p_step, GodotBody3D *p_A, int p_shape_A, const Transform3D &p_xform_A, GodotBody3D *p_B, int p_shape_B, const Transform3D &p_xform_B) {
170172
GodotShape3D *shape_A_ptr = p_A->get_shape(p_shape_A);
171173

modules/godot_physics_3d/godot_step_3d.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,14 @@ void GodotStep3D::step(GodotSpace3D *p_space, real_t p_delta) {
355355

356356
/* PRE-SOLVE CONSTRAINT ISLANDS */
357357

358-
// Warning: This doesn't run on threads, because it involves thread-unsafe processing.
358+
// WARNING: This doesn't run on threads, because it involves thread-unsafe processing.
359359
for (uint32_t island_index = 0; island_index < island_count; ++island_index) {
360360
_pre_solve_island(constraint_islands[island_index]);
361361
}
362362

363363
/* SOLVE CONSTRAINT ISLANDS */
364364

365-
// Warning: _solve_island modifies the constraint islands for optimization purpose,
365+
// WARNING: `_solve_island` modifies the constraint islands for optimization purpose,
366366
// their content is not reliable after these calls and shouldn't be used anymore.
367367
group_task = WorkerThreadPool::get_singleton()->add_template_group_task(this, &GodotStep3D::_solve_island, nullptr, island_count, -1, true, SNAME("Physics3DConstraintSolveIslands"));
368368
WorkerThreadPool::get_singleton()->wait_for_group_task_completion(group_task);

platform/windows/display_server_windows.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3962,9 +3962,9 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
39623962
}
39633963
}
39643964

3965-
// WARNING: we get called with events before the window is registered in our collection
3965+
// WARNING: We get called with events before the window is registered in our collection
39663966
// specifically, even the call to CreateWindowEx already calls here while still on the stack,
3967-
// so there is no way to store the window handle in our collection before we get here
3967+
// so there is no way to store the window handle in our collection before we get here.
39683968
if (!window_created) {
39693969
// don't let code below operate on incompletely initialized window objects or missing window_id
39703970
return _handle_early_window_message(hWnd, uMsg, wParam, lParam);

0 commit comments

Comments
 (0)