File: myparser.cpp

package info (click to toggle)
epiphany 0.7.0%2B0-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 7,528 kB
  • ctags: 1,027
  • sloc: cpp: 6,404; ansic: 141; makefile: 78; sh: 7
file content (110 lines) | stat: -rw-r--r-- 2,740 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/***************************************************************************
                          myparser.cpp  -  description
                             -------------------
    begin                : Fri Jan 17 2003
    copyright            : (C) 2003 by Giuseppe D'Aqui'
    email                : kumber@tiscalinet.it
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License, Version 2, as published by  *
 *   the Free Software Foundation.                                   *
 *                                                                         *
 ***************************************************************************/
#include "dephine.h"
#include "emdlparser.h"
#include "epimap.h"
#include "myparser.h"
#include <iostream>

using namespace std;

myparser::myparser()
{}

Epimap& myparser::get_epimap()
{
	return m_map;
}

void myparser::handle_command_put(Entity_Type e, int x, int y)
{
	m_map.put_entity(e,x,y);
}

void myparser::handle_command_set_str(std::string o, std::string v)
{
	DEBOUT("parsing: set "<<o<<" "<<v<<"\n");
	if(o == "name")
		m_map.set_name(v);

	if(o == "author")
		m_map.set_author(v);

	if(o == "minscore")
		m_map.set_min_score(m_map.count_total_score());
}

void myparser::handle_command_set_int(std::string o, Uint32 v)
{
	DEBOUT("parsing: set "<<o<<" "<<v<<"\n");
	if(o == "minscore")
		m_map.set_min_score(v);

	if(o == "maxtime")
		m_map.set_max_time(v);
}

void myparser::handle_command_line(Entity_Type e, Uint32 x0, Uint32 y0, Uint32 x1, Uint32 y1)
{
	    m_map.put_line(e,x0,y0,x1,y1);
}

void myparser::handle_command_rect(Entity_Type e, Uint32 x0, Uint32 y0, Uint32 w, Uint32 h)
{
	m_map.put_rectangle(e,x0,y0,w,h);
}

void myparser::handle_command_view()
{
/*
	cout<<"View of "<<m_map.get_name()<<endl;
	cout<<"Author "<<m_map.get_author()<<endl;
	cout<<"Minimum score "<<m_map.get_min_score()<<endl;
	cout<<"Maximum time "<<m_map.get_max_time()<<endl;
	
	const char* wrap_map = " P:#EOS]*DDDD++++*@@@@=o";
	
	cout<<"   01234567890123456789012345678901"<<endl;
	for(Uint32 i = 0; i< 32; i++)
	{
		cout<<i<<" ";
		if(i<10)
		    cout<<" ";

		for(Uint32 y = 0; y<32; y++)
			cout<<wrap_map[int(m_map.get_map_element(y,i))];
		cout<<endl;
	}
*/
}

void myparser::handle_command_write()
{
//	m_map.save_map_as(compiled_file_name);
}

void myparser::handle_sintaxerror_comma()
{
	cout<<"err"<<endl;
}

void myparser::handle_sintaxerror_par()
{
	cout<<"Par"<<endl;
}