static int onBonusAdd (RTBonus *pApdon) { if (pApdon->bIsCustomeBonus){ roadmap_main_set_periodic(1000, SpeedCheck_Timer); } else{ if (roadmap_map_settings_road_goodies()) AddBonusToMap(pApdon, FALSE); } return TRUE; }
void RealTimeBonus_SegmentChangedCB (PluginLine *current, int direction){ int line_length; RoadMapPosition pos; line_length = roadmap_line_length(current->line_id); if (line_length < 75) return; roadmap_square_set_current(current->square); if (direction == ROUTE_DIRECTION_WITH_LINE){ roadmap_street_extend_line_ends(current, NULL, &pos, FLAG_EXTEND_TO, NULL, NULL); } else{ roadmap_street_extend_line_ends(current, &pos, NULL, FLAG_EXTEND_FROM, NULL, NULL); } if (g_CustomIndex == -1) return; if (gBonusTable.bonus[g_CustomIndex] == NULL) return; printf("CustomBonusCB %s",gBonusTable.bonus[g_CustomIndex]->pIconName); gBonusTable.bonus[g_CustomIndex]->position.latitude = pos.latitude; gBonusTable.bonus[g_CustomIndex]->position.longitude = pos.longitude; //Adding the custom bonus if (roadmap_map_settings_road_goodies()){ static RoadMapSoundList list; if (!list) { list = roadmap_sound_list_create (SOUND_LIST_NO_FREE); roadmap_sound_list_add (list, "ping2"); roadmap_res_get (RES_SOUND, 0, "ping2"); } roadmap_sound_play_list (list); AddBonusToMap(gBonusTable.bonus[g_CustomIndex], TRUE); } g_CustomIndex = -1; roadmap_navigate_unregister_segment_changed(RealTimeBonus_SegmentChangedCB); }