bool sendGift(uint8_t type, uint8_t to) { int audioTrack; switch (type) { case RADAR_GIFT: audioTrack = ID_SENSOR_DOWNLOAD; giftRadar(selectedPlayer, to, true); break; case DROID_GIFT: audioTrack = ID_UNITS_TRANSFER; sendGiftDroids(selectedPlayer, to); break; case RESEARCH_GIFT: audioTrack = ID_TECHNOLOGY_TRANSFER; giftResearch(selectedPlayer, to, true); break; case POWER_GIFT: audioTrack = ID_POWER_TRANSMIT; giftPower(selectedPlayer, to, 0, true); break; default: debug( LOG_ERROR, "Unknown Gift sent" ); return false; break; } // Play the appropriate audio track audio_QueueTrack(audioTrack); return true; }
bool recvGift(NETQUEUE queue) { uint8_t type, from, to; int audioTrack; uint32_t droidID; NETbeginDecode(queue, GAME_GIFT); NETuint8_t(&type); NETuint8_t(&from); NETuint8_t(&to); NETuint32_t(&droidID); NETend(); if (!canGiveOrdersFor(queue.index, from)) { debug(LOG_WARNING, "Gift (%d) from %d, to %d, queue.index %d", (int)type, (int)from, (int)to, (int)queue.index); syncDebug("Wrong player."); return false; } // Handle the gift depending on what it is switch (type) { case RADAR_GIFT: audioTrack = ID_SENSOR_DOWNLOAD; giftRadar(from, to, false); break; case DROID_GIFT: audioTrack = ID_UNITS_TRANSFER; recvGiftDroids(from, to, droidID); break; case RESEARCH_GIFT: audioTrack = ID_TECHNOLOGY_TRANSFER; giftResearch(from, to, false); break; case POWER_GIFT: audioTrack = ID_POWER_TRANSMIT; giftPower(from, to, droidID, false); break; case AUTOGAME_GIFT: audioTrack = ID_SOUND_NEXUS_SYNAPTIC_LINK; giftAutoGame(from, to, false); break; default: debug(LOG_ERROR, "recvGift: Unknown Gift recvd"); return false; break; } // If we are on the recieving end play an audio alert if (to == selectedPlayer) { audio_QueueTrack(audioTrack); } return true; }
// ******************************************************************************************** bool scrSkDifficultyModifier(void) { int player; RESEARCH_FACILITY *psResFacility; STRUCTURE *psStr; PLAYER_RESEARCH *pPlayerRes; if (!stackPopParams(1, VAL_INT, &player)) { return false; } /* Skip cheats if difficulty modifier slider is set to minimum or this is a true multiplayer game. * (0 - player disabled, 20 - max value, UBYTE_MAX - autogame) */ if (game.skDiff[player] <= 1 || game.skDiff[player] == UBYTE_MAX || NetPlay.bComms) { return true; } // power modifier, range: 0-1000 giftPower(ANYPLAYER, player, game.skDiff[player] * 50, true); //research modifier for (psStr = apsStructLists[player]; psStr; psStr = psStr->psNext) { if (psStr->pStructureType->type == REF_RESEARCH) { psResFacility = (RESEARCH_FACILITY *)psStr->pFunctionality; // subtract 0 - 80% off the time to research. if (psResFacility->psSubject) { RESEARCH *psResearch = (RESEARCH *)psResFacility->psSubject; pPlayerRes = &asPlayerResList[player][psResearch->ref - REF_RESEARCH_START]; pPlayerRes->currentPoints += (psResearch->researchPoints * 4 * game.skDiff[player]) / 100; syncDebug("AI %d is cheating with research time.", player); } } } return true; }
bool recvGift(NETQUEUE queue) { uint8_t type, from, to; int audioTrack; uint32_t droidID; NETbeginDecode(queue, GAME_GIFT); NETuint8_t(&type); NETuint8_t(&from); NETuint8_t(&to); NETuint32_t(&droidID); NETend(); // Handle the gift depending on what it is switch (type) { case RADAR_GIFT: audioTrack = ID_SENSOR_DOWNLOAD; giftRadar(from, to, false); break; case DROID_GIFT: audioTrack = ID_UNITS_TRANSFER; recvGiftDroids(from, to, droidID); break; case RESEARCH_GIFT: audioTrack = ID_TECHNOLOGY_TRANSFER; giftResearch(from, to, false); break; case POWER_GIFT: audioTrack = ID_POWER_TRANSMIT; giftPower(from, to, droidID, false); break; default: debug(LOG_ERROR, "recvGift: Unknown Gift recvd"); return false; break; } // If we are on the recieving end play an audio alert if (to == selectedPlayer) { audio_QueueTrack(audioTrack); } return true; }