Generated from /home/galaxyng/NG/Source/report.c with ROBODoc v4.0.18 on Mon Jan 05 22:26:08 2004

TABLE OF CONTENTS


GalaxyNG/Report

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.    

Report/formatBuffer

NAME

   formatBuffer -- buffer to format lines.

SOURCE

    char            formatBuffer[FORMATBUFFERSIZE];
    

Report/highScoreList

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.

Report/mailGMReport

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.

Report/createDummyGame

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.

Report/createGMReport

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.

Report/mailTurnReport

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

Report/saveTurnReport

NAME

   saveTurnReport --

FUNCTION

   Create and save a turn report in report/<game name>/

Report/createTurnReport

NAME

   createTurnReport -- create turn report.

FUNCTION

   Creates the turn report, a concatenation of 
   bulletins and the actual turn report.

Report/appendToFile

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.

Report/score

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

Report/rateNations

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.

Report/report

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);
    }
    

Report/reportGlobalMessages

NAME

   reportGlobalMessages --

Report/reportMessages

NAME

   reportMessages --

Report/reportOrders

NAME

   reportOrders --

Report/reportMistakes

NAME

   reportMistakes --

Report/reportStatus

NAME

   reportStatus --

Report/reportYourShipTypes

NAME

   reportYourShipTypes --

Report/reportShipTypes

NAME

   reportShipTypes --

Report/reportShipType

NAME

   reportShipType --

Report/GreportShipType

NAME

   GreportShipType --

Report/reportBattles

NAME

   reportBattles --

Report/reportBombings

NAME

   reportBombings --

Report/reportIncoming

NAME

   reportIncoming --

Report/reportYourPlanets

NAME

   reportYourPlanets --

Report/reportProdTable

NAME

   reportProdTable --

Report/GreportProduction

NAME

   GreportProduction --

Report/reportProduction

NAME

   reportProduction --

Report/reportRoutes

NAME

   reportRoutes --

Report/reportPlanetsSeen

NAME

   reportPlanetsSeen --

Report/reportUnidentifiedPlanets

NAME

   reportUnidentifiedPlanets --

Report/reportUninhabitedPlanets

NAME

   reportUninhabitedPlanets --

Report/reportYourGroups

NAME

   reportYourGroups --

Report/GreportFleets

NAME

   GreportFleets --

Report/reportFleets

NAME

   reportFleets --

Report/reportGroupsSeen

NAME

   reportGroupsSeen --

Report/reportGroup

NAME

   reportGroup --

Report/GreportGroup

NAME

   GreportGroup --

Report/reportPlanet

NAME

   reportPlanet --

Report/GreportPlanet

NAME

   GreportPlanet --

Report/canseeBombing

NAME

   canseeBombing --

Report/visibleShipTypes

NAME

   visibleShipTypes --

Report/formatLabels

NAME

   formatLabels --

Report/formatPrint

NAME

   formatPrint --

Report/formatReset

NAME

   formatReset --

Report/storeLength

NAME

   storeLength --

Report/formatChar

NAME

   formatChar --

Report/formatStringMode

NAME

   formatStringMode --

Report/formatString

NAME

   formatString

Report/formatStringCenter

NAME

   formatStringCenter --

Report/formatFloat

NAME

   formatFloat --

Report/formatInteger

NAME

   formatInteger --

Report/GformatInteger

NAME

   GformatInteger --

Report/BformatInteger

NAME

   BformatInteger --

Report/formatReturn

NAME

   formatReturn --

Report/dumpItem

NAME

   dumpItem --

Report/reportGameOptions

NAME

   reportGameOptions --

Report/reportOptions

NAME

   reportOptions --

Report/reportMap_gnuplot

NAME

   reportMap_gnuplot --
 AUTHOR: Steven Webb (steve@badcheese.com)

Report/reportMap

NAME

   reportMap --

Report/tagVisiblePlanets

NAME

   tagVisiblePlanets

Report/yourStatusForecast

NAME

   yourStatusForecast

GalaxyNG/yourPlanetsForecast

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.

GalaxyNG/reportHall

NAME

   reportHall -- report hall of fame information.

GalaxyNG/reportTeam

NAME

   reportTeam -- report statistics about team players to team leader

GalaxyNG/reportGMBombings

NAME

   reportGMBombings --

SYNOPSIS

   void reportGMBombings(game *aGame, fielddef *fields)

FUNCTION

   Report all bombings that took place during the turn.