From f63a0c9b908e8bfb4bd7422f668c7dc1c4b7060a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Thu, 14 Sep 2017 02:32:36 +0200 Subject: [PATCH] Version 17.0.3 --- css/swad17.0.css | 8 +++- swad_action.c | 3 ++ swad_action.h | 91 +++++++++++++++++------------------ swad_changelog.h | 6 ++- swad_game.c | 120 +++++++++++++++++++++++++++++++++-------------- swad_game.h | 1 + 6 files changed, 146 insertions(+), 83 deletions(-) diff --git a/css/swad17.0.css b/css/swad17.0.css index 725840dd7..885e6dd68 100644 --- a/css/swad17.0.css +++ b/css/swad17.0.css @@ -2389,6 +2389,7 @@ a:hover img.CENTRE_PHOTO_SHOW .GAM_PLAY_CONTAINER { box-sizing:border-box; + display:table; margin:5%; } .GAM_PLAY_NUM_QST @@ -2401,17 +2402,20 @@ a:hover img.CENTRE_PHOTO_SHOW font-size:48pt; font-weight:bold; } -.GAM_PLAY_QST_STEM +.GAM_PLAY_QST_CONTAINER { width:85%; float:left; /* position:relative; */ - padding-bottom:24pt; + } +.GAM_PLAY_QST + { color:#404040; font-size:24pt; } .GAM_PLAY_CONTINUE_CONTAINER { + clear:all; text-align:center; } .GAM_PLAY_CONTINUE_CONTAINER a diff --git a/swad_action.c b/swad_action.c index e6b148392..31a75e52e 100644 --- a/swad_action.c +++ b/swad_action.c @@ -494,6 +494,7 @@ Assessment: NEW. ActPlyGam Start playing a game NEW. ActPlyGam1stQst Show first question when playing a game NEW. ActPlyGamNxtQst Show next question when playing a game + NEW. ActPlyGamAns Show answers of current question when playing a game NEW. ActAnsGam Answer a game NEW. ActFrmNewGam Form to create a new game NEW. ActEdiOneGam Edit one game @@ -1959,6 +1960,7 @@ struct Act_Actions Act_Actions[Act_NUM_ACTIONS] = /* ActPlyGam */{1670,-1,TabUnk,ActSeeAllGam ,0x3F8,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_PlayGame ,NULL}, /* ActPlyGam1stQst */{1671,-1,TabUnk,ActSeeAllGam ,0x3F8,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_NEW_TAB,NULL ,Gam_PlayGameNextQuestion ,NULL}, /* ActPlyGamNxtQst */{1672,-1,TabUnk,ActSeeAllGam ,0x3F8,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_PlayGameNextQuestion ,NULL}, + /* ActPlyGamAns */{1673,-1,TabUnk,ActSeeAllGam ,0x3F8,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_2ND_TAB,NULL ,Gam_PlayGameShowAnswers ,NULL}, /* ActAnsGam */{1651,-1,TabUnk,ActSeeAllGam ,0x3F8,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_ReceiveGameAnswers ,NULL}, /* ActFrmNewGam */{1652,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL}, /* ActEdiOneGam */{1653,-1,TabUnk,ActSeeAllGam ,0x3E0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,0x3C0,Act_CONT_NORM,Act_BRW_1ST_TAB,NULL ,Gam_RequestCreatOrEditGame ,NULL}, @@ -4726,6 +4728,7 @@ Act_Action_t Act_FromActCodToAction[1 + Act_MAX_ACTION_COD] = // Do not reuse un ActPlyGam, // #1670 ActPlyGam1stQst, // #1671 ActPlyGamNxtQst, // #1672 + ActPlyGamAns, // #1673 }; /*****************************************************************************/ diff --git a/swad_action.h b/swad_action.h index 2ad10b2e3..9be5ac71e 100644 --- a/swad_action.h +++ b/swad_action.h @@ -58,9 +58,9 @@ typedef enum typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to indicate obsolete action -#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 33 + 24 + 115 + 95 + 416 + 165 + 172 + 42 + 14 + 97) +#define Act_NUM_ACTIONS (1 + 9 + 43 + 17 + 47 + 33 + 24 + 115 + 96 + 416 + 165 + 172 + 42 + 14 + 97) -#define Act_MAX_ACTION_COD 1672 +#define Act_MAX_ACTION_COD 1673 #define Act_MAX_OPTIONS_IN_MENU_PER_TAB 12 @@ -490,51 +490,52 @@ typedef signed int Act_Action_t; // Must be a signed type, because -1 is used to #define ActPlyGam (ActChgCalCrs1stDay + 50) #define ActPlyGam1stQst (ActChgCalCrs1stDay + 51) #define ActPlyGamNxtQst (ActChgCalCrs1stDay + 52) -#define ActAnsGam (ActChgCalCrs1stDay + 53) -#define ActFrmNewGam (ActChgCalCrs1stDay + 54) -#define ActEdiOneGam (ActChgCalCrs1stDay + 55) -#define ActNewGam (ActChgCalCrs1stDay + 56) -#define ActChgGam (ActChgCalCrs1stDay + 57) -#define ActReqRemGam (ActChgCalCrs1stDay + 58) -#define ActRemGam (ActChgCalCrs1stDay + 59) -#define ActReqRstGam (ActChgCalCrs1stDay + 60) -#define ActRstGam (ActChgCalCrs1stDay + 61) -#define ActHidGam (ActChgCalCrs1stDay + 62) -#define ActShoGam (ActChgCalCrs1stDay + 63) -#define ActAddOneGamQst (ActChgCalCrs1stDay + 64) -#define ActGamLstTstQst (ActChgCalCrs1stDay + 65) -#define ActAddTstQstToGam (ActChgCalCrs1stDay + 66) -#define ActReqRemGamQst (ActChgCalCrs1stDay + 67) -#define ActRemGamQst (ActChgCalCrs1stDay + 68) -#define ActUp_GamQst (ActChgCalCrs1stDay + 69) -#define ActDwnGamQst (ActChgCalCrs1stDay + 70) +#define ActPlyGamAns (ActChgCalCrs1stDay + 53) +#define ActAnsGam (ActChgCalCrs1stDay + 54) +#define ActFrmNewGam (ActChgCalCrs1stDay + 55) +#define ActEdiOneGam (ActChgCalCrs1stDay + 56) +#define ActNewGam (ActChgCalCrs1stDay + 57) +#define ActChgGam (ActChgCalCrs1stDay + 58) +#define ActReqRemGam (ActChgCalCrs1stDay + 59) +#define ActRemGam (ActChgCalCrs1stDay + 60) +#define ActReqRstGam (ActChgCalCrs1stDay + 61) +#define ActRstGam (ActChgCalCrs1stDay + 62) +#define ActHidGam (ActChgCalCrs1stDay + 63) +#define ActShoGam (ActChgCalCrs1stDay + 64) +#define ActAddOneGamQst (ActChgCalCrs1stDay + 65) +#define ActGamLstTstQst (ActChgCalCrs1stDay + 66) +#define ActAddTstQstToGam (ActChgCalCrs1stDay + 67) +#define ActReqRemGamQst (ActChgCalCrs1stDay + 68) +#define ActRemGamQst (ActChgCalCrs1stDay + 69) +#define ActUp_GamQst (ActChgCalCrs1stDay + 70) +#define ActDwnGamQst (ActChgCalCrs1stDay + 71) -#define ActSeeOneSvy (ActChgCalCrs1stDay + 71) -#define ActAnsSvy (ActChgCalCrs1stDay + 72) -#define ActFrmNewSvy (ActChgCalCrs1stDay + 73) -#define ActEdiOneSvy (ActChgCalCrs1stDay + 74) -#define ActNewSvy (ActChgCalCrs1stDay + 75) -#define ActChgSvy (ActChgCalCrs1stDay + 76) -#define ActReqRemSvy (ActChgCalCrs1stDay + 77) -#define ActRemSvy (ActChgCalCrs1stDay + 78) -#define ActReqRstSvy (ActChgCalCrs1stDay + 79) -#define ActRstSvy (ActChgCalCrs1stDay + 80) -#define ActHidSvy (ActChgCalCrs1stDay + 81) -#define ActShoSvy (ActChgCalCrs1stDay + 82) -#define ActEdiOneSvyQst (ActChgCalCrs1stDay + 83) -#define ActRcvSvyQst (ActChgCalCrs1stDay + 84) -#define ActReqRemSvyQst (ActChgCalCrs1stDay + 85) -#define ActRemSvyQst (ActChgCalCrs1stDay + 86) +#define ActSeeOneSvy (ActChgCalCrs1stDay + 72) +#define ActAnsSvy (ActChgCalCrs1stDay + 73) +#define ActFrmNewSvy (ActChgCalCrs1stDay + 74) +#define ActEdiOneSvy (ActChgCalCrs1stDay + 75) +#define ActNewSvy (ActChgCalCrs1stDay + 76) +#define ActChgSvy (ActChgCalCrs1stDay + 77) +#define ActReqRemSvy (ActChgCalCrs1stDay + 78) +#define ActRemSvy (ActChgCalCrs1stDay + 79) +#define ActReqRstSvy (ActChgCalCrs1stDay + 80) +#define ActRstSvy (ActChgCalCrs1stDay + 81) +#define ActHidSvy (ActChgCalCrs1stDay + 82) +#define ActShoSvy (ActChgCalCrs1stDay + 83) +#define ActEdiOneSvyQst (ActChgCalCrs1stDay + 84) +#define ActRcvSvyQst (ActChgCalCrs1stDay + 85) +#define ActReqRemSvyQst (ActChgCalCrs1stDay + 86) +#define ActRemSvyQst (ActChgCalCrs1stDay + 87) -#define ActSeeOneExaAnn (ActChgCalCrs1stDay + 87) -#define ActSeeDatExaAnn (ActChgCalCrs1stDay + 88) -#define ActEdiExaAnn (ActChgCalCrs1stDay + 89) -#define ActRcvExaAnn (ActChgCalCrs1stDay + 90) -#define ActPrnExaAnn (ActChgCalCrs1stDay + 91) -#define ActReqRemExaAnn (ActChgCalCrs1stDay + 92) -#define ActRemExaAnn (ActChgCalCrs1stDay + 93) -#define ActHidExaAnn (ActChgCalCrs1stDay + 94) -#define ActShoExaAnn (ActChgCalCrs1stDay + 95) +#define ActSeeOneExaAnn (ActChgCalCrs1stDay + 88) +#define ActSeeDatExaAnn (ActChgCalCrs1stDay + 89) +#define ActEdiExaAnn (ActChgCalCrs1stDay + 90) +#define ActRcvExaAnn (ActChgCalCrs1stDay + 91) +#define ActPrnExaAnn (ActChgCalCrs1stDay + 92) +#define ActReqRemExaAnn (ActChgCalCrs1stDay + 93) +#define ActRemExaAnn (ActChgCalCrs1stDay + 94) +#define ActHidExaAnn (ActChgCalCrs1stDay + 95) +#define ActShoExaAnn (ActChgCalCrs1stDay + 96) /*****************************************************************************/ /******************************** Files tab **********************************/ diff --git a/swad_changelog.h b/swad_changelog.h index c13ef83c6..1f12629b9 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -250,13 +250,17 @@ /****************************** Public constants *****************************/ /*****************************************************************************/ -#define Log_PLATFORM_VERSION "SWAD 17.0.2 (2017-09-14)" +#define Log_PLATFORM_VERSION "SWAD 17.0.3 (2017-09-14)" #define CSS_FILE "swad17.0.css" #define JS_FILE "swad16.206.3.js" // Number of lines (includes comments but not blank lines) has been got with the following command: // nl swad*.c swad*.h css/swad*.css py/swad*.py js/swad*.js soap/swad*?.h sql/swad*.sql | tail -1 /* + Version 17.0.3: Sep 14, 2017 Action to show current question with answers when playing a game. (227350 lines) + 1 change necessary in database: +INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1673','es','N','Mostrar respuestas de pregunta juego'); + Version 17.0.2: Sep 14, 2017 Action to show next question when playing a game. (227293 lines) 2 changes necessary in database: INSERT INTO actions (ActCod,Language,Obsolete,Txt) VALUES ('1671','es','N','Mostrar primera pregunta juego'); diff --git a/swad_game.c b/swad_game.c index e7b96d2a1..856a1d377 100644 --- a/swad_game.c +++ b/swad_game.c @@ -125,11 +125,11 @@ static void Gam_PutParamQstInd (unsigned QstInd); static unsigned Gam_GetParamQstInd (void); static void Gam_RemAnswersOfAQuestion (long QstCod); -static unsigned Gam_GetQstIndFromQstCod (long GamCod,long QstCod); +static int Gam_GetQstIndFromQstCod (long GamCod,long QstCod); // TODO: Remove this function because a question code can be repeated static long Gam_GetQstCodFromQstInd (long GamCod,unsigned QstInd); static int Gam_GetMaxQuestionIndexInGame (long GamCod); -static unsigned Gam_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd); -static unsigned Gam_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd); +static int Gam_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd); +static int Gam_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd); static void Gam_ListGameQuestions (struct Game *Game); static void Gam_ListOneOrMoreQuestionsForEdition (struct Game *Game, unsigned NumQsts, @@ -151,6 +151,8 @@ static void Gam_ExchangeQuestions (long GamCod, unsigned QstIndTop,unsigned QstIndBottom); static void Gam_PutBigButtonToStartGame (long GamCod); + +static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers); static void Gam_PutBigButtonToContinue (Act_Action_t NextAction, long GamCod,unsigned QstInd); @@ -2565,28 +2567,30 @@ static void Gam_RemAnswersOfAQuestion (long QstCod) /*****************************************************************************/ /******************** Get next question index in a game **********************/ /*****************************************************************************/ +// TODO: Remove this function because a question code can be repeated -static unsigned Gam_GetQstIndFromQstCod (long GamCod,long QstCod) +static int Gam_GetQstIndFromQstCod (long GamCod,long QstCod) { char Query[256]; MYSQL_RES *mysql_res; MYSQL_ROW row; - unsigned QstInd = 0; + int QstInd = -1; /***** Get number of games with a field value from database *****/ sprintf (Query,"SELECT QstInd FROM gam_questions" " WHERE GamCod=%ld AND QstCod=%ld", GamCod,QstCod); if (!DB_QuerySELECT (Query,&mysql_res,"can not get question index")) - { + { Ale_ShowAlert (Ale_INFO,Query); Lay_ShowErrorAndExit ("Error when getting question index."); - } + } /***** Get question index (row[0]) *****/ row = mysql_fetch_row (mysql_res); - if (sscanf (row[0],"%u",&QstInd) != 1) - Lay_ShowErrorAndExit ("Error when getting question index."); + if (row[0]) + if (sscanf (row[0],"%d",&QstInd) != 1) + Lay_ShowErrorAndExit ("Error when getting question index."); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -2654,13 +2658,15 @@ static int Gam_GetMaxQuestionIndexInGame (long GamCod) /*****************************************************************************/ /*********** Get previous question index to a given index in a game **********/ /*****************************************************************************/ +// Question index can be 0, 1, 2,... +// Return -1 if no previous question -static unsigned Gam_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd) +static int Gam_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd) { char Query[256]; MYSQL_RES *mysql_res; MYSQL_ROW row; - unsigned PrevQstInd; + int PrevQstInd = -1; /***** Get previous question index in a game from database *****/ // Although indexes are always continuous... @@ -2673,8 +2679,9 @@ static unsigned Gam_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd) /***** Get previous question index (row[0]) *****/ row = mysql_fetch_row (mysql_res); - if (sscanf (row[0],"%u",&PrevQstInd) != 1) - Lay_ShowErrorAndExit ("Error when getting previous question index."); + if (row[0]) + if (sscanf (row[0],"%d",&PrevQstInd) != 1) + Lay_ShowErrorAndExit ("Error when getting previous question index."); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -2685,13 +2692,15 @@ static unsigned Gam_GetPrevQuestionIndexInGame (long GamCod,unsigned QstInd) /*****************************************************************************/ /************* Get next question index to a given index in a game ************/ /*****************************************************************************/ +// Question index can be 0, 1, 2,... +// Return -1 if no next question -static unsigned Gam_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd) +static int Gam_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd) { char Query[256]; MYSQL_RES *mysql_res; MYSQL_ROW row; - unsigned NextQstInd; + int NextQstInd = -1; /***** Get next question index in a game from database *****/ // Although indexes are always continuous... @@ -2704,8 +2713,9 @@ static unsigned Gam_GetNextQuestionIndexInGame (long GamCod,unsigned QstInd) /***** Get next question index (row[0]) *****/ row = mysql_fetch_row (mysql_res); - if (sscanf (row[0],"%u",&NextQstInd) != 1) - Lay_ShowErrorAndExit ("Error when getting next question index."); + if (row[0]) + if (sscanf (row[0],"%d",&NextQstInd) != 1) + Lay_ShowErrorAndExit ("Error when getting next question index."); /***** Free structure that stores the query result *****/ DB_FreeMySQLResult (&mysql_res); @@ -3233,7 +3243,7 @@ void Gam_RequestRemoveQst (void) Lay_ShowErrorAndExit ("Wrong code of question."); /* Get question index */ - QstInd = Gam_GetQstIndFromQstCod (Game.GamCod,QstCod); + QstInd = (unsigned) Gam_GetQstIndFromQstCod (Game.GamCod,QstCod); // TODO: Remove this function because a question code can be repeated /***** Show question and button to remove question *****/ Gbl.Games.CurrentGamCod = Game.GamCod; @@ -3273,7 +3283,7 @@ void Gam_RemoveQst (void) Lay_ShowErrorAndExit ("Wrong code of question."); /* Get question index */ - QstInd = Gam_GetQstIndFromQstCod (Game.GamCod,QstCod); + QstInd = (unsigned) Gam_GetQstIndFromQstCod (Game.GamCod,QstCod); // TODO: Remove this function because a question code can be repeated /***** Remove the question from all the tables *****/ /* Remove answers from this test question */ @@ -3312,8 +3322,8 @@ void Gam_MoveUpQst (void) extern const char *Txt_The_question_has_been_moved_up; struct Game Game; long QstCod; - unsigned QstIndTop; - unsigned QstIndBottom; + int QstIndTop; + int QstIndBottom; /***** Get parameters from form *****/ /* Get game code */ @@ -3325,17 +3335,19 @@ void Gam_MoveUpQst (void) Lay_ShowErrorAndExit ("Wrong code of question."); /* Get question index */ - QstIndBottom = Gam_GetQstIndFromQstCod (Game.GamCod,QstCod); + QstIndBottom = Gam_GetQstIndFromQstCod (Game.GamCod,QstCod); // TODO: Remove this function because a question code can be repeated /***** Move up question *****/ if (QstIndBottom > 0) { /* Indexes of questions to be exchanged */ QstIndTop = Gam_GetPrevQuestionIndexInGame (Game.GamCod,QstIndBottom); + if (QstIndTop < 0) + Lay_ShowErrorAndExit ("Wrong index of question."); /* Exchange questions */ Gam_ExchangeQuestions (Game.GamCod, - QstIndTop,QstIndBottom); + (unsigned) QstIndTop,(unsigned) QstIndBottom); /* Success alert */ Ale_ShowAlert (Ale_SUCCESS,Txt_The_question_has_been_moved_up); @@ -3357,8 +3369,8 @@ void Gam_MoveDownQst (void) extern const char *Txt_The_question_has_been_moved_down; struct Game Game; long QstCod; - unsigned QstIndTop; - unsigned QstIndBottom; + int QstIndTop; + int QstIndBottom; int MaxQstInd; // -1 if no questions /***** Get parameters from form *****/ @@ -3371,20 +3383,23 @@ void Gam_MoveDownQst (void) Lay_ShowErrorAndExit ("Wrong code of question."); /* Get question index */ - QstIndTop = Gam_GetQstIndFromQstCod (Game.GamCod,QstCod); + QstIndTop = Gam_GetQstIndFromQstCod (Game.GamCod,QstCod); // TODO: Remove this function because a question code can be repeated /* Get maximum question index */ MaxQstInd = Gam_GetMaxQuestionIndexInGame (Game.GamCod); /***** Move down question *****/ if (MaxQstInd > 0) - if (QstIndTop < (unsigned) MaxQstInd) + if (QstIndTop < MaxQstInd) { /* Indexes of questions to be exchanged */ QstIndBottom = Gam_GetNextQuestionIndexInGame (Game.GamCod,QstIndTop); + if (QstIndBottom < 0) + Lay_ShowErrorAndExit ("Wrong index of question."); /* Exchange questions */ - Gam_ExchangeQuestions (Game.GamCod,QstIndTop,QstIndBottom); + Gam_ExchangeQuestions (Game.GamCod, + (unsigned) QstIndTop,(unsigned) QstIndBottom); /* Success alert */ Ale_ShowAlert (Ale_SUCCESS,Txt_The_question_has_been_moved_down); @@ -3501,12 +3516,31 @@ static void Gam_PutBigButtonToStartGame (long GamCod) /*****************************************************************************/ void Gam_PlayGameNextQuestion (void) + { + Gam_PlayGameShowQuestionAndAnswers (false); // Don't show answers + } + +/*****************************************************************************/ +/************ Show question and its answers when playing a game **************/ +/*****************************************************************************/ + +void Gam_PlayGameShowAnswers (void) + { + Gam_PlayGameShowQuestionAndAnswers (true); // Show answers + } + +/*****************************************************************************/ +/************ Show question and its answers when playing a game **************/ +/*****************************************************************************/ + +static void Gam_PlayGameShowQuestionAndAnswers (bool ShowAnswers) { char Query[256]; MYSQL_RES *mysql_res; MYSQL_ROW row; struct Game Game; unsigned QstInd; + int NxtQstInd; /***** Get parameters *****/ /* Get game code */ @@ -3539,6 +3573,7 @@ void Gam_PlayGameNextQuestion (void) row = mysql_fetch_row (mysql_res); /***** Show question *****/ + /* Start container for number and question */ fprintf (Gbl.F.Out,"
"); /* Write number of question */ @@ -3546,16 +3581,31 @@ void Gam_PlayGameNextQuestion (void) QstInd + 1); /* Write the stem (row[1]) and the image (row[2], row[3], row[4]) */ - Tst_WriteQstStem (row[1],"GAM_PLAY_QST_STEM"); + fprintf (Gbl.F.Out,"
"); + Tst_WriteQstStem (row[1],"GAM_PLAY_QST"); Img_GetImageNameTitleAndURLFromRow (row[2],row[3],row[4],&Gbl.Test.Image); Img_ShowImage (&Gbl.Test.Image, "TEST_IMG_EDIT_LIST_STEM_CONTAINER", "TEST_IMG_EDIT_LIST_STEM"); - - /***** Put button to show answers *****/ - Gam_PutBigButtonToContinue (ActPlyGamNxtQst,Game.GamCod,QstInd); - + if (ShowAnswers) + fprintf (Gbl.F.Out,"answers"); fprintf (Gbl.F.Out,"
"); + + /* End container for number and question */ + fprintf (Gbl.F.Out,"
"); + + /***** Put button to continue *****/ + if (ShowAnswers) + { + /* Get index of the next question */ + NxtQstInd = Gam_GetNextQuestionIndexInGame (Game.GamCod,QstInd); + if (NxtQstInd > 0) + /* Put button to show next question */ + Gam_PutBigButtonToContinue (ActPlyGamNxtQst,Game.GamCod,(unsigned) NxtQstInd); + } + else + /* Put button to show answers */ + Gam_PutBigButtonToContinue (ActPlyGamAns,Game.GamCod,QstInd); } /*****************************************************************************/ @@ -3577,8 +3627,8 @@ static void Gam_PutBigButtonToContinue (Act_Action_t NextAction, /***** Put icon with link *****/ Act_LinkFormSubmit (Txt_Continue,"GAM_PLAY_CONTINUE ICO_HIGHLIGHT",NULL); - fprintf (Gbl.F.Out,"\"%s\"" + fprintf (Gbl.F.Out,"\"%s\"" "
" "%s", Gbl.Prefs.IconsURL,Txt_Continue,Txt_Continue, diff --git a/swad_game.h b/swad_game.h index 35be32f23..7d7d98871 100644 --- a/swad_game.h +++ b/swad_game.h @@ -126,6 +126,7 @@ void Gam_PlayGame (void); void Gam_ReceiveGameAnswers (void); void Gam_PlayGameNextQuestion (void); +void Gam_PlayGameShowAnswers (void); unsigned Gam_GetNumCoursesWithCrsGames (Sco_Scope_t Scope); unsigned Gam_GetNumCrsGames (Sco_Scope_t Scope);