ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/exp.C
(Generate patch)

Comparing deliantra/server/common/exp.C (file contents):
Revision 1.37 by root, Sat Apr 23 04:56:45 2011 UTC vs.
Revision 1.44 by root, Thu Nov 22 00:40:12 2018 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
4 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 5 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team 6 * Copyright (©) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992 Frank Tore Johansen 7 * Copyright (©) 1992 Frank Tore Johansen
7 * 8 *
8 * Deliantra is free software: you can redistribute it and/or modify it under 9 * Deliantra is free software: you can redistribute it and/or modify it under
9 * the terms of the Affero GNU General Public License as published by the 10 * the terms of the Affero GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your 11 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version. 12 * option) any later version.
12 * 13 *
13 * This program is distributed in the hope that it will be useful, 14 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 17 * GNU General Public License for more details.
17 * 18 *
18 * You should have received a copy of the Affero GNU General Public License 19 * You should have received a copy of the Affero GNU General Public License
19 * and the GNU General Public License along with this program. If not, see 20 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>. 21 * <http://www.gnu.org/licenses/>.
21 * 22 *
22 * The authors can be reached via e-mail to <support@deliantra.net> 23 * The authors can be reached via e-mail to <support@deliantra.net>
23 */ 24 */
24 25
25#include <stdio.h> 26#include <stdio.h>
26#include <global.h> 27#include <global.h>
148} 149}
149 150
150sint64 151sint64
151level_to_min_exp (int level) 152level_to_min_exp (int level)
152{ 153{
153 if (level <= 0)
154 return 0;
155 else
156 return levels [min (level, settings.max_level)]; 154 return levels [clamp (level, 0, settings.max_level)];
157} 155}
158 156
159/* This loads the experience table from the exp_table 157/* This loads the experience table from the exp_table
160 * file. 158 * file.
161 */ 159 */
162void 160void
163reload_exp_table () 161_reload_exp_table ()
164{ 162{
165 int lastlevel = 0; 163 int lastlevel = 0;
166 sint64 lastexp = -1; 164 sint64 lastexp = -1;
167 165
168 object_thawer thawer (settings.datadir, "exp_table"); 166 object_thawer thawer (settings.datadir, "exp_table");
180 } 178 }
181 179
182 thawer.get (settings.max_level); 180 thawer.get (settings.max_level);
183 181
184 sint64 newlevels [MAXNUMLEVELS]; 182 sint64 newlevels [MAXNUMLEVELS];
183 newlevels [0] = 0;
185 184
186 while (thawer.next_line ()) 185 while (thawer.next_line ())
187 { 186 {
188 sint64 tmpexp; 187 sint64 tmpexp;
189 thawer.get (tmpexp); 188 thawer.get (tmpexp);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines