forked from mirror/OpenTTD
Add: documention to large functions that have too little documentation according to CodeQL
This commit is contained in:
@@ -212,11 +212,13 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
||||
switch (lc->ct) {
|
||||
default: NOT_REACHED();
|
||||
case GLCT_MODE:
|
||||
/* Changing landscape, or going from scenario editor to game or back. */
|
||||
buf += seprintf(buf, lastof(buffer), "New game mode: %u landscape: %u",
|
||||
(uint)lc->mode.mode, (uint)lc->mode.landscape);
|
||||
break;
|
||||
|
||||
case GLCT_REVISION:
|
||||
/* The game was loaded in a diffferent version than before. */
|
||||
buf += seprintf(buf, lastof(buffer), "Revision text changed to %s, savegame version %u, ",
|
||||
lc->revision.text, lc->revision.slver);
|
||||
|
||||
@@ -230,6 +232,7 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
||||
break;
|
||||
|
||||
case GLCT_OLDVER:
|
||||
/* The game was loaded from before 0.7.0-beta1. */
|
||||
buf += seprintf(buf, lastof(buffer), "Conversion from ");
|
||||
switch (lc->oldver.type) {
|
||||
default: NOT_REACHED();
|
||||
@@ -260,10 +263,12 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
||||
break;
|
||||
|
||||
case GLCT_SETTING:
|
||||
/* A setting with the SF_NO_NETWORK flag got changed; these settings usually affect NewGRFs, such as road side or wagon speed limits. */
|
||||
buf += seprintf(buf, lastof(buffer), "Setting changed: %s : %d -> %d", lc->setting.name, lc->setting.oldval, lc->setting.newval);
|
||||
break;
|
||||
|
||||
case GLCT_GRFADD: {
|
||||
/* A NewGRF got added to the game, either at the start of the game (never an issue), or later on when it could be an issue. */
|
||||
const GRFConfig *gc = FindGRFConfig(lc->grfadd.grfid, FGCM_EXACT, lc->grfadd.md5sum);
|
||||
buf += seprintf(buf, lastof(buffer), "Added NewGRF: ");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfadd.grfid, lc->grfadd.md5sum, gc);
|
||||
@@ -274,6 +279,7 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
||||
}
|
||||
|
||||
case GLCT_GRFREM: {
|
||||
/* A NewGRF got removed from the game, either manually or by it missing when loading the game. */
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
buf += seprintf(buf, lastof(buffer), la->at == GLAT_LOAD ? "Missing NewGRF: " : "Removed NewGRF: ");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfrem.grfid, nullptr, gm != grf_names.End() ? gm->second.gc : nullptr);
|
||||
@@ -291,6 +297,7 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
||||
}
|
||||
|
||||
case GLCT_GRFCOMPAT: {
|
||||
/* Another version of the same NewGRF got loaded. */
|
||||
const GRFConfig *gc = FindGRFConfig(lc->grfadd.grfid, FGCM_EXACT, lc->grfadd.md5sum);
|
||||
buf += seprintf(buf, lastof(buffer), "Compatible NewGRF loaded: ");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfcompat.grfid, lc->grfcompat.md5sum, gc);
|
||||
@@ -300,6 +307,7 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
||||
}
|
||||
|
||||
case GLCT_GRFPARAM: {
|
||||
/* A parameter of a NewGRF got changed after the game was started. */
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
buf += seprintf(buf, lastof(buffer), "GRF parameter changed: ");
|
||||
buf = PrintGrfInfo(buf, lastof(buffer), lc->grfparam.grfid, nullptr, gm != grf_names.End() ? gm->second.gc : nullptr);
|
||||
@@ -308,6 +316,7 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
||||
}
|
||||
|
||||
case GLCT_GRFMOVE: {
|
||||
/* The order of NewGRFs got changed, which might cause some other NewGRFs to behave differently. */
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
buf += seprintf(buf, lastof(buffer), "GRF order changed: %08X moved %d places %s",
|
||||
BSWAP32(lc->grfmove.grfid), abs(lc->grfmove.offset), lc->grfmove.offset >= 0 ? "down" : "up" );
|
||||
@@ -317,6 +326,7 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
||||
}
|
||||
|
||||
case GLCT_GRFBUG: {
|
||||
/* A specific bug in a NewGRF, that could cause wide spread problems, has been noted during the execution of the game. */
|
||||
GrfIDMapping::Pair *gm = grf_names.Find(lc->grfrem.grfid);
|
||||
switch (lc->grfbug.bug) {
|
||||
default: NOT_REACHED();
|
||||
@@ -330,6 +340,8 @@ void GamelogPrint(std::function<void(const char*)> proc)
|
||||
}
|
||||
|
||||
case GLCT_EMERGENCY:
|
||||
/* At one point the savegame was made during the handling of a game crash.
|
||||
* The generic code already mentioned the emergency savegame, and there is no extra information to log. */
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user