251
251
void rViewport::CorrectViewport(int i, int MAX_PLAYERS){
252
252
if (vpb_dir[i]!=1 && vpb_dir[i]!=-1)
255
int starta=rViewportConfiguration::s_viewportConfigurations[rViewportConfiguration::next_conf_num]->num_viewports-1;
256
int startb=rViewportConfiguration::s_viewportConfigurations[ conf_num]->num_viewports-1;
254
260
s_newViewportBelongsToPlayer[i]+=MAX_PLAYERS-vpb_dir[i];
255
261
s_newViewportBelongsToPlayer[i]%=MAX_PLAYERS;
263
int oldValue = s_newViewportBelongsToPlayer[i];
266
bool expectChange = false;
268
// rotate player assignemnt
258
269
s_newViewportBelongsToPlayer[i]+=MAX_PLAYERS+vpb_dir[i];
259
270
s_newViewportBelongsToPlayer[i]%=MAX_PLAYERS;
272
// check for conflicts
261
int starta=rViewportConfiguration::s_viewportConfigurations[rViewportConfiguration::next_conf_num]->num_viewports-1;
262
int startb=rViewportConfiguration::s_viewportConfigurations[ conf_num]->num_viewports-1;
265
274
for(int j=starta;j>=0;j--)
266
275
if (i!=j && s_newViewportBelongsToPlayer[i]
267
276
==s_newViewportBelongsToPlayer[j])
283
if ( oldValue == s_newViewportBelongsToPlayer[i] && expectChange )
285
// no change? swap players.
286
s_newViewportBelongsToPlayer[i]+=MAX_PLAYERS+vpb_dir[i];
287
s_newViewportBelongsToPlayer[i]%=MAX_PLAYERS;
289
for(int j=starta;j>=0;j--)
290
if (i!=j && s_newViewportBelongsToPlayer[i]
291
==s_newViewportBelongsToPlayer[j])
293
s_newViewportBelongsToPlayer[j] = oldValue;
272
298
void rViewport::CorrectViewports(int MAX_PLAYERS){