diff options
| author | Simon <simon@hardwired.org.uk> | 2010-09-13 21:36:43 (GMT) |
|---|---|---|
| committer | Simon <simon@hardwired.org.uk> | 2010-09-13 21:36:43 (GMT) |
| commit | a92da37559aa6e68d9165ff4f69f83517594bcc4 (patch) | |
| tree | 5e2bba8d835f46d893ce47f85ad70b8ad887a598 | |
| parent | 812cf13ed22ff195be6c5bdaa90286b562c7e9cc (diff) | |
| download | powder-a92da37559aa6e68d9165ff4f69f83517594bcc4.zip powder-a92da37559aa6e68d9165ff4f69f83517594bcc4.tar.gz | |
History almost complete, couple of bug fixes
| -rw-r--r-- | interface.c | 48 | ||||
| -rw-r--r-- | misc.c | 14 | ||||
| -rw-r--r-- | misc.h | 2 | ||||
| -rw-r--r-- | powder.h | 2 |
4 files changed, 55 insertions, 11 deletions
diff --git a/interface.c b/interface.c index 31d28ca..1f972b3 100644 --- a/interface.c +++ b/interface.c @@ -1964,7 +1964,7 @@ int search_ui(pixel *vid_buf) } else pos = gi+GRID_X*gj; - if(!search_dates[pos]) + if(!search_ids[pos]) break; gx = ((XRES/GRID_X)*gi) + (XRES/GRID_X-XRES/GRID_S)/2; gy = ((((YRES-(MENUSIZE-20))+15)/GRID_Y)*gj) + ((YRES-(MENUSIZE-20))/GRID_Y-(YRES-(MENUSIZE-20))/GRID_S+10)/2 + 18; @@ -2166,7 +2166,7 @@ int search_ui(pixel *vid_buf) uri = malloc(strlen(search_ids[mp])*3+strlen(search_dates[mp])*3+strlen(SERVER)+71); strcpy(uri, "http://" SERVER "/Get.api?Op=save&ID="); strcaturl(uri, search_ids[mp]); - strcaturl(uri, "&Date="); + strappend(uri, "&Date="); strcaturl(uri, search_dates[mp]); } else { uri = malloc(strlen(search_ids[mp])*3+strlen(SERVER)+64); @@ -2384,9 +2384,22 @@ int search_ui(pixel *vid_buf) thlen = 4; } thumb_cache_add(img_id[i], thumb, thlen); - for(pos=0; pos<GRID_X*GRID_Y; pos++) - if(search_ids[pos] && !strcmp(search_ids[pos], img_id[i])) - break; + for(pos=0; pos<GRID_X*GRID_Y; pos++){ + if(search_dates[pos]){ + char *id_d_temp = malloc(strlen(search_ids[pos])+strlen(search_dates[pos])+1); + strcpy(id_d_temp, search_ids[pos]); + strappend(id_d_temp, "_"); + strappend(id_d_temp, search_dates[pos]); + //img_id[i] = mystrdup(id_d_temp); + if(id_d_temp && !strcmp(id_d_temp, img_id[i])){ + break; + } + } else { + if(search_ids[pos] && !strcmp(search_ids[pos], img_id[i])){ + break; + } + } + } if(pos<GRID_X*GRID_Y) { search_thumbs[pos] = thumb; @@ -2411,10 +2424,25 @@ int search_ui(pixel *vid_buf) } if(pos<GRID_X*GRID_Y) { - uri = malloc(strlen(search_ids[pos])*3+strlen(SERVER)+64); - strcpy(uri, "http://" SERVER "/Get.api?Op=thumb&ID="); - strcaturl(uri, search_ids[pos]); - img_id[i] = mystrdup(search_ids[pos]); + if(search_dates[pos]){ + char *id_d_temp = malloc(strlen(search_ids[pos])+strlen(search_dates[pos])+1); + uri = malloc(strlen(search_ids[pos])*3+strlen(search_dates[pos])*3+strlen(SERVER)+71); + strcpy(uri, "http://" SERVER "/Get.api?Op=thumb&ID="); + strcaturl(uri, search_ids[pos]); + strappend(uri, "&Date="); + strcaturl(uri, search_dates[pos]); + + strcpy(id_d_temp, search_ids[pos]); + strappend(id_d_temp, "_"); + strappend(id_d_temp, search_dates[pos]); + img_id[i] = mystrdup(id_d_temp); + } else { + uri = malloc(strlen(search_ids[pos])*3+strlen(SERVER)+64); + strcpy(uri, "http://" SERVER "/Get.api?Op=thumb&ID="); + strcaturl(uri, search_ids[pos]); + img_id[i] = mystrdup(search_ids[pos]); + } + img_http[i] = http_async_req_start(img_http[i], uri, NULL, 0, 1); free(uri); } @@ -2456,7 +2484,7 @@ int search_results(char *str, int votes) if(search_ids[i]) { free(search_ids[i]); - search_ids[i] = NULL; + search_ids[i] = NULL; } if(search_names[i]) { @@ -219,6 +219,20 @@ void strcaturl(char *dst, char *src) *d = 0; } +void strappend(char *dst, char *src) +{ + char *d; + unsigned char *s; + + for(d=dst; *d; d++) ; + + for(s=(unsigned char *)src; *s; s++) + { + *(d++) = *s; + } + *d = 0; +} + void *file_load(char *fn, int *size) { FILE *f = fopen(fn, "rb"); @@ -63,6 +63,8 @@ int load_string(FILE *f, char *str, int max); void strcaturl(char *dst, char *src); +void strappend(char *dst, char *src); + void *file_load(char *fn, int *size); int cpu_check(void); @@ -315,7 +315,7 @@ static part_state pstates[PT_NUM] = /* LCRY */ {ST_SOLID, PT_NONE, 0.0f, PT_BGLA, 1273.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* STKM */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, /* SWCH */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* SMKE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 625.0f}, /* DESL */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 335.0f}, /* COAL */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* LO2 */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_O2, 90.1f, PT_NONE, 0.0f}, |
