MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / postWindowInit

Function postWindowInit

src/bzflag/bzflag.cpp:1437–1499  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1435
1436
1437int postWindowInit(void) {
1438 // initialize locale system
1439
1440 bm = new BundleMgr(PlatformFactory::getMedia()->getMediaDirectory(), "bzflag");
1441 World::setBundleMgr(bm);
1442
1443 std::string locale = BZDB.isSet("locale") ? BZDB.get("locale") : "default";
1444 World::setLocale(locale);
1445 bm->getBundle(World::getLocale());
1446
1447
1448 // get sound files. must do this after creating the window because
1449 // DirectSound is a bonehead API.
1450 if (!noAudio) {
1451 if (BZDB.isSet("soundsystem")) { // set the sound system they want
1452 SoundManager::instance().activateSoundSystem(BZDB.get("soundsystem"));
1453 }
1454
1455 SOUNDSYSTEM.startup();
1456 if (startupInfo.hasConfiguration && BZDB.isSet("volume")) {
1457 SOUNDSYSTEM.setVolume(BZDB.eval("volume") * 0.1f);
1458 }
1459
1460 BZDB.set("soundsystem", SOUNDSYSTEM.name()); // save the sound system they get
1461 }
1462
1463 // set server list URL
1464 if (BZDB.isSet("list")) {
1465 startupInfo.listServerURL = BZDB.get("list");
1466 }
1467
1468 // setup silence list
1469 std::vector<std::string> &list = getSilenceList();
1470
1471 // search for entries silencedPerson0 silencedPerson1 etc..
1472 // to the database. Stores silenceList
1473 // By only allowing up to a certain # of people can prevent
1474 // the vague chance of buffer overrun.
1475 const int bufferLength = 30;
1476 const int maxListSize = 1000000; // do even that many play bzflag?
1477 char buffer [bufferLength];
1478 bool keepGoing = true;
1479
1480 for (int s = 0; keepGoing && (s < maxListSize); s++) {
1481 sprintf(buffer, "silencedPerson%d", s); // could do %-10d
1482
1483 if (BZDB.isSet(buffer)) {
1484 list.push_back(BZDB.get(buffer));
1485 // remove the value from the database so when we save
1486 // it saves the list's new values in order
1487 BZDB.unset(buffer);
1488 }
1489 else {
1490 keepGoing = false;
1491 }
1492 }
1493
1494 if (BZDB.isSet("serverCacheAge")) {

Callers 1

mainFunction · 0.85

Calls 14

getMediaDirectoryMethod · 0.80
isSetMethod · 0.80
getBundleMethod · 0.80
startupMethod · 0.80
setVolumeMethod · 0.80
evalMethod · 0.80
unsetMethod · 0.80
setMaxCacheAgeMethod · 0.80
evalIntMethod · 0.80
getMethod · 0.45
activateSoundSystemMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected