#include <sys/stat.h>
#include <unistd.h>
#include <string>
+#include <vector>
#include "SDL2/SDL.h"
#include "SDL2/SDL_mixer.h"
strcpy (gatebeam3.line3, " ] ");
strcpy (gatebeam3.radar, "|");
+ std::vector<game_object> gatebeams;
+ gatebeams.insert(gatebeams.begin(), gatebeam1);
+ gatebeams.insert(gatebeams.begin(), gatebeam2);
+ gatebeams.insert(gatebeams.begin(), gatebeam3);
+
//pods
game_object pods[podmax] = {
{ 2, 1, 18, rand()%620, 0, 0, 1, 0, 0 },
};
};
- gatebeam1 = process_motion(gatebeam1, player);
- gatebeam2 = process_motion(gatebeam2, player);
- gatebeam3 = process_motion(gatebeam3, player);
+ for (std::vector<game_object>::iterator it=gatebeams.begin(); it<gatebeams.end(); ++it){
+ *it = process_motion(*it, player);
+ };
for(int bulletloop = 0; bulletloop<bulletmax; bulletloop++){
if(bullets[bulletloop].active==1){
// Draw gate object 10
drawlocation = draw_object(gate, drawlocation);
- drawlocation = draw_object(gatebeam1, drawlocation);
- drawlocation = draw_object(gatebeam2, drawlocation);
- drawlocation = draw_object(gatebeam3, drawlocation);
+ for (std::vector<game_object>::iterator it=gatebeams.begin(); it<gatebeams.end(); ++it){
+ drawlocation = draw_object(*it, drawlocation);
+ };
// Draw landers objects 60-71
for(int landerloop = 0; landerloop<landermax; landerloop++){
//Radar plot 18x620 represented in 4x62
radar_plot(gate, drawlocation);
- radar_plot(gatebeam1, drawlocation);
- radar_plot(gatebeam2, drawlocation);
- radar_plot(gatebeam3, drawlocation);
+ for (std::vector<game_object>::iterator it=gatebeams.begin(); it<gatebeams.end(); ++it){
+ radar_plot(*it, drawlocation);
+ };
for(int podloop = 0; podloop<podmax; podloop++){ radar_plot(pods[podloop], drawlocation); };
for(int landerloop = 0; landerloop<landermax; landerloop++){ radar_plot(landers[landerloop], drawlocation); };
for(int crazyloop = 0; crazyloop<landermax; crazyloop++){ radar_plot(crazies[crazyloop], drawlocation); };