summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2011-01-30 20:00:54 (GMT)
committer Cracker64 <cracker642@gmail.com>2011-01-30 20:00:54 (GMT)
commitfcf958da21621887a80249f2af863991544815fd (patch)
treecdd8ac38c54d508a701e5ac17238bffb2354f56d /src
parente18337a70ab7d4b1560d909b1375959c9bed7e7b (diff)
downloadpowder-fcf958da21621887a80249f2af863991544815fd.zip
powder-fcf958da21621887a80249f2af863991544815fd.tar.gz
added 'load' command, and a basic error message.
Diffstat (limited to 'src')
-rw-r--r--src/interface.c9
-rw-r--r--src/main.c16
2 files changed, 21 insertions, 4 deletions
diff --git a/src/interface.c b/src/interface.c
index bbb7c2d..6f3f0bc 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -3789,7 +3789,7 @@ void open_link(char *uri) {
printf("Cannot open browser\n");
#endif
}
-char *console_ui(pixel *vid_buf) { //TODO: error messages, show previous commands
+char *console_ui(pixel *vid_buf,char error[255]) { //TODO: error messages, show previous commands
int mx,my,b,bq;
ui_edit ed;
ed.x = 15;
@@ -3814,11 +3814,14 @@ char *console_ui(pixel *vid_buf) { //TODO: error messages, show previous command
clearrect(vid_buf, 0, 0, XRES+BARSIZE, 220);//anyway to make it transparent?
draw_line(vid_buf, 1, 219, XRES, 219, 228, 228, 228, XRES+BARSIZE);
drawtext(vid_buf, 15, 15, "Welcome to The Powder Toy console v.1 (by cracker64)\n"
- "Current commands are quit, set, reset\n"
+ "Current commands are quit, set, reset, load\n"
"You can set type, temp, ctype, life, x, y, vx, vy using this format ('set life particle# 9001')\n"
"You can also use 'all' instead of a particle number to do it to everything\n"
- "Reset works with pressure, velocity, sparks, temp (ex. 'reset pressure')"
+ "Reset works with pressure, velocity, sparks, temp (ex. 'reset pressure')\n"
+ "To load a save use load saveID (ex. load 1337)"
,255, 187, 187, 255);
+ if(error)
+ drawtext(vid_buf, 15, 190, error,255, 187, 187, 255);
ui_edit_draw(vid_buf, &ed);
ui_edit_process(mx, my, b, &ed);
sdl_blit(0, 0, (XRES+BARSIZE), YRES+MENUSIZE, vid_buf, (XRES+BARSIZE));
diff --git a/src/main.c b/src/main.c
index 37a4ce9..6f7ee7b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1117,6 +1117,7 @@ int main(int argc, char *argv[])
pixel *pers_bg=calloc((XRES+BARSIZE)*YRES, PIXELSIZE);
void *http_ver_check;
char *ver_data=NULL, *tmp;
+ char error[255];
int i, j, bq, fire_fc=0, do_check=0, old_version=0, http_ret=0, major, minor, old_ver_len;
#ifdef INTERNAL
int vs = 0;
@@ -1699,8 +1700,10 @@ int main(int argc, char *argv[])
char *console3;
char *console4;
char *console5;
+ //char error[255] = "error!";
sys_pause = 1;
- console = console_ui(vid_buf);
+ console = console_ui(vid_buf,error);
+ strcpy(error,"");
if(console && strcmp(console, "")!=0 && strncmp(console, " ", 1)!=0)
{
console2 = strtok(console, " ");
@@ -1711,6 +1714,15 @@ int main(int argc, char *argv[])
{
break;
}
+ else if(strcmp(console2, "load")==0 && console3)
+ {
+ j = atoi(console3);
+ if(j)
+ {
+ open_ui(vid_buf, console3, NULL);
+ console_mode = 0;
+ }
+ }
else if(strcmp(console2, "reset")==0 && console3)
{
if(strcmp(console3, "pressure")==0)
@@ -1936,6 +1948,8 @@ int main(int argc, char *argv[])
}
}
}
+ else
+ sprintf(error, "Invalid Command", console2);
}
if(!console_mode)
hud_enable = 1;