Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
dialog_termsofservice.qc
Go to the documentation of this file.
2
3#include "../menu.qh"
4#include "mainwindow.qh"
5#include "dialog_firstrun.qh"
6#include "textbox.qh"
7#include "textlabel.qh"
8#include "button.qh"
9#include "util.qh"
10
12{
13 LOG_INFOF("Accepted ToS version %d", _Nex_ExtResponseSystem_NewToS);
14 cvar_set("_termsofservice_accepted", ftos(_Nex_ExtResponseSystem_NewToS));
15 localcmd("saveconfig\n");
16 if (main.firstRunDialog.shouldShow())
17 main.firstDraw = true;
18 Dialog_Close(btn, me);
19}
20
22{
23 localcmd("quit\n");
24}
25
30
31void XonoticToS_OnGet(entity fh, entity me, int status)
32{
33 switch (status) {
35 {
36 break;
37 }
38 case URL_READY_ERROR:
39 {
40 me.textBox.setText(me.textBox, "Error reading ToS");
41 break;
42 }
44 {
45 string temp = "";
46 for (string s; (s = url_fgets(fh)); )
47 {
48 if (temp != "")
49 temp = strcat(temp, "\n", s);
50 else
51 temp = s;
52 }
53 url_fclose(fh);
54 me.textBox.setText(me.textBox, temp);
55 break;
56 }
57 default:
58 {
59 break;
60 }
61 }
62}
63
68
70{
71 entity e;
72 string subtitle;
73
75 subtitle = _("Terms of Service have been updated. Please read them before continuing:");
76 else
77 subtitle = _("Welcome to Xonotic! Please read the following Terms of Service:");
78
79 me.TR(me);
80 me.TD(me, 1, 5, e = makeXonoticTextLabel(0, subtitle));
81 e.allowWrap = true;
82
83 me.TR(me);
84 me.TR(me);
85 me.TD(me, me.rows - 4, me.columns, me.textBox = makeXonoticTextBox());
86 me.textBox.allowColors = true;
87
88 me.TR(me);
89 me.gotoRC(me, me.rows - 1, 0);
90
91 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Accept"), '0 1 0'));
92 e.onClick = Close_Clicked;
93 e.onClickEntity = me;
94
95 me.TD(me, 1, me.columns/2, e = makeXonoticButton(_("Don't accept (quit the game)"), '1 0 0'));
96 e.onClick = DontAccept_Clicked;
97 e.onClickEntity = me;
98}
99
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
const float FILE_READ
bool XonoticToSDialog_shouldShow()
void XonoticToSDialog_loadXonoticToS(entity me)
void XonoticToSDialog_fill(entity me)
void XonoticToS_OnGet(entity fh, entity me, int status)
void DontAccept_Clicked(entity btn, entity me)
void Close_Clicked(entity btn, entity me)
int autocvar__termsofservice_accepted
const string termsofservice_url
#define main
Definition _all.inc:202
#define LOG_INFOF(...)
Definition log.qh:66
void Dialog_Close(entity button, entity me)
Definition dialog.qc:7
entity makeXonoticButton(string theText, vector theColor)
Definition button.qc:10
float _Nex_ExtResponseSystem_NewToS
Definition util.qh:68
void localcmd(string command,...)
void cvar_set(string name, string value)
string ftos(float f)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
entity makeXonoticTextBox()
Definition textbox.qc:4
entity makeXonoticTextLabel(float theAlign, string theText)
Definition textlabel.qc:3
ERASEABLE string url_fgets(entity e)
Definition urllib.qc:287
ERASEABLE void url_single_fopen(string url, int mode, url_ready_func rdy, entity pass)
Definition urllib.qc:87
ERASEABLE void url_fclose(entity e)
Definition urllib.qc:207
const float URL_READY_CLOSED
Definition urllib.qh:15
const float URL_READY_ERROR
Definition urllib.qh:14
const float URL_READY_CANREAD
Definition urllib.qh:17