Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

`MAX_` definitions (or lack thereof) break progressive initializer for arrays

Đang mở
#47 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
38/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Lĩnh vực
tooling

Hướng nghiên cứu

Locate the include definitions for MAX_WEAPONS and the related WEAPON_ constants, then reproduce the progressive initializer example from the issue. Check whether other tagged MAX_ definitions have the same shape and compare array sizing with the tag values. Done means the relevant MAX_ definitions consistently support initialization of every expected slot without breaking indexed access.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Consider following snippet:

static bool:gIsWeaponAllowed[MAX_WEAPONS] = {true, ...};

public OnGameModeInit()
{
    for (new i = 0; i < sizeof gIsWeaponAllowed; i++)
    {
        printf("%d: %d", i, gIsWeaponAllowed[WEAPON:i]);
    }
    return 1;
}

One would expect that all slots would be initialized to true, but only the first slot gets set.

[2024-07-27T18:24:52Z] [Info] 0: 1
[2024-07-27T18:24:52Z] [Info] 1: 0
[2024-07-27T18:24:52Z] [Info] 2: 0
...
[2024-07-27T18:24:52Z] [Info] 45: 0
[2024-07-27T18:24:52Z] [Info] 46: 0

Adding an additional

#define MAX_WEAPONS (WEAPON:47)

seems to remedy this problem and still allows the array to be indexed properly with the WEAPON_ definitions. This will probably need to be added for all tagged MAX_ definitions.

Ngôn ngữ chính
Pawn
Star
54
Fork
20
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của openmultiplayer/omp-stdlib

Tất cả issue của openmultiplayer/omp-stdlib

Issue tương tự

Thêm issue về DevTools

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.