Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#47 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
38/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Ambito
tooling

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Pawn
Stelle
54
Fork
20
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openmultiplayer/omp-stdlib

Tutte le issue di openmultiplayer/omp-stdlib

Issue simili

Altre issue su DevTools

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.