NAME
Report -- functions to create the turn report.
PURPOSE
A collection of functions to create the turn reports. There a many confusingly named functions, but the function that creates the actual turn report is report(). The turn report can be formatted in two different formats (1) plain galaxy (2) Galaxy Plus (The russian variation of galaxy) In addition to this there are functions to create the turn report for the GM and functions to create the highscore list. The turn report is a collection of tables plus an ASCII map of the galaxy. Each table has a heading. The tables consists of a number of rows. Each row consists of a number of fields. The formatting routines allow fields to be aligned across the rows. This is done by a two pass process. In the first pass, nothing is printed but the maximum width of the field in all rows is determined. In the second pass this information is used to properly print the field.
NAME
formatBuffer -- buffer to format lines.
SOURCE
char formatBuffer[FORMATBUFFERSIZE];
NAME
highScoreList -- create high score list
SYNOPSIS
void highScoreList(game *aGame)
FUNCTION
Creates a file with the high score list for the current turn. This file is later included into the turn report.
RESULT
High score list under the name notices/<game name>.score
BUGS
Should check for errors and write them to the log file.
NAME
mailGMReport -- mail the GM a status report.
SYNOPSIS
void mailGMReport(game *aGame, char *gameName)
FUNCTION
Email the GM a status report about a run of a turn.
SEE ALSO
CMD_run()
NOTES
Does log any errors. Does not return an error status.
NAME
createDummyGame -- create a dummy game.
SYNOPSIS
game *createDummyGame(void)
FUNCTION
Create a dummy game in case a real game could not be loaded. Then use it to read the .galaxyngrc file.
NAME
createGMReport -- create status report for GM
SYNOPSIS
void createGMReport(game *aGame, char *gameName, FILE *gmreport)
FUNCTION
Creates the status report for the GM. Currently consists of the log file and the high score list.
NAME
mailTurnReport -- create and mail a turn report
FUNCTION
Create and mail a turn report to a player.
0 -- all OK
>0 -- something went wrong
NAME
saveTurnReport --
FUNCTION
Create and save a turn report in report/<game name>/
NAME
createTurnReport -- create turn report.
FUNCTION
Creates the turn report, a concatenation of bulletins and the actual turn report.
NAME
appendToFile -- append contents of one file to another.
SYNOPSIS
void appendToFile(char *fileName, FILE *report)
FUNCTION
Append the content of another file to a file. If the file does not exist, just skip it.
NAME
score -- create high score list.
SYNOPSIS
void score(game *g1, game *g2, int html, FILE *dest)
FUNCTION
Compute the high score list based on the differences in the economic status of the nations between two turns.
INPUTS
g1 -- previous turn g2 -- this turn html -- do we want html output? dest -- file to write the results to
NAME
rateNations -- give nations a ranking number.
SYNOPSIS
void rateNations(player *playerList)
NOTES
If any nation manages to get more that 1E20 effective industry this function will fail.
NAME
report -- create a basic turn report.
SYNOPSIS
report(game *aGame, player *P, FILE *report)
FUNCTION
Extracts information from the game structure and formats it in human readable format. Two kind of reports are supported, plain galaxy and galaxy plus.
SOURCE
void
report(game *aGame, player *P, FILE * report)
{
struct fielddef fields;
pdebug(DFULL, "report\n");
fields.destination = report;
if (P->flags & F_GPLUS) {
fprintf(fields.destination,
" %s Report for Galaxy PLUS %c%s Turn %d\n",
P->name, toupper((aGame->name)[0]), aGame->name + 1,
aGame->turn);
fprintf(fields.destination,
" Galaxy PLUS version 1.0-NG-GPLUS-Emulator\n\n");
fprintf(fields.destination,
" Size: %.0f Planets: %d Players: %d\n\n",
2 * aGame->galaxysize, numberOfElements(aGame->planets),
numberOfElements(aGame->players));
}
else {
fprintf(fields.destination, "\t%s\n\n", vcid);
fprintf(fields.destination,
"\t\tGalaxy Game %c%s Turn %d Report for %s\n\n",
toupper((aGame->name)[0]), aGame->name + 1, aGame->turn,
P->name);
}
if (P->pswdstate eq 1) {
fprintf(fields.destination,
"\n\nPassword for player %s set to %s\n", P->name, P->pswd);
fprintf(fields.destination,
"First line of your orders should now be:\n");
fprintf(fields.destination, "#GALAXY %s %s %s\n", aGame->name, P->name,
P->pswd);
}
reportGlobalMessages(aGame->messages, &fields);
reportMessages(P, &fields);
reportGameOptions(aGame, &fields); /* CB-20010401 ; see galaxy.h */
reportOptions(aGame, P, &fields);
reportOrders(P, &fields);
reportMistakes(P, &fields);
nationStatus(aGame);
reportStatus(aGame->players, P, &fields);
reportYourShipTypes(P, &fields);
reportShipTypes(aGame, P, &fields);
reportBattles(aGame, P, &fields);
reportBombings(aGame, P, &fields);
reportMap(aGame, P, &fields);
reportIncoming(aGame, P, &fields);
reportYourPlanets(aGame->planets, P, &fields);
reportProdTable(aGame->planets, P, &fields);
reportRoutes(aGame->planets, P, &fields);
reportPlanetsSeen(aGame, P, &fields);
reportUnidentifiedPlanets(aGame->planets, P, &fields);
reportUninhabitedPlanets(aGame->planets, P, &fields);
reportYourGroups(aGame->planets, P, &fields);
if (P->flags & F_GPLUS) {
GreportFleets(aGame->planets, P, &fields);
}
else {
reportFleets(P, &fields);
}
reportGroupsSeen(aGame, P, &fields);
}
NAME
reportGlobalMessages --
NAME
reportMessages --
NAME
reportOrders --
NAME
reportMistakes --
NAME
reportStatus --
NAME
reportYourShipTypes --
NAME
reportShipTypes --
NAME
reportShipType --
NAME
GreportShipType --
NAME
reportBattles --
NAME
reportBombings --
NAME
reportIncoming --
NAME
reportYourPlanets --
NAME
reportProdTable --
NAME
GreportProduction --
NAME
reportProduction --
NAME
reportRoutes --
NAME
reportPlanetsSeen --
NAME
reportUnidentifiedPlanets --
NAME
reportUninhabitedPlanets --
NAME
reportYourGroups --
NAME
GreportFleets --
NAME
reportFleets --
NAME
reportGroupsSeen --
NAME
reportGroup --
NAME
GreportGroup --
NAME
reportPlanet --
NAME
GreportPlanet --
NAME
canseeBombing --
NAME
visibleShipTypes --
NAME
formatLabels --
NAME
formatPrint --
NAME
formatReset --
NAME
storeLength --
NAME
formatChar --
NAME
formatStringMode --
NAME
formatString
NAME
formatStringCenter --
NAME
formatFloat --
NAME
formatInteger --
NAME
GformatInteger --
NAME
BformatInteger --
NAME
formatReturn --
NAME
dumpItem --
NAME
reportGameOptions --
NAME
reportOptions --
NAME
reportMap_gnuplot -- AUTHOR: Steven Webb (steve@badcheese.com)
NAME
reportMap --
NAME
tagVisiblePlanets
NAME
yourStatusForecast
NAME
yourPlanetsForecast -- planet forecast for next turn.
FUNCTION
This is used by the forecaster (orders checker) to predict the situation of the planets the next turn.
NAME
reportHall -- report hall of fame information.
NAME
reportTeam -- report statistics about team players to team leader
NAME
reportGMBombings --
SYNOPSIS
void reportGMBombings(game *aGame, fielddef *fields)
FUNCTION
Report all bombings that took place during the turn.