2017-09-07 18:38:18 +02:00
|
|
|
|
// swad_game.h: games using remote control
|
2017-07-09 20:31:40 +02:00
|
|
|
|
|
2017-09-07 18:38:18 +02:00
|
|
|
|
#ifndef _SWAD_GAM
|
|
|
|
|
#define _SWAD_GAM
|
2017-07-09 20:31:40 +02:00
|
|
|
|
/*
|
|
|
|
|
SWAD (Shared Workspace At a Distance in Spanish),
|
|
|
|
|
is a web platform developed at the University of Granada (Spain),
|
|
|
|
|
and used to support university teaching.
|
|
|
|
|
|
|
|
|
|
This file is part of SWAD core.
|
2019-01-07 21:52:19 +01:00
|
|
|
|
Copyright (C) 1999-2019 Antonio Ca<EFBFBD>as Vargas
|
2017-07-09 20:31:40 +02:00
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU Affero General Public License as
|
|
|
|
|
published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
License, or (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/********************************* Headers ***********************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-09-07 18:38:18 +02:00
|
|
|
|
#include "swad_scope.h"
|
|
|
|
|
|
2017-07-09 20:31:40 +02:00
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/************************** Public types and constants ***********************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2019-05-28 15:06:53 +02:00
|
|
|
|
#define Gam_MAX_CHARS_TITLE (128 - 1) // 127
|
|
|
|
|
#define Gam_MAX_BYTES_TITLE ((Gam_MAX_CHARS_TITLE + 1) * Str_MAX_BYTES_PER_CHAR - 1) // 2047
|
2017-07-09 20:31:40 +02:00
|
|
|
|
|
2017-09-07 18:38:18 +02:00
|
|
|
|
#define Gam_NUM_DATES 2
|
2017-07-09 20:31:40 +02:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2017-09-07 18:38:18 +02:00
|
|
|
|
Gam_START_TIME = 0,
|
|
|
|
|
Gam_END_TIME = 1,
|
|
|
|
|
} Gam_StartOrEndTime_t;
|
2017-07-09 20:31:40 +02:00
|
|
|
|
|
|
|
|
|
struct Game
|
|
|
|
|
{
|
2019-05-20 08:52:07 +02:00
|
|
|
|
long GamCod; // Game code
|
|
|
|
|
long UsrCod; // Author code
|
2019-05-28 15:06:53 +02:00
|
|
|
|
char Title[Gam_MAX_BYTES_TITLE + 1];
|
2017-09-07 18:38:18 +02:00
|
|
|
|
time_t TimeUTC[Gam_NUM_DATES];
|
2017-07-09 20:31:40 +02:00
|
|
|
|
unsigned NumQsts; // Number of questions in the game
|
|
|
|
|
struct
|
|
|
|
|
{
|
|
|
|
|
bool Visible; // Game is not hidden
|
|
|
|
|
bool ICanViewResults;
|
|
|
|
|
bool ICanEdit;
|
|
|
|
|
} Status;
|
|
|
|
|
};
|
|
|
|
|
|
2019-07-04 17:17:15 +02:00
|
|
|
|
#define Gam_NUM_ORDERS 3
|
2017-07-09 20:31:40 +02:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2017-09-07 18:38:18 +02:00
|
|
|
|
Gam_ORDER_BY_START_DATE = 0,
|
|
|
|
|
Gam_ORDER_BY_END_DATE = 1,
|
2019-07-04 17:17:15 +02:00
|
|
|
|
Gam_ORDER_BY_TITLE = 2,
|
2017-09-07 18:38:18 +02:00
|
|
|
|
} Gam_Order_t;
|
|
|
|
|
#define Gam_ORDER_DEFAULT Gam_ORDER_BY_START_DATE
|
2017-07-09 20:31:40 +02:00
|
|
|
|
|
2017-09-07 18:38:18 +02:00
|
|
|
|
#define Gam_NUM_ANS_TYPES 2
|
2017-07-09 20:31:40 +02:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
2017-09-07 18:38:18 +02:00
|
|
|
|
Gam_ANS_UNIQUE_CHOICE = 0,
|
|
|
|
|
Gam_ANS_MULTIPLE_CHOICE = 1,
|
|
|
|
|
} Gam_AnswerType_t;
|
|
|
|
|
#define Gam_ANSWER_TYPE_DEFAULT Gam_ANS_UNIQUE_CHOICE
|
2017-07-09 20:31:40 +02:00
|
|
|
|
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/***************************** Public prototypes *****************************/
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
|
2017-09-07 18:38:18 +02:00
|
|
|
|
void Gam_SeeAllGames (void);
|
|
|
|
|
void Gam_SeeOneGame (void);
|
|
|
|
|
void Gam_PutHiddenParamGameOrder (void);
|
|
|
|
|
void Gam_RequestCreatOrEditGame (void);
|
|
|
|
|
void Gam_GetListGames (void);
|
|
|
|
|
void Gam_GetDataOfGameByCod (struct Game *Gam);
|
|
|
|
|
void Gam_GetDataOfGameByFolder (struct Game *Gam);
|
|
|
|
|
void Gam_FreeListGames (void);
|
2017-09-13 16:24:29 +02:00
|
|
|
|
|
2017-09-07 18:38:18 +02:00
|
|
|
|
void Gam_PutParamGameCod (long GamCod);
|
|
|
|
|
long Gam_GetParamGameCod (void);
|
|
|
|
|
void Gam_AskRemGame (void);
|
|
|
|
|
void Gam_RemoveGame (void);
|
|
|
|
|
void Gam_AskResetGame (void);
|
|
|
|
|
void Gam_ResetGame (void);
|
|
|
|
|
void Gam_HideGame (void);
|
|
|
|
|
void Gam_UnhideGame (void);
|
|
|
|
|
void Gam_RecFormGame (void);
|
2019-05-28 15:06:53 +02:00
|
|
|
|
bool Gam_CheckIfMatchIsAssociatedToGrp (long MchCod,long GrpCod);
|
2017-09-07 18:38:18 +02:00
|
|
|
|
void Gam_RemoveGroup (long GrpCod);
|
|
|
|
|
void Gam_RemoveGroupsOfType (long GrpTypCod);
|
2019-04-03 20:57:04 +02:00
|
|
|
|
void Gam_RemoveGames (Hie_Level_t Scope,long Cod);
|
2017-09-07 18:38:18 +02:00
|
|
|
|
|
|
|
|
|
void Gam_RequestNewQuestion (void);
|
|
|
|
|
|
2019-05-30 12:57:31 +02:00
|
|
|
|
void Gam_GetAndDrawBarNumUsrsWhoAnswered (long GamCod,unsigned QstInd,unsigned AnsInd,unsigned NumUsrs);
|
2017-09-07 18:38:18 +02:00
|
|
|
|
|
|
|
|
|
void Gam_AddTstQuestionsToGame (void);
|
|
|
|
|
|
|
|
|
|
void Gam_RequestRemoveQst (void);
|
|
|
|
|
void Gam_RemoveQst (void);
|
|
|
|
|
|
2017-09-11 19:06:46 +02:00
|
|
|
|
void Gam_MoveUpQst (void);
|
|
|
|
|
void Gam_MoveDownQst (void);
|
|
|
|
|
|
2019-07-16 22:33:28 +02:00
|
|
|
|
void Gam_RequestRemoveMatchTch (void);
|
|
|
|
|
void Gam_RemoveMatchTch (void);
|
2019-05-28 15:06:53 +02:00
|
|
|
|
|
2019-07-16 22:33:28 +02:00
|
|
|
|
void Gam_RequestNewMatchTch (void);
|
2017-09-13 09:47:45 +02:00
|
|
|
|
|
2019-07-17 11:31:42 +02:00
|
|
|
|
void Gam_CreateNewMatchTch (void);
|
|
|
|
|
void Gam_RequestStartResumeMatchTch (void);
|
2019-07-17 18:37:06 +02:00
|
|
|
|
void Gam_ResumeMatchTch (void);
|
2019-07-30 15:21:29 +02:00
|
|
|
|
void Gam_PrevStatusMatchTch (void);
|
2019-07-16 22:33:28 +02:00
|
|
|
|
void Gam_NextStatusMatchTch (void);
|
2019-05-28 15:06:53 +02:00
|
|
|
|
|
2019-05-31 10:04:13 +02:00
|
|
|
|
void Gam_ShowFinishedMatchResults (void);
|
|
|
|
|
|
2019-05-28 15:06:53 +02:00
|
|
|
|
void Gam_GetMatchBeingPlayed (void);
|
2019-07-04 21:39:30 +02:00
|
|
|
|
void Gam_ShowMatchToMeAsStd (void);
|
2019-07-17 18:17:44 +02:00
|
|
|
|
void Gam_RefreshMatchTch (void);
|
|
|
|
|
void Gam_RefreshMatchStd (void);
|
2019-05-20 12:26:15 +02:00
|
|
|
|
|
2019-07-16 22:33:28 +02:00
|
|
|
|
void Gam_ReceiveQstAnsFromStd (void);
|
|
|
|
|
|
2019-04-03 20:57:04 +02:00
|
|
|
|
unsigned Gam_GetNumCoursesWithGames (Hie_Level_t Scope);
|
|
|
|
|
unsigned Gam_GetNumGames (Hie_Level_t Scope);
|
|
|
|
|
float Gam_GetNumQstsPerCrsGame (Hie_Level_t Scope);
|
2017-07-09 20:31:40 +02:00
|
|
|
|
|
|
|
|
|
#endif
|