void Zoom::slotZoom (const char *val) { mag = reverseArray (atoi (val)); emit applyChange(); // okButton->setEnabled (false); }
void StorageAreaMap::dispatchStorageEvent(uint64_t sourceStorageAreaID, const String& key, const String& oldValue, const String& newValue, const String& urlString) { if (!sourceStorageAreaID) { // This storage event originates from another process so we need to apply the change to our storage area map. applyChange(key, newValue); } if (storageType() == SessionStorage) dispatchSessionStorageEvent(sourceStorageAreaID, key, oldValue, newValue, urlString); else dispatchLocalStorageEvent(sourceStorageAreaID, key, oldValue, newValue, urlString); }
void CChangeWidget::setState(const MState &state) { std::string emptyError = ""; setBlockSignals(true); for(auto &kv : state) { applyChange(kv.first, kv.second, emptyError); } setBlockSignals(false); }
bool CLevel::changeBoard(CPacket& pTileData, int pX, int pY, int pWidth, int pHeight, CPlayer* player) { if( pX < 0 || pY < 0 || pX > 63 || pY > 63 || pWidth < 1 || pHeight < 1 || pX + pWidth > 64 || pY + pHeight > 64 ) return false; // Do the check for the push-pull block. if ( pWidth == 4 && pHeight == 4 && clientsidePushPull ) { // Try to find the top-left corner tile. int i; for ( i = 0; i < 16; ++i ) { short stoneCheck = pTileData.readByte2(); if ( stoneCheck == 0x6E4 || stoneCheck == 0x7CE ) break; } // Check if we found a possible push-pull block. if ( i != 16 && i < 11 ) { // Go back one full short so the first readByte2() returns the top-left corner. pTileData.setRead( i * 2 ); int foundCount = 0; for ( int j = 0; j < 6; ++j ) { // Read a piece. short stoneCheck = pTileData.readByte2(); // A valid stone will have pieces at the following j locations. if ( j == 0 || j == 1 || j == 4 || j == 5 ) { switch ( stoneCheck ) { // red case 0x6E4: case 0x6E5: case 0x6F4: case 0x6F5: // blue case 0x7CE: case 0x7CF: case 0x7DE: case 0x7DF: foundCount++; break; } } } pTileData.setRead(0); // Check if we found a full tile. If so, don't accept the change. if ( foundCount == 4 ) { player->sendPacket( CPacket() << (char)SBOARDMODIFY << (char)pX << (char)pY << (char)pWidth << (char)pHeight << pTileData ); return false; } } } //Delete any existing changes within the same region for ( int i = 0; i < boardChanges.count(); i++ ) { CBoardChange* change = (CBoardChange*)boardChanges[i]; if(change->x >= pX && change->y >= pY && change->x + change->width <= pX + pWidth && change->y + change->height <= pY + pHeight) { delete change; boardChanges.remove(i); i--; } } CBoardChange* change = new CBoardChange(pTileData, pX, pY, pWidth, pHeight); change->prevData << applyChange(pTileData, pX, pY, pWidth, pHeight); if ( change->prevData.length() > 0 ) boardChanges.add(change); else delete change; return true; }
void CLevel::animate() { for ( int i = 0; i < boardChanges.count(); i++ ) { CBoardChange* change = (CBoardChange*)boardChanges[i]; if ( change->counter > 0 ) { change->counter--; if ( change->counter <= 0 ) { // Put the old data back in. DON'T DELETE THE CHANGE. // The client remembers board changes and if we delete the // change, the client won't get the new data. applyChange(change->prevData, change->x, change->y, change->width, change->height); change->tileData = change->prevData; change->modifyTime = getSysTime(); change->counter = -1; } } } for ( int i = 0; i < items.count(); i++ ) { CItem* item = (CItem*)items[i]; item->counter--; if(item->counter == 0) { items.remove(i); delete item; i--; } } for ( int i = 0; i < baddies.count(); i++ ) { CBaddy* baddy = (CBaddy*)baddies[i]; if(baddy->mode == DIE || !players.count()) { if(baddy->respawn) { // Drop items. if ( baddy->respawnCount == baddyRespawn && baddyDropItems == true ) dropBaddyItem( baddy->x, baddy->y ); baddy->respawnCount--; if(!baddy->respawnCount) { baddy->reset(); CPacket baddyProps; baddyProps << (char)SBADDYPROPS << (char)baddy->id << baddy->getPropList(); for(int ii = 0; ii < players.count(); ii ++) { CPlayer*player = (CPlayer*)players[ii]; player->sendPacket(baddyProps); } } } if(!baddy->respawn && !players.count()) { baddyIds.replace(baddy->id, NULL); baddies.remove(baddy); delete baddy; i--; } } } for(int i = 0; i < horses.count(); i++) { CHorse* horse = (CHorse*)horses[i]; horse->counter--; if(horse->counter == 0) { CPacket horseData; horseData << (char)SDELHORSE << (char)(horse->x*2) << (char)(horse->y*2); for (int ii = 0; ii < players.count(); ii++) ((CPlayer*)players[ii])->sendPacket(horseData); delete horse; horses.remove(i); i--; } } saveCounter--; if(saveCounter <= 0) { saveNpcs(); saveCounter = 300; } }
void CChangeWidget::applyChangeResponse(SVarChangeResponse response) { setBlockSignals(true); applyChange(response.var, response.value, response.error); setBlockSignals(false); }