- pushing new drawing to master, it's okay...
- changed how swords function, only hits nearest entity
+
+5/11/2016:
+==========
+
+ - hired artist
+ - fixed important bugs/memory leaks, few segfaults happen now
+ - new rendering almost complete
+ - brice stuff almost done
}
// attempt to initialize SDL
- if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0)
+ if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0)
UserError(std::string("SDL was not able to initialize! Error: ") + SDL_GetError());
atexit(SDL_Quit);
// load the first valid XML file for the world
for (const auto &xf : xmlFiles) {
- std::cout << xf << std::endl;
if (xf[0] != '.' && strcmp(&xf[xf.size() - 3], "dat")){
// read it in
std::cout << "File to load: " << xf << '\n';
// put away the brice for later
game::briceSave();
-
- // free library resources
+
+ // free library resources
Mix_HaltMusic();
Mix_CloseAudio();
// close up the game stuff
currentWorld->save();
delete arena;
- delete currentWorld;
+ //delete currentWorld;
return 0; // Calls everything passed to atexit
}
UserError("Cannot open brice data file");
for (const auto& i : brice) {
- data.append(i.first + ',' );
+ data.append(i.first + '\n');
data.append(i.second + '\n');
}
void briceLoad(void) {
const char *data = readFile("brice.dat");
- auto datas = StringTokenizer(data, ',');
+ auto datas = StringTokenizer(data, '\n');
- for (const auto& d : datas)
- std::cout << d << '\n';
+ if (datas.size() != 0) {
+ const unsigned int count = datas[0][0] - '0';
+
+ for (unsigned int i = 1; i <= count; i += 2) {
+ std::cout << datas[i] << ' ' << datas[i + 1] << '\n';
+ brice.emplace(std::make_pair(datas[i], datas[i + 1]));
+ }
+ }
delete[] data;
}
int val;
try {
val = std::stoi(getValue(id));
- } catch (std::invalid_argument &e) {
+ } catch (const std::invalid_argument &e) {
val = 0;
}
return val;
// attempt to load actual values
canJump = getIntValue("canJump");
canSprint = getIntValue("canSprint");
+
+ // re-save values
+ setValue("canJump", std::to_string(canJump));
+ setValue("canSprint", std::to_string(canSprint));
}
}