4-gewinnt  1.0.0
Klassiker "4-gewinnt" als Konsolenanwendung
 Alle Datenstrukturen Dateien Funktionen Variablen Makrodefinitionen Seiten
rules.c-Dateireferenz
Dieser Graph zeigt, welche Datei direkt oder indirekt diese Datei enthält:

gehe zum Quellcode dieser Datei

Funktionen

void addFrame (char *word)
 
void showRules ()
 

Dokumentation der Funktionen

void addFrame ( char *  word)

This method adds a frame around the passed String is never used in current version of game

Definiert in Zeile 6 der Datei rules.c.

Benutzt flushBuffer() und output().

6  {
7  //25Chars+1line break per line
8  //3lines needed 3*26+1(null byte)=
9  char* framePart = calloc(79,sizeof(char));
10  if(framePart==NULL){
11 
12  framePart="________________________\n";
13  framePart=strcat("|",word);
14  //framePart=strcat(framePart);
15 
16 
17  framePart[51]='|';
18  framePart[52]='\n';
19  framePart[53]='\0';
20  //framePart+53="________________________\n\0";
21 
22  }else{
23  //malloc failed-->fallback approach just output the supplied String without any formating
24  output("%s",word);
25  }
26 
27  //clean up
28  flushBuffer();
29  free(framePart);
30 }
void flushBuffer()
Definition: system.c:188
int output(const char *input,...)
Definition: system.c:144

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

void showRules ( )

Method to show the rules.User can leave this screen by pressing any key

Definiert in Zeile 35 der Datei rules.c.

Benutzt flushBuffer(), output(), setLineAlign() und startBuffer().

Wird benutzt von mainMenuReactToEnter().

35  {
36  startBuffer(70);
37  setLineAlign(0);
38  output("[ RULES ]\n\n");
39  setLineAlign(-1);
40  output("This a implementation of the famous two player game \"Connect Four\".\nSo you'll need a friend to play this game :) To win you simply have to\nconnect four of your chips in a row. This row can be horizontal,\nvertical or diagonal,it doesn't matter as long as there are no \"enemy\"\nchips between your chips.\nThe game will automatically end if one you won and take you to the\n\"Hall of Shame\"\n\n");
41  setLineAlign(0);
42  output("[ Press any key to return to main menu ]\n");
43  flushBuffer();
44  getch();
45 }
void setLineAlign(int align)
Definition: system.c:344
void flushBuffer()
Definition: system.c:188
void startBuffer(int maxTextLength)
Definition: system.c:319
int output(const char *input,...)
Definition: system.c:144

Hier ist ein Graph, der zeigt, was diese Funktion aufruft:

Hier ist ein Graph der zeigt, wo diese Funktion aufgerufen wird: