~ubuntu-branches/ubuntu/raring/simutrans/raring-proposed

« back to all changes in this revision

Viewing changes to simgraph8.cc

  • Committer: Package Import Robot
  • Author(s): Ansgar Burchardt
  • Date: 2011-11-03 19:59:02 UTC
  • mfrom: (1.2.7)
  • Revision ID: package-import@ubuntu.com-20111103195902-uopgwf488mfctb75
Tags: 111.0-1
* New upstream release.
* debian/rules: Update get-orig-source target for new upstream release.
* Use xz compression for source and binary packages.
* Use override_* targets to simplify debian/rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
 
40
40
#ifdef _MSC_VER
41
41
#       include <io.h>
42
 
#       include <direct.h>
43
42
#       define W_OK 2
44
43
#else
45
 
#       include <sys/stat.h>
46
 
#       include <fcntl.h>
47
44
#       include <unistd.h>
48
45
#endif
49
46
 
384
381
 
385
382
 
386
383
// offsets of first and second comany color
387
 
#define MAX_PLAYER_COUNT 16
388
384
static uint8 player_offsets[MAX_PLAYER_COUNT][2];
389
385
 
390
386
// the palette for the display ...
1003
999
}
1004
1000
 
1005
1001
 
1006
 
sint16 display_set_height(KOORD_VAL h)
 
1002
void display_set_height(KOORD_VAL const h)
1007
1003
{
1008
 
        sint16 old = disp_height;
1009
 
 
1010
1004
        disp_height = h;
1011
 
        return old;
1012
1005
}
1013
1006
 
1014
1007
 
1362
1355
                "rep\n\t"
1363
1356
                "movsl\n\t"
1364
1357
                : "+D" (dst), "+S" (src), "+c" (amount)
 
1358
                :
1365
1359
                : "memory"
1366
1360
        );
1367
1361
#endif
2458
2452
 * @author Volker Meyer
2459
2453
 * @date  15.06.2003
2460
2454
 */
2461
 
void display_multiline_text(KOORD_VAL x, KOORD_VAL y, const char *buf, PLAYER_COLOR_VAL color)
 
2455
int display_multiline_text(KOORD_VAL x, KOORD_VAL y, const char *buf, PLAYER_COLOR_VAL color)
2462
2456
{
 
2457
        int max_px_len = 0;
2463
2458
        if (buf != NULL && *buf != '\0') {
2464
2459
                const char *next;
2465
2460
 
2466
2461
                do {
2467
2462
                        next = strchr(buf, '\n');
2468
 
                        display_text_proportional_len_clip(
 
2463
                        const int px_len = display_text_proportional_len_clip(
2469
2464
                                x, y, buf,
2470
2465
                                ALIGN_LEFT | DT_DIRTY | DT_CLIP, color,
2471
2466
                                next != NULL ? next - buf : -1
2472
2467
                        );
 
2468
                        if(  px_len>max_px_len  ) {
 
2469
                                max_px_len = px_len;
 
2470
                        }
2473
2471
                        buf = next + 1;
2474
2472
                        y += LINESPACE;
2475
2473
                } while (next != NULL);
2476
2474
        }
 
2475
        return max_px_len;
2477
2476
}
2478
2477
 
2479
2478
 
2592
2591
        // make sure it something of 16 (also better for caching ... )
2593
2592
        width = (width + 15) & 0x7FF0;
2594
2593
 
2595
 
        if (dr_os_open(width, height, 8, full_screen)) {
 
2594
        if (dr_os_open(width, height, full_screen)) {
2596
2595
                disp_width = width;
2597
2596
                disp_height = height;
2598
2597
 
2698
2697
                guarded_free(tile_dirty);
2699
2698
                guarded_free(tile_dirty_old);
2700
2699
 
2701
 
                dr_textur_resize((unsigned short**)&textur, disp_width, disp_height, 8);
 
2700
                dr_textur_resize((unsigned short**)&textur, disp_width, disp_height);
2702
2701
 
2703
2702
                tiles_per_line     = (disp_width  + DIRTY_TILE_SIZE - 1) / DIRTY_TILE_SIZE;
2704
2703
                tile_lines         = (disp_height + DIRTY_TILE_SIZE - 1) / DIRTY_TILE_SIZE;
2725
2724
 
2726
2725
        char buf[80];
2727
2726
 
2728
 
#ifdef WIN32
2729
 
        mkdir(SCRENSHOT_PATH);
2730
 
#else
2731
 
        mkdir(SCRENSHOT_PATH, 0700);
2732
 
#endif
 
2727
        dr_mkdir(SCRENSHOT_PATH);
2733
2728
 
2734
2729
        do {
2735
2730
                sprintf(buf, SCRENSHOT_PATH_X "simscr%02d.bmp", number++);