This repository was archived by the owner on Mar 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathiomapserialize.h
More file actions
83 lines (69 loc) · 3.03 KB
/
Copy pathiomapserialize.h
File metadata and controls
83 lines (69 loc) · 3.03 KB
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
//////////////////////////////////////////////////////////////////////
// OpenTibia - an opensource roleplaying game
//////////////////////////////////////////////////////////////////////
// Base class for the map serialization
//////////////////////////////////////////////////////////////////////
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//////////////////////////////////////////////////////////////////////
#ifndef __OTSERV_IOMAPSERIALIZE_H__
#define __OTSERV_IOMAPSERIALIZE_H__
#include "classes.h"
#include "database_driver.h"
class IOMapSerialize{
public:
static IOMapSerialize* getInstance();
/** Load the map from a data storage
* \param map pointer to the Map class
* \return Returns true if the map was loaded successfully
*/
bool loadMap(Map* map);
/** Save the map to a data storage
* \param map pointer to the Map class
* \return Returns true if the map was saved successfully
*/
bool saveMap(Map* map);
/** Synchronize the house information from the map
* \return Returns true if all houses where updated correctly
*/
bool updateHouseInfo();
/** Checks if any house auctions has ended and update to the new owner
* \return Returns true if all houses where updated successfully
*/
bool processHouseAuctions();
/** Load the house access list from a data storage
* \param map pointer to the Map class
* \return Returns true if the house access list was opened successfully
*/
bool loadHouseInfo(Map* map);
/** Save the house access list to a data storage
* \param map pointer to the Map class
* \return Returns true if the house access list was saved successfully
*/
bool saveHouseInfo(Map* map);
protected:
// Relational storage uses a row for each item/tile
bool loadMapRelational(Map* map);
bool saveMapRelational(Map* map);
bool saveItems(DatabaseDriver* db, uint32_t houseId, const Tile* tile);
bool loadItems(DatabaseDriver* db, DBResult* result, Cylinder* parent, bool depotTransfer = false);
// Binary storage uses a giant BLOB field for storing everything
bool loadMapBinary(Map* map);
bool saveMapBinary(Map* map);
bool saveItem(PropWriteStream& stream, const Item* item);
bool saveTile(PropWriteStream& stream, const Tile* tile);
bool loadItem(PropStream& propStream, Cylinder* parent, bool depotTransfer = false);
bool loadContainer(PropStream& propStream, Container* container);
};
#endif