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

« back to all changes in this revision

Viewing changes to besch/writer/citycar_writer.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:
1
1
#include <string>
2
2
#include "../../dataobj/tabfile.h"
3
 
#include "../stadtauto_besch.h"
4
3
#include "obj_node.h"
5
4
#include "text_writer.h"
6
5
#include "imagelist_writer.h"
9
8
 
10
9
void citycar_writer_t::write_obj(FILE* fp, obj_node_t& parent, tabfileobj_t& obj)
11
10
{
12
 
        stadtauto_besch_t besch;
13
11
        int i;
14
12
 
15
13
        obj_node_t node(this, 10, &parent);
16
14
 
17
 
        besch.gewichtung = obj.get_int("distributionweight", 1);
18
 
 
19
 
        besch.intro_date  = obj.get_int("intro_year", DEFAULT_INTRO_DATE) * 12;
20
 
        besch.intro_date += obj.get_int("intro_month", 1) - 1;
21
 
 
22
 
        besch.obsolete_date  = obj.get_int("retire_year", DEFAULT_RETIRE_DATE) * 12;
23
 
        besch.obsolete_date += obj.get_int("retire_month", 1) - 1;
24
 
 
25
 
        besch.geschw  = obj.get_int("speed", 80) * 16;
 
15
        uint16 const gewichtung = obj.get_int("distributionweight", 1);
 
16
 
 
17
        uint16 const intro_date =
 
18
                obj.get_int("intro_year", DEFAULT_INTRO_DATE) * 12 +
 
19
                obj.get_int("intro_month", 1) - 1;
 
20
 
 
21
        uint16 const obsolete_date =
 
22
                obj.get_int("retire_year", DEFAULT_RETIRE_DATE) * 12 +
 
23
                obj.get_int("retire_month", 1) - 1;
 
24
 
 
25
        uint16 const geschw = obj.get_int("speed", 80) * 16;
26
26
 
27
27
        // new version with intro and obsolete dates
28
 
        node.write_uint16(fp, 0x8002,                    0); // version information
29
 
        node.write_uint16(fp, (uint16) besch.gewichtung, 2);
30
 
        node.write_uint16(fp, (uint16) besch.geschw,     4);
31
 
        node.write_uint16(fp, besch.intro_date,          6);
32
 
        node.write_uint16(fp, besch.obsolete_date,       8);
 
28
        node.write_uint16(fp, 0x8002,        0); // version information
 
29
        node.write_uint16(fp, gewichtung,    2);
 
30
        node.write_uint16(fp, geschw,        4);
 
31
        node.write_uint16(fp, intro_date,    6);
 
32
        node.write_uint16(fp, obsolete_date, 8);
33
33
 
34
34
        write_head(fp, node, obj);
35
35