New message notification on session check TODO: Clickable link to conversations on website
This commit is contained in:
parent
1ddff1ad3b
commit
9d70d60ee9
@ -7,10 +7,10 @@
|
||||
#define PATH_SEP "/"
|
||||
#endif
|
||||
|
||||
#define SAVE_VERSION 47
|
||||
#define MINOR_VERSION 4
|
||||
#define SAVE_VERSION 48
|
||||
#define MINOR_VERSION 0
|
||||
#define IDENT_VERSION "G" //Change this if you're not Simon! It should be a single letter.
|
||||
//#define BETA
|
||||
#define BETA
|
||||
|
||||
#define SERVER "powdertoy.co.uk"
|
||||
|
||||
|
@ -116,6 +116,7 @@ extern SDLMod sdl_mod;
|
||||
extern int sdl_key, sdl_wheel, sdl_caps, sdl_ascii, sdl_zoom_trig;
|
||||
extern char *shift_0;
|
||||
extern char *shift_1;
|
||||
extern int svf_messages;
|
||||
extern int svf_login;
|
||||
extern int svf_admin;
|
||||
extern int svf_mod;
|
||||
|
@ -22,6 +22,7 @@ int sdl_key, sdl_wheel, sdl_caps=0, sdl_ascii, sdl_zoom_trig=0;
|
||||
char *shift_0="`1234567890-=[]\\;',./";
|
||||
char *shift_1="~!@#$%^&*()_+{}|:\"<>?";
|
||||
|
||||
int svf_messages = 0;
|
||||
int svf_login = 0;
|
||||
int svf_admin = 0;
|
||||
int svf_mod = 0;
|
||||
|
23
src/main.c
23
src/main.c
@ -165,6 +165,7 @@ typedef struct
|
||||
static const char *old_ver_msg_beta = "A new beta is available - click here!";
|
||||
#endif
|
||||
static const char *old_ver_msg = "A new version is available - click here!";
|
||||
char new_message_msg[255];
|
||||
float mheat = 0.0f;
|
||||
|
||||
int do_open = 0;
|
||||
@ -1373,7 +1374,7 @@ int main(int argc, char *argv[])
|
||||
void *http_ver_check, *http_session_check = NULL;
|
||||
char *ver_data=NULL, *check_data=NULL, *tmp;
|
||||
//char console_error[255] = "";
|
||||
int result, i, j, bq, fire_fc=0, do_check=0, do_s_check=0, old_version=0, http_ret=0,http_s_ret=0, major, minor, old_ver_len;
|
||||
int result, i, j, bq, fire_fc=0, do_check=0, do_s_check=0, old_version=0, http_ret=0,http_s_ret=0, major, minor, old_ver_len, new_message_len;
|
||||
#ifdef INTERNAL
|
||||
int vs = 0;
|
||||
#endif
|
||||
@ -1700,6 +1701,7 @@ int main(int argc, char *argv[])
|
||||
svf_own = 0;
|
||||
svf_admin = 0;
|
||||
svf_mod = 0;
|
||||
svf_messages = 0;
|
||||
}
|
||||
else if (!strncmp(check_data, "BANNED", 6))
|
||||
{
|
||||
@ -1712,6 +1714,7 @@ int main(int argc, char *argv[])
|
||||
svf_own = 0;
|
||||
svf_admin = 0;
|
||||
svf_mod = 0;
|
||||
svf_messages = 0;
|
||||
error_ui(vid_buf, 0, "Unable to log in\nYour account has been suspended, consider reading the rules.");
|
||||
}
|
||||
else if (!strncmp(check_data, "OK", 2))
|
||||
@ -1719,7 +1722,7 @@ int main(int argc, char *argv[])
|
||||
//Session valid
|
||||
if (strlen(check_data)>2) {
|
||||
//User is elevated
|
||||
if (!strncmp(check_data+3, "ADMIN", 5))
|
||||
if (!strncmp(check_data+3, "ADM", 5))
|
||||
{
|
||||
svf_admin = 1;
|
||||
svf_mod = 0;
|
||||
@ -1729,7 +1732,11 @@ int main(int argc, char *argv[])
|
||||
svf_admin = 0;
|
||||
svf_mod = 1;
|
||||
}
|
||||
//Check for messages
|
||||
svf_messages = atoi(check_data+7);
|
||||
printf("%d\n", svf_messages);
|
||||
}
|
||||
printf("%s\n", check_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1742,6 +1749,7 @@ int main(int argc, char *argv[])
|
||||
svf_own = 0;
|
||||
svf_admin = 0;
|
||||
svf_mod = 0;
|
||||
svf_messages = 0;
|
||||
}
|
||||
save_presets(0);
|
||||
free(check_data);
|
||||
@ -1755,6 +1763,7 @@ int main(int argc, char *argv[])
|
||||
svf_own = 0;
|
||||
svf_admin = 0;
|
||||
svf_mod = 0;
|
||||
svf_messages = 0;
|
||||
}
|
||||
http_session_check = NULL;
|
||||
} else {
|
||||
@ -3020,6 +3029,16 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
drawrect(vid_buf, XRES-19-old_ver_len, YRES-22, old_ver_len+5, 13, 255, 216, 32, 255);
|
||||
}
|
||||
|
||||
if (svf_messages)
|
||||
{
|
||||
sprintf(new_message_msg, "You have %d new message%s", svf_messages, (svf_messages>1)?"s":"");
|
||||
new_message_len = textwidth(new_message_msg);
|
||||
|
||||
clearrect(vid_buf, XRES-21-new_message_len, YRES-24, new_message_len+9, 17);
|
||||
drawtext(vid_buf, XRES-16-new_message_len, YRES-19, new_message_msg, 255, 216, 32, 255);
|
||||
drawrect(vid_buf, XRES-19-new_message_len, YRES-22, new_message_len+5, 13, 255, 216, 32, 255);
|
||||
}
|
||||
|
||||
FPS++;
|
||||
currentTime = SDL_GetTicks();
|
||||
|
Loading…
Reference in New Issue
Block a user